main.8802c01f.chunk.js 28 KB

12
  1. (this["webpackJsonpreact-21-22"]=this["webpackJsonpreact-21-22"]||[]).push([[3],{128:function(t,e,r){"use strict";r.r(e);var n=r(7),a=r(0),u=r.n(a),c=r(21),o=r(63),s=r(22),i=r.n(s),p=(r(78),r(79),r(80),r(81),r(82),r(1)),f=r.n(p),d=r(5),l=r(34),b=r(10),v=r(24),h=r(131),j=r(70),O=r(64),m=r.n(O),w=r(25),y=r(51),x=r(39),g=r(17),k=r(15),C=r(37);var A=function(t){var e=t.children,r=Object(C.a)(t,["children"]),a=Object(c.c)(w.c);return Object(n.jsx)(b.b,Object(k.a)(Object(k.a)({},r),{},{children:a?e:Object(n.jsx)(b.a,{to:"/w/"})}))};var L=function(t){var e=t.children,r=t.restricted,a=void 0!==r&&r,u=Object(C.a)(t,["children","restricted"]),o=Object(c.c)(w.c)&&a;return Object(n.jsx)(b.b,Object(k.a)(Object(k.a)({},u),{},{children:o?Object(n.jsx)(b.a,{to:"/"}):e}))},M=(r(106),r(66)),I=r.n(M),_=r(67),B=r.n(_),E=function(){return Object(n.jsx)(I.a,{className:B.a.loader,type:"Puff",color:"#0ca0f5",height:100,width:100,timeout:3e5})},N=Object(a.lazy)((function(){return Promise.all([r.e(0),r.e(5),r.e(2)]).then(r.bind(null,493))})),S=Object(a.lazy)((function(){return Promise.all([r.e(0),r.e(1)]).then(r.bind(null,498))}));var z,D,T,P,U,H,R,G=function(){var t=Object(c.c)(w.c),e=Object(c.c)(y.a).companionId,r=Object(c.b)(),u=function(){var t=Object(d.a)(f.a.mark((function t(){return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=e,!t.t0){t.next=5;break}return t.next=4,Object(g.z)(e,!1);case 4:t.t0=t.sent;case 5:return t.abrupt("return",t.t0);case 6:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return Object(a.useEffect)((function(){t&&"true"===localStorage.isChecked&&(g.w.set(t),r(Object(x.b)()))}),[r,t]),Object(a.useEffect)((function(){var t=function(){var t=Object(d.a)(f.a.mark((function t(){var e;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=localStorage.isChecked)||"false"!==e){t.next=5;break}r(Object(x.d)()),t.next=8;break;case 5:if(!e||"true"!==e){t.next=8;break}return t.next=8,Object(g.l)();case 8:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return window.addEventListener("beforeunload",t),function(){return window.removeEventListener("beforeunload",t)}}),[r]),Object(a.useEffect)((function(){var t=function(){var t=Object(d.a)(f.a.mark((function t(){return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(g.z)(e,!1);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return window.addEventListener("beforeunload",t),function(){return window.removeEventListener("beforeunload",t)}}),[e]),Object(n.jsx)("div",{onMouseLeave:u,className:m.a.appWrapper,children:Object(n.jsxs)(h.a,{utils:j.a,children:[Object(n.jsx)(a.Suspense,{fallback:Object(n.jsx)(E,{}),children:Object(n.jsx)(l.a,{children:Object(n.jsxs)(b.d,{children:[Object(n.jsx)(A,{exact:!0,path:"/",children:Object(n.jsx)(N,{})}),Object(n.jsx)(L,{path:"/w/",restricted:!0,children:Object(n.jsx)(S,{})})]})})}),Object(n.jsx)(v.a,{position:"top-right",autoClose:5e3,hideProgressBar:!1,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0})]})})},W=r(12),F=r(28),q=r(36),J=r(68),X=r(69),K=r.n(X),Q=r(6),V=r(13),Y=r.n(V),Z=r(4),$=r(43),tt=Object(Z.b)({total:"0",limit:"0",page:"0",messages:[]},(z={},Object(Q.a)(z,$.b.type,(function(t,e){var r=e.payload;return!1===Y()(t,r)?r:t})),Object(Q.a)(z,$.a.type,(function(t,e){return t})),z)),et=r(44),rt=Object(Z.b)({total:"0",limit:"0",page:"0",messages:[]},(D={},Object(Q.a)(D,et.b.type,(function(t,e){var r=e.payload;return!1===Y()(t,r)?r:t})),Object(Q.a)(D,et.a.type,(function(t,e){return t})),D)),nt=r(45),at=Object(Z.b)({total:"0",limit:"0",page:"0",contacts:[]},(T={},Object(Q.a)(T,nt.b.type,(function(t,e){var r=e.payload;return!1===Y()(t,r)?r:t})),Object(Q.a)(T,nt.a.type,(function(t,e){return t})),T)),ut=r(33),ct={name:"",lastName:"",originalName:"",originalLastName:"",avatarUrl:"",avatarsArr:[],color:"",online:"",lastMessage:"",lastMessageCreatedAt:"",mute:!1,sort:!1,seen:0,total:0,watched:!1,typing:!1,number:"",_id:"",companionId:"",owner:"",createdAt:"",updatedAt:"",__v:0},ot=Object(Z.b)(ct,(P={},Object(Q.a)(P,ut.c.type,(function(t,e){var r=e.payload;return!1===Y()(t,r)?r:t})),Object(Q.a)(P,ut.a.type,(function(t,e){var r=e.payload;return!1===Y()(t,r)?r:t})),Object(Q.a)(P,ut.b.type,(function(t,e){return ct})),P)),st=r(46),it=Object(Z.b)({total:"0",limit:"0",page:"0",chats:[]},(U={},Object(Q.a)(U,st.b.type,(function(t,e){var r=e.payload;return!1===Y()(t,r)?r:t})),Object(Q.a)(U,st.a.type,(function(t,e){return t})),U)),pt=r(30),ft=Object(Z.b)({leftIsOpen:"",rightIsOpen:"",scrollChat:!1},(H={},Object(Q.a)(H,pt.a.type,(function(t,e){var r=e.payload;return!1===Y()(t.leftIsOpen,r)?Object(k.a)(Object(k.a)({},t),{},{leftIsOpen:r}):t})),Object(Q.a)(H,pt.b.type,(function(t,e){var r=e.payload;return!1===Y()(t.rightIsOpen,r)?Object(k.a)(Object(k.a)({},t),{},{rightIsOpen:r}):t})),Object(Q.a)(H,pt.c.type,(function(t,e){var r=e.payload;return!1===Y()(t.scrollChat,r)?Object(k.a)(Object(k.a)({},t),{},{scrollChat:r}):t})),H)),dt=r(16),lt={name:"",lastName:"",originalName:"",originalLastName:"",avatarUrl:"",avatarsArr:[],color:"",code:"",_id:"",token:"",online:"",number:"",country:"",sort:!1,nightMode:!1,createdAt:"",updatedAt:"",__v:0},bt=Object(Z.b)(lt,(R={},Object(Q.a)(R,dt.d.type,(function(t,e){var r=e.payload;return Object(k.a)(Object(k.a)({},t),{},{token:r})})),Object(Q.a)(R,dt.c.type,(function(t,e){return t})),Object(Q.a)(R,dt.f.type,(function(t,e){return lt})),Object(Q.a)(R,dt.e.type,(function(t,e){return t})),Object(Q.a)(R,dt.b.type,(function(t,e){var r=e.payload;return!1===Y()(t,r)?r:t})),Object(Q.a)(R,dt.a.type,(function(t,e){return lt})),R)),vt={key:"auth",storage:K.a},ht=Object(W.combineReducers)({messages:tt,allMessages:rt,chat:ot,chats:it,contacts:at,control:ft,authorization:Object(q.a)(vt,bt)}),jt=Object(J.composeWithDevTools)({}),Ot=Object(W.createStore)(ht,jt(Object(W.applyMiddleware)(F.a))),mt=Object(q.b)(Ot),wt=r(136),yt=r(135),xt=new wt.a;i.a.render(Object(n.jsx)(u.a.StrictMode,{children:Object(n.jsx)(o.a,{loading:Object(n.jsx)(E,{}),persistor:mt,children:Object(n.jsx)(c.a,{store:Ot,children:Object(n.jsx)(yt.a,{client:xt,children:Object(n.jsx)(G,{})})})})}),document.getElementById("root"))},16:function(t,e,r){"use strict";r.d(e,"d",(function(){return a})),r.d(e,"c",(function(){return u})),r.d(e,"f",(function(){return c})),r.d(e,"e",(function(){return o})),r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return i}));var n=r(4),a=Object(n.a)("login/success",(function(t){return{payload:t}})),u=Object(n.a)("login/reject",(function(){return{payload:null}})),c=Object(n.a)("logout/success",(function(){return{payload:null}})),o=Object(n.a)("logout/reject",(function(){return{payload:null}})),s=Object(n.a)("current/success",(function(t){return{payload:t}})),i=Object(n.a)("current/reject",(function(){return{payload:null}}))},17:function(t,e,r){"use strict";r.d(e,"w",(function(){return i})),r.d(e,"b",(function(){return f})),r.d(e,"i",(function(){return d})),r.d(e,"j",(function(){return l})),r.d(e,"l",(function(){return b})),r.d(e,"B",(function(){return v})),r.d(e,"C",(function(){return h})),r.d(e,"p",(function(){return j})),r.d(e,"D",(function(){return O})),r.d(e,"c",(function(){return m})),r.d(e,"a",(function(){return w})),r.d(e,"n",(function(){return y})),r.d(e,"A",(function(){return x})),r.d(e,"g",(function(){return g})),r.d(e,"y",(function(){return C})),r.d(e,"m",(function(){return A})),r.d(e,"e",(function(){return k})),r.d(e,"k",(function(){return L})),r.d(e,"x",(function(){return M})),r.d(e,"q",(function(){return I})),r.d(e,"z",(function(){return _})),r.d(e,"f",(function(){return B})),r.d(e,"o",(function(){return E})),r.d(e,"u",(function(){return N})),r.d(e,"t",(function(){return S})),r.d(e,"r",(function(){return z})),r.d(e,"v",(function(){return D})),r.d(e,"s",(function(){return T})),r.d(e,"h",(function(){return P})),r.d(e,"d",(function(){return U}));var n=r(1),a=r.n(n),u=r(5),c=r(24),o=r(50),s=r(84);s.defaults.baseURL="".concat(o.j,"/api");var i={set:function(t){s.defaults.headers.common.Authorization="Bearer ".concat(t)},unset:function(){s.defaults.headers.common.Authorization=""}},p=function(t){"403"===t.message.slice(-3)&&(localStorage.removeItem("persist:auth"),window.location.reload(!0))},f=function(){var t=Object(u.a)(a.a.mark((function t(e,r){var n,u;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/auth/register",{number:e,country:r});case 3:return n=t.sent,u=n.data.data,a="code ".concat(u),c.b.success("\u26a1 ".concat(a),{position:"bottom-left",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0}),t.abrupt("return",u);case 9:return t.prev=9,t.t0=t.catch(0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}var a}),t,null,[[0,9]])})));return function(e,r){return t.apply(this,arguments)}}(),d=function(){var t=Object(u.a)(a.a.mark((function t(e,r){var n,u;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/auth/login",{number:e,code:r});case 3:return n=t.sent,u=n.data.data,t.abrupt("return",u);case 8:return t.prev=8,t.t0=t.catch(0),t.abrupt("return",void 0);case 11:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r){return t.apply(this,arguments)}}(),l=function(){var t=Object(u.a)(a.a.mark((function t(){var e,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/auth/logout");case 3:return e=t.sent,r=e.data,t.abrupt("return",r);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(){return t.apply(this,arguments)}}(),b=function(){var t=Object(u.a)(a.a.mark((function t(){var e,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/auth/online");case 3:return e=t.sent,r=e.data,t.abrupt("return",r);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(){return t.apply(this,arguments)}}(),v=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/users/current/credentials",e);case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),h=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/users/current/update",e);case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),j=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.delete("/users/current/".concat(e));case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),O=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/users/avatars",e);case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),m=function(){var t=Object(u.a)(a.a.mark((function t(){var e,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.get("/users/current");case 3:return e=t.sent,r=e.data.data,t.abrupt("return",r);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(){return t.apply(this,arguments)}}(),w=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/contacts",{number:e});case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),y=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.delete("/contacts/".concat(e));case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),x=function(){var t=Object(u.a)(a.a.mark((function t(e,r,n,u,c){var o,i;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/contacts",{id:e,_id:r,name:n,lastName:u,companionId:c});case 3:return o=t.sent,i=o.data.data,t.abrupt("return",i);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r,n,a,u){return t.apply(this,arguments)}}(),g=function(){var t=Object(u.a)(a.a.mark((function t(){var e,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.get("/contacts");case 3:return e=t.sent,r=e.data.data,t.abrupt("return",r);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(){return t.apply(this,arguments)}}(),k=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.get("/chats/".concat(e));case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n._doc);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),C=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/chats",{id:e});case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),A=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.delete("/chats/both/".concat(e));case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),L=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/chats/mute",{id:e});case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),M=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/chats/sort",{id:e});case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),I=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/chats/seen",{id:e});case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),_=function(){var t=Object(u.a)(a.a.mark((function t(e,r){var n,u;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.patch("/chats/typing",{id:e,typing:r});case 3:return n=t.sent,u=n.data.data,t.abrupt("return",u);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r){return t.apply(this,arguments)}}(),B=function(){var t=Object(u.a)(a.a.mark((function t(){var e,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.get("/chats");case 3:return e=t.sent,r=e.data.data,t.abrupt("return",r);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(){return t.apply(this,arguments)}}(),E=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.delete("/messages/".concat(e));case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),N=function(){var t=Object(u.a)(a.a.mark((function t(e,r){var n,u;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/messages",{id:e,message:r});case 3:return n=t.sent,u=n.data.data,t.abrupt("return",u);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r){return t.apply(this,arguments)}}(),S=function(){var t=Object(u.a)(a.a.mark((function t(e,r){var n,u;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/messages/image/".concat(e),r);case 3:return n=t.sent,u=n.data.data,t.abrupt("return",u);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r){return t.apply(this,arguments)}}(),z=function(){var t=Object(u.a)(a.a.mark((function t(e,r){var n,u;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/messages/audio/".concat(e),r);case 3:return n=t.sent,u=n.data.data,t.abrupt("return",u);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r){return t.apply(this,arguments)}}(),D=function(){var t=Object(u.a)(a.a.mark((function t(e,r){var n,u;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/messages/video/".concat(e),r);case 3:return n=t.sent,u=n.data.data,t.abrupt("return",u);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r){return t.apply(this,arguments)}}(),T=function(){var t=Object(u.a)(a.a.mark((function t(e,r){var n,u;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/messages/file/".concat(e),r);case 3:return n=t.sent,u=n.data.data,t.abrupt("return",u);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r){return t.apply(this,arguments)}}(),P=function(){var t=Object(u.a)(a.a.mark((function t(e){var r,n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.get("/messages/".concat(e));case 3:return r=t.sent,n=r.data.data,t.abrupt("return",n);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}(),U=function(){var t=Object(u.a)(a.a.mark((function t(){var e,r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.get("/messages");case 3:return e=t.sent,r=e.data.data,t.abrupt("return",r);case 8:return t.prev=8,t.t0=t.catch(0),p(t.t0),t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(){return t.apply(this,arguments)}}()},25:function(t,e,r){"use strict";r.d(e,"c",(function(){return n})),r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return u}));var n=function(t){return t.authorization.token},a=function(t){return t.authorization.number},u=function(t){return t.authorization}},30:function(t,e,r){"use strict";r.d(e,"a",(function(){return a})),r.d(e,"b",(function(){return u})),r.d(e,"c",(function(){return c}));var n=r(4),a=Object(n.a)("control/LeftIsOpen",(function(t){return{payload:t}})),u=Object(n.a)("control/RightIsOpen",(function(t){return{payload:t}})),c=Object(n.a)("control/scrollChat",(function(t){return{payload:t}}))},33:function(t,e,r){"use strict";r.d(e,"c",(function(){return a})),r.d(e,"a",(function(){return u})),r.d(e,"b",(function(){return c}));var n=r(4),a=Object(n.a)("selectChat/success",(function(t){return{payload:t}})),u=Object(n.a)("getChatById/success",(function(t){return{payload:t}})),c=Object(n.a)("deleteChat/success",(function(){return{payload:{}}}))},39:function(t,e,r){"use strict";r.d(e,"a",(function(){return s})),r.d(e,"c",(function(){return i})),r.d(e,"d",(function(){return p})),r.d(e,"b",(function(){return f}));var n=r(1),a=r.n(n),u=r(5),c=r(16),o=r(17),s=function(t,e,r){return function(){var n=Object(u.a)(a.a.mark((function n(u){var s,i,p,f;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,(i=new FormData).append("avatar",r),n.next=5,Promise.all([Object(o.D)(i),Object(o.B)({name:t,lastName:e,originalName:t,originalLastName:e})]);case 5:p=n.sent,(f=null===(s=p.find((function(t){return null===t||void 0===t?void 0:t.token})))||void 0===s?void 0:s.token)&&u(Object(c.d)(f)),n.next=13;break;case 10:n.prev=10,n.t0=n.catch(0),u(Object(c.c)());case 13:case"end":return n.stop()}}),n,null,[[0,10]])})));return function(t){return n.apply(this,arguments)}}()},i=function(t,e,r){return function(){var n=Object(u.a)(a.a.mark((function n(u){var s,i,p;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,Object(o.i)(t,e);case 3:if(s=n.sent,i=null===s||void 0===s?void 0:s.token,p=null===s||void 0===s?void 0:s.registered,i){n.next=8;break}return n.abrupt("return");case 8:if(o.w.set(i),p){n.next=11;break}return n.abrupt("return",r());case 11:u(Object(c.d)(i)),n.next=18;break;case 14:n.prev=14,n.t0=n.catch(0),u(Object(c.c)()),r();case 18:case"end":return n.stop()}}),n,null,[[0,14]])})));return function(t){return n.apply(this,arguments)}}()},p=function(){return function(){var t=Object(u.a)(a.a.mark((function t(e){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(o.j)();case 3:e(Object(c.f)()),o.w.unset(),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),e(Object(c.e)());case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}()},f=function(){return function(){var t=Object(u.a)(a.a.mark((function t(e){var r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(o.c)();case 3:if((r=t.sent)&&e(Object(c.b)(r)),null===r||void 0===r?void 0:r.token){t.next=7;break}throw new Error("old token");case 7:t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),e(Object(c.a)());case 12:case"end":return t.stop()}}),t,null,[[0,9]])})));return function(e){return t.apply(this,arguments)}}()}},43:function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return u}));var n=r(4),a=Object(n.a)("getMessages/success",(function(t){return{payload:t}})),u=Object(n.a)("getMessages/reject",(function(){return{payload:null}}))},44:function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return u}));var n=r(4),a=Object(n.a)("getAllMessages/success",(function(t){return{payload:t}})),u=Object(n.a)("getAllMessages/reject",(function(){return{payload:null}}))},45:function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return u}));var n=r(4),a=Object(n.a)("getContacts/success",(function(t){return{payload:t}})),u=Object(n.a)("getContacts/reject",(function(){return{payload:null}}))},46:function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return u}));var n=r(4),a=Object(n.a)("getChats/success",(function(t){return{payload:t}})),u=Object(n.a)("getChats/reject",(function(){return{payload:null}}))},50:function(t,e,r){"use strict";r.d(e,"d",(function(){return p})),r.d(e,"c",(function(){return f})),r.d(e,"l",(function(){return d})),r.d(e,"n",(function(){return l})),r.d(e,"p",(function(){return v})),r.d(e,"o",(function(){return h})),r.d(e,"h",(function(){return j})),r.d(e,"g",(function(){return O})),r.d(e,"a",(function(){return m})),r.d(e,"i",(function(){return w})),r.d(e,"e",(function(){return y})),r.d(e,"f",(function(){return x})),r.d(e,"m",(function(){return g})),r.d(e,"b",(function(){return k})),r.d(e,"j",(function(){return C})),r.d(e,"k",(function(){return A}));var n=r(38),a=r(1),u=r.n(a),c=r(5),o=r(24),s=r(65),i=r.n(s),p=function(t){return t.split(" ").join("").trim()},f=function(t){return t.slice(0,1).toUpperCase()},d=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t.length<e?t.slice(r):t.slice(r,e)},l=function(t){return new Date(t).toLocaleString("en-GB",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})},b=function(t){return new Date(t).toLocaleString("en-GB",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"})},v=function(t){return new Date(t).toLocaleString("en-GB",{hour:"numeric",minute:"2-digit"})},h=function(t){return new Date(t).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric"})},j=function(t){new Audio(t).play()},O=function(t,e){Object(o.b)("\ud83e\udd84new message from ".concat(t),{position:"bottom-right",autoClose:5e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,onClick:e})},m=function(t){Object(o.b)("".concat(t," Copied"),{position:"bottom-right",autoClose:2e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0})},w=function(t){var e=window,r=new(e.AudioContext||e.webkitAudioContext);navigator.mediaDevices.getUserMedia({audio:!0}).then((function(){var e=r.createBufferSource();e.addEventListener("ended",(function(){e.stop(),r.close()}));var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){r.decodeAudioData(n.response,(function(t){e.buffer=t,e.connect(r.destination),e.start()}),(function(t){console.log("Error with decoding audio data"+t.message)}))},n.send()})).catch((function(t){return console.error("Audio permissions denied: ".concat(t))}))},y=function(){var t=Object(c.a)(u.a.mark((function t(e,r){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.a.saveAs(e,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),x=function(t,e,r){return Object(n.a)(e).sort((function(e,n){return(r?e[t]>n[t]:e[t]<n[t])?-1:(r?e[t]<n[t]:e[t]>n[t])?1:0}))},g=function(t,e){return Object(n.a)(t).sort((function(t,r){var n=t.lastMessageCreatedAt?t.lastMessageCreatedAt:t.createdAt,a=r.lastMessageCreatedAt?r.lastMessageCreatedAt:r.createdAt,u=b(n),c=b(a);return(e?u<c:u>c)?1:-1}))},k=function(t,e,r){return t.filter((function(t){if(e){if(!t.fullType&&t.message.toLowerCase().includes(r.toLowerCase())&&h(e)===h(t.createdAt))return t;if(t.fullType&&t.fullType.toLowerCase().includes(r.toLowerCase())&&h(e)===h(t.createdAt))return t}else{if(!t.fullType&&t.message.toLowerCase().includes(r.toLowerCase()))return t;if(t.fullType&&t.fullType.toLowerCase().includes(r.toLowerCase()))return t}}))},C="http://localhost:3000",A=3e3},51:function(t,e,r){"use strict";r.d(e,"a",(function(){return a})),r.d(e,"b",(function(){return u}));var n=r(26),a=function(t){return t.chat},u=Object(n.a)([a],(function(t){return t}))},64:function(t,e,r){t.exports={appWrapper:"App_appWrapper__2lsaD"}},67:function(t,e,r){t.exports={loader:"Load_loader__5RgFk"}},82:function(t,e,r){}},[[128,4,6]]]);
  2. //# sourceMappingURL=main.8802c01f.chunk.js.map