main.f1c56119.chunk.js 35 KB

12
  1. (this["webpackJsonpreact-21-22"]=this["webpackJsonpreact-21-22"]||[]).push([[3],{129: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(64),s=r(22),i=r.n(s),p=(r(80),r(81),r(82),r(83),r(84),r(1)),f=r.n(p),d=r(4),l=r(34),v=r(10),b=r(24),h=r(132),j=r(71),O=r(65),m=r.n(O),w=r(25),y=r(52),x=r(39),g=r(17),k=r(14),C=r(37);var A=function(t){var e=t.children,r=Object(C.a)(t,["children"]),a=Object(c.c)(w.f);return Object(n.jsx)(v.b,Object(k.a)(Object(k.a)({},r),{},{children:a?e:Object(n.jsx)(v.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.f)&&a;return Object(n.jsx)(v.b,Object(k.a)(Object(k.a)({},u),{},{children:o?Object(n.jsx)(v.a,{to:"/"}):e}))},M=(r(107),r(67)),I=r.n(M),N=r(68),S=r.n(N),_=function(){return Object(n.jsx)(I.a,{className:S.a.loader,type:"Puff",color:"#0ca0f5",height:100,width:100,timeout:3e5})},z=Object(a.lazy)((function(){return Promise.all([r.e(0),r.e(5),r.e(2)]).then(r.bind(null,591))})),D=Object(a.lazy)((function(){return Promise.all([r.e(0),r.e(1)]).then(r.bind(null,595))}));var E,P,T,B,H,U,F,G,R=function(){var t=Object(c.c)(w.f),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.H)(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.D.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.H)(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)(_,{}),children:Object(n.jsx)(l.a,{children:Object(n.jsxs)(v.d,{children:[Object(n.jsx)(A,{exact:!0,path:"/",children:Object(n.jsx)(z,{})}),Object(n.jsx)(L,{path:"/w/",restricted:!0,children:Object(n.jsx)(D,{})})]})})}),Object(n.jsx)(b.a,{position:"top-right",autoClose:5e3,hideProgressBar:!1,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0})]})})},W=r(13),q=r(29),J=r(36),K=r(69),X=r(70),Q=r.n(X),V=r(6),Y=r(12),Z=r.n(Y),$=r(5),tt=r(43),et=Object($.b)({total:"0",limit:"0",page:"0",messages:[]},(E={},Object(V.a)(E,tt.b.type,(function(t,e){var r=e.payload;return!1===Z()(t,r)?r:t})),Object(V.a)(E,tt.a.type,(function(t,e){return t})),E)),rt=r(44),nt=Object($.b)([],(P={},Object(V.a)(P,rt.b.type,(function(t,e){var r=e.payload;return!1===Z()(t,r)?r:t})),Object(V.a)(P,rt.a.type,(function(t,e){return t})),P)),at=r(45),ut=Object($.b)({total:"0",limit:"0",page:"0",messages:[]},(T={},Object(V.a)(T,at.b.type,(function(t,e){var r=e.payload;return!1===Z()(t,r)?r:t})),Object(V.a)(T,at.a.type,(function(t,e){return t})),T)),ct=r(46),ot=Object($.b)({total:"0",limit:"0",page:"0",contacts:[]},(B={},Object(V.a)(B,ct.b.type,(function(t,e){var r=e.payload;return!1===Z()(t,r)?r:t})),Object(V.a)(B,ct.a.type,(function(t,e){return t})),B)),st=r(33),it={name:"",lastName:"",originalName:"",originalLastName:"",avatarUrl:"",avatarsArr:[],color:"",online:"",lastMessage:"",lastMessageCreatedAt:"",mute:!1,sort:!1,seen:0,seenCompanion:0,total:0,watched:!1,typing:!1,number:"",country:"",pinned:!1,socketId:"",_id:"",companionId:"",owner:"",createdAt:"",updatedAt:"",__v:0},pt=Object($.b)(it,(H={},Object(V.a)(H,st.c.type,(function(t,e){var r=e.payload;return!1===Z()(t,r)?r:t})),Object(V.a)(H,st.a.type,(function(t,e){var r=e.payload;return!1===Z()(t,r)?r:t})),Object(V.a)(H,st.b.type,(function(t,e){return it})),H)),ft=r(47),dt=Object($.b)({total:"0",limit:"0",page:"0",chats:[]},(U={},Object(V.a)(U,ft.b.type,(function(t,e){var r=e.payload;return!1===Z()(t,r)?r:t})),Object(V.a)(U,ft.a.type,(function(t,e){return t})),U)),lt=r(27),vt=Object($.b)({leftIsOpen:"",rightIsOpen:"",scrollChat:!1,openPinned:!1},(F={},Object(V.a)(F,lt.a.type,(function(t,e){var r=e.payload;return!1===Z()(t.leftIsOpen,r)?Object(k.a)(Object(k.a)({},t),{},{leftIsOpen:r}):t})),Object(V.a)(F,lt.c.type,(function(t,e){var r=e.payload;return!1===Z()(t.rightIsOpen,r)?Object(k.a)(Object(k.a)({},t),{},{rightIsOpen:r}):t})),Object(V.a)(F,lt.d.type,(function(t,e){var r=e.payload;return!1===Z()(t.scrollChat,r)?Object(k.a)(Object(k.a)({},t),{},{scrollChat:r}):t})),Object(V.a)(F,lt.b.type,(function(t,e){var r=e.payload;return!1===Z()(t.openPinned,r)?Object(k.a)(Object(k.a)({},t),{},{openPinned:r}):t})),F)),bt=r(16),ht={name:"",lastName:"",originalName:"",originalLastName:"",avatarUrl:"",avatarsArr:[],color:"",code:"",_id:"",token:"",online:"",number:"",country:"",sort:!1,nightMode:!1,silentMode:!1,createdAt:"",updatedAt:"",__v:0},jt=Object($.b)(ht,(G={},Object(V.a)(G,bt.d.type,(function(t,e){var r=e.payload;return Object(k.a)(Object(k.a)({},t),{},{token:r})})),Object(V.a)(G,bt.c.type,(function(t,e){return t})),Object(V.a)(G,bt.f.type,(function(t,e){return ht})),Object(V.a)(G,bt.e.type,(function(t,e){return t})),Object(V.a)(G,bt.b.type,(function(t,e){var r=e.payload;return!1===Z()(t,r)?r:t})),Object(V.a)(G,bt.a.type,(function(t,e){return ht})),G)),Ot={key:"auth",storage:Q.a},mt=Object(W.combineReducers)({messages:et,pinnedMessages:nt,allMessages:ut,chat:pt,chats:dt,contacts:ot,control:vt,authorization:Object(J.a)(Ot,jt)}),wt=Object(K.composeWithDevTools)({}),yt=Object(W.createStore)(mt,wt(Object(W.applyMiddleware)(q.a))),xt=Object(J.b)(yt),gt=r(137),kt=r(136),Ct=new gt.a;i.a.render(Object(n.jsx)(u.a.StrictMode,{children:Object(n.jsx)(o.a,{loading:Object(n.jsx)(_,{}),persistor:xt,children:Object(n.jsx)(c.a,{store:yt,children:Object(n.jsx)(kt.a,{client:Ct,children:Object(n.jsx)(R,{})})})})}),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(5),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,"D",(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 v})),r.d(e,"K",(function(){return b})),r.d(e,"M",(function(){return h})),r.d(e,"t",(function(){return j})),r.d(e,"N",(function(){return O})),r.d(e,"c",(function(){return m})),r.d(e,"a",(function(){return w})),r.d(e,"q",(function(){return y})),r.d(e,"J",(function(){return x})),r.d(e,"n",(function(){return g})),r.d(e,"g",(function(){return k})),r.d(e,"G",(function(){return A})),r.d(e,"p",(function(){return L})),r.d(e,"e",(function(){return C})),r.d(e,"k",(function(){return M})),r.d(e,"F",(function(){return I})),r.d(e,"E",(function(){return N})),r.d(e,"u",(function(){return S})),r.d(e,"H",(function(){return _})),r.d(e,"m",(function(){return z})),r.d(e,"f",(function(){return D})),r.d(e,"r",(function(){return E})),r.d(e,"s",(function(){return P})),r.d(e,"L",(function(){return T})),r.d(e,"o",(function(){return B})),r.d(e,"I",(function(){return H})),r.d(e,"y",(function(){return U})),r.d(e,"z",(function(){return F})),r.d(e,"B",(function(){return G})),r.d(e,"A",(function(){return R})),r.d(e,"x",(function(){return W})),r.d(e,"v",(function(){return q})),r.d(e,"C",(function(){return J})),r.d(e,"w",(function(){return K})),r.d(e,"h",(function(){return X})),r.d(e,"d",(function(){return Q}));var n=r(1),a=r.n(n),u=r(4),c=r(24),o=r(51),s=r(86);s.defaults.baseURL="".concat(o.m,"/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="Use this code ".concat(u,' to sign in to the app "w-telegram". The real code cannot be sent via SMS to your phone because the Twilio account is not paid.'),o=2e4,c.b.success("\u26a1 ".concat(a),{position:"bottom-left",autoClose:o,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,o}),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)}}(),v=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)}}(),b=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(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("/contacts/pin",{id:e,pinned: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)}}(),k=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)}}(),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.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)}}(),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.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)}}(),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.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)}}(),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/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)}}(),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/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)}}(),N=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/socketId",{socketId: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)}}(),S=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)}}(),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.patch("/chats/pin",{id:e,pinned: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(){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)}}(),P=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("/messages/selected",{companionId:e,selectedArr:r});case 3:return n=t.sent,u=n.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.patch("/messages/".concat(e),{emoji: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(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("/messages/pin/".concat(e),{pinned: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)}}(),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("/messages/unpin/all/",{pinnedMessages: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(e,r,n){var u,c;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,caption:n});case 3:return u=t.sent,c=u.data.data,t.abrupt("return",c);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){return t.apply(this,arguments)}}(),F=function(){var t=Object(u.a)(a.a.mark((function t(e,r,n){var u,c;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/messages/edit",{id:e,message:r,caption:n});case 3:return u=t.sent,c=u.data.data,t.abrupt("return",c);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){return t.apply(this,arguments)}}(),G=function(){var t=Object(u.a)(a.a.mark((function t(e,r,n){var u,c;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/messages/reply",{id:e,message:r,caption:n});case 3:return u=t.sent,c=u.data.data,t.abrupt("return",c);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){return t.apply(this,arguments)}}(),R=function(){var t=Object(u.a)(a.a.mark((function t(e,r,n,u){var c,o;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s.post("/messages/forward",{id:e,companionIdForwardToAndFrom:r,message:n,caption:u});case 3:return c=t.sent,o=c.data.data,t.abrupt("return",o);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){return t.apply(this,arguments)}}(),W=function(){var t=Object(u.a)(a.a.mark((function t(e,r,n){var u,c;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," ").concat(n,"}"),r);case 3:return u=t.sent,c=u.data.data,t.abrupt("return",c);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){return t.apply(this,arguments)}}(),q=function(){var t=Object(u.a)(a.a.mark((function t(e,r,n){var u,c;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," ").concat(n),r);case 3:return u=t.sent,c=u.data.data,t.abrupt("return",c);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){return t.apply(this,arguments)}}(),J=function(){var t=Object(u.a)(a.a.mark((function t(e,r,n){var u,c;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," ").concat(n),r);case 3:return u=t.sent,c=u.data.data,t.abrupt("return",c);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){return t.apply(this,arguments)}}(),K=function(){var t=Object(u.a)(a.a.mark((function t(e,r,n){var u,c;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," ").concat(n),r);case 3:return u=t.sent,c=u.data.data,t.abrupt("return",c);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){return t.apply(this,arguments)}}(),X=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)}}(),Q=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,"f",(function(){return n})),r.d(e,"c",(function(){return a})),r.d(e,"e",(function(){return u})),r.d(e,"b",(function(){return c})),r.d(e,"d",(function(){return o})),r.d(e,"a",(function(){return s}));var n=function(t){return t.authorization.token},a=function(t){return t.authorization.number},u=function(t){return t.authorization.sort},c=function(t){return t.authorization.nightMode},o=function(t){return t.authorization.silentMode},s=function(t){return t.authorization}},27:function(t,e,r){"use strict";r.d(e,"a",(function(){return a})),r.d(e,"c",(function(){return u})),r.d(e,"d",(function(){return c})),r.d(e,"b",(function(){return o}));var n=r(5),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}})),o=Object(n.a)("control/openPinned",(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(5),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(4),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;return a.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,Object(o.K)({name:t,lastName:e,originalName:t,originalLastName:e});case 3:if((s=n.sent)&&s.token&&u(Object(c.d)(s.token)),!r){n.next=10;break}return(i=new FormData).append("avatar",r),n.next=10,Object(o.N)(i);case 10:n.next=15;break;case 12:n.prev=12,n.t0=n.catch(0),u(Object(c.c)());case 15:case"end":return n.stop()}}),n,null,[[0,12]])})));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.D.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.D.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(5),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(5),a=Object(n.a)("getPinnedMessages/success",(function(t){return{payload:t}})),u=Object(n.a)("getPinnedMessages/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(5),a=Object(n.a)("getAllMessages/success",(function(t){return{payload:t}})),u=Object(n.a)("getAllMessages/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(5),a=Object(n.a)("getContacts/success",(function(t){return{payload:t}})),u=Object(n.a)("getContacts/reject",(function(){return{payload:null}}))},47:function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return u}));var n=r(5),a=Object(n.a)("getChats/success",(function(t){return{payload:t}})),u=Object(n.a)("getChats/reject",(function(){return{payload:null}}))},51:function(t,e,r){"use strict";r.d(e,"f",(function(){return p})),r.d(e,"e",(function(){return f})),r.d(e,"p",(function(){return d})),r.d(e,"r",(function(){return l})),r.d(e,"t",(function(){return b})),r.d(e,"s",(function(){return h})),r.d(e,"j",(function(){return j})),r.d(e,"i",(function(){return O})),r.d(e,"a",(function(){return m})),r.d(e,"k",(function(){return w})),r.d(e,"g",(function(){return y})),r.d(e,"h",(function(){return x})),r.d(e,"q",(function(){return g})),r.d(e,"d",(function(){return k})),r.d(e,"c",(function(){return C})),r.d(e,"b",(function(){return A})),r.d(e,"n",(function(){return M})),r.d(e,"m",(function(){return L})),r.d(e,"l",(function(){return I})),r.d(e,"o",(function(){return N}));var n=r(38),a=r(1),u=r.n(a),c=r(4),o=r(24),s=r(66),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"})},v=function(t){return new Date(t).toLocaleString("en-GB",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"})},b=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=v(n),c=v(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=["pdf/docx","image","text","audio","video"],A=["\ud83d\udc98","\ud83d\ude00","\ud83d\ude0d","\ud83d\ude32","\ud83d\ude21"],L="https://w-telegram.herokuapp.com",M="https://w-telegram-socket.herokuapp.com",I="https://my-telegram-bucket.s3.eu-west-1.amazonaws.com",N=3e3},52: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}))},65:function(t,e,r){t.exports={appWrapper:"App_appWrapper__2lsaD"}},68:function(t,e,r){t.exports={loader:"Load_loader__5RgFk"}},84:function(t,e,r){}},[[129,4,6]]]);
  2. //# sourceMappingURL=main.f1c56119.chunk.js.map