mezon-js 2.15.21 → 2.15.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var $=Object.defineProperty,Z=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var J=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var V=(_,e,t)=>e in _?$(_,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):_[e]=t,w=(_,e)=>{for(var t in e||(e={}))ee.call(e,t)&&V(_,t,e[t]);if(J)for(var t of J(e))te.call(e,t)&&V(_,t,e[t]);return _},E=(_,e)=>Z(_,X(e));var l=(_,e,t)=>new Promise((n,s)=>{var c=o=>{try{i(t.next(o))}catch(a){s(a)}},d=o=>{try{i(t.throw(o))}catch(a){s(a)}},i=o=>o.done?n(o.value):Promise.resolve(o.value).then(c,d);i((t=t.apply(_,e)).next())});import"whatwg-fetch";import{encode as ne,decode as ie}from"js-base64";import*as R from"mezon-js-protobuf";function m(_,e,t){let n=w({method:_},e);return n.headers=w({},e.headers),Object.keys(n.headers).includes("Accept")||(n.headers.Accept="application/proto"),Object.keys(n.headers).includes("Content-Type")||(n.headers["Content-Type"]="application/proto"),Object.keys(n.headers).forEach(s=>{n.headers[s]||delete n.headers[s]}),t&&(n.body=t),n}function _e(_){return ne(encodeURIComponent(_).replace(/%([0-9A-F]{2})/g,function(t,n){return String.fromCharCode(+("0x"+n))}))}function fe(_){return decodeURIComponent(ie(_).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))}function P(_){if(_==null)return{t:_};let e;if(_ instanceof Uint8Array)e=new TextDecoder().decode(_);else if(typeof _=="string")e=_;else return typeof _=="object"?_:{t:_};if(!e||e===""||e==="[]")return{t:e};try{return JSON.parse(e)}catch(t){try{let n=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r");return JSON.parse(n)}catch(n){return console.error("JSON Parse failed completely:",{original:e,error:n}),{t:e}}}}var L=_=>!_||_===null||_===void 0||_===""||_==="[]";function U(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.MessageMentionList.decode(s)}catch(n){return P(_)}}function T(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.MessageAttachmentList.decode(s)}catch(n){return P(_)}}function k(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.ListChannelTimelineAttachment.decode(s)}catch(n){return P(_)}}function D(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.MessageRefList.decode(s)}catch(n){return P(_)}}function B(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.MessageReactionList.decode(s)}catch(n){return P(_)}}function H(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.DirectFcmProto.decode(s)}catch(n){return P(_)}}function Ae(_){return R.MessageMentionList.encode(R.MessageMentionList.fromPartial(_)).finish()}function ye(_){return R.MessageAttachmentList.encode(R.MessageAttachmentList.fromPartial(_)).finish()}function be(_){return R.MessageRefList.encode(R.MessageRefList.fromPartial(_)).finish()}function Ce(_){return R.MessageReactionList.encode(R.MessageReactionList.fromPartial(_)).finish()}function Pe(_){return R.DirectFcmProto.encode(R.DirectFcmProto.fromPartial(_)).finish()}var se=(c=>(c[c.USER_ROLE_UNKNOWN=0]="USER_ROLE_UNKNOWN",c[c.USER_ROLE_ADMIN=1]="USER_ROLE_ADMIN",c[c.USER_ROLE_DEVELOPER=2]="USER_ROLE_DEVELOPER",c[c.USER_ROLE_MAINTAINER=3]="USER_ROLE_MAINTAINER",c[c.USER_ROLE_READONLY=4]="USER_ROLE_READONLY",c))(se||{}),re=(a=>(a[a.CHANNEL_TYPE_CHANNEL=1]="CHANNEL_TYPE_CHANNEL",a[a.CHANNEL_TYPE_GROUP=2]="CHANNEL_TYPE_GROUP",a[a.CHANNEL_TYPE_DM=3]="CHANNEL_TYPE_DM",a[a.CHANNEL_TYPE_FORUM=5]="CHANNEL_TYPE_FORUM",a[a.CHANNEL_TYPE_STREAMING=6]="CHANNEL_TYPE_STREAMING",a[a.CHANNEL_TYPE_THREAD=7]="CHANNEL_TYPE_THREAD",a[a.CHANNEL_TYPE_APP=8]="CHANNEL_TYPE_APP",a[a.CHANNEL_TYPE_ANNOUNCEMENT=9]="CHANNEL_TYPE_ANNOUNCEMENT",a[a.CHANNEL_TYPE_MEZON_VOICE=10]="CHANNEL_TYPE_MEZON_VOICE",a))(re||{}),oe=(c=>(c[c.STREAM_MODE_CHANNEL=2]="STREAM_MODE_CHANNEL",c[c.STREAM_MODE_GROUP=3]="STREAM_MODE_GROUP",c[c.STREAM_MODE_DM=4]="STREAM_MODE_DM",c[c.STREAM_MODE_CLAN=5]="STREAM_MODE_CLAN",c[c.STREAM_MODE_THREAD=6]="STREAM_MODE_THREAD",c))(oe||{}),ae=(n=>(n[n.ALL_MESSAGE=1]="ALL_MESSAGE",n[n.MENTION_MESSAGE=2]="MENTION_MESSAGE",n[n.NOTHING_MESSAGE=3]="NOTHING_MESSAGE",n))(ae||{}),ce=(a=>(a[a.WEBRTC_SDP_INIT=0]="WEBRTC_SDP_INIT",a[a.WEBRTC_SDP_OFFER=1]="WEBRTC_SDP_OFFER",a[a.WEBRTC_SDP_ANSWER=2]="WEBRTC_SDP_ANSWER",a[a.WEBRTC_ICE_CANDIDATE=3]="WEBRTC_ICE_CANDIDATE",a[a.WEBRTC_SDP_QUIT=4]="WEBRTC_SDP_QUIT",a[a.WEBRTC_SDP_TIMEOUT=5]="WEBRTC_SDP_TIMEOUT",a[a.WEBRTC_SDP_NOT_AVAILABLE=6]="WEBRTC_SDP_NOT_AVAILABLE",a[a.WEBRTC_SDP_JOINED_OTHER_CALL=7]="WEBRTC_SDP_JOINED_OTHER_CALL",a[a.WEBRTC_SDP_STATUS_REMOTE_MEDIA=8]="WEBRTC_SDP_STATUS_REMOTE_MEDIA",a))(ce||{});function Q(_){let e,t,n,s,c,d;try{e=P(_.channel_message.content)}catch(o){console.log("content is invalid",o)}try{t=B(_.channel_message.reactions)}catch(o){console.log("reactions is invalid",o)}try{n=U(_.channel_message.mentions)}catch(o){console.log("mentions is invalid",o)}try{s=T(_.channel_message.attachments)}catch(o){console.log("attachments is invalid",o)}try{c=D(_.channel_message.references)}catch(o){console.log("references is invalid",o)}try{d=_.channel_message.referenced_message}catch(o){console.log("referenced messages is invalid",o)}return{id:_.id||_.channel_message.message_id,avatar:_.channel_message.avatar,channel_id:_.channel_message.channel_id,mode:_.channel_message.mode,channel_label:_.channel_message.channel_label,clan_id:_.channel_message.clan_id,code:_.channel_message.code,message_id:_.channel_message.message_id,sender_id:_.channel_message.sender_id,update_time:_.channel_message.update_time,clan_logo:_.channel_message.clan_logo,category_name:_.channel_message.category_name,username:_.channel_message.username,clan_nick:_.channel_message.clan_nick,clan_avatar:_.channel_message.clan_avatar,display_name:_.channel_message.display_name,content:e,reactions:t==null?void 0:t.reactions,mentions:n==null?void 0:n.mentions,attachments:s==null?void 0:s.attachments,referenced_message:d,references:c==null?void 0:c.refs,hide_editted:_.channel_message.hide_editted,is_public:_.channel_message.is_public,create_time_seconds:_.channel_message.create_time_seconds,update_time_seconds:_.channel_message.update_time_seconds,topic_id:_.channel_message.topic_id}}import*as I from"js-base64";var O=class _{constructor(e,t,n,s,c,d,i){this.created=n;this.api_url=s;this.ws_url=c;this.id_token=d;this.token=e,this.refresh_token=t,this.id_token=d,this.api_url=s,this.ws_url=c,this.created_at=Math.floor(new Date().getTime()/1e3),this.is_remember=i,this.update(e,t,i)}isexpired(e){return this.expires_at-e<=0}isrefreshexpired(e){return this.refresh_expires_at-e<=0}update(e,t,n){let s=e.split(".");if(s.length!=3)throw"jwt is not valid.";let c=JSON.parse(I.atob(s[1])),d=Math.floor(parseInt(c.exp));if(t){let i=t.split(".");if(i.length!=3)throw"refresh jwt is not valid.";let o=JSON.parse(I.atob(i[1])),a=Math.floor(parseInt(o.exp));this.refresh_expires_at=a,this.refresh_token=t,this.is_remember=n}this.token=e,this.expires_at=d,this.username=c.usn,this.user_id=c.uid,this.vars=c.vrs}static restore(e,t,n,s,c){return new _(e,t,!1,n,s,"",c)}};var j=Symbol.for("mezon.refreshTokenManager"),N=class _{constructor(){this.pendingRefreshes=new Map}static getInstance(){let e=globalThis;return e[j]||(e[j]=new _),e[j]}refresh(e,t){return l(this,null,function*(){let n=this.pendingRefreshes.get(e);if(n)return n;let s=t().finally(()=>{this.pendingRefreshes.delete(e)});return this.pendingRefreshes.set(e,s),s})}isRefreshing(e){return this.pendingRefreshes.has(e)}get pendingCount(){return this.pendingRefreshes.size}};import{encode as M}from"js-base64";import*as r from"mezon-js-protobuf";import{WebSocketAdapter as de}from"mezon-js-protobuf";var G=(C=>(C[C.ListRoles=0]="ListRoles",C[C.ListEvents=1]="ListEvents",C[C.GetRoleOfUserInTheClan=2]="GetRoleOfUserInTheClan",C[C.GetListPermission=3]="GetListPermission",C[C.ListUserPermissionInChannel=4]="ListUserPermissionInChannel",C[C.GetNotificationClan=5]="GetNotificationClan",C[C.ListMutedChannel=6]="ListMutedChannel",C[C.ListStreamingChannelUsers=7]="ListStreamingChannelUsers",C[C.ListQuickMenuAccess=8]="ListQuickMenuAccess",C[C.GetNotificationChannel=9]="GetNotificationChannel",C[C.ListFriends=10]="ListFriends",C[C.EmojiRecentList=11]="EmojiRecentList",C[C.GetListEmojisByUserId=12]="GetListEmojisByUserId",C[C.ListChannelBadgeCount=13]="ListChannelBadgeCount",C[C.ListClanUsersStatus=14]="ListClanUsersStatus",C[C.ListChannelApps=15]="ListChannelApps",C[C.GetListFavoriteChannel=16]="GetListFavoriteChannel",C[C.ListCategoryDescs=17]="ListCategoryDescs",C[C.ListOnboarding=18]="ListOnboarding",C[C.GetListStickersByUserId=19]="GetListStickersByUserId",C[C.GetSystemMessageByClanId=20]="GetSystemMessageByClanId",C[C.GetPinMessagesList=21]="GetPinMessagesList",C[C.GetChannelCanvasList=22]="GetChannelCanvasList",C[C.ListChannelTimeline=23]="ListChannelTimeline",C[C.ListChannelMessages=24]="ListChannelMessages",C))(G||{}),x=class x{constructor(e,t,n,s){this.serverKey=e;this.timeoutMs=t;this.cIds={},this.nextCid=1,this.basePath=s,n?this.adapter=n:this.adapter=new de}setOnOpen(e){this.adapter.onOpen=e}setOnError(e){this.adapter.onError=e}close(){this.adapter.close()}generatecid(){let e=this.nextCid;return++this.nextCid,e}setTransportAdapter(e){this.adapter=e}setFallbackSession(e){}getApiFromPath(e){if(e in G)return G[e]}connect(e,t=!1,n=!1,s,c,d){let[i,o]=e.ws_url.split(":");this.adapter.connect(i,o,t,e.token,d),this.adapter.onClose=c,this.adapter.onMessage=(a,u,h)=>l(this,null,function*(){if(n&&window&&window.console&&console.log("incomming message with cid %o and message %o",a,h),a!=0){let g=this.cIds[a];if(!g){console.error("No promise executor for message: %o",h);return}delete this.cIds[a],h.error?g.reject(h.error):g.resolve({code:u,message:h})}else yield s(0,0,h)})}send(e,t=x.DefaultSendTimeoutMs){let{urlPath:n,fetchOptions:s}=e,c=s;if(n!=null&&n.includes("/mezon.api.Mezon/")){let d=n.substring(17);c={api_request_event:{api_index:this.getApiFromPath(d),api_name:d,body:s.body}}}return new Promise((d,i)=>{var o,a;if(!this.adapter.isOpen())i("Socket connection has not been established yet.");else{c.channel_message_send?c.channel_message_send.content=JSON.stringify(c.channel_message_send.content):c.channel_message_update?c.channel_message_update.content=JSON.stringify(c.channel_message_update.content):c.ephemeral_message_send?c.ephemeral_message_send.message.content=JSON.stringify((o=c.ephemeral_message_send.message)==null?void 0:o.content):c.quick_menu_event&&(c.quick_menu_event.message.content=JSON.stringify((a=c.quick_menu_event.message)==null?void 0:a.content));let u=this.generatecid();this.cIds[u]={resolve:d,reject:i},t!==1/0&&t>0&&setTimeout(()=>{i("The socket timed out while waiting for a response.")},t),c.cid=u.toString(),this.adapter.send(c)}})}setBasePath(e){this.basePath=e}deleteAccount(e,t={}){let n="/mezon.api.Mezon/DeleteAccount",c=m("POST",t,"");return e&&(c.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:c}).then(d=>d),new Promise((d,i)=>setTimeout(i,this.timeoutMs,"Request timed out."))])}getAccount(e,t={}){let n="/mezon.api.Mezon/GetAccount",c=m("POST",t,"");return e&&(c.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:c}).then(d=>l(this,null,function*(){return d.code!=0?{}:r.Account.decode(d.message)})),new Promise((d,i)=>setTimeout(()=>i(new Error("Request timed out.")),this.timeoutMs))])}updateAccount(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateAccount",d=r.UpdateAccountRequest.encode(r.UpdateAccountRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}checkLoginRequest(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/checklogin",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.Session.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}confirmLogin(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/confirmlogin",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(t,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Bearer "+e),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>u),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}createQRLogin(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/createqrlogin",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.LoginIDResponse.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}AuthenticateSMSOTPRequest(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/smsotp",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.LinkAccountConfirmRequest.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}AuthenticateEmailOTPRequest(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/emailotp",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.LinkAccountConfirmRequest.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}authenticateEmail(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/email",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.Session.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}authenticateMezon(e,t,n,s,c,d,i={}){if(n==null)throw new Error("'account' is a required parameter but is null or undefined.");let o="/v2/account/authenticate/mezon",a=new Map;a.set("create",s),a.set("username",c),a.set("is_remember",d);let u="";u=JSON.stringify(n||{});let h=this.buildFullUrl(this.basePath,o,a),g=m("POST",i,u);return e&&(g.headers.Authorization="Basic "+M(e+":"+t)),g.headers.Accept="application/x-protobuf",Promise.race([fetch(h,g).then(f=>l(this,null,function*(){let A=yield f.arrayBuffer();return r.Session.decode(new Uint8Array(A))})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}linkEmail(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/LinkEmail",d=r.AccountEmail.encode(r.AccountEmail.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.LinkAccountConfirmRequest.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}linkSMS(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/LinkSMS",d=r.AccountMezon.encode(r.AccountMezon.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.LinkAccountConfirmRequest.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}confirmLinkMezonOTP(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ConfirmLinkMezonOTP",d=r.LinkAccountConfirmRequest.encode(r.LinkAccountConfirmRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),i.headers.Accept="application/x-protobuf",Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.Session.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}confirmAuthenticateOTP(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/confirmotp",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.Session.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}registrationEmail(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/RegistrationEmail",d=r.RegistrationEmailRequest.encode(r.RegistrationEmailRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.Session.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}sessionRefresh(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/SessionRefresh",i=r.SessionRefreshRequest.encode(r.SessionRefreshRequest.fromPartial(n)).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Basic "+M(e+":"+t)),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.Session.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}unlinkEmail(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UnlinkEmail",d=r.AccountEmail.encode(r.AccountEmail.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listActivity(e,t={}){let n="/mezon.api.Mezon/ListActivity",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.ListUserActivity.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}createActiviy(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateActiviy",d=r.CreateActivityRequest.encode(r.CreateActivityRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.UserActivity.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}addApp(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddApp",d=r.AddAppRequest.encode(r.AddAppRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.App.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listApps(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListApps",o=r.ListAppsRequest.encode(r.ListAppsRequest.fromPartial({filter:t,tombstones:n,cursor:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.AppList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}addAppToClan(e,t,n,s={}){if(t==null)throw new Error("'appId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/AddAppToClan",i=r.AppClan.encode(r.AppClan.fromPartial({app_id:t,clan_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}deleteApp(e,t,n={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DeleteApp",d=r.App.encode(r.App.fromPartial({id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o})),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}getApp(e,t,n={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetApp",d=r.App.encode(r.App.fromPartial({id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.App.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateApp(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateApp",i=r.UpdateAppRequest.encode(r.UpdateAppRequest.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.App.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listAuditLog(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/ListAuditLog",a=r.ListAuditLogRequest.encode(r.ListAuditLogRequest.fromPartial({clan_id:s,user_id:n,action_log:t,date_log:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return r.ListAuditLog.decode(h)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}updateCategoryOrder(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateCategoryOrder",d=r.UpdateCategoryOrderRequest.encode(r.UpdateCategoryOrderRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o})),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listCategoryDescs(e,t,n,s,c,d,i={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let o="/mezon.api.Mezon/ListCategoryDescs",u=r.CategoryDesc.encode(r.CategoryDesc.fromPartial({clan_id:t,creator_id:n,category_name:s,category_id:c,category_order:d})).finish(),h=m("POST",i,"");return h.body=u,e&&(h.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:o,fetchOptions:h}).then(g=>l(this,null,function*(){return g.code!=0?{}:r.CategoryDescList.decode(g.message)})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])}listChannelApps(e,t,n={}){let s="/mezon.api.Mezon/ListChannelApps",d=r.ListChannelAppsRequest.encode(r.ListChannelAppsRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListChannelAppsResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getChannelCanvasList(e,t,n,s,c,d={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let i="/mezon.api.Mezon/GetChannelCanvasList",a=r.ChannelCanvasListRequest.encode(r.ChannelCanvasListRequest.fromPartial({channel_id:t,clan_id:n,limit:s,page:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.ChannelCanvasListResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}addChannelFavorite(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddChannelFavorite",d=r.AddFavoriteChannelRequest.encode(r.AddFavoriteChannelRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.AddFavoriteChannelResponse.decode(o)})),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}removeChannelFavorite(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/RemoveChannelFavorite",i=r.RemoveFavoriteChannelRequest.encode(r.RemoveFavoriteChannelRequest.fromPartial({channel_id:t,clan_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}getListFavoriteChannel(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetListFavoriteChannel",d=r.ListFavoriteChannelRequest.encode(r.ListFavoriteChannelRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListFavoriteChannelResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listChannelMessages(e,t,n,s,c,d,i,o={}){if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let a="/mezon.api.Mezon/ListChannelMessages",h=r.ListChannelMessagesRequest.encode(r.ListChannelMessagesRequest.fromPartial({clan_id:t,channel_id:n,message_id:s,direction:c,limit:d,topic_id:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return r.ChannelMessageList.decode(f)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}addChannelUsers(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/AddChannelUsers",i=r.AddChannelUsersRequest.encode(r.AddChannelUsersRequest.fromPartial({channel_id:t,user_ids:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listChannelAttachment(e,t,n,s,c,d,i,o,a,u={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let h="/mezon.api.Mezon/ListChannelAttachment",f=r.ListChannelAttachmentRequest.encode(r.ListChannelAttachmentRequest.fromPartial({channel_id:t,clan_id:n,file_type:s,limit:c,state:d,before:i,after:o,around:a})).finish(),A=m("POST",u,"");return A.body=f,e&&(A.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:h,fetchOptions:A}).then(y=>l(this,null,function*(){return y.code!=0?{}:r.ChannelAttachmentList.decode(y.message)})),new Promise((y,b)=>setTimeout(()=>b(new Error("Request timed out.")),this.timeoutMs))])}getChanEncryptionMethod(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/GetChanEncryptionMethod",i=r.ChanEncryptionMethod.encode(r.ChanEncryptionMethod.fromPartial({channel_id:t,method:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.ChanEncryptionMethod.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}setChanEncryptionMethod(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/SetChanEncryptionMethod",i=r.ChanEncryptionMethod.encode(r.ChanEncryptionMethod.fromPartial(E(w({},n),{channel_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}leaveThread(e,t,n,s={}){if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/LeaveThread",i=r.LeaveThreadRequest.encode(r.LeaveThreadRequest.fromPartial({channel_id:n,clan_id:t})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}archiveChannel(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/ArchiveChannel",i=r.ArchiveChannelRequest.encode(r.ArchiveChannelRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listArchivedChannelDescs(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListArchivedChannelDescs",d=r.ListArchivedChannelDescsRequest.encode(r.ListArchivedChannelDescsRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListArchivedChannelDescsResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}removeChannelUsers(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/RemoveChannelUsers",i=r.RemoveChannelUsersRequest.encode(r.RemoveChannelUsersRequest.fromPartial({channel_id:t,user_ids:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listChannelUsers(e,t,n,s,c,d,i,o={}){if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let a="/mezon.api.Mezon/ListChannelUsers",h=r.ListChannelUsersRequest.encode(r.ListChannelUsersRequest.fromPartial({clan_id:t,channel_id:n,channel_type:s,limit:c,state:d,cursor:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return f.code!=0?{}:r.ChannelUserList.decode(f.message)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}listChannelDescs(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/ListChannelDescs",h=r.ListChannelDescsRequest.encode(r.ListChannelDescsRequest.fromPartial({limit:t,state:n,page:s,clan_id:c,channel_type:d,is_mobile:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return f.code!=0?{}:r.ChannelDescList.decode(f.message)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}createChannelDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateChannelDesc",d=r.CreateChannelDescRequest.encode(r.CreateChannelDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ChannelDescription.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listChannelUsersUC(e,t,n,s={}){let c="/mezon.api.Mezon/ListChannelUsersUC",i=r.AllUsersAddChannelRequest.encode(r.AllUsersAddChannelRequest.fromPartial({channel_id:t,limit:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.AllUsersAddChannelResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}deleteChannelDesc(e,t,n,s={}){if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteChannelDesc",i=r.DeleteChannelDescRequest.encode(r.DeleteChannelDescRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}updateChannelDesc(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateChannelDesc",i=r.UpdateChannelDescRequest.encode(r.UpdateChannelDescRequest.fromPartial(E(w({},n),{channel_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listChannelSetting(e,t,n,s,c,d,i,o,a,u,h,g={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let f="/mezon.api.Mezon/ListChannelSetting",y=r.ChannelSettingListRequest.encode(r.ChannelSettingListRequest.fromPartial({clan_id:t,parent_id:n,category_id:s,active:d,private_channel:c,status:i,type:o,limit:a,page:u,channel_label:h})).finish(),b=m("POST",g,"");return b.body=y,e&&(b.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:f,fetchOptions:b}).then(S=>l(this,null,function*(){return S.code!=0?{}:r.ChannelSettingListResponse.decode(S.message)})),new Promise((S,v)=>setTimeout(()=>v(new Error("Request timed out.")),this.timeoutMs))])}listChannelVoiceUsers(e,t,n,s={}){let c="/mezon.api.Mezon/ListChannelVoiceUsers",i=r.ListChannelUsersRequest.encode(r.ListChannelUsersRequest.fromPartial({clan_id:t,limit:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.VoiceChannelUserList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listClanDescs(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListClanDescs",o=r.ListClanDescRequest.encode(r.ListClanDescRequest.fromPartial({limit:t,state:n,cursor:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ClanDescList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}listChannelBadgeCount(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListChannelBadgeCount",o=r.ListChannelBadgeCountRequest.encode(r.ListChannelBadgeCountRequest.fromPartial({clan_id:t,limit:n!=null?n:0,page:s!=null?s:0})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ListChannelBadgeCountResponse.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}listUserOnline(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListUserOnline",o=r.ListUserOnlineRequest.encode(r.ListUserOnlineRequest.fromPartial({clan_id:t,limit:n!=null?n:0,page:s!=null?s:0})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ListUserOnlineResponse.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}createClanDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateClanDesc",d=r.CreateClanDescRequest.encode(r.CreateClanDescRequest.fromPartial({clan_name:t.clan_name,logo:t.logo,banner:t.banner})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ClanDesc.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteClanDesc(e,t,n={}){if(t==null)throw new Error("'clanDescId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DeleteClanDesc",d=r.DeleteClanDescRequest.encode(r.DeleteClanDescRequest.fromPartial({clan_desc_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}updateClanDesc(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateClanDesc",i=r.UpdateClanDescRequest.encode(r.UpdateClanDescRequest.fromPartial(w({clan_id:t},n))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}removeClanUsers(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/RemoveClanUsers",i=r.RemoveClanUsersRequest.encode(r.RemoveClanUsersRequest.fromPartial({clan_id:t,user_ids:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listBannedUsers(e,t,n,s={}){let c="/mezon.api.Mezon/ListBannedUsers",i=r.BannedUserListRequest.encode(r.BannedUserListRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.BannedUserList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}unbanClanUsers(e,t,n,s,c,d={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let i="/mezon.api.Mezon/UnbanClanUsers",a=r.BanClanUsersRequest.encode(r.BanClanUsersRequest.fromPartial({clan_id:t,channel_id:n,user_ids:s,ban_time:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return{}})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}banClanUsers(e,t,n,s,c,d={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let i="/mezon.api.Mezon/BanClanUsers",a=r.BanClanUsersRequest.encode(r.BanClanUsersRequest.fromPartial({clan_id:t,channel_id:n,user_ids:s,ban_time:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return{}})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}listClanUsers(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListClanUsers",d=r.ListClanUsersRequest.encode(r.ListClanUsersRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ClanUserList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listClanUsersStatus(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListClanUsersStatus",d=r.ListClanUsersStatusRequest.encode(r.ListClanUsersStatusRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ClanUserStatusList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createCategoryDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateCategoryDesc",d=r.CreateCategoryDescRequest.encode(r.CreateCategoryDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.CategoryDesc.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}checkDuplicateName(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CheckDuplicateName",d=r.CheckDuplicateNameRequest.encode(r.CheckDuplicateNameRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){if(o.status>=200&&o.status<300)return r.CheckDuplicateNameResponse.decode(o);throw o})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteCategoryDesc(e,t,n,s,c={}){if(t==null)throw new Error("'categoryId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/DeleteCategoryDesc",o=r.DeleteCategoryDescRequest.encode(r.DeleteCategoryDescRequest.fromPartial({category_id:t,clan_id:n,category_label:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return{}})),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}registFCMDeviceToken(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/RegistFCMDeviceToken",a=r.RegistFcmDeviceTokenRequest.encode(r.RegistFcmDeviceTokenRequest.fromPartial({token:t,device_id:n,platform:s,voip_token:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.RegistFcmDeviceTokenResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}closeDirectMess(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CloseDMByChannelId",d=r.DeleteChannelDescRequest.encode(r.DeleteChannelDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}openDirectMess(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/OpenDMByChannelId",d=r.DeleteChannelDescRequest.encode(r.DeleteChannelDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createClanEmoji(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateClanEmoji",d=r.ClanEmojiCreateRequest.encode(r.ClanEmojiCreateRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteClanEmojiById(e,t,n,s,c={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/DeleteByIdClanEmoji",o=r.ClanEmojiDeleteRequest.encode(r.ClanEmojiDeleteRequest.fromPartial({id:t,clan_id:n,emoji_label:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return{}})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}updateClanEmojiById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateClanEmojiById",i=r.ClanEmojiUpdateRequest.encode(r.ClanEmojiUpdateRequest.fromPartial({id:n.id,shortname:n.shortname,clan_id:n.clan_id})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}emojiRecentList(e,t={}){let n="/mezon.api.Mezon/EmojiRecentList",c=m("POST",t,"");return e&&(c.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:c}).then(d=>l(this,null,function*(){return d.code!=0?{}:r.EmojiRecentList.decode(d.message)})),new Promise((d,i)=>setTimeout(()=>i(new Error("Request timed out.")),this.timeoutMs))])}getListEmojisByUserId(e,t={}){let n="/mezon.api.Mezon/GetListEmojisByUserId",c=m("POST",t,"");return e&&(c.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:c}).then(d=>l(this,null,function*(){return d.code!=0?{}:r.EmojiListedResponse.decode(d.message)})),new Promise((d,i)=>setTimeout(()=>i(new Error("Request timed out.")),this.timeoutMs))])}searchMessage(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SearchMessage",d=r.SearchMessageRequest.encode(r.SearchMessageRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.SearchMessageResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}event(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateEvent",d=r.Event.encode(r.Event.fromPartial({external:t.external,name:t.name,properties:t.properties})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listEvents(e,t,n={}){let s="/mezon.api.Mezon/ListEvents",d=r.ListEventsRequest.encode(r.ListEventsRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.EventList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createEvent(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateEvent",d=r.CreateEventRequest.encode(r.CreateEventRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.EventManagement.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateEventUser(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateEventUser",d=r.DeleteEventRequest.encode(r.DeleteEventRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteEvent(e,t,n,s,c,d,i={}){if(t==null)throw new Error("'eventId' is a required parameter but is null or undefined.");let o="/mezon.api.Mezon/DeleteEvent",u=r.DeleteEventRequest.encode(r.DeleteEventRequest.fromPartial({event_id:t,clan_id:n,creator_id:s,event_label:c,channel_id:d})).finish(),h=m("POST",i,"");return h.body=u,e&&(h.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:o,fetchOptions:h}).then(g=>l(this,null,function*(){return{}})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])}updateEvent(e,t,n,s={}){if(t==null)throw new Error("'eventId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateEvent",i=r.UpdateEventRequest.encode(r.UpdateEventRequest.fromPartial(n)).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}deleteFriends(e,t,n,s={}){let c="/mezon.api.Mezon/DeleteFriends",i=r.DeleteFriendsRequest.encode(r.DeleteFriendsRequest.fromPartial({ids:t,usernames:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listFriends(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListFriends",o=r.ListFriendsRequest.encode(r.ListFriendsRequest.fromPartial({limit:t,state:n,cursor:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.FriendList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}addFriends(e,t,n,s={}){let c="/mezon.api.Mezon/AddFriends",i=r.AddFriendsRequest.encode(r.AddFriendsRequest.fromPartial({ids:t,usernames:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.AddFriendsResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}blockFriends(e,t,n,s={}){let c="/mezon.api.Mezon/BlockFriends",i=r.BlockFriendsRequest.encode(r.BlockFriendsRequest.fromPartial({ids:t,usernames:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}unblockFriends(e,t,n,s={}){let c="/mezon.api.Mezon/UnblockFriends",i=r.BlockFriendsRequest.encode(r.BlockFriendsRequest.fromPartial({ids:t,usernames:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}getChannelCategoryNotiSettingsList(e,t,n={}){let s="/mezon.api.Mezon/GetChannelCategoryNotiSettingsList",d=r.NotificationClan.encode(r.NotificationClan.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotificationChannelCategorySettingList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getUserProfileOnClan(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetUserProfileOnClan",d=r.ClanProfileRequest.encode(r.ClanProfileRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ClanProfile.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getNotificationCategory(e,t,n={}){let s="/mezon.api.Mezon/GetNotificationCategory",d=r.DefaultNotificationCategory.encode(r.DefaultNotificationCategory.fromPartial({category_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotificationUserChannel.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getNotificationChannel(e,t,n={}){let s="/mezon.api.Mezon/GetNotificationChannel",d=r.NotificationChannel.encode(r.NotificationChannel.fromPartial({channel_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotificationUserChannel.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getNotificationClan(e,t,n={}){let s="/mezon.api.Mezon/GetNotificationClan",d=r.NotificationClan.encode(r.NotificationClan.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotificationSetting.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getNotificationReactMessage(e,t,n={}){let s="/mezon.api.Mezon/GetNotificationReactMessage",d=r.NotifiReactMessage.encode(r.NotifiReactMessage.fromPartial({channel_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotifiReactMessage.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}giveMeACoffee(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GiveMeACoffee",d=r.GiveCoffeeEvent.encode(r.GiveCoffeeEvent.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getKeyServer(e,t={}){let n="/mezon.api.Mezon/GetKeyServer",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.GetKeyServerResp.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}createLinkInviteUser(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateLinkInviteUser",d=r.LinkInviteUserRequest.encode(r.LinkInviteUserRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.LinkInviteUser.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}inviteUser(e,t,n={}){if(t==null)throw new Error("'inviteId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/InviteUser",d=r.InviteUserRequest.encode(r.InviteUserRequest.fromPartial({invite_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.InviteUserRes.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getLinkInvite(e,t,n,s={}){if(n==null)throw new Error("'inviteId' is a required parameter but is null or undefined.");let c="/v2/invite/{inviteId}".replace("{inviteId}",encodeURIComponent(String(n))),d=new Map,i="",o=this.buildFullUrl(this.basePath,c,d),a=m("GET",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.InviteUserRes.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}listChannelByUserId(e,t={}){let n="/mezon.api.Mezon/ListChannelByUserId",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.ChannelDescList.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}markAsRead(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/MarkAsRead",d=r.MarkAsReadRequest.encode(r.MarkAsReadRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listMezonOauthClient(e,t={}){let n="/mezon.api.Mezon/ListMezonOauthClient",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.MezonOauthClientList.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}setMuteCategory(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetMuteCategory",d=r.SetMuteRequest.encode(r.SetMuteRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}setMuteChannel(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetMuteChannel",d=r.SetMuteRequest.encode(r.SetMuteRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteNotifications(e,t,n,s={}){let c="/mezon.api.Mezon/DeleteNotifications",i=r.DeleteNotificationsRequest.encode(r.DeleteNotificationsRequest.fromPartial({ids:t||[],category:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listNotifications(e,t,n,s,c,d,i={}){let o="/mezon.api.Mezon/ListNotifications",u=r.ListNotificationsRequest.encode(r.ListNotificationsRequest.fromPartial({limit:t,clan_id:n,notification_id:s,category:c,direction:d})).finish(),h=m("POST",i,"");return h.body=u,e&&(h.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:o,fetchOptions:h}).then(g=>l(this,null,function*(){return r.NotificationList.decode(g)})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])}setNotificationChannelSetting(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetNotificationChannelSetting",d=r.SetNotificationRequest.encode(r.SetNotificationRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}setNotificationClanSetting(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetNotificationClanSetting",d=r.SetDefaultNotificationRequest.encode(r.SetDefaultNotificationRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}setNotificationCategorySetting(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetNotificationCategorySetting",d=r.SetNotificationRequest.encode(r.SetNotificationRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}deleteNotificationCategorySetting(e,t,n={}){let s="/mezon.api.Mezon/DeleteNotificationCategorySetting",d=r.DefaultNotificationCategory.encode(r.DefaultNotificationCategory.fromPartial({category_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}deleteNotificationChannel(e,t,n={}){let s="/mezon.api.Mezon/DeleteNotificationChannel",d=r.NotificationChannel.encode(r.NotificationChannel.fromPartial({channel_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}deleteNotiReactMessage(e,t,n={}){let s="/mezon.api.Mezon/DeleteNotiReactMessage",d=r.NotificationChannel.encode(r.NotificationChannel.fromPartial({channel_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}setNotificationReactMessage(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetNotificationReactMessage",d=r.NotificationChannel.encode(r.NotificationChannel.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}setRoleChannelPermission(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetRoleChannelPermission",d=r.UpdateRoleChannelRequest.encode(r.UpdateRoleChannelRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}getListPermission(e,t={}){let n="/mezon.api.Mezon/GetListPermission",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.PermissionList.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}getPermissionByRoleIdChannelId(e,t,n,s,c={}){let d="/mezon.api.Mezon/GetPermissionByRoleIdChannelId",o=r.PermissionRoleChannelListEventRequest.encode(r.PermissionRoleChannelListEventRequest.fromPartial({role_id:t,channel_id:n,user_id:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.PermissionRoleChannelListEventResponse.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}deletePinMessage(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/DeletePinMessage",a=r.DeletePinMessage.encode(r.DeletePinMessage.fromPartial({id:t,message_id:n,channel_id:s,clan_id:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>h),new Promise((h,g)=>setTimeout(g,this.timeoutMs,"Request timed out."))])}getPinMessagesList(e,t,n,s,c={}){let d="/mezon.api.Mezon/GetPinMessagesList",o=r.PinMessageRequest.encode(r.PinMessageRequest.fromPartial({message_id:t,channel_id:n,clan_id:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return r.PinMessagesList.decode(u)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}createMessage2Inbox(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateMessage2Inbox",d=r.Message2InboxRequest.encode(r.Message2InboxRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ChannelMessageHeader.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createPinMessage(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreatePinMessage",d=r.PinMessageRequest.encode(r.PinMessageRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ChannelMessageHeader.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getPubKeys(e,t,n={}){let s="/mezon.api.Mezon/GetPubKeys",d=r.GetPubKeysRequest.encode(r.GetPubKeysRequest.fromPartial({user_ids:t||[]})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.GetPubKeysResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}pushPubKey(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/PushPubKey",d=r.PushPubKeyRequest.encode(r.PushPubKeyRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}addRolesChannelDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddRolesChannelDesc",d=r.AddRoleChannelDescRequest.encode(r.AddRoleChannelDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}changeChannelCategory(e,t,n,s={}){if(t==null)throw new Error("'newCategoryId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/ChangeChannelCategory",i=r.ChangeChannelCategoryRequest.encode(r.ChangeChannelCategoryRequest.fromPartial(E(w({},n),{new_category_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}deleteRoleChannelDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DeleteRoleChannelDesc",d=r.DeleteRoleRequest.encode(r.DeleteRoleRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listRoles(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/ListRoles",a=r.RoleListEventRequest.encode(r.RoleListEventRequest.fromPartial({clan_id:t,limit:n,state:s,cursor:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.RoleListEventResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}createRole(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateRole",d=r.CreateRoleRequest.encode(r.CreateRoleRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.Role.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateRoleDelete(e,t,n,s={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteRole",i=r.DeleteRoleRequest.encode(r.DeleteRoleRequest.fromPartial(E(w({},n),{role_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}deleteRole(e,t,n,s,c,d={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");let i="/mezon.api.Mezon/DeleteRole",a=r.DeleteRoleRequest.encode(r.DeleteRoleRequest.fromPartial({role_id:t,channel_id:n,clan_id:s,role_label:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>h),new Promise((h,g)=>setTimeout(g,this.timeoutMs,"Request timed out."))])}updateRole(e,t,n,s={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateRole",i=r.UpdateRoleRequest.encode(r.UpdateRoleRequest.fromPartial(E(w({},n),{role_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listRolePermissions(e,t,n={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListRolePermissions",d=r.ListPermissionsRequest.encode(r.ListPermissionsRequest.fromPartial({role_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.PermissionList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listRoleUsers(e,t,n,s,c={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/ListRoleUsers",o=r.ListRoleUsersRequest.encode(r.ListRoleUsersRequest.fromPartial({role_id:t,limit:n,cursor:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.RoleUserList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}getRoleOfUserInTheClan(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/GetRoleOfUserInTheClan",i=r.ListPermissionOfUsersRequest.encode(r.ListPermissionOfUsersRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.RoleList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}searchThread(e,t,n,s,c={}){let d="/mezon.api.Mezon/SearchThread",o=r.SearchThreadRequest.encode(r.SearchThreadRequest.fromPartial({clan_id:t,channel_id:n,label:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ChannelDescList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}sendToken(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SendToken",d=r.TokenSentEvent.encode(r.TokenSentEvent.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}sessionLogout(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SessionLogout",d=r.SessionLogoutRequest.encode(r.SessionLogoutRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}addClanSticker(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddClanSticker",d=r.ClanStickerAddRequest.encode(r.ClanStickerAddRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteClanStickerById(e,t,n,s,c={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/DeleteClanStickerById",o=r.ClanStickerDeleteRequest.encode(r.ClanStickerDeleteRequest.fromPartial({id:t,clan_id:n,sticker_label:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return{}})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}updateClanStickerById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateClanStickerById",i=r.ClanStickerUpdateByIdRequest.encode(r.ClanStickerUpdateByIdRequest.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}getListStickersByUserId(e,t={}){let n="/mezon.api.Mezon/GetListStickersByUserId",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.StickerListedResponse.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}registerStreamingChannel(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/RegisterStreamingChannel",d=r.RegisterStreamingChannelRequest.encode(r.RegisterStreamingChannelRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.RegisterStreamingChannelResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listStreamingChannelUsers(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/ListStreamingChannelUsers",h=r.ListChannelUsersRequest.encode(r.ListChannelUsersRequest.fromPartial({clan_id:t,channel_id:n,channel_type:s,limit:c,state:d,cursor:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return f.code!=0?{}:r.StreamingChannelUserList.decode(f.message)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}getSystemMessagesList(e,t={}){let n="/mezon.api.Mezon/GetSystemMessagesList",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.SystemMessagesList.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}createSystemMessage(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateSystemMessage",d=r.SystemMessageRequest.encode(r.SystemMessageRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listSdTopic(e,t,n,s={}){let c="/mezon.api.Mezon/ListSdTopic",i=r.ListSdTopicRequest.encode(r.ListSdTopicRequest.fromPartial({clan_id:t,limit:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.SdTopicList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}createSdTopic(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateSdTopic",d=r.SdTopicRequest.encode(r.SdTopicRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.SdTopic.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteSystemMessage(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DeleteSystemMessage",d=r.DeleteSystemMessage.encode(r.DeleteSystemMessage.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getSystemMessageByClanId(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetSystemMessageByClanId",d=r.GetSystemMessage.encode(r.GetSystemMessage.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.SystemMessage.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateSystemMessage(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateSystemMessage",i=r.SystemMessageRequest.encode(r.SystemMessageRequest.fromPartial(E(w({},n),{clan_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listThreadDescs(e,t,n,s,c,d,i,o={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let a="/mezon.api.Mezon/ListThreadDescs",h=r.ListThreadRequest.encode(r.ListThreadRequest.fromPartial({channel_id:t,limit:n,state:s,clan_id:c,thread_id:d,page:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return f.code!=0?{}:r.ChannelDescListNoPool.decode(f.message)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}updateCategory(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateCategory",i=r.UpdateCategoryDescRequest.encode(r.UpdateCategoryDescRequest.fromPartial(E(w({},n),{clan_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}updateChannelPrivate(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateChannelPrivate",d=r.ChangeChannelPrivateRequest.encode(r.ChangeChannelPrivateRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateUserProfileByClan(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateUserProfileByClan",i=r.UpdateClanProfileRequest.encode(r.UpdateClanProfileRequest.fromPartial(E(w({},n),{clan_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}uploadOauthFile(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UploadOauthFile",d=r.UploadAttachmentRequest.encode(r.UploadAttachmentRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.UploadAttachment.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}uploadAttachmentFile(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UploadAttachmentFile",d=r.UploadAttachmentRequest.encode(r.UploadAttachmentRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.UploadAttachment.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}multipartUploadAttachmentFile(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/MultipartUploadAttachmentFileStart",d=r.UploadAttachmentRequest.encode(r.UploadAttachmentRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.MultipartUploadAttachment.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}multipartUploadAttachmentFileFinsih(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/MultipartUploadAttachmentFileStart",d=r.MultipartUploadAttachmentFinishRequest.encode(r.MultipartUploadAttachmentFinishRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateUser(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateUser",d=r.UpdateUsersRequest.encode(r.UpdateUsersRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listUserClansByUserId(e,t={}){let n="/mezon.api.Mezon/ListUserClansByUserId",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.AllUserClans.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}listUserPermissionInChannel(e,t,n,s={}){let c="/mezon.api.Mezon/ListUserPermissionInChannel",i=r.UserPermissionInChannelListRequest.encode(r.UserPermissionInChannelListRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.UserPermissionInChannelListResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}getUserStatus(e,t={}){let n="/mezon.api.Mezon/GetUserStatus",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.UserStatus.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}updateUserStatus(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateUserStatus",d=r.UserStatusUpdate.encode(r.UserStatusUpdate.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}updateUserCustomStatus(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateUserCustomStatus",d=r.UserStatusUpdate.encode(r.UserStatusUpdate.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}generateWebhook(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GenerateWebhook",d=r.WebhookCreateRequest.encode(r.WebhookCreateRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.WebhookGenerateResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateWebhookById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateWebhookById",i=r.WebhookUpdateRequestById.encode(r.WebhookUpdateRequestById.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listWebhookByChannelId(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/ListWebhookByChannelId",i=r.WebhookListRequest.encode(r.WebhookListRequest.fromPartial({channel_id:t,clan_id:n||""})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.WebhookListResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}deleteWebhookById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteWebhookById",i=r.WebhookDeleteRequestById.encode(r.WebhookDeleteRequestById.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}buildFullUrl(e,t,n){let s=e+t+"?";for(let[c,d]of n)d instanceof Array?s+=d.reduce((i,o)=>i+encodeURIComponent(c)+"="+encodeURIComponent(o)+"&",""):d!=null&&(s+=encodeURIComponent(c)+"="+encodeURIComponent(d)+"&");return s}editChannelCanvases(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/EditChannelCanvases",d=r.EditChannelCanvasRequest.encode(r.EditChannelCanvasRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.EditChannelCanvasResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getChannelCanvasDetail(e,t,n,s,c={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/GetChannelCanvasDetail",o=r.ChannelCanvasDetailRequest.encode(r.ChannelCanvasDetailRequest.fromPartial({id:t,clan_id:n||"",channel_id:s||""})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ChannelCanvasDetailResponse.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}deleteChannelCanvas(e,t,n,s,c={}){if(t==null)throw new Error("'canvasId' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/DeleteChannelCanvas",o=r.DeleteChannelCanvasRequest.encode(r.DeleteChannelCanvasRequest.fromPartial({canvas_id:t,clan_id:n||"",channel_id:s||""})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}listOnboarding(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/ListOnboarding",a=r.ListOnboardingRequest.encode(r.ListOnboardingRequest.fromPartial({clan_id:t,guide_type:n,limit:s,page:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.ListOnboardingResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}createOnboarding(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateOnboarding",d=r.CreateOnboardingRequest.encode(r.CreateOnboardingRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListOnboardingResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteOnboarding(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteOnboarding",i=r.OnboardingRequest.encode(r.OnboardingRequest.fromPartial({id:t,clan_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}getOnboardingDetail(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/GetOnboardingDetail",i=r.OnboardingRequest.encode(r.OnboardingRequest.fromPartial({id:t,clan_id:n||""})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.OnboardingItem.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}updateOnboarding(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateOnboarding",i=r.UpdateOnboardingRequest.encode(r.UpdateOnboardingRequest.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}generateClanWebhook(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GenerateClanWebhook",d=r.GenerateClanWebhookRequest.encode(r.GenerateClanWebhookRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.GenerateClanWebhookResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listClanWebhook(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListClanWebhook",d=r.ListClanWebhookRequest.encode(r.ListClanWebhookRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListClanWebhookResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteClanWebhookById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteClanWebhookById",d={id:t,clan_id:n},o=r.ClanWebhookRequest.encode(r.ClanWebhookRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}updateClanWebhookById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateClanWebhookById",d=E(w({},n),{id:t}),o=r.UpdateClanWebhookRequest.encode(r.UpdateClanWebhookRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}getTopicDetail(e,t,n={}){let s="/mezon.api.Mezon/GetTopicDetail",c={topic_id:t},i=r.SdTopicDetailRequest.encode(r.SdTopicDetailRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.SdTopic.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listOnboardingStep(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListOnboardingStep",i={clan_id:t,limit:n,page:s},a=r.ListOnboardingStepRequest.encode(r.ListOnboardingStepRequest.fromPartial(i)).finish(),u=m("POST",c,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.ListOnboardingStepResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}updateOnboardingStepByClanId(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateOnboardingStep",d=E(w({},n),{clan_id:t}),o=r.UpdateOnboardingStepRequest.encode(r.UpdateOnboardingStepRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}createRoomChannelApps(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateRoomChannelApps",d=r.CreateRoomChannelApps.encode(r.CreateRoomChannelApps.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.CreateRoomChannelApps.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}generateMeetToken(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GenerateMeetToken",d=r.GenerateMeetTokenRequest.encode(r.GenerateMeetTokenRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.GenerateMeetTokenResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getMezonOauthClient(e,t,n,s={}){let c="/mezon.api.Mezon/GetMezonOauthClient",d={client_id:t,client_name:n},o=r.GetMezonOauthClientRequest.encode(r.GetMezonOauthClientRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.MezonOauthClient.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}updateMezonOauthClient(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateMezonOauthClient",d=r.MezonOauthClient.encode(r.MezonOauthClient.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.MezonOauthClient.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}generateHashChannelApps(e,t,n={}){let s="/mezon.api.Mezon/GenerateHashChannelApps",c={app_id:t},i=r.GenerateHashChannelAppsRequest.encode(r.GenerateHashChannelAppsRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.GenerateHashChannelAppsResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}addUserEvent(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddUserEvent",d=r.UserEventRequest.encode(r.UserEventRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}deleteUserEvent(e,t,n,s={}){let c="/mezon.api.Mezon/DeleteUserEvent",d={clan_id:t,event_id:n},o=r.UserEventRequest.encode(r.UserEventRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}updateRoleOrder(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateRoleOrder",d=r.UpdateRoleOrderRequest.encode(r.UpdateRoleOrderRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}createExternalMezonMeet(e,t={}){let n="/mezon.api.Mezon/CreateExternalMezonMeet",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.GenerateMezonMeetResponse.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}generateMeetTokenExternal(e,t,n,s,c,d,i={}){if(n==null)throw new Error("'token' is a required parameter but is null or undefined.");let o="/v2/meet/external/{token}".replace("{token}",encodeURIComponent(String(n))),a=new Map;a.set("username",s),a.set("metadata",c),a.set("is_guest",d);let u="",h=this.buildFullUrl(t,o,a),g=m("POST",i,u);return e&&(g.headers.Authorization="Bearer "+e),g.headers.Accept="application/x-protobuf",g.headers["Content-Type"]="application/json",Promise.race([fetch(h,g).then(f=>l(this,null,function*(){let A=yield f.arrayBuffer();return r.GenerateMeetTokenExternalResponse.decode(new Uint8Array(A))})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}muteParticipantMezonMeet(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/MuteParticipantMezonMeet",d=r.MeetParticipantRequest.encode(r.MeetParticipantRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}removeParticipantMezonMeet(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/RemoveParticipantMezonMeet",d=r.MeetParticipantRequest.encode(r.MeetParticipantRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listChannelDetail(e,t,n={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListChannelDetail",c={channel_id:t},i=r.ListChannelDetailRequest.encode(r.ListChannelDetailRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.ChannelDescription.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listChannelTimeline(e,t,n={}){if(!t)throw new Error("'request' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListChannelTimeline",d=r.ListChannelTimelineRequest.encode(r.ListChannelTimelineRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.ListChannelTimelineResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createChannelTimeline(e,t,n={}){if(!t)throw new Error("'request' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateChannelTimeline",d=r.CreateChannelTimelineRequest.encode(r.CreateChannelTimelineRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.CreateChannelTimelineResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateChannelTimeline(e,t,n={}){if(!t)throw new Error("'request' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateChannelTimeline",d=r.UpdateChannelTimelineRequest.encode(r.UpdateChannelTimelineRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.UpdateChannelTimelineResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}detailChannelTimeline(e,t,n={}){if(!t)throw new Error("'request' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DetailChannelTimeline",d=r.ChannelTimelineDetailRequest.encode(r.ChannelTimelineDetailRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.ChannelTimelineDetailResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateClanOrder(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateClanOrder",d=r.UpdateClanOrderRequest.encode(r.UpdateClanOrderRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}clanDiscover(e,t,n,s,c={}){if(s==null)throw new Error("'body' is a required parameter but is null or undefined.");let d="/v2/clan/discover",i=new Map,o="";o=JSON.stringify(s||{});let a=this.buildFullUrl(n,d,i),u=m("POST",c,o);return e&&(u.headers.Authorization="Basic "+M(e+":"+t)),u.headers.Accept="application/x-protobuf",u.headers["Content-Type"]="application/json",Promise.race([fetch(a,u).then(h=>l(this,null,function*(){let g=yield h.arrayBuffer();return r.ListClanDiscover.decode(new Uint8Array(g))})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}deleteQuickMenuAccess(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/DeleteQuickMenuAccess",u={id:t,clan_id:n,bot_id:s,menu_name:c,background:d,action_msg:i},g=r.QuickMenuAccess.encode(r.QuickMenuAccess.fromPartial(u)).finish(),f=m("POST",o,"");return f.body=g,e&&(f.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:f}).then(A=>A),new Promise((A,y)=>setTimeout(y,this.timeoutMs,"Request timed out."))])}listQuickMenuAccess(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListQuickMenuAccess",i={bot_id:t,channel_id:n,menu_type:s},a=r.ListQuickMenuAccessRequest.encode(r.ListQuickMenuAccessRequest.fromPartial(i)).finish(),u=m("POST",c,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.QuickMenuAccessList.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}addQuickMenuAccess(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddQuickMenuAccess",d=r.QuickMenuAccess.encode(r.QuickMenuAccess.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}updateQuickMenuAccess(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateQuickMenuAccess",d=r.QuickMenuAccess.encode(r.QuickMenuAccess.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listForSaleItems(e,t,n={}){let s="/mezon.api.Mezon/ListForSaleItems",c={page:t},i=r.ListForSaleItemsRequest.encode(r.ListForSaleItemsRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.ForSaleItemList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}isFollower(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/IsFollower",d=r.IsFollowerRequest.encode(r.IsFollowerRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.IsFollowerResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}transferOwnership(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/TransferOwnership",d=r.TransferOwnershipRequest.encode(r.TransferOwnershipRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}updateUsername(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateUsername",d=r.UpdateUsernameRequest.encode(r.UpdateUsernameRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.Session.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}isBanned(e,t,n={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/IsBanned",c={channel_id:t},i=r.IsBannedRequest.encode(r.IsBannedRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.IsBannedResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}reportMessageAbuse(e,t,n,s={}){let c="/mezon.api.Mezon/ReportMessageAbuse",d={message_id:t,abuse_type:n},o=r.ReportMessageAbuseReqest.encode(r.ReportMessageAbuseReqest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}sendChannelMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A){let y="/mezon.api.Mezon/SendChannelMessage",S=r.ChannelMessageSend.encode(r.ChannelMessageSend.fromPartial({clan_id:t,channel_id:n,mode:s,is_public:c,content:d,mentions:i,attachments:o,references:a,anonymous_message:u,mention_everyone:h,avatar:g,code:f,topic_id:A})).finish(),v=m("POST",{},"");return v.body=S,e&&(v.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:y,fetchOptions:v}).then(q=>l(this,null,function*(){return r.ChannelMessageAck.decode(q)})),new Promise((q,W)=>setTimeout(()=>W(new Error("Request timed out.")),this.timeoutMs))])}updateChannelMessage(e,t,n,s,c,d,i,o,a,u,h,g){let f="/mezon.api.Mezon/UpdateChannelMessage",y=r.ChannelMessageUpdate.encode(r.ChannelMessageUpdate.fromPartial({clan_id:t,channel_id:n,message_id:d,mode:s,is_public:c,content:i,mentions:o,attachments:a,hide_editted:u,topic_id:h,is_update_msg_topic:g})).finish(),b=m("POST",{},"");return b.body=y,e&&(b.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:f,fetchOptions:b}).then(S=>l(this,null,function*(){return S.code!=0?{}:r.ChannelMessageUpdate.decode(S.message)})),new Promise((S,v)=>setTimeout(()=>v(new Error("Request timed out.")),this.timeoutMs))])}deleteChannelMessage(e,t,n,s,c,d,i,o,a,u){let h="/mezon.api.Mezon/DeleteChannelMessage",f=r.ChannelMessageRemove.encode(r.ChannelMessageRemove.fromPartial({clan_id:t,channel_id:n,message_id:d,mode:s,is_public:c,has_attachment:i,mentions:a,references:u,topic_id:o})).finish(),A=m("POST",{},"");return A.body=f,e&&(A.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:h,fetchOptions:A}).then(y=>l(this,null,function*(){return y.code!=0?{}:r.ChannelMessageRemove.decode(y.message)})),new Promise((y,b)=>setTimeout(()=>b(new Error("Request timed out.")),this.timeoutMs))])}updateMezonVoiceState(e,t,n,s,c,d,i={}){let o="/mezon.api.Mezon/UpdateMezonVoiceState",a={clan_id:t,channel_id:n,display_name:s,room_name:c,state:d},h=r.HandleParticipantMeetStateEvent.encode(r.HandleParticipantMeetStateEvent.fromPartial(a)).finish(),g=m("POST",i,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:o,fetchOptions:g}).then(f=>f),new Promise((f,A)=>setTimeout(A,this.timeoutMs,"Request timed out."))])}messageButtonClick(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/MessageButtonClick",u={message_id:t,channel_id:n,button_id:s,sender_id:c,user_id:d,extra_data:i},g=r.MessageButtonClicked.encode(r.MessageButtonClicked.fromPartial(u)).finish(),f=m("POST",o,"");return f.body=g,e&&(f.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:f}).then(A=>A),new Promise((A,y)=>setTimeout(y,this.timeoutMs,"Request timed out."))])}dropdownBoxSelected(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/DropdownBoxSelected",u={message_id:t,channel_id:n,selectbox_id:s,sender_id:c,user_id:d,values:i},g=r.DropdownBoxSelected.encode(r.DropdownBoxSelected.fromPartial(u)).finish(),f=m("POST",o,"");return f.body=g,e&&(f.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:f}).then(A=>A),new Promise((A,y)=>setTimeout(y,this.timeoutMs,"Request timed out."))])}activeArchivedThread(e,t,n,s={}){let c="/mezon.api.Mezon/ActiveArchivedThread",d={clan_id:t,channel_id:n},o=r.ActiveArchivedThread.encode(r.ActiveArchivedThread.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}addAgentToChannel(e,t,n,s={}){let c="/mezon.api.Mezon/AddAgentToChannel",d={room_name:t,channel_id:n},o=r.UpdateAIAgentRequest.encode(r.UpdateAIAgentRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}disconnectAgent(e,t,n,s={}){let c="/mezon.api.Mezon/DisconnectAgent",d={room_name:t,channel_id:n},o=r.UpdateAIAgentRequest.encode(r.UpdateAIAgentRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}listMutedChannel(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListMutedChannel",d=r.ListMutedChannelRequest.encode(r.ListMutedChannelRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.MutedChannelList.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}channelMessageReact(e,t,n,s,c,d,i,o,a,u,h,g,f,A){let y="/mezon.api.Mezon/ReactChannelMessage",S=r.MessageReaction.encode(r.MessageReaction.fromPartial({clan_id:t,channel_id:n,mode:s,is_public:c,message_id:d,emoji_id:i,emoji:o,count:a,message_sender_id:u,action:h,emoji_recent_id:f,sender_name:A,topic_id:g})).finish(),v=m("POST",{},"");return v.body=S,e&&(v.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:y,fetchOptions:v}).then(q=>l(this,null,function*(){return r.ChannelMessageSend.decode(q)})),new Promise((q,W)=>setTimeout(()=>W(new Error("Request timed out.")),this.timeoutMs))])}createPoll(e,t,n={}){var o,a,u,h,g,f;if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreatePoll",d=r.CreatePollRequest.encode(r.CreatePollRequest.fromPartial({channel_id:(o=t.channel_id)!=null?o:"0",clan_id:(a=t.clan_id)!=null?a:"0",question:(u=t.question)!=null?u:"",answers:(h=t.answers)!=null?h:[],expire_hours:(g=t.expire_hours)!=null?g:0,type:(f=t.type)!=null?f:0})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(A=>l(this,null,function*(){let y=r.CreatePollResponse.decode(A);return{poll_id:y.poll_id,message_id:y.message_id,question:y.question,answers:y.answers.map(b=>({index:b.index,label:b.label})),answer_counts:y.answer_counts,exp:y.exp,is_closed:y.is_closed,creator_id:y.creator_id,type:y.type,total_votes:y.total_votes}})),new Promise((A,y)=>setTimeout(()=>y(new Error("Request timed out.")),this.timeoutMs))])}votePoll(e,t,n={}){var o,a,u,h;if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/VotePoll",d=r.VotePollRequest.encode(r.VotePollRequest.fromPartial({poll_id:(o=t.poll_id)!=null?o:"0",message_id:(a=t.message_id)!=null?a:"0",channel_id:(u=t.channel_id)!=null?u:"0",answer_indices:(h=t.answer_indices)!=null?h:[]})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(g=>l(this,null,function*(){var A;let f=g.length>0?r.VotePollResponse.decode(g):{my_answer_indices:[]};return{my_answer_indices:Array.from((A=f.my_answer_indices)!=null?A:[])}})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])}closePoll(e,t,n={}){var o,a,u;if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ClosePoll",d=r.ClosePollRequest.encode(r.ClosePollRequest.fromPartial({poll_id:(o=t.poll_id)!=null?o:"0",message_id:(a=t.message_id)!=null?a:"0",channel_id:(u=t.channel_id)!=null?u:"0"})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(h=>{if(h.status==204||h.status>=200&&h.status<300)return{};throw h}),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}getPoll(e,t,n={}){var o,a,u;if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetPoll",d=r.GetPollRequest.encode(r.GetPollRequest.fromPartial({poll_id:(o=t.poll_id)!=null?o:"0",message_id:(a=t.message_id)!=null?a:"0",channel_id:(u=t.channel_id)!=null?u:"0"})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(h=>l(this,null,function*(){let g=r.GetPollResponse.decode(h);return{poll_id:g.poll_id,message_id:g.message_id,question:g.question,answers:g.answers.map(f=>({index:f.index,label:f.label})),answer_counts:g.answer_counts,exp:g.exp,is_closed:g.is_closed,creator_id:g.creator_id,type:g.type,total_votes:g.total_votes,voter_details:g.voter_details.map(f=>({answer_index:f.answer_index,user_ids:f.user_ids}))}})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}followUsers(e){return l(this,null,function*(){let t="",n={status_follow:{user_ids:e}};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return{}})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])})}joinClanChat(e){return l(this,null,function*(){let t="",n={clan_join:{clan_id:e}};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return{}})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])})}follower(){return l(this,null,function*(){let e="",t={follow_event:{}};return Promise.race([this.send({urlPath:e,fetchOptions:t}).then(n=>l(this,null,function*(){return{}})),new Promise((n,s)=>setTimeout(()=>s(new Error("Request timed out.")),this.timeoutMs))])})}joinChat(e,t,n,s){return l(this,null,function*(){let c="",d={channel_join:{clan_id:e,channel_id:t,channel_type:n,is_public:s}};return Promise.race([this.send({urlPath:c,fetchOptions:d}).then(i=>l(this,null,function*(){return{}})),new Promise((i,o)=>setTimeout(()=>o(new Error("Request timed out.")),this.timeoutMs))])})}leaveChat(e,t,n,s){let c="",d={channel_leave:{clan_id:e,channel_id:t,channel_type:n,is_public:s}};return Promise.race([this.send({urlPath:c,fetchOptions:d}).then(i=>l(this,null,function*(){return{}})),new Promise((i,o)=>setTimeout(()=>o(new Error("Request timed out.")),this.timeoutMs))])}removeChatMessage(e,t,n,s,c,d,i,o,a){return l(this,null,function*(){let u="",h={channel_message_remove:{clan_id:e,channel_id:t,mode:n,message_id:c,is_public:s,has_attachment:d,topic_id:i,mentions:o,references:a}};return Promise.race([this.send({urlPath:u,fetchOptions:h}).then(g=>l(this,null,function*(){return{}})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])})}unfollowUsers(e){let t="",n={status_unfollow:{user_ids:e}};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return{}})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])}updateChatMessage(e,t,n,s,c,d,i,o,a,u,h){return l(this,null,function*(){let g="",f={channel_message_update:{clan_id:e,channel_id:t,message_id:c,content:d,mentions:i,attachments:o,mode:n,is_public:s,hide_editted:a,topic_id:u,is_update_msg_topic:h}};return Promise.race([this.send({urlPath:g,fetchOptions:f}).then(A=>l(this,null,function*(){return{}})),new Promise((A,y)=>setTimeout(()=>y(new Error("Request timed out.")),this.timeoutMs))])})}updateStatus(e){let t="",n={status_update:{status:e}};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return{}})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])}writeQuickMenuEvent(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){let y="",b={quick_menu_event:{menu_name:e,message:{clan_id:t,channel_id:n,mode:s,is_public:c,content:d,mentions:i,attachments:o,references:a,anonymous_message:u,mention_everyone:h,avatar:g,code:f,topic_id:A}}};return Promise.race([this.send({urlPath:y,fetchOptions:b}).then(S=>l(this,null,function*(){return{}})),new Promise((S,v)=>setTimeout(()=>v(new Error("Request timed out.")),this.timeoutMs))])})}writeEphemeralMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A,y){return l(this,null,function*(){let b="",S={ephemeral_message_send:{receiver_ids:e,message:{clan_id:t,channel_id:n,mode:s,is_public:c,content:d,mentions:i,attachments:o,references:a,anonymous_message:u,mention_everyone:h,avatar:g,code:f,topic_id:A,id:y}}};return Promise.race([this.send({urlPath:b,fetchOptions:S}).then(v=>l(this,null,function*(){return{}})),new Promise((v,q)=>setTimeout(()=>q(new Error("Request timed out.")),this.timeoutMs))])})}writeChatMessage(e,t,n,s,c,d,i,o,a,u,h,g,f){return l(this,null,function*(){let A="",y={channel_message_send:{clan_id:e,channel_id:t,mode:n,is_public:s,content:c,mentions:d,attachments:i,references:o,anonymous_message:a,mention_everyone:u,avatar:h,code:g,topic_id:f}};return Promise.race([this.send({urlPath:A,fetchOptions:y}).then(b=>l(this,null,function*(){return{}})),new Promise((b,S)=>setTimeout(()=>S(new Error("Request timed out.")),this.timeoutMs))])})}writeMessageReaction(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){let y="",b={message_reaction_event:{id:e,clan_id:t,channel_id:n,mode:s,is_public:c,message_id:d,emoji_id:i,emoji:o,count:a,message_sender_id:u,action:h,topic_id:g,emoji_recent_id:f,sender_name:A}};return Promise.race([this.send({urlPath:y,fetchOptions:b}).then(S=>l(this,null,function*(){return{}})),new Promise((S,v)=>setTimeout(()=>v(new Error("Request timed out.")),this.timeoutMs))])})}writeMessageTyping(e,t,n,s,c,d){return l(this,null,function*(){let i="",o={message_typing_event:{clan_id:e,channel_id:t,mode:n,is_public:s,sender_display_name:c,topic_id:d}};return Promise.race([this.send({urlPath:i,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])})}writeLastSeenMessage(e,t,n,s,c,d){return l(this,null,function*(){let i="",o={last_seen_message_event:{clan_id:e,channel_id:t,mode:n,message_id:s,timestamp_seconds:c,badge_count:d}};return Promise.race([this.send({urlPath:i,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])})}writeLastPinMessage(e,t,n,s,c,d,i,o,a,u,h,g,f){return l(this,null,function*(){let A="",y={last_pin_message_event:{clan_id:e,channel_id:t,mode:n,is_public:s,message_id:c,timestamp_seconds:d,operation:i,message_sender_avatar:o,message_sender_id:a,message_sender_username:u,message_content:h,message_attachment:g,message_created_time:f}};return Promise.race([this.send({urlPath:A,fetchOptions:y}).then(b=>l(this,null,function*(){return{}})),new Promise((b,S)=>setTimeout(()=>S(new Error("Request timed out.")),this.timeoutMs))])})}writeCustomStatus(e,t,n,s){return l(this,null,function*(){let c="",d={custom_status_event:{clan_id:e,status:t,time_reset:n,no_clear:s}};return Promise.race([this.send({urlPath:c,fetchOptions:d}).then(i=>l(this,null,function*(){return{}})),new Promise((i,o)=>setTimeout(()=>o(new Error("Request timed out.")),this.timeoutMs))])})}writeVoiceReaction(e,t){return l(this,null,function*(){let n="",s={voice_reaction_send:{emojis:e,channel_id:t}};return Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return{}})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])})}forwardWebrtcSignaling(e,t,n,s,c){return l(this,null,function*(){let d="",i={webrtc_signaling_fwd:{receiver_id:e,data_type:t,json_data:n,channel_id:s,caller_id:c}};return Promise.race([this.send({urlPath:d,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])})}makeCallPush(e,t,n,s){return l(this,null,function*(){let c="",d={incoming_call_push:{receiver_id:e,json_data:t,channel_id:n,caller_id:s}};return Promise.race([this.send({urlPath:c,fetchOptions:d}).then(i=>l(this,null,function*(){return{}})),new Promise((i,o)=>setTimeout(()=>o(new Error("Request timed out.")),this.timeoutMs))])})}writeChannelAppEvent(e,t,n){return l(this,null,function*(){let s="",c={channel_app_event:{clan_id:e,channel_id:t,action:n}};return Promise.race([this.send({urlPath:s,fetchOptions:c}).then(d=>l(this,null,function*(){return{}})),new Promise((d,i)=>setTimeout(()=>i(new Error("Request timed out.")),this.timeoutMs))])})}listDataSocket(e){return l(this,null,function*(){let t="",n={list_data_socket:e};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return s})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])})}};x.DefaultSendTimeoutMs=1e4;var F=x;var le="127.0.0.1",ue="7350",pe="defaultkey",he=3e4,p={DISCONNECTED:"disconnected",CONNECTING:"connecting",CONNECTED:"connected"},K=!1,z=class z{constructor(e=pe,t=le,n=ue,s=!1,c=null,d=he,i=!0){this.serverkey=e;this.timeout=d;this.autoFallbackHttp=i;this.verbose=!1;this.refreshTokenManager=N.getInstance();this.host=t,this.port=n,this.useSSL=s;let a=`${s?"https://":"http://"}${t}:${n}`;this._heartbeatTimeoutMs=z.DefaultHeartbeatTimeoutMs,this._connectionState=p.DISCONNECTED,this.transport=new F(e,d,c,a)}isOpen(){return this._connectionState===p.CONNECTED}setTransportAdapter(e){this.transport.setTransportAdapter(e)}connect(e,t=!1,n=!1,s=z.DefaultConnectTimeoutMs){if(this.verbose=n,this._connectionState===p.CONNECTED)return Promise.resolve(e);if(this._connectionState===p.CONNECTING&&this._connectPromise)return this._connectPromise;this.clearConnectTimeout(),this._connectionState=p.CONNECTING,this.transport.connect(e,t,n,(d,i)=>l(this,null,function*(){if(!i.cid)if(i.notifications)i.notifications.notifications.forEach(o=>{o.content=o.content?H(o.content):void 0,this.onnotification(o)});else if(i.voice_started_event)this.onvoicestarted(i.voice_started_event);else if(i.voice_ended_event)this.onvoiceended(i.voice_ended_event);else if(i.voice_joined_event)this.onvoicejoined(i.voice_joined_event);else if(i.voice_leaved_event)this.onvoiceleaved(i.voice_leaved_event);else if(i.channel_created_event)this.onchannelcreated(i.channel_created_event);else if(i.category_event)this.oncategoryevent(i.category_event);else if(i.role_event)this.onroleevent(i.role_event);else if(i.event_emoji)this.oneventemoji(i.event_emoji);else if(i.noti_user_channel)this.oneventnotiuserchannel(i.noti_user_channel);else if(i.webhook_event)this.oneventwebhook(i.webhook_event);else if(i.channel_deleted_event)this.onchanneldeleted(i.channel_deleted_event);else if(i.clan_deleted_event)this.onclandeleted(i.clan_deleted_event);else if(i.sticker_create_event)this.onstickercreated(i.sticker_create_event);else if(i.sticker_update_event)this.onstickerupdated(i.sticker_update_event);else if(i.sticker_delete_event)this.onstickerdeleted(i.sticker_delete_event);else if(i.channel_updated_event)this.onchannelupdated(i.channel_updated_event);else if(i.delete_account_event)this.ondeleteaccount(i.delete_account_event);else if(i.clan_profile_updated_event)this.onclanprofileupdated(i.clan_profile_updated_event);else if(i.clan_updated_event)this.onclanupdated(i.clan_updated_event);else if(i.last_seen_message_event)this.onlastseenupdated(i.last_seen_message_event);else if(i.status_presence_event)this.onstatuspresence(i.status_presence_event);else if(i.channel_message){let o=Q(i);this.onchannelmessage(o)}else i.message_typing_event?this.onmessagetyping(i.message_typing_event):i.message_reaction_event?this.onmessagereaction(i.message_reaction_event):i.channel_presence_event?this.onchannelpresence(i.channel_presence_event):i.last_pin_message_event?this.onpinmessage(i.last_pin_message_event):i.custom_status_event?this.oncustomstatus(i.custom_status_event):i.canvas_event?this.oncanvasevent(i.canvas_event):i.user_channel_added_event?this.onuserchanneladded(i.user_channel_added_event):i.add_clan_user_event?this.onuserclanadded(i.add_clan_user_event):i.user_profile_updated_event?this.onuserprofileupdate(i.user_profile_updated_event):i.user_channel_removed_event?this.onuserchannelremoved(i.user_channel_removed_event):i.block_friend?this.onblockfriend(i.block_friend):i.un_block_friend?this.onunblockfriend(i.un_block_friend):i.add_friend?this.onaddfriend(i.add_friend):i.remove_friend?this.onremovefriend(i.remove_friend):i.user_clan_removed_event?this.onuserclanremoved(i.user_clan_removed_event):i.clan_event_created?this.oneventcreated(i.clan_event_created):i.give_coffee_event?this.oncoffeegiven(i.give_coffee_event):i.role_assign_event?this.onroleassign(i.role_assign_event):i.streaming_started_event?this.onstreamingchannelstarted(i.streaming_started_event):i.streaming_ended_event?this.onstreamingchannelended(i.streaming_ended_event):i.streaming_joined_event?this.onstreamingchanneljoined(i.streaming_joined_event):i.streaming_leaved_event?this.onstreamingchannelleaved(i.streaming_leaved_event):i.permission_set_event?this.onpermissionset(i.permission_set_event):i.permission_changed_event?this.onpermissionchanged(i.permission_changed_event):i.unmute_event?this.onunmuteevent(i.unmute_event):i.token_sent_event?this.ontokensent(i.token_sent_event):i.message_button_clicked?this.onmessagebuttonclicked(i.message_button_clicked):i.dropdown_box_selected?this.onmessagedropdownboxselected(i.dropdown_box_selected):i.mark_as_read?this.onmarkasread(i.mark_as_read):i.voice_reaction_send?this.onvoicereactionmessage(i.voice_reaction_send):i.webrtc_signaling_fwd?this.onwebrtcsignalingfwd(i.webrtc_signaling_fwd):i.list_activity?this.onactivityupdated(i.list_activity):i.sd_topic_event?this.onsdtopicevent(i.sd_topic_event):i.channel_app_event?this.onchannelappevent(i.channel_app_event):i.user_status_event?this.onuserstatusevent(i.user_status_event):i.join_channel_app_data?this.onjoinchannelappevent(i.join_channel_app_data):i.unpin_message_event?this.onunpinmessageevent(i.unpin_message_event):i.quick_menu_event?this.onquickmenuevent(i.quick_menu_event):i.meet_participant_event?this.onmeetparticipantevent(i.meet_participant_event):i.transfer_ownership_event?this.ontransferownership(i.transfer_ownership_event):i.ban_user_event?this.onbanneduser(i.ban_user_event):i.list_channel_users_banned_event?this.onlistchannelusersbanned(i.list_channel_users_banned_event):i.allow_anonymous_event?this.onallowanonymousevent(i.allow_anonymous_event):i.aiagent_enabled_event?this.onaiagentenabled(i.aiagent_enabled_event):i.pong?this.verbose&&window&&window.console&&console.log("Pong message received: %o",i):this.verbose&&window&&window.console&&console.log("Unrecognized message received: %o",i)}),d=>l(this,null,function*(){this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.clearConnectTimeout(),this.ondisconnect(d)}));let c=new Promise((d,i)=>{this.transport.setOnOpen(o=>{this.verbose&&window&&window.console&&console.log(o);let a=K;K=!0,this.clearConnectTimeout(),this._connectionState=p.CONNECTED,this.startHeartbeatLoop(),this._connectPromise=void 0,d(e),a&&this.onreconnect(o)}),this.transport.setOnError(o=>{this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.clearConnectTimeout(),this.onerror(o),this._connectPromise=void 0,this.transport.close(),i(o)}),this._connectTimeoutTimer=setTimeout(()=>{this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.transport.close(),this._connectPromise=void 0,i("The socket timed out when trying to connect."),this._connectTimeoutTimer=void 0},s)});return this._connectPromise=c,this._connectPromise}pingPong(){return l(this,null,function*(){if(!this.isOpen()){this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop();return}try{let e="",t={ping:{}};yield this.transport.send({urlPath:e,fetchOptions:t},this._heartbeatTimeoutMs)}catch(e){this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.isOpen()&&(window&&window.console&&console.error("Server unreachable from heartbeat."),this.onheartbeattimeout(),this.transport.close());return}this.startHeartbeatLoop()})}startHeartbeatLoop(){this.stopHeartbeatLoop(),this._heartbeatTimer=setTimeout(()=>this.pingPong(),this._heartbeatTimeoutMs)}stopHeartbeatLoop(){this._heartbeatTimer!==void 0&&(clearTimeout(this._heartbeatTimer),this._heartbeatTimer=void 0)}clearConnectTimeout(){this._connectTimeoutTimer!==void 0&&(clearTimeout(this._connectTimeoutTimer),this._connectTimeoutTimer=void 0)}onreconnect(e){this.verbose&&window&&window.console&&console.log(e)}ondisconnect(e){this.verbose&&window&&window.console&&console.log(e)}onerror(e){this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.verbose&&window&&window.console&&console.log(e)}onmessagetyping(e){this.verbose&&window&&window.console&&console.log(e)}onmessagereaction(e){this.verbose&&window&&window.console&&console.log(e)}onchannelmessage(e){this.verbose&&window&&window.console&&console.log(e)}onchannelpresence(e){this.verbose&&window&&window.console&&console.log(e)}onuserchanneladded(e){this.verbose&&window&&window.console&&console.log(e)}onuserclanadded(e){this.verbose&&window&&window.console&&console.log(e)}onuserprofileupdate(e){this.verbose&&window&&window.console&&console.log(e)}onuserchannelremoved(e){this.verbose&&window&&window.console&&console.log(e)}onaddfriend(e){this.verbose&&window&&window.console&&console.log(e)}onremovefriend(e){this.verbose&&window&&window.console&&console.log(e)}onblockfriend(e){this.verbose&&window&&window.console&&console.log(e)}onunblockfriend(e){this.verbose&&window&&window.console&&console.log(e)}onuserclanremoved(e){this.verbose&&window&&window.console&&console.log(e)}onnotification(e){this.verbose&&window&&window.console&&console.log(e)}onstatuspresence(e){this.verbose&&window&&window.console&&console.log(e)}onpinmessage(e){this.verbose&&window&&window.console&&console.log(e)}onvoiceended(e){this.verbose&&window&&window.console&&console.log(e)}onvoicestarted(e){this.verbose&&window&&window.console&&console.log(e)}onvoicejoined(e){this.verbose&&window&&window.console&&console.log(e)}onvoiceleaved(e){this.verbose&&window&&window.console&&console.log(e)}onchannelcreated(e){this.verbose&&window&&window.console&&console.log(e)}oncategoryevent(e){this.verbose&&window&&window.console&&console.log(e)}onroleevent(e){this.verbose&&window&&window.console&&console.log(e)}oneventemoji(e){this.verbose&&window&&window.console&&console.log(e)}oneventnotiuserchannel(e){this.verbose&&window&&window.console&&console.log(e)}oneventwebhook(e){this.verbose&&window&&window.console&&console.log(e)}onchanneldeleted(e){this.verbose&&window&&window.console&&console.log(e)}onclandeleted(e){this.verbose&&window&&window.console&&console.log(e)}onstickercreated(e){this.verbose&&window&&window.console&&console.log(e)}onstickerdeleted(e){this.verbose&&window&&window.console&&console.log(e)}onstickerupdated(e){this.verbose&&window&&window.console&&console.log(e)}onchannelupdated(e){this.verbose&&window&&window.console&&console.log(e)}ondeleteaccount(e){this.verbose&&window&&window.console&&console.log(e)}onclanprofileupdated(e){this.verbose&&window&&window.console&&console.log(e)}onclanupdated(e){this.verbose&&window&&window.console&&console.log(e)}onlastseenupdated(e){this.verbose&&window&&window.console&&console.log(e)}onheartbeattimeout(){this.verbose&&window&&window.console&&console.log("Heartbeat timeout.")}oncustomstatus(e){this.verbose&&window&&window.console&&console.log(e)}oncanvasevent(e){this.verbose&&window&&window.console&&console.log(e)}oneventcreated(e){this.verbose&&window&&window.console&&console.log(e)}oncoffeegiven(e){this.verbose&&window&&window.console&&console.log(e)}onroleassign(e){this.verbose&&window&&window.console&&console.log(e)}onstreamingchannelstarted(e){this.verbose&&window&&window.console&&console.log(e)}onstreamingchannelended(e){this.verbose&&window&&window.console&&console.log(e)}onstreamingchanneljoined(e){this.verbose&&window&&window.console&&console.log(e)}onstreamingchannelleaved(e){this.verbose&&window&&window.console&&console.log(e)}onpermissionset(e){this.verbose&&window&&window.console&&console.log(e)}onpermissionchanged(e){this.verbose&&window&&window.console&&console.log(e)}onunmuteevent(e){this.verbose&&window&&window.console&&console.log(e)}ontokensent(e){this.verbose&&window&&window.console&&console.log(e)}onmessagebuttonclicked(e){this.verbose&&window&&window.console&&console.log(e)}onmessagedropdownboxselected(e){this.verbose&&window&&window.console&&console.log(e)}onmarkasread(e){this.verbose&&window&&window.console&&console.log(e)}onvoicereactionmessage(e){this.verbose&&window&&window.console&&console.log(e)}onwebrtcsignalingfwd(e){this.verbose&&window&&window.console&&console.log(e)}onactivityupdated(e){this.verbose&&window&&window.console&&console.log(e)}onsdtopicevent(e){this.verbose&&window&&window.console&&console.log(e)}onchannelappevent(e){this.verbose&&window&&window.console&&console.log(e)}onuserstatusevent(e){this.verbose&&window&&window.console&&console.log(e)}onjoinchannelappevent(e){this.verbose&&window&&window.console&&console.log(e)}onunpinmessageevent(e){this.verbose&&window&&window.console&&console.log(e)}onquickmenuevent(e){this.verbose&&window&&window.console&&console.log(e)}ontransferownership(e){this.verbose&&window&&window.console&&console.log(e)}onbanneduser(e){this.verbose&&window&&window.console&&console.log(e)}onlistchannelusersbanned(e){this.verbose&&window&&window.console&&console.log(e)}onmeetparticipantevent(e){this.verbose&&window&&window.console&&console.log(e)}onallowanonymousevent(e){this.verbose&&window&&window.console&&console.log(e)}onaiagentenabled(e){this.verbose&&window&&window.console&&console.log(e)}onRefreshSession(e){console.log(`Token refresh occurred. Token: ${e.token}`)}isexpired(e){return e.isexpired(Date.now()/1e3)}authenticateMezon(e,t,n,s,c={},d={}){let i={token:e,vars:c};return this.transport.authenticateMezon(this.serverkey,"",i,t,n,s,d).then(o=>new O(o.token||"",o.refresh_token||"",o.created||!1,o.api_url||"",o.ws_url||"",o.id_token||"",o.is_remember||!1))}authenticateSMSOTPRequest(e,t,n){let s={username:t,account:{phoneno:e,vars:n}};return this.transport.AuthenticateSMSOTPRequest(this.serverkey,"",s,t).then(c=>Promise.resolve(c))}authenticateEmailOTPRequest(e,t,n){let s={username:t,account:{email:e,vars:n}};return this.transport.AuthenticateEmailOTPRequest(this.serverkey,"",s,t).then(c=>Promise.resolve(c))}confirmAuthenticateOTP(e){return l(this,null,function*(){return this.transport.confirmAuthenticateOTP(this.serverkey,"",e).then(t=>new O(t.token||"",t.refresh_token||"",t.created||!1,t.api_url||"",t.ws_url||"",t.id_token||"",t.is_remember||!1))})}authenticateEmail(e,t,n,s){let c={username:n,account:{email:e,password:t,vars:s}};return this.transport.authenticateEmail(this.serverkey,"",c,n).then(d=>new O(d.token||"",d.refresh_token||"",d.created||!1,d.api_url||"",d.ws_url||"",d.id_token||"",d.is_remember||!1))}setBasePath(e,t,n){this.host=e,this.port=t,this.useSSL=n;let c=`${n?"https://":"http://"}${e}:${t}`;return this.transport.setBasePath(c)}addChannelUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addChannelUsers(e.token,t,n).then(s=>s!==void 0)})}addFriends(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addFriends(e.token,t,n)})}blockFriends(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.blockFriends(e.token,t,n).then(s=>Promise.resolve(s!=null))})}unblockFriends(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.unblockFriends(e.token,t,n).then(s=>Promise.resolve(s!=null))})}uploadOauthFile(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.uploadOauthFile(e.token,t)})}uploadAttachmentFile(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.uploadAttachmentFile(e.token,t)})}multipartUploadAttachmentFile(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.multipartUploadAttachmentFile(e.token,t)})}multipartUploadAttachmentFileFinish(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.multipartUploadAttachmentFileFinsih(e.token,t)})}createChannelDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createChannelDesc(e.token,t).then(n=>Promise.resolve(n))})}createClanDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createClanDesc(e.token,t).then(n=>Promise.resolve(n))})}checkDuplicateName(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.checkDuplicateName(e.token,t)})}createCategoryDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createCategoryDesc(e.token,t).then(n=>Promise.resolve(n))})}createRole(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createRole(e.token,t).then(n=>Promise.resolve(n))})}createEvent(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createEvent(e.token,t).then(n=>Promise.resolve(n))})}addRolesChannelDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addRolesChannelDesc(e.token,t).then(n=>n!==void 0)})}deleteRoleChannelDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteRoleChannelDesc(e.token,t).then(n=>n!==void 0)})}deleteApp(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteApp(e.token,t).then(n=>n!==void 0)})}deleteFriends(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteFriends(e.token,t,n).then(s=>s!==void 0)})}deleteChannelDesc(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteChannelDesc(e.token,t,n).then(s=>s!==void 0)})}deleteClanDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteClanDesc(e.token,t).then(n=>n!==void 0)})}deleteCategoryDesc(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteCategoryDesc(e.token,t,n,s).then(c=>c!==void 0)})}deleteNotifications(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteNotifications(e.token,t,n).then(s=>Promise.resolve(s!=null))})}deleteRole(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteRole(e.token,t,"0",n,s).then(c=>c!==void 0)})}deleteEvent(e,t,n,s,c,d){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteEvent(e.token,t,n,s,c,d).then(i=>i!==void 0)})}updateEventUser(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateEventUser(e.token,t).then(n=>n!==void 0)})}emitEvent(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.event(e.token,t).then(n=>Promise.resolve(n!=null))})}getAccount(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getAccount(e.token)})}removeClanUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeClanUsers(e.token,t,n).then(s=>Promise.resolve(s!=null))})}listBannedUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listBannedUsers(e.token,t,n).then(s=>Promise.resolve(s))})}unbanClanUsers(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.unbanClanUsers(e.token,t,n,s).then(c=>Promise.resolve(c!=null))})}banClanUsers(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.banClanUsers(e.token,t,n,s,c).then(d=>Promise.resolve(d!=null))})}removeChannelUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeChannelUsers(e.token,t,n).then(s=>Promise.resolve(s!=null))})}listChannelMessages(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelMessages(e.token,t,n,s,c,d,i).then(o=>{let a={messages:[],last_seen_message:o.last_seen_message,last_sent_message:o.last_sent_message};return o.messages==null||o.messages.forEach(u=>{let h,g,f,A,y;try{h=P(u.content)}catch(b){console.log("error parse content",b)}try{let b=B(u.reactions);g=(b==null?void 0:b.reactions)||b||P(u.reactions||"[]")}catch(b){g=P(u.reactions||"[]")}try{let b=U(u.mentions);f=(b==null?void 0:b.mentions)||b||P(u.mentions||"[]")}catch(b){f=P(u.mentions||"[]")}try{let b=T(u.attachments);A=(b==null?void 0:b.attachments)||b||P(u.attachments||"[]")}catch(b){A=P(u.attachments||"[]")}try{let b=D(u.references);y=(b==null?void 0:b.refs)||b||P(u.references||"[]")}catch(b){y=P(u.references||"[]")}a.messages.push({channel_id:u.channel_id,code:u.code?Number(u.code):0,id:u.message_id||"",sender_id:u.sender_id,username:u.username,display_name:u.display_name,avatar:u.avatar,content:h,channel_label:u.channel_label,clan_logo:u.clan_logo,category_name:u.category_name,clan_nick:u.clan_nick,clan_avatar:u.clan_avatar,attachments:A,mentions:f,reactions:g,references:y,clan_id:u.clan_id,create_time_seconds:u.create_time_seconds,update_time_seconds:u.update_time_seconds,hide_editted:u.hide_editted})}),Promise.resolve(a)})})}listChannelVoiceUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelVoiceUsers(e.token,t,n).then(s=>{let c={voice_channel_users:[]};return s.voice_channel_users==null||s.voice_channel_users.forEach(d=>{c.voice_channel_users.push({id:d.id,channel_id:d.channel_id,user_ids:d.user_ids,participant:d.participant})}),Promise.resolve(c)})})}listChannelUsers(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelUsers(e.token,t,n,s,d,c,i).then(o=>{let a={channel_users:[],cursor:o.cursor,channel_id:o.channel_id};return o.channel_users==null||o.channel_users.forEach(u=>{a.channel_users.push({user_id:u.user_id,role_id:u.role_id,thread_id:u.thread_id,clan_avatar:u.clan_avatar,clan_nick:u.clan_nick,id:u.id,clan_id:u.clan_id,added_by:u.added_by,is_banned:u.is_banned})}),Promise.resolve(a)})})}listChannelAttachments(e,t,n,s,c,d,i,o){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelAttachment(e.token,n,t,s,d,c,i,o).then(a=>{let u={attachments:[]};return a.attachments==null||a.attachments.forEach(h=>{u.attachments.push({filename:h.filename,filesize:h.filesize,filetype:h.filetype,id:h.id,uploader:h.uploader,url:h.url,message_id:h.message_id,create_time_seconds:h.create_time_seconds,width:h.width,height:h.height})}),Promise.resolve(u)})})}listClanUsers(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listClanUsers(e.token,t).then(n=>{let s={clan_users:[],cursor:n.cursor,clan_id:n.clan_id};return n.clan_users==null||n.clan_users.forEach(c=>{var d;s.clan_users.push({user:{avatar_url:c.user.avatar_url,create_time_seconds:c.user.create_time_seconds,display_name:c.user.display_name,edge_count:c.user.edge_count?Number(c.user.edge_count):0,id:c.user.id,lang_tag:c.user.lang_tag,location:c.user.location,online:c.user.online,is_mobile:(d=c.user)==null?void 0:d.is_mobile,timezone:c.user.timezone,update_time:c.user.update_time,username:c.user.username,user_status:c.user.user_status,status:c.user.status,about_me:c.user.about_me,mezon_id:c.user.mezon_id,list_nick_names:c.user.list_nick_names,phone_number:c.user.phone_number,join_time_seconds:c.user.join_time_seconds},role_id:c.role_id,clan_nick:c.clan_nick,clan_avatar:c.clan_avatar})}),Promise.resolve(s)})})}listClanUsersStatus(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listClanUsersStatus(e.token,t).then(n=>{let s={clan_user_statuses:[]};return n.clan_user_statuses==null||n.clan_user_statuses.forEach(c=>{s.clan_user_statuses.push({user_id:c.user_id,user_status:c.user_status})}),Promise.resolve(s)})})}listChannelDetail(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelDetail(e.token,t).then(n=>Promise.resolve(n))})}listChannelDescs(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelDescs(e.token,t,n,s,c,d,i).then(o=>{let a={channeldesc:[],next_cursor:o.next_cursor,prev_cursor:o.prev_cursor,cacheable_cursor:o.cacheable_cursor};return o.channeldesc==null||(a.channeldesc=o.channeldesc),Promise.resolve(a)})})}listClanDescs(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listClanDescs(e.token,t,n,s).then(c=>{let d={clandesc:[]};return c.clandesc==null||(d.clandesc=c.clandesc),Promise.resolve(d)})})}listChannelBadgeCount(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelBadgeCount(e.token,t,n,s).then(c=>{var d;return{channeldesc:(d=c.channeldesc)!=null?d:[],total_count:c.total_count}})})}listUserOnline(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listUserOnline(e.token,t,n,s).then(c=>{var d;return{users:(d=c.users)!=null?d:[],total_count:c.total_count}})})}listCategoryDescs(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listCategoryDescs(e.token,t,n,s).then(c=>{let d={categorydesc:[]};return c.categorydesc==null||(d.categorydesc=c.categorydesc),Promise.resolve(d)})})}listEvents(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listEvents(e.token,t).then(n=>Promise.resolve(n))})}getListPermission(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getListPermission(e.token).then(t=>Promise.resolve(t))})}listRolePermissions(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listRolePermissions(e.token,t).then(n=>Promise.resolve(n))})}listRoleUsers(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listRoleUsers(e.token,t,n,s).then(c=>Promise.resolve(c))})}registFCMDeviceToken(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.registFCMDeviceToken(e.token,t,n,s,c).then(d=>Promise.resolve(d))})}getUserProfileOnClan(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getUserProfileOnClan(e.token,t).then(n=>Promise.resolve(n))})}closeDirectMess(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.closeDirectMess(e.token,t).then(n=>n!==void 0)})}openDirectMess(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.openDirectMess(e.token,t).then(n=>n!==void 0)})}confirmLinkMezonOTP(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.confirmLinkMezonOTP(e.token,t)})}linkSMS(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.linkSMS(e.token,t).then(n=>Promise.resolve(n))})}linkEmail(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.linkEmail(e.token,t).then(n=>Promise.resolve(n))})}listFriends(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listFriends(e.token,n,t,s).then(c=>{let d={friends:[],cursor:c.cursor};return c.friends==null||c.friends.forEach(i=>{var o;d.friends.push({user:{avatar_url:i.user.avatar_url,create_time_seconds:i.user.create_time_seconds,display_name:i.user.display_name,edge_count:i.user.edge_count?Number(i.user.edge_count):0,id:i.user.id,lang_tag:i.user.lang_tag,location:i.user.location,online:i.user.online,timezone:i.user.timezone,update_time:i.user.update_time,username:i.user.username,is_mobile:(o=i.user)==null?void 0:o.is_mobile,user_status:i.user.user_status,status:i.user.status,mezon_id:i.user.mezon_id,list_nick_names:i.user.list_nick_names,phone_number:i.user.phone_number,about_me:i.user.about_me},state:i.state,source_id:i.source_id})}),Promise.resolve(d)})})}listNotifications(e,t,n,s,c,d){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listNotifications(e.token,n,t,s,c,d).then(i=>{let o={cacheable_cursor:i.cacheable_cursor,notifications:[]};return i.notifications==null||i.notifications.forEach(a=>{o.notifications.push({id:a.id,subject:a.subject,content:a.content?H(a.content):void 0,code:a.code?Number(a.code):0,sender_id:a.sender_id,create_time_seconds:a.create_time_seconds,persistent:a.persistent,category:a.category})}),Promise.resolve(o)})})}sessionLogout(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.sessionLogout(e.token,{refresh_token:n,token:t,device_id:s,platform:c}).then(d=>d!==void 0)})}sessionRefresh(n){return l(this,arguments,function*(e,t={}){if(!e)return console.error("Cannot refresh a null session."),e;e.created&&e.expires_at-e.created_at<70&&console.warn("Session lifetime too short, please set '--session.token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session"),e.created&&e.refresh_expires_at-e.created_at<3700&&console.warn("Session refresh lifetime too short, please set '--session.refresh_token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session");let s=yield this.refreshTokenManager.refresh(e.refresh_token,()=>l(this,null,function*(){try{let c=yield this.transport.sessionRefresh(this.serverkey,"",{token:e.refresh_token,vars:t,is_remember:e.is_remember});return{token:c.token,refresh_token:c.refresh_token,is_remember:c.is_remember||!1}}catch(c){throw console.error("Session refresh failed:",c),c}}));return e.update(s.token,s.refresh_token,s.is_remember),this.onRefreshSession(s),e})}unlinkEmail(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.unlinkEmail(e.token,t).then(n=>n!==void 0)})}updateUsername(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateUsername(e.token,t).then(n=>Promise.resolve(n))})}updateAccount(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateAccount(e.token,t).then(n=>n!==void 0)})}updateChannelDesc(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChannelDesc(e.token,t,n).then(s=>s!==void 0)})}updateClanDesc(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanDesc(e.token,t,n).then(s=>s!==void 0)})}updateCategory(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateCategory(e.token,t,n).then(s=>s!==void 0)})}updateUserProfileByClan(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateUserProfileByClan(e.token,t,n).then(s=>s!==void 0)})}updateRole(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateRole(e.token,t,n).then(s=>s!==void 0)})}updateEvent(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateEvent(e.token,t,n).then(s=>s!==void 0)})}updateApp(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateApp(e.token,t,n).then(s=>Promise.resolve(s))})}createLinkInviteUser(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createLinkInviteUser(e.token,t).then(n=>Promise.resolve(n))})}getLinkInvite(e){return l(this,null,function*(){return this.transport.getLinkInvite(this.serverkey,"",e).then(t=>Promise.resolve(t))})}GetRoleOfUserInTheClan(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getRoleOfUserInTheClan(e.token,t).then(n=>Promise.resolve(n))})}inviteUser(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.inviteUser(e.token,t).then(n=>Promise.resolve(n))})}setNotificationClan(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setNotificationClanSetting(e.token,t).then(n=>n!==void 0)})}setNotificationChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setNotificationChannelSetting(e.token,t).then(n=>n!==void 0)})}setMuteCategory(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setMuteCategory(e.token,t).then(n=>n!==void 0)})}setMuteChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setMuteChannel(e.token,t).then(n=>n!==void 0)})}updateChannelPrivate(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChannelPrivate(e.token,t).then(n=>n!==void 0)})}setNotificationCategory(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setNotificationCategorySetting(e.token,t).then(n=>n!==void 0)})}deleteNotificationCategory(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteNotificationCategorySetting(e.token,t).then(n=>n!==void 0)})}deleteNotificationChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteNotificationChannel(e.token,t).then(n=>n!==void 0)})}setNotificationReactMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setNotificationReactMessage(e.token,{channel_id:t}).then(n=>n!==void 0)})}deleteNotiReactMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteNotiReactMessage(e.token,t).then(n=>n!==void 0)})}searchMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.searchMessage(e.token,t).then(n=>Promise.resolve(n))})}createMessage2Inbox(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createMessage2Inbox(e.token,t).then(n=>Promise.resolve(n))})}createPinMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createPinMessage(e.token,t).then(n=>Promise.resolve(n))})}pinMessagesList(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getPinMessagesList(e.token,t,n,s).then(c=>{let d={pin_messages_list:[]};return c.pin_messages_list==null||c.pin_messages_list.forEach(i=>{d.pin_messages_list.push({id:i.id,avatar:i.avatar,channel_id:i.channel_id,content:i.content,create_time_seconds:i.create_time_seconds,message_id:i.message_id,sender_id:i.sender_id,username:i.username,attachment:i.attachment})}),Promise.resolve(d)})})}deletePinMessage(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deletePinMessage(e.token,t,n,s,c).then(d=>d!==void 0)})}createClanEmoji(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createClanEmoji(e.token,t).then(n=>n!==void 0)})}updateClanEmojiById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanEmojiById(e.token,t,n).then(s=>s!==void 0)})}deleteByIdClanEmoji(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteClanEmojiById(e.token,t,n,s).then(c=>c!==void 0)})}generateWebhookLink(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.generateWebhook(e.token,t).then(n=>Promise.resolve(n))})}listWebhookByChannelId(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listWebhookByChannelId(e.token,t,n).then(s=>Promise.resolve(s))})}updateWebhookById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateWebhookById(e.token,t,n).then(s=>s!==void 0)})}deleteWebhookById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteWebhookById(e.token,t,n).then(s=>s!==void 0)})}addClanSticker(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addClanSticker(e.token,t).then(n=>n!==void 0)})}deleteClanStickerById(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteClanStickerById(e.token,t,n,s).then(c=>c!==void 0)})}updateClanStickerById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanStickerById(e.token,t,n).then(s=>s!==void 0)})}changeChannelCategory(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.changeChannelCategory(e.token,t,n).then(s=>s!==void 0)})}setRoleChannelPermission(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setRoleChannelPermission(e.token,t).then(n=>n!==void 0)})}addApp(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addApp(e.token,t).then(n=>Promise.resolve(n))})}getApp(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getApp(e.token,t).then(n=>Promise.resolve(n))})}listApps(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listApps(e.token).then(t=>Promise.resolve(t))})}addAppToClan(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addAppToClan(e.token,t,n).then(s=>s!==void 0)})}getSystemMessagesList(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getSystemMessagesList(e.token).then(t=>Promise.resolve(t))})}getSystemMessageByClanId(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getSystemMessageByClanId(e.token,t).then(n=>Promise.resolve(n))})}createSystemMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createSystemMessage(e.token,t).then(n=>Promise.resolve(n))})}updateSystemMessage(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateSystemMessage(e.token,t,n).then(s=>Promise.resolve(s))})}deleteSystemMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteSystemMessage(e.token,t).then(n=>Promise.resolve(n))})}updateCategoryOrder(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateCategoryOrder(e.token,t).then(n=>Promise.resolve(n))})}givecoffee(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.giveMeACoffee(e.token,t).then(n=>n!==void 0)})}sendToken(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.sendToken(e.token,t).then(n=>n!==void 0)})}listStreamingChannelUsers(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listStreamingChannelUsers(e.token,t,n,s,d,c,i).then(o=>{let a={streaming_channel_users:[]};return o.streaming_channel_users==null||o.streaming_channel_users.forEach(u=>{a.streaming_channel_users.push({id:u.id,channel_id:u.channel_id,user_id:u.user_id,participant:u.participant})}),Promise.resolve(a)})})}registerStreamingChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.registerStreamingChannel(e.token,t).then(n=>n!==void 0)})}listChannelApps(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelApps(e.token,t).then(n=>{let s={channel_apps:[]};return n.channel_apps==null||n.channel_apps.forEach(c=>{s.channel_apps.push({id:c.id,channel_id:c.channel_id,app_id:c.app_id,clan_id:c.clan_id,app_url:c.app_url,app_name:c.app_name,app_logo:c.app_logo})}),Promise.resolve(s)})})}getChannelCategoryNotiSettingsList(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getChannelCategoryNotiSettingsList(e.token,t).then(n=>Promise.resolve(n))})}getNotificationCategory(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getNotificationCategory(e.token,t).then(n=>Promise.resolve(n))})}getNotificationChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getNotificationChannel(e.token,t).then(n=>Promise.resolve(n))})}getNotificationClan(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getNotificationClan(e.token,t).then(n=>Promise.resolve(n))})}getNotificationReactMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getNotificationReactMessage(e.token,t).then(n=>Promise.resolve(n))})}listChannelByUserId(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelByUserId(e.token).then(t=>Promise.resolve(t))})}listChannelUsersUC(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelUsersUC(e.token,t,n).then(s=>Promise.resolve(s))})}getListEmojisByUserId(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getListEmojisByUserId(e.token).then(t=>Promise.resolve(t))})}emojiRecentList(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.emojiRecentList(e.token).then(t=>Promise.resolve(t))})}getListStickersByUserId(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getListStickersByUserId(e.token).then(t=>Promise.resolve(t))})}listUserClansByUserId(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listUserClansByUserId(e.token).then(t=>Promise.resolve(t))})}listRoles(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listRoles(e.token,t,n,s,c).then(d=>{let i={clan_id:t,roles:d.roles};return Promise.resolve(i)})})}listUserPermissionInChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listUserPermissionInChannel(e.token,t,n).then(s=>{let c={clan_id:t,channel_id:n,permissions:s.permissions};return Promise.resolve(c)})})}getPermissionByRoleIdChannelId(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getPermissionByRoleIdChannelId(e.token,t,n,s).then(c=>{let d={role_id:t,channel_id:n,permission_role_channel:c.permission_role_channel,user_id:s};return Promise.resolve(d)})})}markAsRead(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.markAsRead(e.token,t).then(n=>Promise.resolve(n))})}listThreadDescs(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listThreadDescs(e.token,t,n,s,c,d,i).then(o=>{let a={channeldesc:[]};return o.channeldesc==null||(a.channeldesc=o.channeldesc),Promise.resolve(a)})})}listChannelTimeline(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelTimeline(e.token,t).then(n=>{var s;return(s=n.events)==null||s.forEach(c=>{c.attachments=[];let d;try{let i=k(c.preview_imgs);d=(i==null?void 0:i.attachments)||i||P(c.preview_imgs||"[]")}catch(i){d=P(c.preview_imgs||"[]")}Array.isArray(d)?c.preview_imgs=d:c.preview_imgs=[]}),Promise.resolve(n)})})}createChannelTimeline(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createChannelTimeline(e.token,t).then(n=>{let s=n.event;if(s){let c,d;try{let i=k(s.attachments),o=k(s.preview_imgs);c=(i==null?void 0:i.attachments)||i||P(s.attachments||"[]"),d=(o==null?void 0:o.attachments)||o||P(s.preview_imgs||"[]")}catch(i){c=P(s.attachments||"[]"),d=P(s.preview_imgs||"[]")}Array.isArray(c)?s.attachments=c:s.attachments=[],Array.isArray(d)?s.preview_imgs=d:s.preview_imgs=[]}return Promise.resolve(n)})})}updateChannelTimeline(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChannelTimeline(e.token,t).then(n=>{let s=n.event;if(s){let c,d;try{let i=k(s.attachments),o=k(s.preview_imgs);c=(i==null?void 0:i.attachments)||i||P(s.attachments||"[]"),d=(o==null?void 0:o.attachments)||o||P(s.preview_imgs||"[]")}catch(i){c=P(s.attachments||"[]"),d=P(s.preview_imgs||"[]")}Array.isArray(c)?s.attachments=c:s.attachments=[],Array.isArray(d)?s.preview_imgs=d:s.preview_imgs=[]}return Promise.resolve(n)})})}detailChannelTimeline(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.detailChannelTimeline(e.token,t).then(n=>{let s=n.event;if(s){let c,d;try{let i=k(s.attachments),o=k(s.preview_imgs);c=(i==null?void 0:i.attachments)||i||P(s.attachments||"[]"),d=(o==null?void 0:o.attachments)||o||P(s.preview_imgs||"[]")}catch(i){c=P(s.attachments||"[]"),d=P(s.preview_imgs||"[]")}Array.isArray(c)?s.attachments=c:s.attachments=[],Array.isArray(d)?s.preview_imgs=d:s.preview_imgs=[]}return Promise.resolve(n)})})}leaveThread(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.leaveThread(e.token,t,n).then(s=>Promise.resolve(s))})}archiveChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.archiveChannel(e.token,t,n).then(s=>Promise.resolve(s))})}listArchivedChannelDescs(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listArchivedChannelDescs(e.token,t).then(n=>Promise.resolve(n))})}getChannelSettingInClan(e,t,n,s,c,d,i,o,a,u,h){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelSetting(e.token,t,n,s,c,d,i,o,a,u,h).then(g=>Promise.resolve(g))})}getChannelCanvasList(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getChannelCanvasList(e.token,t,n,s,c).then(d=>{let i={channel_canvases:[]};return d.channel_canvases==null||(i.clan_id=d.clan_id,i.channel_id=d.channel_id,i.channel_canvases=d.channel_canvases,i.count=d.count),Promise.resolve(i)})})}getChannelCanvasDetail(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getChannelCanvasDetail(e.token,t,n,s).then(c=>Promise.resolve(c))})}editChannelCanvases(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.editChannelCanvases(e.token,t).then(n=>Promise.resolve(n))})}deleteChannelCanvas(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteChannelCanvas(e.token,t,n,s).then(c=>c!==void 0)})}addFavoriteChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addChannelFavorite(e.token,{channel_id:t,clan_id:n}).then(s=>s)})}removeFavoriteChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeChannelFavorite(e.token,t,n).then(s=>s)})}getListFavoriteChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getListFavoriteChannel(e.token,t).then(n=>n)})}listActivity(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listActivity(e.token).then(t=>t)})}createActiviy(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createActiviy(e.token,t).then(n=>n)})}createQRLogin(e){return l(this,null,function*(){let t=yield this.transport.createQRLogin(this.serverkey,"",e);return{login_id:t.login_id,create_time_second:t.create_time_second}})}checkLoginRequest(e){return l(this,null,function*(){let t=yield this.transport.checkLoginRequest(this.serverkey,"",e);return t!=null&&t.token?new O(t.token||"",t.refresh_token||"",t.created||!1,t.api_url||"",t.ws_url||"",t.id_token||"",t.is_remember||!1):null})}confirmLogin(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.confirmLogin(e.token,t,n).then(s=>s)})}getChanEncryptionMethod(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getChanEncryptionMethod(e.token,t).then(n=>n)})}setChanEncryptionMethod(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setChanEncryptionMethod(e.token,t,{method:n}).then(s=>s)})}getPubKeys(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getPubKeys(e.token,t).then(n=>n)})}pushPubKey(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.pushPubKey(e.token,{PK:t}).then(n=>n)})}getKeyServer(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getKeyServer(e.token).then(t=>t)})}listAuditLog(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listAuditLog(e.token,t,n,s,c).then(d=>d)})}listOnboarding(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listOnboarding(e.token,t,n,s,c).then(d=>d)})}getOnboardingDetail(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getOnboardingDetail(e.token,t,n).then(s=>Promise.resolve(s))})}createOnboarding(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createOnboarding(e.token,t).then(n=>n)})}updateOnboarding(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateOnboarding(e.token,t,n).then(s=>s!==void 0)})}deleteOnboarding(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteOnboarding(e.token,t,n).then(s=>s!==void 0)})}generateClanWebhook(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.generateClanWebhook(e.token,t).then(n=>Promise.resolve(n))})}listClanWebhook(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listClanWebhook(e.token,t).then(n=>Promise.resolve(n))})}deleteClanWebhookById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteClanWebhookById(e.token,t,n).then(s=>s!==void 0)})}updateClanWebhookById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanWebhookById(e.token,t,n).then(s=>s!==void 0)})}listOnboardingStep(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listOnboardingStep(e.token,t,n,s).then(c=>Promise.resolve(c))})}updateOnboardingStepByClanId(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateOnboardingStepByClanId(e.token,t,n).then(s=>s!==void 0)})}updateUserStatus(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateUserStatus(e.token,t).then(n=>n!==void 0)})}updateUserCustomStatus(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateUserCustomStatus(e.token,t).then(n=>n!==void 0)})}getUserStatus(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getUserStatus(e.token).then(t=>Promise.resolve(t))})}listSdTopic(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listSdTopic(e.token,t,n).then(s=>Promise.resolve(s))})}createSdTopic(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createSdTopic(e.token,t).then(n=>n)})}getTopicDetail(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getTopicDetail(e.token,t).then(n=>Promise.resolve(n))})}createRoomChannelApps(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createRoomChannelApps(e.token,t).then(n=>Promise.resolve(n))})}generateMeetToken(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.generateMeetToken(e.token,t).then(n=>Promise.resolve(n))})}listMezonOauthClient(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listMezonOauthClient(e.token).then(t=>Promise.resolve(t))})}getMezonOauthClient(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getMezonOauthClient(e.token,t,n).then(s=>Promise.resolve(s))})}updateMezonOauthClient(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateMezonOauthClient(e.token,t).then(n=>Promise.resolve(n))})}searchThread(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.searchThread(e.token,t,n,s).then(c=>Promise.resolve(c))})}generateHashChannelApps(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.generateHashChannelApps(e.token,t).then(n=>Promise.resolve(n))})}registrationPassword(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.registrationEmail(e.token,{email:t,password:n,old_password:s}).then(c=>Promise.resolve(c))})}addUserEvent(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addUserEvent(e.token,t).then(n=>n!==void 0)})}deleteUserEvent(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteUserEvent(e.token,t,n).then(s=>s!==void 0)})}updateRoleOrder(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateRoleOrder(e.token,t).then(n=>Promise.resolve(n))})}deleteAccount(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteAccount(e.token).then(t=>Promise.resolve(t))})}createExternalMezonMeet(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createExternalMezonMeet(e.token).then(t=>Promise.resolve(t))})}generateMeetTokenExternal(e,t,n,s,c){return l(this,null,function*(){return this.transport.generateMeetTokenExternal("",e,t,n,s,c).then(d=>Promise.resolve(d))})}removeMezonMeetParticipant(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeParticipantMezonMeet(e.token,t).then(n=>Promise.resolve(n))})}muteMezonMeetParticipant(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.muteParticipantMezonMeet(e.token,t).then(n=>Promise.resolve(n))})}updateClanOrder(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanOrder(e.token,t).then(n=>n!==void 0)})}listClanDiscover(e,t){return l(this,null,function*(){return this.transport.clanDiscover(this.serverkey,"",e,t).then(n=>Promise.resolve(n))})}listQuickMenuAccess(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listQuickMenuAccess(e.token,t,n,s).then(c=>Promise.resolve(c))})}deleteQuickMenuAccess(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteQuickMenuAccess(e.token,t,n).then(s=>s!==void 0)})}addQuickMenuAccess(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addQuickMenuAccess(e.token,t).then(n=>n!==void 0)})}updateQuickMenuAccess(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateQuickMenuAccess(e.token,t).then(n=>n!==void 0)})}listForSaleItems(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listForSaleItems(e.token,t).then(n=>Promise.resolve(n))})}isFollower(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.isFollower(e.token,t).then(n=>Promise.resolve(n))})}transferOwnership(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.transferOwnership(e.token,t).then(n=>n!==void 0)})}isBanned(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.isBanned(e.token,t).then(n=>Promise.resolve(n))})}reportMessageAbuse(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.reportMessageAbuse(e.token,t,n).then(s=>s!==void 0)})}updateMezonVoiceState(e,t,n,s,c,d){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateMezonVoiceState(e.token,t,n,s,c,d).then(i=>i!==void 0)})}sendChannelMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.sendChannelMessage(e.token,t,n,s,c,d,i,o,a,u,h,g,f,A).then(y=>Promise.resolve(y))})}updateChannelMessage(e,t,n,s,c,d,i,o,a,u,h,g){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChannelMessage(e.token,t,n,s,c,d,i,o,a,u,h,g).then(f=>Promise.resolve(f))})}deleteChannelMessage(e,t,n,s,c,d,i,o,a,u){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteChannelMessage(e.token,t,n,s,c,d,i,o,a,u).then(h=>Promise.resolve(h))})}messageButtonClick(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.messageButtonClick(e.token,t,n,s,c,d,i).then(o=>Promise.resolve(o))})}dropdownBoxSelected(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.dropdownBoxSelected(e.token,t,n,s,c,d,i).then(o=>Promise.resolve(o))})}activeArchivedThread(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.activeArchivedThread(e.token,t,n).then(s=>Promise.resolve(s))})}addAgentToChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addAgentToChannel(e.token,t,n).then(s=>Promise.resolve(s))})}disconnectAgent(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.disconnectAgent(e.token,t,n).then(s=>Promise.resolve(s))})}listMutedChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listMutedChannel(e.token,t).then(n=>Promise.resolve(n))})}channelMessageReact(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.channelMessageReact(e.token,t,n,s,c,d,i,o,a,u,h,g,f,A).then(y=>Promise.resolve(y))})}createPoll(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createPoll(e.token,t)})}votePoll(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.votePoll(e.token,t)})}closePoll(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.closePoll(e.token,t)})}getPoll(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getPoll(e.token,t)})}followUsers(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.followUsers(t)})}joinClanChat(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.joinClanChat(t)})}follower(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.follower()})}joinChat(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.joinChat(t,n,s,c)})}leaveChat(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.leaveChat(t,n,s,c)})}removeChatMessage(e,t,n,s,c,d,i,o,a,u){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeChatMessage(t,n,s,c,d,i,o,a,u)})}unfollowUsers(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.unfollowUsers(t)})}updateChatMessage(e,t,n,s,c,d,i,o,a,u,h,g){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChatMessage(t,n,s,c,d,i,o,a,u,h,g)})}updateStatus(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateStatus(t)})}writeQuickMenuEvent(e,t,n,s,c,d,i,o,a,u,h,g,f,A,y){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeQuickMenuEvent(t,n,s,c,d,i,o,a,u,h,g,f,A,y)})}writeEphemeralMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A,y,b){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeEphemeralMessage(t,n,s,c,d,i,o,a,u,h,g,f,A,y,b)})}writeChatMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeChatMessage(t,n,s,c,d,i,o,a,u,h,g,f,A)})}writeMessageReaction(e,t,n,s,c,d,i,o,a,u,h,g,f,A,y){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeMessageReaction(t,n,s,c,d,i,o,a,u,h,g,f,A,y)})}writeMessageTyping(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeMessageTyping(t,n,s,c,d,i)})}writeLastSeenMessage(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeLastSeenMessage(t,n,s,c,d,i)})}writeLastPinMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeLastPinMessage(t,n,s,c,d,i,o,a,u,h,g,f,A)})}writeCustomStatus(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeCustomStatus(t,n,s,c)})}writeVoiceReaction(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeVoiceReaction(t,n)})}forwardWebrtcSignaling(e,t,n,s,c,d){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.forwardWebrtcSignaling(t,n,s,c,d)})}makeCallPush(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.makeCallPush(t,n,s,c)})}writeChannelAppEvent(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeChannelAppEvent(t,n,s)})}listDataSocket(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listDataSocket(t)})}};z.DefaultHeartbeatTimeoutMs=1e4,z.DefaultConnectTimeoutMs=3e4;var Y=z;export{se as ApiAppRole,oe as ChannelStreamMode,re as ChannelType,Y as Client,p as ConnectionState,Q as CreateChannelMessageFromEvent,ae as NotificationType,N as RefreshTokenManager,O as Session,ce as WebrtcSignalingType,fe as b64DecodeUnicode,_e as b64EncodeUnicode,m as buildFetchOptions,T as decodeAttachments,k as decodeChannelTimelineAttachments,U as decodeMentions,H as decodeNotificationFcm,B as decodeReactions,D as decodeRefs,ye as encodeAttachments,Ae as encodeMentions,Pe as encodeNotificationFcm,Ce as encodeReactions,be as encodeRefs,P as safeJSONParse};
1
+ var $=Object.defineProperty,Z=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var J=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var V=(_,e,t)=>e in _?$(_,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):_[e]=t,w=(_,e)=>{for(var t in e||(e={}))ee.call(e,t)&&V(_,t,e[t]);if(J)for(var t of J(e))te.call(e,t)&&V(_,t,e[t]);return _},E=(_,e)=>Z(_,X(e));var l=(_,e,t)=>new Promise((n,s)=>{var c=o=>{try{i(t.next(o))}catch(a){s(a)}},d=o=>{try{i(t.throw(o))}catch(a){s(a)}},i=o=>o.done?n(o.value):Promise.resolve(o.value).then(c,d);i((t=t.apply(_,e)).next())});import"whatwg-fetch";import{encode as ne,decode as ie}from"js-base64";import*as R from"mezon-js-protobuf";function m(_,e,t){let n=w({method:_},e);return n.headers=w({},e.headers),Object.keys(n.headers).includes("Accept")||(n.headers.Accept="application/proto"),Object.keys(n.headers).includes("Content-Type")||(n.headers["Content-Type"]="application/proto"),Object.keys(n.headers).forEach(s=>{n.headers[s]||delete n.headers[s]}),t&&(n.body=t),n}function _e(_){return ne(encodeURIComponent(_).replace(/%([0-9A-F]{2})/g,function(t,n){return String.fromCharCode(+("0x"+n))}))}function fe(_){return decodeURIComponent(ie(_).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))}function P(_){if(_==null)return{t:_};let e;if(_ instanceof Uint8Array)e=new TextDecoder().decode(_);else if(typeof _=="string")e=_;else return typeof _=="object"?_:{t:_};if(!e||e===""||e==="[]")return{t:e};try{return JSON.parse(e)}catch(t){try{let n=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r");return JSON.parse(n)}catch(n){return console.error("JSON Parse failed completely:",{original:e,error:n}),{t:e}}}}var L=_=>!_||_===null||_===void 0||_===""||_==="[]";function U(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.MessageMentionList.decode(s)}catch(n){return P(_)}}function T(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.MessageAttachmentList.decode(s)}catch(n){return P(_)}}function k(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.ListChannelTimelineAttachment.decode(s)}catch(n){return P(_)}}function D(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.MessageRefList.decode(s)}catch(n){return P(_)}}function B(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.MessageReactionList.decode(s)}catch(n){return P(_)}}function H(_){if(L(_))return;let e=_[0];if(e===91||e===123)return P(_);try{let n=_,s=new Uint8Array(n);return R.DirectFcmProto.decode(s)}catch(n){return P(_)}}function Ae(_){return R.MessageMentionList.encode(R.MessageMentionList.fromPartial(_)).finish()}function ye(_){return R.MessageAttachmentList.encode(R.MessageAttachmentList.fromPartial(_)).finish()}function be(_){return R.MessageRefList.encode(R.MessageRefList.fromPartial(_)).finish()}function Ce(_){return R.MessageReactionList.encode(R.MessageReactionList.fromPartial(_)).finish()}function Pe(_){return R.DirectFcmProto.encode(R.DirectFcmProto.fromPartial(_)).finish()}var se=(c=>(c[c.USER_ROLE_UNKNOWN=0]="USER_ROLE_UNKNOWN",c[c.USER_ROLE_ADMIN=1]="USER_ROLE_ADMIN",c[c.USER_ROLE_DEVELOPER=2]="USER_ROLE_DEVELOPER",c[c.USER_ROLE_MAINTAINER=3]="USER_ROLE_MAINTAINER",c[c.USER_ROLE_READONLY=4]="USER_ROLE_READONLY",c))(se||{}),re=(a=>(a[a.CHANNEL_TYPE_CHANNEL=1]="CHANNEL_TYPE_CHANNEL",a[a.CHANNEL_TYPE_GROUP=2]="CHANNEL_TYPE_GROUP",a[a.CHANNEL_TYPE_DM=3]="CHANNEL_TYPE_DM",a[a.CHANNEL_TYPE_FORUM=5]="CHANNEL_TYPE_FORUM",a[a.CHANNEL_TYPE_STREAMING=6]="CHANNEL_TYPE_STREAMING",a[a.CHANNEL_TYPE_THREAD=7]="CHANNEL_TYPE_THREAD",a[a.CHANNEL_TYPE_APP=8]="CHANNEL_TYPE_APP",a[a.CHANNEL_TYPE_ANNOUNCEMENT=9]="CHANNEL_TYPE_ANNOUNCEMENT",a[a.CHANNEL_TYPE_MEZON_VOICE=10]="CHANNEL_TYPE_MEZON_VOICE",a))(re||{}),oe=(c=>(c[c.STREAM_MODE_CHANNEL=2]="STREAM_MODE_CHANNEL",c[c.STREAM_MODE_GROUP=3]="STREAM_MODE_GROUP",c[c.STREAM_MODE_DM=4]="STREAM_MODE_DM",c[c.STREAM_MODE_CLAN=5]="STREAM_MODE_CLAN",c[c.STREAM_MODE_THREAD=6]="STREAM_MODE_THREAD",c))(oe||{}),ae=(n=>(n[n.ALL_MESSAGE=1]="ALL_MESSAGE",n[n.MENTION_MESSAGE=2]="MENTION_MESSAGE",n[n.NOTHING_MESSAGE=3]="NOTHING_MESSAGE",n))(ae||{}),ce=(a=>(a[a.WEBRTC_SDP_INIT=0]="WEBRTC_SDP_INIT",a[a.WEBRTC_SDP_OFFER=1]="WEBRTC_SDP_OFFER",a[a.WEBRTC_SDP_ANSWER=2]="WEBRTC_SDP_ANSWER",a[a.WEBRTC_ICE_CANDIDATE=3]="WEBRTC_ICE_CANDIDATE",a[a.WEBRTC_SDP_QUIT=4]="WEBRTC_SDP_QUIT",a[a.WEBRTC_SDP_TIMEOUT=5]="WEBRTC_SDP_TIMEOUT",a[a.WEBRTC_SDP_NOT_AVAILABLE=6]="WEBRTC_SDP_NOT_AVAILABLE",a[a.WEBRTC_SDP_JOINED_OTHER_CALL=7]="WEBRTC_SDP_JOINED_OTHER_CALL",a[a.WEBRTC_SDP_STATUS_REMOTE_MEDIA=8]="WEBRTC_SDP_STATUS_REMOTE_MEDIA",a))(ce||{});function Q(_){let e,t,n,s,c,d;try{e=P(_.channel_message.content)}catch(o){console.log("content is invalid",o)}try{t=B(_.channel_message.reactions)}catch(o){console.log("reactions is invalid",o)}try{n=U(_.channel_message.mentions)}catch(o){console.log("mentions is invalid",o)}try{s=T(_.channel_message.attachments)}catch(o){console.log("attachments is invalid",o)}try{c=D(_.channel_message.references)}catch(o){console.log("references is invalid",o)}try{d=_.channel_message.referenced_message}catch(o){console.log("referenced messages is invalid",o)}return{id:_.id||_.channel_message.message_id,avatar:_.channel_message.avatar,channel_id:_.channel_message.channel_id,mode:_.channel_message.mode,channel_label:_.channel_message.channel_label,clan_id:_.channel_message.clan_id,code:_.channel_message.code,message_id:_.channel_message.message_id,sender_id:_.channel_message.sender_id,update_time:_.channel_message.update_time,clan_logo:_.channel_message.clan_logo,category_name:_.channel_message.category_name,username:_.channel_message.username,clan_nick:_.channel_message.clan_nick,clan_avatar:_.channel_message.clan_avatar,display_name:_.channel_message.display_name,content:e,reactions:t==null?void 0:t.reactions,mentions:n==null?void 0:n.mentions,attachments:s==null?void 0:s.attachments,referenced_message:d,references:c==null?void 0:c.refs,hide_editted:_.channel_message.hide_editted,is_public:_.channel_message.is_public,create_time_seconds:_.channel_message.create_time_seconds,update_time_seconds:_.channel_message.update_time_seconds,topic_id:_.channel_message.topic_id}}import*as I from"js-base64";var O=class _{constructor(e,t,n,s,c,d,i){this.created=n;this.api_url=s;this.ws_url=c;this.id_token=d;this.token=e,this.refresh_token=t,this.id_token=d,this.api_url=s,this.ws_url=c,this.created_at=Math.floor(new Date().getTime()/1e3),this.is_remember=i,this.update(e,t,i)}isexpired(e){return this.expires_at-e<=0}isrefreshexpired(e){return this.refresh_expires_at-e<=0}update(e,t,n){let s=e.split(".");if(s.length!=3)throw"jwt is not valid.";let c=JSON.parse(I.atob(s[1])),d=Math.floor(parseInt(c.exp));if(t){let i=t.split(".");if(i.length!=3)throw"refresh jwt is not valid.";let o=JSON.parse(I.atob(i[1])),a=Math.floor(parseInt(o.exp));this.refresh_expires_at=a,this.refresh_token=t,this.is_remember=n}this.token=e,this.expires_at=d,this.username=c.usn,this.user_id=c.uid,this.vars=c.vrs}static restore(e,t,n,s,c){return new _(e,t,!1,n,s,"",c)}};var j=Symbol.for("mezon.refreshTokenManager"),N=class _{constructor(){this.pendingRefreshes=new Map}static getInstance(){let e=globalThis;return e[j]||(e[j]=new _),e[j]}refresh(e,t){return l(this,null,function*(){let n=this.pendingRefreshes.get(e);if(n)return n;let s=t().finally(()=>{this.pendingRefreshes.delete(e)});return this.pendingRefreshes.set(e,s),s})}isRefreshing(e){return this.pendingRefreshes.has(e)}get pendingCount(){return this.pendingRefreshes.size}};import{encode as M}from"js-base64";import*as r from"mezon-js-protobuf";import{WebSocketAdapter as de}from"mezon-js-protobuf";var G=(b=>(b[b.ListChannelDescs=0]="ListChannelDescs",b[b.GetAccount=1]="GetAccount",b[b.ListClanDescs=2]="ListClanDescs",b[b.ListClanUsers=3]="ListClanUsers",b[b.ListRoles=4]="ListRoles",b[b.ListEvents=5]="ListEvents",b[b.GetRoleOfUserInTheClan=6]="GetRoleOfUserInTheClan",b[b.GetListPermission=7]="GetListPermission",b[b.ListUserPermissionInChannel=8]="ListUserPermissionInChannel",b[b.GetNotificationClan=9]="GetNotificationClan",b[b.ListMutedChannel=10]="ListMutedChannel",b[b.ListStreamingChannelUsers=11]="ListStreamingChannelUsers",b[b.ListQuickMenuAccess=12]="ListQuickMenuAccess",b[b.GetNotificationChannel=13]="GetNotificationChannel",b[b.ListFriends=14]="ListFriends",b[b.EmojiRecentList=15]="EmojiRecentList",b[b.GetListEmojisByUserId=16]="GetListEmojisByUserId",b[b.ListChannelBadgeCount=17]="ListChannelBadgeCount",b[b.ListClanUsersStatus=18]="ListClanUsersStatus",b[b.ListChannelApps=19]="ListChannelApps",b[b.GetListFavoriteChannel=20]="GetListFavoriteChannel",b[b.ListCategoryDescs=21]="ListCategoryDescs",b[b.ListOnboarding=22]="ListOnboarding",b[b.GetListStickersByUserId=23]="GetListStickersByUserId",b[b.GetSystemMessageByClanId=24]="GetSystemMessageByClanId",b[b.GetPinMessagesList=25]="GetPinMessagesList",b[b.GetChannelCanvasList=26]="GetChannelCanvasList",b[b.ListChannelTimeline=27]="ListChannelTimeline",b[b.ListChannelMessages=28]="ListChannelMessages",b[b.ListActivity=29]="ListActivity",b))(G||{}),x=class x{constructor(e,t,n,s){this.serverKey=e;this.timeoutMs=t;this.cIds={},this.nextCid=1,this.basePath=s,n?this.adapter=n:this.adapter=new de}setOnOpen(e){this.adapter.onOpen=e}setOnError(e){this.adapter.onError=e}close(){this.adapter.close()}generatecid(){let e=this.nextCid;return++this.nextCid,e}setTransportAdapter(e){this.adapter=e}setFallbackSession(e){}getApiFromPath(e){if(e in G)return G[e]}connect(e,t=!1,n=!1,s,c,d){let[i,o]=e.ws_url.split(":");this.adapter.connect(i,o,t,e.token,d),this.adapter.onClose=c,this.adapter.onMessage=(a,u,h)=>l(this,null,function*(){if(n&&window&&window.console&&console.log("incomming message with cid %o and message %o",a,h),a!=0){let g=this.cIds[a];if(!g){console.error("No promise executor for message: %o",h);return}delete this.cIds[a],h.error?g.reject(h.error):g.resolve({code:u,message:h})}else yield s(0,0,h)})}send(e,t=x.DefaultSendTimeoutMs){let{urlPath:n,fetchOptions:s}=e,c=s;if(n!=null&&n.includes("/mezon.api.Mezon/")){let d=n.substring(17);c={api_request_event:{api_index:this.getApiFromPath(d),api_name:d,body:s.body}}}return new Promise((d,i)=>{var o,a;if(!this.adapter.isOpen())i("Socket connection has not been established yet.");else{c.channel_message_send?c.channel_message_send.content=JSON.stringify(c.channel_message_send.content):c.channel_message_update?c.channel_message_update.content=JSON.stringify(c.channel_message_update.content):c.ephemeral_message_send?c.ephemeral_message_send.message.content=JSON.stringify((o=c.ephemeral_message_send.message)==null?void 0:o.content):c.quick_menu_event&&(c.quick_menu_event.message.content=JSON.stringify((a=c.quick_menu_event.message)==null?void 0:a.content));let u=this.generatecid();this.cIds[u]={resolve:d,reject:i},t!==1/0&&t>0&&setTimeout(()=>{i("The socket timed out while waiting for a response.")},t),c.cid=u.toString(),console.log("send cid",u),this.adapter.send(c)}})}setBasePath(e){this.basePath=e}deleteAccount(e,t={}){let n="/mezon.api.Mezon/DeleteAccount",c=m("POST",t,"");return e&&(c.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:c}).then(d=>d),new Promise((d,i)=>setTimeout(i,this.timeoutMs,"Request timed out."))])}getAccount(e,t={}){let n="/mezon.api.Mezon/GetAccount",c=m("POST",t,"");return e&&(c.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:c}).then(d=>l(this,null,function*(){return d.code!=0?{}:r.Account.decode(d.message)})),new Promise((d,i)=>setTimeout(()=>i(new Error("Request timed out.")),this.timeoutMs))])}updateAccount(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateAccount",d=r.UpdateAccountRequest.encode(r.UpdateAccountRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}checkLoginRequest(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/checklogin",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.Session.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}confirmLogin(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/confirmlogin",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(t,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Bearer "+e),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>u),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}createQRLogin(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/createqrlogin",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.LoginIDResponse.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}AuthenticateSMSOTPRequest(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/smsotp",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.LinkAccountConfirmRequest.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}AuthenticateEmailOTPRequest(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/emailotp",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.LinkAccountConfirmRequest.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}authenticateEmail(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/email",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.Session.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}authenticateMezon(e,t,n,s,c,d,i={}){if(n==null)throw new Error("'account' is a required parameter but is null or undefined.");let o="/v2/account/authenticate/mezon",a=new Map;a.set("create",s),a.set("username",c),a.set("is_remember",d);let u="";u=JSON.stringify(n||{});let h=this.buildFullUrl(this.basePath,o,a),g=m("POST",i,u);return e&&(g.headers.Authorization="Basic "+M(e+":"+t)),g.headers.Accept="application/x-protobuf",Promise.race([fetch(h,g).then(f=>l(this,null,function*(){let A=yield f.arrayBuffer();return r.Session.decode(new Uint8Array(A))})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}linkEmail(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/LinkEmail",d=r.AccountEmail.encode(r.AccountEmail.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.LinkAccountConfirmRequest.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}linkSMS(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/LinkSMS",d=r.AccountMezon.encode(r.AccountMezon.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.LinkAccountConfirmRequest.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}confirmLinkMezonOTP(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ConfirmLinkMezonOTP",d=r.LinkAccountConfirmRequest.encode(r.LinkAccountConfirmRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),i.headers.Accept="application/x-protobuf",Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.Session.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}confirmAuthenticateOTP(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/v2/account/authenticate/confirmotp",d=new Map,i="";i=JSON.stringify(n||{});let o=this.buildFullUrl(this.basePath,c,d),a=m("POST",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.Session.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}registrationEmail(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/RegistrationEmail",d=r.RegistrationEmailRequest.encode(r.RegistrationEmailRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.Session.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}sessionRefresh(e,t,n,s={}){if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/SessionRefresh",i=r.SessionRefreshRequest.encode(r.SessionRefreshRequest.fromPartial(n)).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Basic "+M(e+":"+t)),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.Session.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}unlinkEmail(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UnlinkEmail",d=r.AccountEmail.encode(r.AccountEmail.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listActivity(e,t={}){let n="/mezon.api.Mezon/ListActivity",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.ListUserActivity.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}createActiviy(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateActiviy",d=r.CreateActivityRequest.encode(r.CreateActivityRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.UserActivity.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}addApp(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddApp",d=r.AddAppRequest.encode(r.AddAppRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.App.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listApps(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListApps",o=r.ListAppsRequest.encode(r.ListAppsRequest.fromPartial({filter:t,tombstones:n,cursor:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.AppList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}addAppToClan(e,t,n,s={}){if(t==null)throw new Error("'appId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/AddAppToClan",i=r.AppClan.encode(r.AppClan.fromPartial({app_id:t,clan_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}deleteApp(e,t,n={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DeleteApp",d=r.App.encode(r.App.fromPartial({id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o})),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}getApp(e,t,n={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetApp",d=r.App.encode(r.App.fromPartial({id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.App.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateApp(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateApp",i=r.UpdateAppRequest.encode(r.UpdateAppRequest.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.App.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listAuditLog(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/ListAuditLog",a=r.ListAuditLogRequest.encode(r.ListAuditLogRequest.fromPartial({clan_id:s,user_id:n,action_log:t,date_log:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return r.ListAuditLog.decode(h)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}updateCategoryOrder(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateCategoryOrder",d=r.UpdateCategoryOrderRequest.encode(r.UpdateCategoryOrderRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o})),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listCategoryDescs(e,t,n,s,c,d,i={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let o="/mezon.api.Mezon/ListCategoryDescs",u=r.CategoryDesc.encode(r.CategoryDesc.fromPartial({clan_id:t,creator_id:n,category_name:s,category_id:c,category_order:d})).finish(),h=m("POST",i,"");return h.body=u,e&&(h.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:o,fetchOptions:h}).then(g=>l(this,null,function*(){return g.code!=0?{}:r.CategoryDescList.decode(g.message)})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])}listChannelApps(e,t,n={}){let s="/mezon.api.Mezon/ListChannelApps",d=r.ListChannelAppsRequest.encode(r.ListChannelAppsRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListChannelAppsResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getChannelCanvasList(e,t,n,s,c,d={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let i="/mezon.api.Mezon/GetChannelCanvasList",a=r.ChannelCanvasListRequest.encode(r.ChannelCanvasListRequest.fromPartial({channel_id:t,clan_id:n,limit:s,page:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.ChannelCanvasListResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}addChannelFavorite(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddChannelFavorite",d=r.AddFavoriteChannelRequest.encode(r.AddFavoriteChannelRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.AddFavoriteChannelResponse.decode(o)})),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}removeChannelFavorite(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/RemoveChannelFavorite",i=r.RemoveFavoriteChannelRequest.encode(r.RemoveFavoriteChannelRequest.fromPartial({channel_id:t,clan_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}getListFavoriteChannel(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetListFavoriteChannel",d=r.ListFavoriteChannelRequest.encode(r.ListFavoriteChannelRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListFavoriteChannelResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listChannelMessages(e,t,n,s,c,d,i,o={}){if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let a="/mezon.api.Mezon/ListChannelMessages",h=r.ListChannelMessagesRequest.encode(r.ListChannelMessagesRequest.fromPartial({clan_id:t,channel_id:n,message_id:s,direction:c,limit:d,topic_id:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return r.ChannelMessageList.decode(f)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}addChannelUsers(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/AddChannelUsers",i=r.AddChannelUsersRequest.encode(r.AddChannelUsersRequest.fromPartial({channel_id:t,user_ids:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listChannelAttachment(e,t,n,s,c,d,i,o,a,u={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let h="/mezon.api.Mezon/ListChannelAttachment",f=r.ListChannelAttachmentRequest.encode(r.ListChannelAttachmentRequest.fromPartial({channel_id:t,clan_id:n,file_type:s,limit:c,state:d,before:i,after:o,around:a})).finish(),A=m("POST",u,"");return A.body=f,e&&(A.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:h,fetchOptions:A}).then(y=>l(this,null,function*(){return y.code!=0?{}:r.ChannelAttachmentList.decode(y.message)})),new Promise((y,C)=>setTimeout(()=>C(new Error("Request timed out.")),this.timeoutMs))])}getChanEncryptionMethod(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/GetChanEncryptionMethod",i=r.ChanEncryptionMethod.encode(r.ChanEncryptionMethod.fromPartial({channel_id:t,method:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.ChanEncryptionMethod.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}setChanEncryptionMethod(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/SetChanEncryptionMethod",i=r.ChanEncryptionMethod.encode(r.ChanEncryptionMethod.fromPartial(E(w({},n),{channel_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}leaveThread(e,t,n,s={}){if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/LeaveThread",i=r.LeaveThreadRequest.encode(r.LeaveThreadRequest.fromPartial({channel_id:n,clan_id:t})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}archiveChannel(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/ArchiveChannel",i=r.ArchiveChannelRequest.encode(r.ArchiveChannelRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listArchivedChannelDescs(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListArchivedChannelDescs",d=r.ListArchivedChannelDescsRequest.encode(r.ListArchivedChannelDescsRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListArchivedChannelDescsResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}removeChannelUsers(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/RemoveChannelUsers",i=r.RemoveChannelUsersRequest.encode(r.RemoveChannelUsersRequest.fromPartial({channel_id:t,user_ids:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a})),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listChannelUsers(e,t,n,s,c,d,i,o={}){if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let a="/mezon.api.Mezon/ListChannelUsers",h=r.ListChannelUsersRequest.encode(r.ListChannelUsersRequest.fromPartial({clan_id:t,channel_id:n,channel_type:s,limit:c,state:d,cursor:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return f.code!=0?{}:r.ChannelUserList.decode(f.message)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}listChannelDescs(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/ListChannelDescs",h=r.ListChannelDescsRequest.encode(r.ListChannelDescsRequest.fromPartial({limit:t,state:n,page:s,clan_id:c,channel_type:d,is_mobile:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return f.code!=0?{}:r.ChannelDescList.decode(f.message)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}createChannelDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateChannelDesc",d=r.CreateChannelDescRequest.encode(r.CreateChannelDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ChannelDescription.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listChannelUsersUC(e,t,n,s={}){let c="/mezon.api.Mezon/ListChannelUsersUC",i=r.AllUsersAddChannelRequest.encode(r.AllUsersAddChannelRequest.fromPartial({channel_id:t,limit:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.AllUsersAddChannelResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}deleteChannelDesc(e,t,n,s={}){if(n==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteChannelDesc",i=r.DeleteChannelDescRequest.encode(r.DeleteChannelDescRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}updateChannelDesc(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateChannelDesc",i=r.UpdateChannelDescRequest.encode(r.UpdateChannelDescRequest.fromPartial(E(w({},n),{channel_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listChannelSetting(e,t,n,s,c,d,i,o,a,u,h,g={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let f="/mezon.api.Mezon/ListChannelSetting",y=r.ChannelSettingListRequest.encode(r.ChannelSettingListRequest.fromPartial({clan_id:t,parent_id:n,category_id:s,active:d,private_channel:c,status:i,type:o,limit:a,page:u,channel_label:h})).finish(),C=m("POST",g,"");return C.body=y,e&&(C.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:f,fetchOptions:C}).then(S=>l(this,null,function*(){return S.code!=0?{}:r.ChannelSettingListResponse.decode(S.message)})),new Promise((S,v)=>setTimeout(()=>v(new Error("Request timed out.")),this.timeoutMs))])}listChannelVoiceUsers(e,t,n,s={}){let c="/mezon.api.Mezon/ListChannelVoiceUsers",i=r.ListChannelUsersRequest.encode(r.ListChannelUsersRequest.fromPartial({clan_id:t,limit:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.VoiceChannelUserList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listClanDescs(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListClanDescs",o=r.ListClanDescRequest.encode(r.ListClanDescRequest.fromPartial({limit:t,state:n,cursor:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ClanDescList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}listChannelBadgeCount(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListChannelBadgeCount",o=r.ListChannelBadgeCountRequest.encode(r.ListChannelBadgeCountRequest.fromPartial({clan_id:t,limit:n!=null?n:0,page:s!=null?s:0})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ListChannelBadgeCountResponse.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}listUserOnline(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListUserOnline",o=r.ListUserOnlineRequest.encode(r.ListUserOnlineRequest.fromPartial({clan_id:t,limit:n!=null?n:0,page:s!=null?s:0})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ListUserOnlineResponse.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}createClanDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateClanDesc",d=r.CreateClanDescRequest.encode(r.CreateClanDescRequest.fromPartial({clan_name:t.clan_name,logo:t.logo,banner:t.banner})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ClanDesc.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteClanDesc(e,t,n={}){if(t==null)throw new Error("'clanDescId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DeleteClanDesc",d=r.DeleteClanDescRequest.encode(r.DeleteClanDescRequest.fromPartial({clan_desc_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}updateClanDesc(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateClanDesc",i=r.UpdateClanDescRequest.encode(r.UpdateClanDescRequest.fromPartial(w({clan_id:t},n))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}removeClanUsers(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/RemoveClanUsers",i=r.RemoveClanUsersRequest.encode(r.RemoveClanUsersRequest.fromPartial({clan_id:t,user_ids:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listBannedUsers(e,t,n,s={}){let c="/mezon.api.Mezon/ListBannedUsers",i=r.BannedUserListRequest.encode(r.BannedUserListRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.BannedUserList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}unbanClanUsers(e,t,n,s,c,d={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let i="/mezon.api.Mezon/UnbanClanUsers",a=r.BanClanUsersRequest.encode(r.BanClanUsersRequest.fromPartial({clan_id:t,channel_id:n,user_ids:s,ban_time:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return{}})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}banClanUsers(e,t,n,s,c,d={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let i="/mezon.api.Mezon/BanClanUsers",a=r.BanClanUsersRequest.encode(r.BanClanUsersRequest.fromPartial({clan_id:t,channel_id:n,user_ids:s,ban_time:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return{}})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}listClanUsers(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListClanUsers",d=r.ListClanUsersRequest.encode(r.ListClanUsersRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ClanUserList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listClanUsersStatus(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListClanUsersStatus",d=r.ListClanUsersStatusRequest.encode(r.ListClanUsersStatusRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ClanUserStatusList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createCategoryDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateCategoryDesc",d=r.CreateCategoryDescRequest.encode(r.CreateCategoryDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.CategoryDesc.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}checkDuplicateName(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CheckDuplicateName",d=r.CheckDuplicateNameRequest.encode(r.CheckDuplicateNameRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){if(o.status>=200&&o.status<300)return r.CheckDuplicateNameResponse.decode(o);throw o})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteCategoryDesc(e,t,n,s,c={}){if(t==null)throw new Error("'categoryId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/DeleteCategoryDesc",o=r.DeleteCategoryDescRequest.encode(r.DeleteCategoryDescRequest.fromPartial({category_id:t,clan_id:n,category_label:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return{}})),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}registFCMDeviceToken(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/RegistFCMDeviceToken",a=r.RegistFcmDeviceTokenRequest.encode(r.RegistFcmDeviceTokenRequest.fromPartial({token:t,device_id:n,platform:s,voip_token:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.RegistFcmDeviceTokenResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}closeDirectMess(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CloseDMByChannelId",d=r.DeleteChannelDescRequest.encode(r.DeleteChannelDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}openDirectMess(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/OpenDMByChannelId",d=r.DeleteChannelDescRequest.encode(r.DeleteChannelDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createClanEmoji(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateClanEmoji",d=r.ClanEmojiCreateRequest.encode(r.ClanEmojiCreateRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteClanEmojiById(e,t,n,s,c={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/DeleteByIdClanEmoji",o=r.ClanEmojiDeleteRequest.encode(r.ClanEmojiDeleteRequest.fromPartial({id:t,clan_id:n,emoji_label:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return{}})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}updateClanEmojiById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateClanEmojiById",i=r.ClanEmojiUpdateRequest.encode(r.ClanEmojiUpdateRequest.fromPartial({id:n.id,shortname:n.shortname,clan_id:n.clan_id})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}emojiRecentList(e,t={}){let n="/mezon.api.Mezon/EmojiRecentList",c=m("POST",t,"");return e&&(c.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:c}).then(d=>l(this,null,function*(){return d.code!=0?{}:r.EmojiRecentList.decode(d.message)})),new Promise((d,i)=>setTimeout(()=>i(new Error("Request timed out.")),this.timeoutMs))])}getListEmojisByUserId(e,t={}){let n="/mezon.api.Mezon/GetListEmojisByUserId",c=m("POST",t,"");return e&&(c.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:c}).then(d=>l(this,null,function*(){return d.code!=0?{}:r.EmojiListedResponse.decode(d.message)})),new Promise((d,i)=>setTimeout(()=>i(new Error("Request timed out.")),this.timeoutMs))])}searchMessage(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SearchMessage",d=r.SearchMessageRequest.encode(r.SearchMessageRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.SearchMessageResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}event(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateEvent",d=r.Event.encode(r.Event.fromPartial({external:t.external,name:t.name,properties:t.properties})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listEvents(e,t,n={}){let s="/mezon.api.Mezon/ListEvents",d=r.ListEventsRequest.encode(r.ListEventsRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.EventList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createEvent(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateEvent",d=r.CreateEventRequest.encode(r.CreateEventRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.EventManagement.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateEventUser(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateEventUser",d=r.DeleteEventRequest.encode(r.DeleteEventRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteEvent(e,t,n,s,c,d,i={}){if(t==null)throw new Error("'eventId' is a required parameter but is null or undefined.");let o="/mezon.api.Mezon/DeleteEvent",u=r.DeleteEventRequest.encode(r.DeleteEventRequest.fromPartial({event_id:t,clan_id:n,creator_id:s,event_label:c,channel_id:d})).finish(),h=m("POST",i,"");return h.body=u,e&&(h.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:o,fetchOptions:h}).then(g=>l(this,null,function*(){return{}})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])}updateEvent(e,t,n,s={}){if(t==null)throw new Error("'eventId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateEvent",i=r.UpdateEventRequest.encode(r.UpdateEventRequest.fromPartial(n)).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}deleteFriends(e,t,n,s={}){let c="/mezon.api.Mezon/DeleteFriends",i=r.DeleteFriendsRequest.encode(r.DeleteFriendsRequest.fromPartial({ids:t,usernames:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listFriends(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListFriends",o=r.ListFriendsRequest.encode(r.ListFriendsRequest.fromPartial({limit:t,state:n,cursor:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.FriendList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}addFriends(e,t,n,s={}){let c="/mezon.api.Mezon/AddFriends",i=r.AddFriendsRequest.encode(r.AddFriendsRequest.fromPartial({ids:t,usernames:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.AddFriendsResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}blockFriends(e,t,n,s={}){let c="/mezon.api.Mezon/BlockFriends",i=r.BlockFriendsRequest.encode(r.BlockFriendsRequest.fromPartial({ids:t,usernames:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}unblockFriends(e,t,n,s={}){let c="/mezon.api.Mezon/UnblockFriends",i=r.BlockFriendsRequest.encode(r.BlockFriendsRequest.fromPartial({ids:t,usernames:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}getChannelCategoryNotiSettingsList(e,t,n={}){let s="/mezon.api.Mezon/GetChannelCategoryNotiSettingsList",d=r.NotificationClan.encode(r.NotificationClan.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotificationChannelCategorySettingList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getUserProfileOnClan(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetUserProfileOnClan",d=r.ClanProfileRequest.encode(r.ClanProfileRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ClanProfile.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getNotificationCategory(e,t,n={}){let s="/mezon.api.Mezon/GetNotificationCategory",d=r.DefaultNotificationCategory.encode(r.DefaultNotificationCategory.fromPartial({category_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotificationUserChannel.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getNotificationChannel(e,t,n={}){let s="/mezon.api.Mezon/GetNotificationChannel",d=r.NotificationChannel.encode(r.NotificationChannel.fromPartial({channel_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotificationUserChannel.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getNotificationClan(e,t,n={}){let s="/mezon.api.Mezon/GetNotificationClan",d=r.NotificationClan.encode(r.NotificationClan.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotificationSetting.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getNotificationReactMessage(e,t,n={}){let s="/mezon.api.Mezon/GetNotificationReactMessage",d=r.NotifiReactMessage.encode(r.NotifiReactMessage.fromPartial({channel_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.NotifiReactMessage.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}giveMeACoffee(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GiveMeACoffee",d=r.GiveCoffeeEvent.encode(r.GiveCoffeeEvent.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getKeyServer(e,t={}){let n="/mezon.api.Mezon/GetKeyServer",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.GetKeyServerResp.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}createLinkInviteUser(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateLinkInviteUser",d=r.LinkInviteUserRequest.encode(r.LinkInviteUserRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.LinkInviteUser.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}inviteUser(e,t,n={}){if(t==null)throw new Error("'inviteId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/InviteUser",d=r.InviteUserRequest.encode(r.InviteUserRequest.fromPartial({invite_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.InviteUserRes.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getLinkInvite(e,t,n,s={}){if(n==null)throw new Error("'inviteId' is a required parameter but is null or undefined.");let c="/v2/invite/{inviteId}".replace("{inviteId}",encodeURIComponent(String(n))),d=new Map,i="",o=this.buildFullUrl(this.basePath,c,d),a=m("GET",s,i);return e&&(a.headers.Authorization="Basic "+M(e+":"+t)),a.headers.Accept="application/x-protobuf",a.headers["Content-Type"]="application/json",Promise.race([fetch(o,a).then(u=>l(this,null,function*(){let h=yield u.arrayBuffer();return r.InviteUserRes.decode(new Uint8Array(h))})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}listChannelByUserId(e,t={}){let n="/mezon.api.Mezon/ListChannelByUserId",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.ChannelDescList.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}markAsRead(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/MarkAsRead",d=r.MarkAsReadRequest.encode(r.MarkAsReadRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listMezonOauthClient(e,t={}){let n="/mezon.api.Mezon/ListMezonOauthClient",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.MezonOauthClientList.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}setMuteCategory(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetMuteCategory",d=r.SetMuteRequest.encode(r.SetMuteRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}setMuteChannel(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetMuteChannel",d=r.SetMuteRequest.encode(r.SetMuteRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteNotifications(e,t,n,s={}){let c="/mezon.api.Mezon/DeleteNotifications",i=r.DeleteNotificationsRequest.encode(r.DeleteNotificationsRequest.fromPartial({ids:t||[],category:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listNotifications(e,t,n,s,c,d,i={}){let o="/mezon.api.Mezon/ListNotifications",u=r.ListNotificationsRequest.encode(r.ListNotificationsRequest.fromPartial({limit:t,clan_id:n,notification_id:s,category:c,direction:d})).finish(),h=m("POST",i,"");return h.body=u,e&&(h.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:o,fetchOptions:h}).then(g=>l(this,null,function*(){return r.NotificationList.decode(g)})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])}setNotificationChannelSetting(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetNotificationChannelSetting",d=r.SetNotificationRequest.encode(r.SetNotificationRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}setNotificationClanSetting(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetNotificationClanSetting",d=r.SetDefaultNotificationRequest.encode(r.SetDefaultNotificationRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}setNotificationCategorySetting(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetNotificationCategorySetting",d=r.SetNotificationRequest.encode(r.SetNotificationRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}deleteNotificationCategorySetting(e,t,n={}){let s="/mezon.api.Mezon/DeleteNotificationCategorySetting",d=r.DefaultNotificationCategory.encode(r.DefaultNotificationCategory.fromPartial({category_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}deleteNotificationChannel(e,t,n={}){let s="/mezon.api.Mezon/DeleteNotificationChannel",d=r.NotificationChannel.encode(r.NotificationChannel.fromPartial({channel_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}deleteNotiReactMessage(e,t,n={}){let s="/mezon.api.Mezon/DeleteNotiReactMessage",d=r.NotificationChannel.encode(r.NotificationChannel.fromPartial({channel_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}setNotificationReactMessage(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetNotificationReactMessage",d=r.NotificationChannel.encode(r.NotificationChannel.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}setRoleChannelPermission(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SetRoleChannelPermission",d=r.UpdateRoleChannelRequest.encode(r.UpdateRoleChannelRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}getListPermission(e,t={}){let n="/mezon.api.Mezon/GetListPermission",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.PermissionList.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}getPermissionByRoleIdChannelId(e,t,n,s,c={}){let d="/mezon.api.Mezon/GetPermissionByRoleIdChannelId",o=r.PermissionRoleChannelListEventRequest.encode(r.PermissionRoleChannelListEventRequest.fromPartial({role_id:t,channel_id:n,user_id:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.PermissionRoleChannelListEventResponse.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}deletePinMessage(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/DeletePinMessage",a=r.DeletePinMessage.encode(r.DeletePinMessage.fromPartial({id:t,message_id:n,channel_id:s,clan_id:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>h),new Promise((h,g)=>setTimeout(g,this.timeoutMs,"Request timed out."))])}getPinMessagesList(e,t,n,s,c={}){let d="/mezon.api.Mezon/GetPinMessagesList",o=r.PinMessageRequest.encode(r.PinMessageRequest.fromPartial({message_id:t,channel_id:n,clan_id:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return r.PinMessagesList.decode(u)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}createMessage2Inbox(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateMessage2Inbox",d=r.Message2InboxRequest.encode(r.Message2InboxRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ChannelMessageHeader.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createPinMessage(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreatePinMessage",d=r.PinMessageRequest.encode(r.PinMessageRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ChannelMessageHeader.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getPubKeys(e,t,n={}){let s="/mezon.api.Mezon/GetPubKeys",d=r.GetPubKeysRequest.encode(r.GetPubKeysRequest.fromPartial({user_ids:t||[]})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.GetPubKeysResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}pushPubKey(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/PushPubKey",d=r.PushPubKeyRequest.encode(r.PushPubKeyRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}addRolesChannelDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddRolesChannelDesc",d=r.AddRoleChannelDescRequest.encode(r.AddRoleChannelDescRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}changeChannelCategory(e,t,n,s={}){if(t==null)throw new Error("'newCategoryId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/ChangeChannelCategory",i=r.ChangeChannelCategoryRequest.encode(r.ChangeChannelCategoryRequest.fromPartial(E(w({},n),{new_category_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}deleteRoleChannelDesc(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DeleteRoleChannelDesc",d=r.DeleteRoleRequest.encode(r.DeleteRoleRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listRoles(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/ListRoles",a=r.RoleListEventRequest.encode(r.RoleListEventRequest.fromPartial({clan_id:t,limit:n,state:s,cursor:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.RoleListEventResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}createRole(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateRole",d=r.CreateRoleRequest.encode(r.CreateRoleRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.Role.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateRoleDelete(e,t,n,s={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteRole",i=r.DeleteRoleRequest.encode(r.DeleteRoleRequest.fromPartial(E(w({},n),{role_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}deleteRole(e,t,n,s,c,d={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");let i="/mezon.api.Mezon/DeleteRole",a=r.DeleteRoleRequest.encode(r.DeleteRoleRequest.fromPartial({role_id:t,channel_id:n,clan_id:s,role_label:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>h),new Promise((h,g)=>setTimeout(g,this.timeoutMs,"Request timed out."))])}updateRole(e,t,n,s={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateRole",i=r.UpdateRoleRequest.encode(r.UpdateRoleRequest.fromPartial(E(w({},n),{role_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listRolePermissions(e,t,n={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListRolePermissions",d=r.ListPermissionsRequest.encode(r.ListPermissionsRequest.fromPartial({role_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.PermissionList.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listRoleUsers(e,t,n,s,c={}){if(t==null)throw new Error("'roleId' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/ListRoleUsers",o=r.ListRoleUsersRequest.encode(r.ListRoleUsersRequest.fromPartial({role_id:t,limit:n,cursor:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.RoleUserList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}getRoleOfUserInTheClan(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/GetRoleOfUserInTheClan",i=r.ListPermissionOfUsersRequest.encode(r.ListPermissionOfUsersRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.RoleList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}searchThread(e,t,n,s,c={}){let d="/mezon.api.Mezon/SearchThread",o=r.SearchThreadRequest.encode(r.SearchThreadRequest.fromPartial({clan_id:t,channel_id:n,label:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ChannelDescList.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}sendToken(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SendToken",d=r.TokenSentEvent.encode(r.TokenSentEvent.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}sessionLogout(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/SessionLogout",d=r.SessionLogoutRequest.encode(r.SessionLogoutRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}addClanSticker(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddClanSticker",d=r.ClanStickerAddRequest.encode(r.ClanStickerAddRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteClanStickerById(e,t,n,s,c={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/DeleteClanStickerById",o=r.ClanStickerDeleteRequest.encode(r.ClanStickerDeleteRequest.fromPartial({id:t,clan_id:n,sticker_label:s})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return{}})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}updateClanStickerById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateClanStickerById",i=r.ClanStickerUpdateByIdRequest.encode(r.ClanStickerUpdateByIdRequest.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}getListStickersByUserId(e,t={}){let n="/mezon.api.Mezon/GetListStickersByUserId",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.StickerListedResponse.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}registerStreamingChannel(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/RegisterStreamingChannel",d=r.RegisterStreamingChannelRequest.encode(r.RegisterStreamingChannelRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.RegisterStreamingChannelResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listStreamingChannelUsers(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/ListStreamingChannelUsers",h=r.ListChannelUsersRequest.encode(r.ListChannelUsersRequest.fromPartial({clan_id:t,channel_id:n,channel_type:s,limit:c,state:d,cursor:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return f.code!=0?{}:r.StreamingChannelUserList.decode(f.message)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}getSystemMessagesList(e,t={}){let n="/mezon.api.Mezon/GetSystemMessagesList",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.SystemMessagesList.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}createSystemMessage(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateSystemMessage",d=r.SystemMessageRequest.encode(r.SystemMessageRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listSdTopic(e,t,n,s={}){let c="/mezon.api.Mezon/ListSdTopic",i=r.ListSdTopicRequest.encode(r.ListSdTopicRequest.fromPartial({clan_id:t,limit:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.SdTopicList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}createSdTopic(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateSdTopic",d=r.SdTopicRequest.encode(r.SdTopicRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.SdTopic.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteSystemMessage(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DeleteSystemMessage",d=r.DeleteSystemMessage.encode(r.DeleteSystemMessage.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getSystemMessageByClanId(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetSystemMessageByClanId",d=r.GetSystemMessage.encode(r.GetSystemMessage.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.SystemMessage.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateSystemMessage(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateSystemMessage",i=r.SystemMessageRequest.encode(r.SystemMessageRequest.fromPartial(E(w({},n),{clan_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listThreadDescs(e,t,n,s,c,d,i,o={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let a="/mezon.api.Mezon/ListThreadDescs",h=r.ListThreadRequest.encode(r.ListThreadRequest.fromPartial({channel_id:t,limit:n,state:s,clan_id:c,thread_id:d,page:i})).finish(),g=m("POST",o,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:g}).then(f=>l(this,null,function*(){return f.code!=0?{}:r.ChannelDescListNoPool.decode(f.message)})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}updateCategory(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateCategory",i=r.UpdateCategoryDescRequest.encode(r.UpdateCategoryDescRequest.fromPartial(E(w({},n),{clan_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}updateChannelPrivate(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateChannelPrivate",d=r.ChangeChannelPrivateRequest.encode(r.ChangeChannelPrivateRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateUserProfileByClan(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateUserProfileByClan",i=r.UpdateClanProfileRequest.encode(r.UpdateClanProfileRequest.fromPartial(E(w({},n),{clan_id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}uploadOauthFile(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UploadOauthFile",d=r.UploadAttachmentRequest.encode(r.UploadAttachmentRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.UploadAttachment.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}uploadAttachmentFile(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UploadAttachmentFile",d=r.UploadAttachmentRequest.encode(r.UploadAttachmentRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.UploadAttachment.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}multipartUploadAttachmentFile(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/MultipartUploadAttachmentFileStart",d=r.UploadAttachmentRequest.encode(r.UploadAttachmentRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.MultipartUploadAttachment.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}multipartUploadAttachmentFileFinsih(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/MultipartUploadAttachmentFileStart",d=r.MultipartUploadAttachmentFinishRequest.encode(r.MultipartUploadAttachmentFinishRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateUser(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateUser",d=r.UpdateUsersRequest.encode(r.UpdateUsersRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listUserClansByUserId(e,t={}){let n="/mezon.api.Mezon/ListUserClansByUserId",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.AllUserClans.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}listUserPermissionInChannel(e,t,n,s={}){let c="/mezon.api.Mezon/ListUserPermissionInChannel",i=r.UserPermissionInChannelListRequest.encode(r.UserPermissionInChannelListRequest.fromPartial({clan_id:t,channel_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.UserPermissionInChannelListResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}getUserStatus(e,t={}){let n="/mezon.api.Mezon/GetUserStatus",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.UserStatus.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}updateUserStatus(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateUserStatus",d=r.UserStatusUpdate.encode(r.UserStatusUpdate.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}updateUserCustomStatus(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateUserCustomStatus",d=r.UserStatusUpdate.encode(r.UserStatusUpdate.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}generateWebhook(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GenerateWebhook",d=r.WebhookCreateRequest.encode(r.WebhookCreateRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.WebhookGenerateResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateWebhookById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateWebhookById",i=r.WebhookUpdateRequestById.encode(r.WebhookUpdateRequestById.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}listWebhookByChannelId(e,t,n,s={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/ListWebhookByChannelId",i=r.WebhookListRequest.encode(r.WebhookListRequest.fromPartial({channel_id:t,clan_id:n||""})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.WebhookListResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}deleteWebhookById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteWebhookById",i=r.WebhookDeleteRequestById.encode(r.WebhookDeleteRequestById.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}buildFullUrl(e,t,n){let s=e+t+"?";for(let[c,d]of n)d instanceof Array?s+=d.reduce((i,o)=>i+encodeURIComponent(c)+"="+encodeURIComponent(o)+"&",""):d!=null&&(s+=encodeURIComponent(c)+"="+encodeURIComponent(d)+"&");return s}editChannelCanvases(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/EditChannelCanvases",d=r.EditChannelCanvasRequest.encode(r.EditChannelCanvasRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.EditChannelCanvasResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getChannelCanvasDetail(e,t,n,s,c={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/GetChannelCanvasDetail",o=r.ChannelCanvasDetailRequest.encode(r.ChannelCanvasDetailRequest.fromPartial({id:t,clan_id:n||"",channel_id:s||""})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.ChannelCanvasDetailResponse.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}deleteChannelCanvas(e,t,n,s,c={}){if(t==null)throw new Error("'canvasId' is a required parameter but is null or undefined.");let d="/mezon.api.Mezon/DeleteChannelCanvas",o=r.DeleteChannelCanvasRequest.encode(r.DeleteChannelCanvasRequest.fromPartial({canvas_id:t,clan_id:n||"",channel_id:s||""})).finish(),a=m("POST",c,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}listOnboarding(e,t,n,s,c,d={}){let i="/mezon.api.Mezon/ListOnboarding",a=r.ListOnboardingRequest.encode(r.ListOnboardingRequest.fromPartial({clan_id:t,guide_type:n,limit:s,page:c})).finish(),u=m("POST",d,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:i,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.ListOnboardingResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}createOnboarding(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateOnboarding",d=r.CreateOnboardingRequest.encode(r.CreateOnboardingRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListOnboardingResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteOnboarding(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteOnboarding",i=r.OnboardingRequest.encode(r.OnboardingRequest.fromPartial({id:t,clan_id:n})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}getOnboardingDetail(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/GetOnboardingDetail",i=r.OnboardingRequest.encode(r.OnboardingRequest.fromPartial({id:t,clan_id:n||""})).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.OnboardingItem.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}updateOnboarding(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateOnboarding",i=r.UpdateOnboardingRequest.encode(r.UpdateOnboardingRequest.fromPartial(E(w({},n),{id:t}))).finish(),o=m("POST",s,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:o}).then(a=>a),new Promise((a,u)=>setTimeout(u,this.timeoutMs,"Request timed out."))])}generateClanWebhook(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GenerateClanWebhook",d=r.GenerateClanWebhookRequest.encode(r.GenerateClanWebhookRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.GenerateClanWebhookResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}listClanWebhook(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListClanWebhook",d=r.ListClanWebhookRequest.encode(r.ListClanWebhookRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.ListClanWebhookResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}deleteClanWebhookById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/DeleteClanWebhookById",d={id:t,clan_id:n},o=r.ClanWebhookRequest.encode(r.ClanWebhookRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}updateClanWebhookById(e,t,n,s={}){if(t==null)throw new Error("'id' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateClanWebhookById",d=E(w({},n),{id:t}),o=r.UpdateClanWebhookRequest.encode(r.UpdateClanWebhookRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}getTopicDetail(e,t,n={}){let s="/mezon.api.Mezon/GetTopicDetail",c={topic_id:t},i=r.SdTopicDetailRequest.encode(r.SdTopicDetailRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.SdTopic.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listOnboardingStep(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListOnboardingStep",i={clan_id:t,limit:n,page:s},a=r.ListOnboardingStepRequest.encode(r.ListOnboardingStepRequest.fromPartial(i)).finish(),u=m("POST",c,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.ListOnboardingStepResponse.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}updateOnboardingStepByClanId(e,t,n,s={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");if(n==null)throw new Error("'body' is a required parameter but is null or undefined.");let c="/mezon.api.Mezon/UpdateOnboardingStep",d=E(w({},n),{clan_id:t}),o=r.UpdateOnboardingStepRequest.encode(r.UpdateOnboardingStepRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}createRoomChannelApps(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateRoomChannelApps",d=r.CreateRoomChannelApps.encode(r.CreateRoomChannelApps.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.CreateRoomChannelApps.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}generateMeetToken(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GenerateMeetToken",d=r.GenerateMeetTokenRequest.encode(r.GenerateMeetTokenRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.GenerateMeetTokenResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}getMezonOauthClient(e,t,n,s={}){let c="/mezon.api.Mezon/GetMezonOauthClient",d={client_id:t,client_name:n},o=r.GetMezonOauthClientRequest.encode(r.GetMezonOauthClientRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>l(this,null,function*(){return u.code!=0?{}:r.MezonOauthClient.decode(u.message)})),new Promise((u,h)=>setTimeout(()=>h(new Error("Request timed out.")),this.timeoutMs))])}updateMezonOauthClient(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateMezonOauthClient",d=r.MezonOauthClient.encode(r.MezonOauthClient.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.MezonOauthClient.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}generateHashChannelApps(e,t,n={}){let s="/mezon.api.Mezon/GenerateHashChannelApps",c={app_id:t},i=r.GenerateHashChannelAppsRequest.encode(r.GenerateHashChannelAppsRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.GenerateHashChannelAppsResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}addUserEvent(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddUserEvent",d=r.UserEventRequest.encode(r.UserEventRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}deleteUserEvent(e,t,n,s={}){let c="/mezon.api.Mezon/DeleteUserEvent",d={clan_id:t,event_id:n},o=r.UserEventRequest.encode(r.UserEventRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}updateRoleOrder(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateRoleOrder",d=r.UpdateRoleOrderRequest.encode(r.UpdateRoleOrderRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}createExternalMezonMeet(e,t={}){let n="/mezon.api.Mezon/CreateExternalMezonMeet",s=m("POST",t,"");return e&&(s.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return c.code!=0?{}:r.GenerateMezonMeetResponse.decode(c.message)})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])}generateMeetTokenExternal(e,t,n,s,c,d,i={}){if(n==null)throw new Error("'token' is a required parameter but is null or undefined.");let o="/v2/meet/external/{token}".replace("{token}",encodeURIComponent(String(n))),a=new Map;a.set("username",s),a.set("metadata",c),a.set("is_guest",d);let u="",h=this.buildFullUrl(t,o,a),g=m("POST",i,u);return e&&(g.headers.Authorization="Bearer "+e),g.headers.Accept="application/x-protobuf",g.headers["Content-Type"]="application/json",Promise.race([fetch(h,g).then(f=>l(this,null,function*(){let A=yield f.arrayBuffer();return r.GenerateMeetTokenExternalResponse.decode(new Uint8Array(A))})),new Promise((f,A)=>setTimeout(()=>A(new Error("Request timed out.")),this.timeoutMs))])}muteParticipantMezonMeet(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/MuteParticipantMezonMeet",d=r.MeetParticipantRequest.encode(r.MeetParticipantRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}removeParticipantMezonMeet(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/RemoveParticipantMezonMeet",d=r.MeetParticipantRequest.encode(r.MeetParticipantRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listChannelDetail(e,t,n={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListChannelDetail",c={channel_id:t},i=r.ListChannelDetailRequest.encode(r.ListChannelDetailRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.ChannelDescription.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}listChannelTimeline(e,t,n={}){if(!t)throw new Error("'request' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListChannelTimeline",d=r.ListChannelTimelineRequest.encode(r.ListChannelTimelineRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.ListChannelTimelineResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}createChannelTimeline(e,t,n={}){if(!t)throw new Error("'request' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreateChannelTimeline",d=r.CreateChannelTimelineRequest.encode(r.CreateChannelTimelineRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.CreateChannelTimelineResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateChannelTimeline(e,t,n={}){if(!t)throw new Error("'request' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateChannelTimeline",d=r.UpdateChannelTimelineRequest.encode(r.UpdateChannelTimelineRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.UpdateChannelTimelineResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}detailChannelTimeline(e,t,n={}){if(!t)throw new Error("'request' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/DetailChannelTimeline",d=r.ChannelTimelineDetailRequest.encode(r.ChannelTimelineDetailRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.ChannelTimelineDetailResponse.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}updateClanOrder(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateClanOrder",d=r.UpdateClanOrderRequest.encode(r.UpdateClanOrderRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}clanDiscover(e,t,n,s,c={}){if(s==null)throw new Error("'body' is a required parameter but is null or undefined.");let d="/v2/clan/discover",i=new Map,o="";o=JSON.stringify(s||{});let a=this.buildFullUrl(n,d,i),u=m("POST",c,o);return e&&(u.headers.Authorization="Basic "+M(e+":"+t)),u.headers.Accept="application/x-protobuf",u.headers["Content-Type"]="application/json",Promise.race([fetch(a,u).then(h=>l(this,null,function*(){let g=yield h.arrayBuffer();return r.ListClanDiscover.decode(new Uint8Array(g))})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}deleteQuickMenuAccess(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/DeleteQuickMenuAccess",u={id:t,clan_id:n,bot_id:s,menu_name:c,background:d,action_msg:i},g=r.QuickMenuAccess.encode(r.QuickMenuAccess.fromPartial(u)).finish(),f=m("POST",o,"");return f.body=g,e&&(f.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:f}).then(A=>A),new Promise((A,y)=>setTimeout(y,this.timeoutMs,"Request timed out."))])}listQuickMenuAccess(e,t,n,s,c={}){let d="/mezon.api.Mezon/ListQuickMenuAccess",i={bot_id:t,channel_id:n,menu_type:s},a=r.ListQuickMenuAccessRequest.encode(r.ListQuickMenuAccessRequest.fromPartial(i)).finish(),u=m("POST",c,"");return u.body=a,e&&(u.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:d,fetchOptions:u}).then(h=>l(this,null,function*(){return h.code!=0?{}:r.QuickMenuAccessList.decode(h.message)})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}addQuickMenuAccess(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/AddQuickMenuAccess",d=r.QuickMenuAccess.encode(r.QuickMenuAccess.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}updateQuickMenuAccess(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateQuickMenuAccess",d=r.QuickMenuAccess.encode(r.QuickMenuAccess.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}listForSaleItems(e,t,n={}){let s="/mezon.api.Mezon/ListForSaleItems",c={page:t},i=r.ListForSaleItemsRequest.encode(r.ListForSaleItemsRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.ForSaleItemList.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}isFollower(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/IsFollower",d=r.IsFollowerRequest.encode(r.IsFollowerRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.IsFollowerResponse.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}transferOwnership(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/TransferOwnership",d=r.TransferOwnershipRequest.encode(r.TransferOwnershipRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>o),new Promise((o,a)=>setTimeout(a,this.timeoutMs,"Request timed out."))])}updateUsername(e,t,n={}){if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/UpdateUsername",d=r.UpdateUsernameRequest.encode(r.UpdateUsernameRequest.fromPartial(t)).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return o.code!=0?{}:r.Session.decode(o.message)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}isBanned(e,t,n={}){if(t==null)throw new Error("'channelId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/IsBanned",c={channel_id:t},i=r.IsBannedRequest.encode(r.IsBannedRequest.fromPartial(c)).finish(),o=m("POST",n,"");return o.body=i,e&&(o.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:o}).then(a=>l(this,null,function*(){return a.code!=0?{}:r.IsBannedResponse.decode(a.message)})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])}reportMessageAbuse(e,t,n,s={}){let c="/mezon.api.Mezon/ReportMessageAbuse",d={message_id:t,abuse_type:n},o=r.ReportMessageAbuseReqest.encode(r.ReportMessageAbuseReqest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}sendChannelMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A){let y="/mezon.api.Mezon/SendChannelMessage",S=r.ChannelMessageSend.encode(r.ChannelMessageSend.fromPartial({clan_id:t,channel_id:n,mode:s,is_public:c,content:d,mentions:i,attachments:o,references:a,anonymous_message:u,mention_everyone:h,avatar:g,code:f,topic_id:A})).finish(),v=m("POST",{},"");return v.body=S,e&&(v.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:y,fetchOptions:v}).then(q=>l(this,null,function*(){return r.ChannelMessageAck.decode(q)})),new Promise((q,W)=>setTimeout(()=>W(new Error("Request timed out.")),this.timeoutMs))])}updateChannelMessage(e,t,n,s,c,d,i,o,a,u,h,g){let f="/mezon.api.Mezon/UpdateChannelMessage",y=r.ChannelMessageUpdate.encode(r.ChannelMessageUpdate.fromPartial({clan_id:t,channel_id:n,message_id:d,mode:s,is_public:c,content:i,mentions:o,attachments:a,hide_editted:u,topic_id:h,is_update_msg_topic:g})).finish(),C=m("POST",{},"");return C.body=y,e&&(C.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:f,fetchOptions:C}).then(S=>l(this,null,function*(){return S.code!=0?{}:r.ChannelMessageUpdate.decode(S.message)})),new Promise((S,v)=>setTimeout(()=>v(new Error("Request timed out.")),this.timeoutMs))])}deleteChannelMessage(e,t,n,s,c,d,i,o,a,u){let h="/mezon.api.Mezon/DeleteChannelMessage",f=r.ChannelMessageRemove.encode(r.ChannelMessageRemove.fromPartial({clan_id:t,channel_id:n,message_id:d,mode:s,is_public:c,has_attachment:i,mentions:a,references:u,topic_id:o})).finish(),A=m("POST",{},"");return A.body=f,e&&(A.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:h,fetchOptions:A}).then(y=>l(this,null,function*(){return y.code!=0?{}:r.ChannelMessageRemove.decode(y.message)})),new Promise((y,C)=>setTimeout(()=>C(new Error("Request timed out.")),this.timeoutMs))])}updateMezonVoiceState(e,t,n,s,c,d,i={}){let o="/mezon.api.Mezon/UpdateMezonVoiceState",a={clan_id:t,channel_id:n,display_name:s,room_name:c,state:d},h=r.HandleParticipantMeetStateEvent.encode(r.HandleParticipantMeetStateEvent.fromPartial(a)).finish(),g=m("POST",i,"");return g.body=h,e&&(g.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:o,fetchOptions:g}).then(f=>f),new Promise((f,A)=>setTimeout(A,this.timeoutMs,"Request timed out."))])}messageButtonClick(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/MessageButtonClick",u={message_id:t,channel_id:n,button_id:s,sender_id:c,user_id:d,extra_data:i},g=r.MessageButtonClicked.encode(r.MessageButtonClicked.fromPartial(u)).finish(),f=m("POST",o,"");return f.body=g,e&&(f.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:f}).then(A=>A),new Promise((A,y)=>setTimeout(y,this.timeoutMs,"Request timed out."))])}dropdownBoxSelected(e,t,n,s,c,d,i,o={}){let a="/mezon.api.Mezon/DropdownBoxSelected",u={message_id:t,channel_id:n,selectbox_id:s,sender_id:c,user_id:d,values:i},g=r.DropdownBoxSelected.encode(r.DropdownBoxSelected.fromPartial(u)).finish(),f=m("POST",o,"");return f.body=g,e&&(f.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:a,fetchOptions:f}).then(A=>A),new Promise((A,y)=>setTimeout(y,this.timeoutMs,"Request timed out."))])}activeArchivedThread(e,t,n,s={}){let c="/mezon.api.Mezon/ActiveArchivedThread",d={clan_id:t,channel_id:n},o=r.ActiveArchivedThread.encode(r.ActiveArchivedThread.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}addAgentToChannel(e,t,n,s={}){let c="/mezon.api.Mezon/AddAgentToChannel",d={room_name:t,channel_id:n},o=r.UpdateAIAgentRequest.encode(r.UpdateAIAgentRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}disconnectAgent(e,t,n,s={}){let c="/mezon.api.Mezon/DisconnectAgent",d={room_name:t,channel_id:n},o=r.UpdateAIAgentRequest.encode(r.UpdateAIAgentRequest.fromPartial(d)).finish(),a=m("POST",s,"");return a.body=o,e&&(a.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:c,fetchOptions:a}).then(u=>u),new Promise((u,h)=>setTimeout(h,this.timeoutMs,"Request timed out."))])}listMutedChannel(e,t,n={}){if(t==null)throw new Error("'clanId' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ListMutedChannel",d=r.ListMutedChannelRequest.encode(r.ListMutedChannelRequest.fromPartial({clan_id:t})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(o=>l(this,null,function*(){return r.MutedChannelList.decode(o)})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])}channelMessageReact(e,t,n,s,c,d,i,o,a,u,h,g,f,A){let y="/mezon.api.Mezon/ReactChannelMessage",S=r.MessageReaction.encode(r.MessageReaction.fromPartial({clan_id:t,channel_id:n,mode:s,is_public:c,message_id:d,emoji_id:i,emoji:o,count:a,message_sender_id:u,action:h,emoji_recent_id:f,sender_name:A,topic_id:g})).finish(),v=m("POST",{},"");return v.body=S,e&&(v.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:y,fetchOptions:v}).then(q=>l(this,null,function*(){return r.ChannelMessageSend.decode(q)})),new Promise((q,W)=>setTimeout(()=>W(new Error("Request timed out.")),this.timeoutMs))])}createPoll(e,t,n={}){var o,a,u,h,g,f;if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/CreatePoll",d=r.CreatePollRequest.encode(r.CreatePollRequest.fromPartial({channel_id:(o=t.channel_id)!=null?o:"0",clan_id:(a=t.clan_id)!=null?a:"0",question:(u=t.question)!=null?u:"",answers:(h=t.answers)!=null?h:[],expire_hours:(g=t.expire_hours)!=null?g:0,type:(f=t.type)!=null?f:0})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(A=>l(this,null,function*(){let y=r.CreatePollResponse.decode(A);return{poll_id:y.poll_id,message_id:y.message_id,question:y.question,answers:y.answers.map(C=>({index:C.index,label:C.label})),answer_counts:y.answer_counts,exp:y.exp,is_closed:y.is_closed,creator_id:y.creator_id,type:y.type,total_votes:y.total_votes}})),new Promise((A,y)=>setTimeout(()=>y(new Error("Request timed out.")),this.timeoutMs))])}votePoll(e,t,n={}){var o,a,u,h;if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/VotePoll",d=r.VotePollRequest.encode(r.VotePollRequest.fromPartial({poll_id:(o=t.poll_id)!=null?o:"0",message_id:(a=t.message_id)!=null?a:"0",channel_id:(u=t.channel_id)!=null?u:"0",answer_indices:(h=t.answer_indices)!=null?h:[]})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(g=>l(this,null,function*(){var A;let f=g.length>0?r.VotePollResponse.decode(g):{my_answer_indices:[]};return{my_answer_indices:Array.from((A=f.my_answer_indices)!=null?A:[])}})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])}closePoll(e,t,n={}){var o,a,u;if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/ClosePoll",d=r.ClosePollRequest.encode(r.ClosePollRequest.fromPartial({poll_id:(o=t.poll_id)!=null?o:"0",message_id:(a=t.message_id)!=null?a:"0",channel_id:(u=t.channel_id)!=null?u:"0"})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(h=>{if(h.status==204||h.status>=200&&h.status<300)return{};throw h}),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}getPoll(e,t,n={}){var o,a,u;if(t==null)throw new Error("'body' is a required parameter but is null or undefined.");let s="/mezon.api.Mezon/GetPoll",d=r.GetPollRequest.encode(r.GetPollRequest.fromPartial({poll_id:(o=t.poll_id)!=null?o:"0",message_id:(a=t.message_id)!=null?a:"0",channel_id:(u=t.channel_id)!=null?u:"0"})).finish(),i=m("POST",n,"");return i.body=d,e&&(i.headers.Authorization="Bearer "+e),Promise.race([this.send({urlPath:s,fetchOptions:i}).then(h=>l(this,null,function*(){let g=r.GetPollResponse.decode(h);return{poll_id:g.poll_id,message_id:g.message_id,question:g.question,answers:g.answers.map(f=>({index:f.index,label:f.label})),answer_counts:g.answer_counts,exp:g.exp,is_closed:g.is_closed,creator_id:g.creator_id,type:g.type,total_votes:g.total_votes,voter_details:g.voter_details.map(f=>({answer_index:f.answer_index,user_ids:f.user_ids}))}})),new Promise((h,g)=>setTimeout(()=>g(new Error("Request timed out.")),this.timeoutMs))])}followUsers(e){return l(this,null,function*(){let t="",n={status_follow:{user_ids:e}};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return{}})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])})}joinClanChat(e){return l(this,null,function*(){let t="",n={clan_join:{clan_id:e}};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return{}})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])})}follower(){return l(this,null,function*(){let e="",t={follow_event:{}};return Promise.race([this.send({urlPath:e,fetchOptions:t}).then(n=>l(this,null,function*(){return{}})),new Promise((n,s)=>setTimeout(()=>s(new Error("Request timed out.")),this.timeoutMs))])})}joinChat(e,t,n,s){return l(this,null,function*(){let c="",d={channel_join:{clan_id:e,channel_id:t,channel_type:n,is_public:s}};return Promise.race([this.send({urlPath:c,fetchOptions:d}).then(i=>l(this,null,function*(){return{}})),new Promise((i,o)=>setTimeout(()=>o(new Error("Request timed out.")),this.timeoutMs))])})}leaveChat(e,t,n,s){let c="",d={channel_leave:{clan_id:e,channel_id:t,channel_type:n,is_public:s}};return Promise.race([this.send({urlPath:c,fetchOptions:d}).then(i=>l(this,null,function*(){return{}})),new Promise((i,o)=>setTimeout(()=>o(new Error("Request timed out.")),this.timeoutMs))])}removeChatMessage(e,t,n,s,c,d,i,o,a){return l(this,null,function*(){let u="",h={channel_message_remove:{clan_id:e,channel_id:t,mode:n,message_id:c,is_public:s,has_attachment:d,topic_id:i,mentions:o,references:a}};return Promise.race([this.send({urlPath:u,fetchOptions:h}).then(g=>l(this,null,function*(){return{}})),new Promise((g,f)=>setTimeout(()=>f(new Error("Request timed out.")),this.timeoutMs))])})}unfollowUsers(e){let t="",n={status_unfollow:{user_ids:e}};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return{}})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])}updateChatMessage(e,t,n,s,c,d,i,o,a,u,h){return l(this,null,function*(){let g="",f={channel_message_update:{clan_id:e,channel_id:t,message_id:c,content:d,mentions:i,attachments:o,mode:n,is_public:s,hide_editted:a,topic_id:u,is_update_msg_topic:h}};return Promise.race([this.send({urlPath:g,fetchOptions:f}).then(A=>l(this,null,function*(){return{}})),new Promise((A,y)=>setTimeout(()=>y(new Error("Request timed out.")),this.timeoutMs))])})}updateStatus(e){let t="",n={status_update:{status:e}};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return{}})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])}writeQuickMenuEvent(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){let y="",C={quick_menu_event:{menu_name:e,message:{clan_id:t,channel_id:n,mode:s,is_public:c,content:d,mentions:i,attachments:o,references:a,anonymous_message:u,mention_everyone:h,avatar:g,code:f,topic_id:A}}};return Promise.race([this.send({urlPath:y,fetchOptions:C}).then(S=>l(this,null,function*(){return{}})),new Promise((S,v)=>setTimeout(()=>v(new Error("Request timed out.")),this.timeoutMs))])})}writeEphemeralMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A,y){return l(this,null,function*(){let C="",S={ephemeral_message_send:{receiver_ids:e,message:{clan_id:t,channel_id:n,mode:s,is_public:c,content:d,mentions:i,attachments:o,references:a,anonymous_message:u,mention_everyone:h,avatar:g,code:f,topic_id:A,id:y}}};return Promise.race([this.send({urlPath:C,fetchOptions:S}).then(v=>l(this,null,function*(){return{}})),new Promise((v,q)=>setTimeout(()=>q(new Error("Request timed out.")),this.timeoutMs))])})}writeChatMessage(e,t,n,s,c,d,i,o,a,u,h,g,f){return l(this,null,function*(){let A="",y={channel_message_send:{clan_id:e,channel_id:t,mode:n,is_public:s,content:c,mentions:d,attachments:i,references:o,anonymous_message:a,mention_everyone:u,avatar:h,code:g,topic_id:f}};return Promise.race([this.send({urlPath:A,fetchOptions:y}).then(C=>l(this,null,function*(){return{}})),new Promise((C,S)=>setTimeout(()=>S(new Error("Request timed out.")),this.timeoutMs))])})}writeMessageReaction(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){let y="",C={message_reaction_event:{id:e,clan_id:t,channel_id:n,mode:s,is_public:c,message_id:d,emoji_id:i,emoji:o,count:a,message_sender_id:u,action:h,topic_id:g,emoji_recent_id:f,sender_name:A}};return Promise.race([this.send({urlPath:y,fetchOptions:C}).then(S=>l(this,null,function*(){return{}})),new Promise((S,v)=>setTimeout(()=>v(new Error("Request timed out.")),this.timeoutMs))])})}writeMessageTyping(e,t,n,s,c,d){return l(this,null,function*(){let i="",o={message_typing_event:{clan_id:e,channel_id:t,mode:n,is_public:s,sender_display_name:c,topic_id:d}};return Promise.race([this.send({urlPath:i,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])})}writeLastSeenMessage(e,t,n,s,c,d){return l(this,null,function*(){let i="",o={last_seen_message_event:{clan_id:e,channel_id:t,mode:n,message_id:s,timestamp_seconds:c,badge_count:d}};return Promise.race([this.send({urlPath:i,fetchOptions:o}).then(a=>l(this,null,function*(){return{}})),new Promise((a,u)=>setTimeout(()=>u(new Error("Request timed out.")),this.timeoutMs))])})}writeLastPinMessage(e,t,n,s,c,d,i,o,a,u,h,g,f){return l(this,null,function*(){let A="",y={last_pin_message_event:{clan_id:e,channel_id:t,mode:n,is_public:s,message_id:c,timestamp_seconds:d,operation:i,message_sender_avatar:o,message_sender_id:a,message_sender_username:u,message_content:h,message_attachment:g,message_created_time:f}};return Promise.race([this.send({urlPath:A,fetchOptions:y}).then(C=>l(this,null,function*(){return{}})),new Promise((C,S)=>setTimeout(()=>S(new Error("Request timed out.")),this.timeoutMs))])})}writeCustomStatus(e,t,n,s){return l(this,null,function*(){let c="",d={custom_status_event:{clan_id:e,status:t,time_reset:n,no_clear:s}};return Promise.race([this.send({urlPath:c,fetchOptions:d}).then(i=>l(this,null,function*(){return{}})),new Promise((i,o)=>setTimeout(()=>o(new Error("Request timed out.")),this.timeoutMs))])})}writeVoiceReaction(e,t){return l(this,null,function*(){let n="",s={voice_reaction_send:{emojis:e,channel_id:t}};return Promise.race([this.send({urlPath:n,fetchOptions:s}).then(c=>l(this,null,function*(){return{}})),new Promise((c,d)=>setTimeout(()=>d(new Error("Request timed out.")),this.timeoutMs))])})}forwardWebrtcSignaling(e,t,n,s,c){return l(this,null,function*(){let d="",i={webrtc_signaling_fwd:{receiver_id:e,data_type:t,json_data:n,channel_id:s,caller_id:c}};return Promise.race([this.send({urlPath:d,fetchOptions:i}).then(o=>l(this,null,function*(){return{}})),new Promise((o,a)=>setTimeout(()=>a(new Error("Request timed out.")),this.timeoutMs))])})}makeCallPush(e,t,n,s){return l(this,null,function*(){let c="",d={incoming_call_push:{receiver_id:e,json_data:t,channel_id:n,caller_id:s}};return Promise.race([this.send({urlPath:c,fetchOptions:d}).then(i=>l(this,null,function*(){return{}})),new Promise((i,o)=>setTimeout(()=>o(new Error("Request timed out.")),this.timeoutMs))])})}writeChannelAppEvent(e,t,n){return l(this,null,function*(){let s="",c={channel_app_event:{clan_id:e,channel_id:t,action:n}};return Promise.race([this.send({urlPath:s,fetchOptions:c}).then(d=>l(this,null,function*(){return{}})),new Promise((d,i)=>setTimeout(()=>i(new Error("Request timed out.")),this.timeoutMs))])})}listDataSocket(e){return l(this,null,function*(){let t="",n={list_data_socket:e};return Promise.race([this.send({urlPath:t,fetchOptions:n}).then(s=>l(this,null,function*(){return s})),new Promise((s,c)=>setTimeout(()=>c(new Error("Request timed out.")),this.timeoutMs))])})}};x.DefaultSendTimeoutMs=1e4;var F=x;var le="127.0.0.1",ue="7350",pe="defaultkey",he=3e4,p={DISCONNECTED:"disconnected",CONNECTING:"connecting",CONNECTED:"connected"},K=!1,z=class z{constructor(e=pe,t=le,n=ue,s=!1,c=null,d=he,i=!0){this.serverkey=e;this.timeout=d;this.autoFallbackHttp=i;this.verbose=!1;this.refreshTokenManager=N.getInstance();this.host=t,this.port=n,this.useSSL=s;let a=`${s?"https://":"http://"}${t}:${n}`;this._heartbeatTimeoutMs=z.DefaultHeartbeatTimeoutMs,this._connectionState=p.DISCONNECTED,this.transport=new F(e,d,c,a)}isOpen(){return this._connectionState===p.CONNECTED}setTransportAdapter(e){this.transport.setTransportAdapter(e)}connect(e,t=!1,n=!1,s=z.DefaultConnectTimeoutMs){if(this.verbose=n,this._connectionState===p.CONNECTED)return Promise.resolve(e);if(this._connectionState===p.CONNECTING&&this._connectPromise)return this._connectPromise;this.clearConnectTimeout(),this._connectionState=p.CONNECTING,this.transport.connect(e,t,n,(d,i)=>l(this,null,function*(){if(!i.cid)if(i.notifications)i.notifications.notifications.forEach(o=>{o.content=o.content?H(o.content):void 0,this.onnotification(o)});else if(i.voice_started_event)this.onvoicestarted(i.voice_started_event);else if(i.voice_ended_event)this.onvoiceended(i.voice_ended_event);else if(i.voice_joined_event)this.onvoicejoined(i.voice_joined_event);else if(i.voice_leaved_event)this.onvoiceleaved(i.voice_leaved_event);else if(i.channel_created_event)this.onchannelcreated(i.channel_created_event);else if(i.category_event)this.oncategoryevent(i.category_event);else if(i.role_event)this.onroleevent(i.role_event);else if(i.event_emoji)this.oneventemoji(i.event_emoji);else if(i.noti_user_channel)this.oneventnotiuserchannel(i.noti_user_channel);else if(i.webhook_event)this.oneventwebhook(i.webhook_event);else if(i.channel_deleted_event)this.onchanneldeleted(i.channel_deleted_event);else if(i.clan_deleted_event)this.onclandeleted(i.clan_deleted_event);else if(i.sticker_create_event)this.onstickercreated(i.sticker_create_event);else if(i.sticker_update_event)this.onstickerupdated(i.sticker_update_event);else if(i.sticker_delete_event)this.onstickerdeleted(i.sticker_delete_event);else if(i.channel_updated_event)this.onchannelupdated(i.channel_updated_event);else if(i.delete_account_event)this.ondeleteaccount(i.delete_account_event);else if(i.clan_profile_updated_event)this.onclanprofileupdated(i.clan_profile_updated_event);else if(i.clan_updated_event)this.onclanupdated(i.clan_updated_event);else if(i.last_seen_message_event)this.onlastseenupdated(i.last_seen_message_event);else if(i.status_presence_event)this.onstatuspresence(i.status_presence_event);else if(i.channel_message){let o=Q(i);this.onchannelmessage(o)}else i.message_typing_event?this.onmessagetyping(i.message_typing_event):i.message_reaction_event?this.onmessagereaction(i.message_reaction_event):i.channel_presence_event?this.onchannelpresence(i.channel_presence_event):i.last_pin_message_event?this.onpinmessage(i.last_pin_message_event):i.custom_status_event?this.oncustomstatus(i.custom_status_event):i.canvas_event?this.oncanvasevent(i.canvas_event):i.user_channel_added_event?this.onuserchanneladded(i.user_channel_added_event):i.add_clan_user_event?this.onuserclanadded(i.add_clan_user_event):i.user_profile_updated_event?this.onuserprofileupdate(i.user_profile_updated_event):i.user_channel_removed_event?this.onuserchannelremoved(i.user_channel_removed_event):i.block_friend?this.onblockfriend(i.block_friend):i.un_block_friend?this.onunblockfriend(i.un_block_friend):i.add_friend?this.onaddfriend(i.add_friend):i.remove_friend?this.onremovefriend(i.remove_friend):i.user_clan_removed_event?this.onuserclanremoved(i.user_clan_removed_event):i.clan_event_created?this.oneventcreated(i.clan_event_created):i.give_coffee_event?this.oncoffeegiven(i.give_coffee_event):i.role_assign_event?this.onroleassign(i.role_assign_event):i.streaming_started_event?this.onstreamingchannelstarted(i.streaming_started_event):i.streaming_ended_event?this.onstreamingchannelended(i.streaming_ended_event):i.streaming_joined_event?this.onstreamingchanneljoined(i.streaming_joined_event):i.streaming_leaved_event?this.onstreamingchannelleaved(i.streaming_leaved_event):i.permission_set_event?this.onpermissionset(i.permission_set_event):i.permission_changed_event?this.onpermissionchanged(i.permission_changed_event):i.unmute_event?this.onunmuteevent(i.unmute_event):i.token_sent_event?this.ontokensent(i.token_sent_event):i.message_button_clicked?this.onmessagebuttonclicked(i.message_button_clicked):i.dropdown_box_selected?this.onmessagedropdownboxselected(i.dropdown_box_selected):i.mark_as_read?this.onmarkasread(i.mark_as_read):i.voice_reaction_send?this.onvoicereactionmessage(i.voice_reaction_send):i.webrtc_signaling_fwd?this.onwebrtcsignalingfwd(i.webrtc_signaling_fwd):i.list_activity?this.onactivityupdated(i.list_activity):i.sd_topic_event?this.onsdtopicevent(i.sd_topic_event):i.channel_app_event?this.onchannelappevent(i.channel_app_event):i.user_status_event?this.onuserstatusevent(i.user_status_event):i.join_channel_app_data?this.onjoinchannelappevent(i.join_channel_app_data):i.unpin_message_event?this.onunpinmessageevent(i.unpin_message_event):i.quick_menu_event?this.onquickmenuevent(i.quick_menu_event):i.meet_participant_event?this.onmeetparticipantevent(i.meet_participant_event):i.transfer_ownership_event?this.ontransferownership(i.transfer_ownership_event):i.ban_user_event?this.onbanneduser(i.ban_user_event):i.list_channel_users_banned_event?this.onlistchannelusersbanned(i.list_channel_users_banned_event):i.allow_anonymous_event?this.onallowanonymousevent(i.allow_anonymous_event):i.aiagent_enabled_event?this.onaiagentenabled(i.aiagent_enabled_event):i.pong?this.verbose&&window&&window.console&&console.log("Pong message received: %o",i):this.verbose&&window&&window.console&&console.log("Unrecognized message received: %o",i)}),d=>l(this,null,function*(){this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.clearConnectTimeout(),this.ondisconnect(d)}));let c=new Promise((d,i)=>{this.transport.setOnOpen(o=>{this.verbose&&window&&window.console&&console.log(o);let a=K;K=!0,this.clearConnectTimeout(),this._connectionState=p.CONNECTED,this.startHeartbeatLoop(),this._connectPromise=void 0,d(e),a&&this.onreconnect(o)}),this.transport.setOnError(o=>{this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.clearConnectTimeout(),this.onerror(o),this._connectPromise=void 0,this.transport.close(),i(o)}),this._connectTimeoutTimer=setTimeout(()=>{this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.transport.close(),this._connectPromise=void 0,i("The socket timed out when trying to connect."),this._connectTimeoutTimer=void 0},s)});return this._connectPromise=c,this._connectPromise}pingPong(){return l(this,null,function*(){if(!this.isOpen()){this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop();return}try{let e="",t={ping:{}};yield this.transport.send({urlPath:e,fetchOptions:t},this._heartbeatTimeoutMs)}catch(e){this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.isOpen()&&(window&&window.console&&console.error("Server unreachable from heartbeat."),this.onheartbeattimeout(),this.transport.close());return}this.startHeartbeatLoop()})}startHeartbeatLoop(){this.stopHeartbeatLoop(),this._heartbeatTimer=setTimeout(()=>this.pingPong(),this._heartbeatTimeoutMs)}stopHeartbeatLoop(){this._heartbeatTimer!==void 0&&(clearTimeout(this._heartbeatTimer),this._heartbeatTimer=void 0)}clearConnectTimeout(){this._connectTimeoutTimer!==void 0&&(clearTimeout(this._connectTimeoutTimer),this._connectTimeoutTimer=void 0)}onreconnect(e){this.verbose&&window&&window.console&&console.log(e)}ondisconnect(e){this.verbose&&window&&window.console&&console.log(e)}onerror(e){this._connectionState=p.DISCONNECTED,this.stopHeartbeatLoop(),this.verbose&&window&&window.console&&console.log(e)}onmessagetyping(e){this.verbose&&window&&window.console&&console.log(e)}onmessagereaction(e){this.verbose&&window&&window.console&&console.log(e)}onchannelmessage(e){this.verbose&&window&&window.console&&console.log(e)}onchannelpresence(e){this.verbose&&window&&window.console&&console.log(e)}onuserchanneladded(e){this.verbose&&window&&window.console&&console.log(e)}onuserclanadded(e){this.verbose&&window&&window.console&&console.log(e)}onuserprofileupdate(e){this.verbose&&window&&window.console&&console.log(e)}onuserchannelremoved(e){this.verbose&&window&&window.console&&console.log(e)}onaddfriend(e){this.verbose&&window&&window.console&&console.log(e)}onremovefriend(e){this.verbose&&window&&window.console&&console.log(e)}onblockfriend(e){this.verbose&&window&&window.console&&console.log(e)}onunblockfriend(e){this.verbose&&window&&window.console&&console.log(e)}onuserclanremoved(e){this.verbose&&window&&window.console&&console.log(e)}onnotification(e){this.verbose&&window&&window.console&&console.log(e)}onstatuspresence(e){this.verbose&&window&&window.console&&console.log(e)}onpinmessage(e){this.verbose&&window&&window.console&&console.log(e)}onvoiceended(e){this.verbose&&window&&window.console&&console.log(e)}onvoicestarted(e){this.verbose&&window&&window.console&&console.log(e)}onvoicejoined(e){this.verbose&&window&&window.console&&console.log(e)}onvoiceleaved(e){this.verbose&&window&&window.console&&console.log(e)}onchannelcreated(e){this.verbose&&window&&window.console&&console.log(e)}oncategoryevent(e){this.verbose&&window&&window.console&&console.log(e)}onroleevent(e){this.verbose&&window&&window.console&&console.log(e)}oneventemoji(e){this.verbose&&window&&window.console&&console.log(e)}oneventnotiuserchannel(e){this.verbose&&window&&window.console&&console.log(e)}oneventwebhook(e){this.verbose&&window&&window.console&&console.log(e)}onchanneldeleted(e){this.verbose&&window&&window.console&&console.log(e)}onclandeleted(e){this.verbose&&window&&window.console&&console.log(e)}onstickercreated(e){this.verbose&&window&&window.console&&console.log(e)}onstickerdeleted(e){this.verbose&&window&&window.console&&console.log(e)}onstickerupdated(e){this.verbose&&window&&window.console&&console.log(e)}onchannelupdated(e){this.verbose&&window&&window.console&&console.log(e)}ondeleteaccount(e){this.verbose&&window&&window.console&&console.log(e)}onclanprofileupdated(e){this.verbose&&window&&window.console&&console.log(e)}onclanupdated(e){this.verbose&&window&&window.console&&console.log(e)}onlastseenupdated(e){this.verbose&&window&&window.console&&console.log(e)}onheartbeattimeout(){this.verbose&&window&&window.console&&console.log("Heartbeat timeout.")}oncustomstatus(e){this.verbose&&window&&window.console&&console.log(e)}oncanvasevent(e){this.verbose&&window&&window.console&&console.log(e)}oneventcreated(e){this.verbose&&window&&window.console&&console.log(e)}oncoffeegiven(e){this.verbose&&window&&window.console&&console.log(e)}onroleassign(e){this.verbose&&window&&window.console&&console.log(e)}onstreamingchannelstarted(e){this.verbose&&window&&window.console&&console.log(e)}onstreamingchannelended(e){this.verbose&&window&&window.console&&console.log(e)}onstreamingchanneljoined(e){this.verbose&&window&&window.console&&console.log(e)}onstreamingchannelleaved(e){this.verbose&&window&&window.console&&console.log(e)}onpermissionset(e){this.verbose&&window&&window.console&&console.log(e)}onpermissionchanged(e){this.verbose&&window&&window.console&&console.log(e)}onunmuteevent(e){this.verbose&&window&&window.console&&console.log(e)}ontokensent(e){this.verbose&&window&&window.console&&console.log(e)}onmessagebuttonclicked(e){this.verbose&&window&&window.console&&console.log(e)}onmessagedropdownboxselected(e){this.verbose&&window&&window.console&&console.log(e)}onmarkasread(e){this.verbose&&window&&window.console&&console.log(e)}onvoicereactionmessage(e){this.verbose&&window&&window.console&&console.log(e)}onwebrtcsignalingfwd(e){this.verbose&&window&&window.console&&console.log(e)}onactivityupdated(e){this.verbose&&window&&window.console&&console.log(e)}onsdtopicevent(e){this.verbose&&window&&window.console&&console.log(e)}onchannelappevent(e){this.verbose&&window&&window.console&&console.log(e)}onuserstatusevent(e){this.verbose&&window&&window.console&&console.log(e)}onjoinchannelappevent(e){this.verbose&&window&&window.console&&console.log(e)}onunpinmessageevent(e){this.verbose&&window&&window.console&&console.log(e)}onquickmenuevent(e){this.verbose&&window&&window.console&&console.log(e)}ontransferownership(e){this.verbose&&window&&window.console&&console.log(e)}onbanneduser(e){this.verbose&&window&&window.console&&console.log(e)}onlistchannelusersbanned(e){this.verbose&&window&&window.console&&console.log(e)}onmeetparticipantevent(e){this.verbose&&window&&window.console&&console.log(e)}onallowanonymousevent(e){this.verbose&&window&&window.console&&console.log(e)}onaiagentenabled(e){this.verbose&&window&&window.console&&console.log(e)}onRefreshSession(e){console.log(`Token refresh occurred. Token: ${e.token}`)}isexpired(e){return e.isexpired(Date.now()/1e3)}authenticateMezon(e,t,n,s,c={},d={}){let i={token:e,vars:c};return this.transport.authenticateMezon(this.serverkey,"",i,t,n,s,d).then(o=>new O(o.token||"",o.refresh_token||"",o.created||!1,o.api_url||"",o.ws_url||"",o.id_token||"",o.is_remember||!1))}authenticateSMSOTPRequest(e,t,n){let s={username:t,account:{phoneno:e,vars:n}};return this.transport.AuthenticateSMSOTPRequest(this.serverkey,"",s,t).then(c=>Promise.resolve(c))}authenticateEmailOTPRequest(e,t,n){let s={username:t,account:{email:e,vars:n}};return this.transport.AuthenticateEmailOTPRequest(this.serverkey,"",s,t).then(c=>Promise.resolve(c))}confirmAuthenticateOTP(e){return l(this,null,function*(){return this.transport.confirmAuthenticateOTP(this.serverkey,"",e).then(t=>new O(t.token||"",t.refresh_token||"",t.created||!1,t.api_url||"",t.ws_url||"",t.id_token||"",t.is_remember||!1))})}authenticateEmail(e,t,n,s){let c={username:n,account:{email:e,password:t,vars:s}};return this.transport.authenticateEmail(this.serverkey,"",c,n).then(d=>new O(d.token||"",d.refresh_token||"",d.created||!1,d.api_url||"",d.ws_url||"",d.id_token||"",d.is_remember||!1))}setBasePath(e,t,n){this.host=e,this.port=t,this.useSSL=n;let c=`${n?"https://":"http://"}${e}:${t}`;return this.transport.setBasePath(c)}addChannelUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addChannelUsers(e.token,t,n).then(s=>s!==void 0)})}addFriends(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addFriends(e.token,t,n)})}blockFriends(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.blockFriends(e.token,t,n).then(s=>Promise.resolve(s!=null))})}unblockFriends(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.unblockFriends(e.token,t,n).then(s=>Promise.resolve(s!=null))})}uploadOauthFile(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.uploadOauthFile(e.token,t)})}uploadAttachmentFile(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.uploadAttachmentFile(e.token,t)})}multipartUploadAttachmentFile(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.multipartUploadAttachmentFile(e.token,t)})}multipartUploadAttachmentFileFinish(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.multipartUploadAttachmentFileFinsih(e.token,t)})}createChannelDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createChannelDesc(e.token,t).then(n=>Promise.resolve(n))})}createClanDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createClanDesc(e.token,t).then(n=>Promise.resolve(n))})}checkDuplicateName(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.checkDuplicateName(e.token,t)})}createCategoryDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createCategoryDesc(e.token,t).then(n=>Promise.resolve(n))})}createRole(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createRole(e.token,t).then(n=>Promise.resolve(n))})}createEvent(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createEvent(e.token,t).then(n=>Promise.resolve(n))})}addRolesChannelDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addRolesChannelDesc(e.token,t).then(n=>n!==void 0)})}deleteRoleChannelDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteRoleChannelDesc(e.token,t).then(n=>n!==void 0)})}deleteApp(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteApp(e.token,t).then(n=>n!==void 0)})}deleteFriends(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteFriends(e.token,t,n).then(s=>s!==void 0)})}deleteChannelDesc(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteChannelDesc(e.token,t,n).then(s=>s!==void 0)})}deleteClanDesc(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteClanDesc(e.token,t).then(n=>n!==void 0)})}deleteCategoryDesc(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteCategoryDesc(e.token,t,n,s).then(c=>c!==void 0)})}deleteNotifications(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteNotifications(e.token,t,n).then(s=>Promise.resolve(s!=null))})}deleteRole(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteRole(e.token,t,"0",n,s).then(c=>c!==void 0)})}deleteEvent(e,t,n,s,c,d){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteEvent(e.token,t,n,s,c,d).then(i=>i!==void 0)})}updateEventUser(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateEventUser(e.token,t).then(n=>n!==void 0)})}emitEvent(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.event(e.token,t).then(n=>Promise.resolve(n!=null))})}getAccount(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getAccount(e.token)})}removeClanUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeClanUsers(e.token,t,n).then(s=>Promise.resolve(s!=null))})}listBannedUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listBannedUsers(e.token,t,n).then(s=>Promise.resolve(s))})}unbanClanUsers(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.unbanClanUsers(e.token,t,n,s).then(c=>Promise.resolve(c!=null))})}banClanUsers(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.banClanUsers(e.token,t,n,s,c).then(d=>Promise.resolve(d!=null))})}removeChannelUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeChannelUsers(e.token,t,n).then(s=>Promise.resolve(s!=null))})}listChannelMessages(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelMessages(e.token,t,n,s,c,d,i).then(o=>{let a={messages:[],last_seen_message:o.last_seen_message,last_sent_message:o.last_sent_message};return o.messages==null||o.messages.forEach(u=>{let h,g,f,A,y;try{h=P(u.content)}catch(C){console.log("error parse content",C)}try{let C=B(u.reactions);g=(C==null?void 0:C.reactions)||C||P(u.reactions||"[]")}catch(C){g=P(u.reactions||"[]")}try{let C=U(u.mentions);f=(C==null?void 0:C.mentions)||C||P(u.mentions||"[]")}catch(C){f=P(u.mentions||"[]")}try{let C=T(u.attachments);A=(C==null?void 0:C.attachments)||C||P(u.attachments||"[]")}catch(C){A=P(u.attachments||"[]")}try{let C=D(u.references);y=(C==null?void 0:C.refs)||C||P(u.references||"[]")}catch(C){y=P(u.references||"[]")}a.messages.push({channel_id:u.channel_id,code:u.code?Number(u.code):0,id:u.message_id||"",sender_id:u.sender_id,username:u.username,display_name:u.display_name,avatar:u.avatar,content:h,channel_label:u.channel_label,clan_logo:u.clan_logo,category_name:u.category_name,clan_nick:u.clan_nick,clan_avatar:u.clan_avatar,attachments:A,mentions:f,reactions:g,references:y,clan_id:u.clan_id,create_time_seconds:u.create_time_seconds,update_time_seconds:u.update_time_seconds,hide_editted:u.hide_editted})}),Promise.resolve(a)})})}listChannelVoiceUsers(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelVoiceUsers(e.token,t,n).then(s=>{let c={voice_channel_users:[]};return s.voice_channel_users==null||s.voice_channel_users.forEach(d=>{c.voice_channel_users.push({id:d.id,channel_id:d.channel_id,user_ids:d.user_ids,participant:d.participant})}),Promise.resolve(c)})})}listChannelUsers(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelUsers(e.token,t,n,s,d,c,i).then(o=>{let a={channel_users:[],cursor:o.cursor,channel_id:o.channel_id};return o.channel_users==null||o.channel_users.forEach(u=>{a.channel_users.push({user_id:u.user_id,role_id:u.role_id,thread_id:u.thread_id,clan_avatar:u.clan_avatar,clan_nick:u.clan_nick,id:u.id,clan_id:u.clan_id,added_by:u.added_by,is_banned:u.is_banned})}),Promise.resolve(a)})})}listChannelAttachments(e,t,n,s,c,d,i,o){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelAttachment(e.token,n,t,s,d,c,i,o).then(a=>{let u={attachments:[]};return a.attachments==null||a.attachments.forEach(h=>{u.attachments.push({filename:h.filename,filesize:h.filesize,filetype:h.filetype,id:h.id,uploader:h.uploader,url:h.url,message_id:h.message_id,create_time_seconds:h.create_time_seconds,width:h.width,height:h.height})}),Promise.resolve(u)})})}listClanUsers(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listClanUsers(e.token,t).then(n=>{let s={clan_users:[],cursor:n.cursor,clan_id:n.clan_id};return n.clan_users==null||n.clan_users.forEach(c=>{var d;s.clan_users.push({user:{avatar_url:c.user.avatar_url,create_time_seconds:c.user.create_time_seconds,display_name:c.user.display_name,edge_count:c.user.edge_count?Number(c.user.edge_count):0,id:c.user.id,lang_tag:c.user.lang_tag,location:c.user.location,online:c.user.online,is_mobile:(d=c.user)==null?void 0:d.is_mobile,timezone:c.user.timezone,update_time:c.user.update_time,username:c.user.username,user_status:c.user.user_status,status:c.user.status,about_me:c.user.about_me,mezon_id:c.user.mezon_id,list_nick_names:c.user.list_nick_names,phone_number:c.user.phone_number,join_time_seconds:c.user.join_time_seconds},role_id:c.role_id,clan_nick:c.clan_nick,clan_avatar:c.clan_avatar})}),Promise.resolve(s)})})}listClanUsersStatus(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listClanUsersStatus(e.token,t).then(n=>{let s={clan_user_statuses:[]};return n.clan_user_statuses==null||n.clan_user_statuses.forEach(c=>{s.clan_user_statuses.push({user_id:c.user_id,user_status:c.user_status})}),Promise.resolve(s)})})}listChannelDetail(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelDetail(e.token,t).then(n=>Promise.resolve(n))})}listChannelDescs(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelDescs(e.token,t,n,s,c,d,i).then(o=>{let a={channeldesc:[],next_cursor:o.next_cursor,prev_cursor:o.prev_cursor,cacheable_cursor:o.cacheable_cursor};return o.channeldesc==null||(a.channeldesc=o.channeldesc),Promise.resolve(a)})})}listClanDescs(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listClanDescs(e.token,t,n,s).then(c=>{let d={clandesc:[]};return c.clandesc==null||(d.clandesc=c.clandesc),Promise.resolve(d)})})}listChannelBadgeCount(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelBadgeCount(e.token,t,n,s).then(c=>{var d;return{channeldesc:(d=c.channeldesc)!=null?d:[],total_count:c.total_count}})})}listUserOnline(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listUserOnline(e.token,t,n,s).then(c=>{var d;return{users:(d=c.users)!=null?d:[],total_count:c.total_count}})})}listCategoryDescs(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listCategoryDescs(e.token,t,n,s).then(c=>{let d={categorydesc:[]};return c.categorydesc==null||(d.categorydesc=c.categorydesc),Promise.resolve(d)})})}listEvents(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listEvents(e.token,t).then(n=>Promise.resolve(n))})}getListPermission(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getListPermission(e.token).then(t=>Promise.resolve(t))})}listRolePermissions(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listRolePermissions(e.token,t).then(n=>Promise.resolve(n))})}listRoleUsers(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listRoleUsers(e.token,t,n,s).then(c=>Promise.resolve(c))})}registFCMDeviceToken(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.registFCMDeviceToken(e.token,t,n,s,c).then(d=>Promise.resolve(d))})}getUserProfileOnClan(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getUserProfileOnClan(e.token,t).then(n=>Promise.resolve(n))})}closeDirectMess(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.closeDirectMess(e.token,t).then(n=>n!==void 0)})}openDirectMess(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.openDirectMess(e.token,t).then(n=>n!==void 0)})}confirmLinkMezonOTP(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.confirmLinkMezonOTP(e.token,t)})}linkSMS(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.linkSMS(e.token,t).then(n=>Promise.resolve(n))})}linkEmail(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.linkEmail(e.token,t).then(n=>Promise.resolve(n))})}listFriends(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listFriends(e.token,n,t,s).then(c=>{let d={friends:[],cursor:c.cursor};return c.friends==null||c.friends.forEach(i=>{var o;d.friends.push({user:{avatar_url:i.user.avatar_url,create_time_seconds:i.user.create_time_seconds,display_name:i.user.display_name,edge_count:i.user.edge_count?Number(i.user.edge_count):0,id:i.user.id,lang_tag:i.user.lang_tag,location:i.user.location,online:i.user.online,timezone:i.user.timezone,update_time:i.user.update_time,username:i.user.username,is_mobile:(o=i.user)==null?void 0:o.is_mobile,user_status:i.user.user_status,status:i.user.status,mezon_id:i.user.mezon_id,list_nick_names:i.user.list_nick_names,phone_number:i.user.phone_number,about_me:i.user.about_me},state:i.state,source_id:i.source_id})}),Promise.resolve(d)})})}listNotifications(e,t,n,s,c,d){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listNotifications(e.token,n,t,s,c,d).then(i=>{let o={cacheable_cursor:i.cacheable_cursor,notifications:[]};return i.notifications==null||i.notifications.forEach(a=>{o.notifications.push({id:a.id,subject:a.subject,content:a.content?H(a.content):void 0,code:a.code?Number(a.code):0,sender_id:a.sender_id,create_time_seconds:a.create_time_seconds,persistent:a.persistent,category:a.category})}),Promise.resolve(o)})})}sessionLogout(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.sessionLogout(e.token,{refresh_token:n,token:t,device_id:s,platform:c}).then(d=>d!==void 0)})}sessionRefresh(n){return l(this,arguments,function*(e,t={}){if(!e)return console.error("Cannot refresh a null session."),e;e.created&&e.expires_at-e.created_at<70&&console.warn("Session lifetime too short, please set '--session.token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session"),e.created&&e.refresh_expires_at-e.created_at<3700&&console.warn("Session refresh lifetime too short, please set '--session.refresh_token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session");let s=yield this.refreshTokenManager.refresh(e.refresh_token,()=>l(this,null,function*(){try{let c=yield this.transport.sessionRefresh(this.serverkey,"",{token:e.refresh_token,vars:t,is_remember:e.is_remember});return{token:c.token,refresh_token:c.refresh_token,is_remember:c.is_remember||!1}}catch(c){throw console.error("Session refresh failed:",c),c}}));return e.update(s.token,s.refresh_token,s.is_remember),this.onRefreshSession(s),e})}unlinkEmail(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.unlinkEmail(e.token,t).then(n=>n!==void 0)})}updateUsername(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateUsername(e.token,t).then(n=>Promise.resolve(n))})}updateAccount(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateAccount(e.token,t).then(n=>n!==void 0)})}updateChannelDesc(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChannelDesc(e.token,t,n).then(s=>s!==void 0)})}updateClanDesc(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanDesc(e.token,t,n).then(s=>s!==void 0)})}updateCategory(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateCategory(e.token,t,n).then(s=>s!==void 0)})}updateUserProfileByClan(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateUserProfileByClan(e.token,t,n).then(s=>s!==void 0)})}updateRole(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateRole(e.token,t,n).then(s=>s!==void 0)})}updateEvent(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateEvent(e.token,t,n).then(s=>s!==void 0)})}updateApp(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateApp(e.token,t,n).then(s=>Promise.resolve(s))})}createLinkInviteUser(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createLinkInviteUser(e.token,t).then(n=>Promise.resolve(n))})}getLinkInvite(e){return l(this,null,function*(){return this.transport.getLinkInvite(this.serverkey,"",e).then(t=>Promise.resolve(t))})}GetRoleOfUserInTheClan(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getRoleOfUserInTheClan(e.token,t).then(n=>Promise.resolve(n))})}inviteUser(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.inviteUser(e.token,t).then(n=>Promise.resolve(n))})}setNotificationClan(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setNotificationClanSetting(e.token,t).then(n=>n!==void 0)})}setNotificationChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setNotificationChannelSetting(e.token,t).then(n=>n!==void 0)})}setMuteCategory(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setMuteCategory(e.token,t).then(n=>n!==void 0)})}setMuteChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setMuteChannel(e.token,t).then(n=>n!==void 0)})}updateChannelPrivate(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChannelPrivate(e.token,t).then(n=>n!==void 0)})}setNotificationCategory(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setNotificationCategorySetting(e.token,t).then(n=>n!==void 0)})}deleteNotificationCategory(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteNotificationCategorySetting(e.token,t).then(n=>n!==void 0)})}deleteNotificationChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteNotificationChannel(e.token,t).then(n=>n!==void 0)})}setNotificationReactMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setNotificationReactMessage(e.token,{channel_id:t}).then(n=>n!==void 0)})}deleteNotiReactMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteNotiReactMessage(e.token,t).then(n=>n!==void 0)})}searchMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.searchMessage(e.token,t).then(n=>Promise.resolve(n))})}createMessage2Inbox(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createMessage2Inbox(e.token,t).then(n=>Promise.resolve(n))})}createPinMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createPinMessage(e.token,t).then(n=>Promise.resolve(n))})}pinMessagesList(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getPinMessagesList(e.token,t,n,s).then(c=>{let d={pin_messages_list:[]};return c.pin_messages_list==null||c.pin_messages_list.forEach(i=>{d.pin_messages_list.push({id:i.id,avatar:i.avatar,channel_id:i.channel_id,content:i.content,create_time_seconds:i.create_time_seconds,message_id:i.message_id,sender_id:i.sender_id,username:i.username,attachment:i.attachment})}),Promise.resolve(d)})})}deletePinMessage(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deletePinMessage(e.token,t,n,s,c).then(d=>d!==void 0)})}createClanEmoji(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createClanEmoji(e.token,t).then(n=>n!==void 0)})}updateClanEmojiById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanEmojiById(e.token,t,n).then(s=>s!==void 0)})}deleteByIdClanEmoji(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteClanEmojiById(e.token,t,n,s).then(c=>c!==void 0)})}generateWebhookLink(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.generateWebhook(e.token,t).then(n=>Promise.resolve(n))})}listWebhookByChannelId(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listWebhookByChannelId(e.token,t,n).then(s=>Promise.resolve(s))})}updateWebhookById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateWebhookById(e.token,t,n).then(s=>s!==void 0)})}deleteWebhookById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteWebhookById(e.token,t,n).then(s=>s!==void 0)})}addClanSticker(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addClanSticker(e.token,t).then(n=>n!==void 0)})}deleteClanStickerById(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteClanStickerById(e.token,t,n,s).then(c=>c!==void 0)})}updateClanStickerById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanStickerById(e.token,t,n).then(s=>s!==void 0)})}changeChannelCategory(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.changeChannelCategory(e.token,t,n).then(s=>s!==void 0)})}setRoleChannelPermission(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setRoleChannelPermission(e.token,t).then(n=>n!==void 0)})}addApp(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addApp(e.token,t).then(n=>Promise.resolve(n))})}getApp(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getApp(e.token,t).then(n=>Promise.resolve(n))})}listApps(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listApps(e.token).then(t=>Promise.resolve(t))})}addAppToClan(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addAppToClan(e.token,t,n).then(s=>s!==void 0)})}getSystemMessagesList(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getSystemMessagesList(e.token).then(t=>Promise.resolve(t))})}getSystemMessageByClanId(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getSystemMessageByClanId(e.token,t).then(n=>Promise.resolve(n))})}createSystemMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createSystemMessage(e.token,t).then(n=>Promise.resolve(n))})}updateSystemMessage(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateSystemMessage(e.token,t,n).then(s=>Promise.resolve(s))})}deleteSystemMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteSystemMessage(e.token,t).then(n=>Promise.resolve(n))})}updateCategoryOrder(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateCategoryOrder(e.token,t).then(n=>Promise.resolve(n))})}givecoffee(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.giveMeACoffee(e.token,t).then(n=>n!==void 0)})}sendToken(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.sendToken(e.token,t).then(n=>n!==void 0)})}listStreamingChannelUsers(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listStreamingChannelUsers(e.token,t,n,s,d,c,i).then(o=>{let a={streaming_channel_users:[]};return o.streaming_channel_users==null||o.streaming_channel_users.forEach(u=>{a.streaming_channel_users.push({id:u.id,channel_id:u.channel_id,user_id:u.user_id,participant:u.participant})}),Promise.resolve(a)})})}registerStreamingChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.registerStreamingChannel(e.token,t).then(n=>n!==void 0)})}listChannelApps(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelApps(e.token,t).then(n=>{let s={channel_apps:[]};return n.channel_apps==null||n.channel_apps.forEach(c=>{s.channel_apps.push({id:c.id,channel_id:c.channel_id,app_id:c.app_id,clan_id:c.clan_id,app_url:c.app_url,app_name:c.app_name,app_logo:c.app_logo})}),Promise.resolve(s)})})}getChannelCategoryNotiSettingsList(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getChannelCategoryNotiSettingsList(e.token,t).then(n=>Promise.resolve(n))})}getNotificationCategory(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getNotificationCategory(e.token,t).then(n=>Promise.resolve(n))})}getNotificationChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getNotificationChannel(e.token,t).then(n=>Promise.resolve(n))})}getNotificationClan(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getNotificationClan(e.token,t).then(n=>Promise.resolve(n))})}getNotificationReactMessage(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getNotificationReactMessage(e.token,t).then(n=>Promise.resolve(n))})}listChannelByUserId(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelByUserId(e.token).then(t=>Promise.resolve(t))})}listChannelUsersUC(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelUsersUC(e.token,t,n).then(s=>Promise.resolve(s))})}getListEmojisByUserId(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getListEmojisByUserId(e.token).then(t=>Promise.resolve(t))})}emojiRecentList(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.emojiRecentList(e.token).then(t=>Promise.resolve(t))})}getListStickersByUserId(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getListStickersByUserId(e.token).then(t=>Promise.resolve(t))})}listUserClansByUserId(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listUserClansByUserId(e.token).then(t=>Promise.resolve(t))})}listRoles(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listRoles(e.token,t,n,s,c).then(d=>{let i={clan_id:t,roles:d.roles};return Promise.resolve(i)})})}listUserPermissionInChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listUserPermissionInChannel(e.token,t,n).then(s=>{let c={clan_id:t,channel_id:n,permissions:s.permissions};return Promise.resolve(c)})})}getPermissionByRoleIdChannelId(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getPermissionByRoleIdChannelId(e.token,t,n,s).then(c=>{let d={role_id:t,channel_id:n,permission_role_channel:c.permission_role_channel,user_id:s};return Promise.resolve(d)})})}markAsRead(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.markAsRead(e.token,t).then(n=>Promise.resolve(n))})}listThreadDescs(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listThreadDescs(e.token,t,n,s,c,d,i).then(o=>{let a={channeldesc:[]};return o.channeldesc==null||(a.channeldesc=o.channeldesc),Promise.resolve(a)})})}listChannelTimeline(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelTimeline(e.token,t).then(n=>{var s;return(s=n.events)==null||s.forEach(c=>{c.attachments=[];let d;try{let i=k(c.preview_imgs);d=(i==null?void 0:i.attachments)||i||P(c.preview_imgs||"[]")}catch(i){d=P(c.preview_imgs||"[]")}Array.isArray(d)?c.preview_imgs=d:c.preview_imgs=[]}),Promise.resolve(n)})})}createChannelTimeline(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createChannelTimeline(e.token,t).then(n=>{let s=n.event;if(s){let c,d;try{let i=k(s.attachments),o=k(s.preview_imgs);c=(i==null?void 0:i.attachments)||i||P(s.attachments||"[]"),d=(o==null?void 0:o.attachments)||o||P(s.preview_imgs||"[]")}catch(i){c=P(s.attachments||"[]"),d=P(s.preview_imgs||"[]")}Array.isArray(c)?s.attachments=c:s.attachments=[],Array.isArray(d)?s.preview_imgs=d:s.preview_imgs=[]}return Promise.resolve(n)})})}updateChannelTimeline(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChannelTimeline(e.token,t).then(n=>{let s=n.event;if(s){let c,d;try{let i=k(s.attachments),o=k(s.preview_imgs);c=(i==null?void 0:i.attachments)||i||P(s.attachments||"[]"),d=(o==null?void 0:o.attachments)||o||P(s.preview_imgs||"[]")}catch(i){c=P(s.attachments||"[]"),d=P(s.preview_imgs||"[]")}Array.isArray(c)?s.attachments=c:s.attachments=[],Array.isArray(d)?s.preview_imgs=d:s.preview_imgs=[]}return Promise.resolve(n)})})}detailChannelTimeline(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.detailChannelTimeline(e.token,t).then(n=>{let s=n.event;if(s){let c,d;try{let i=k(s.attachments),o=k(s.preview_imgs);c=(i==null?void 0:i.attachments)||i||P(s.attachments||"[]"),d=(o==null?void 0:o.attachments)||o||P(s.preview_imgs||"[]")}catch(i){c=P(s.attachments||"[]"),d=P(s.preview_imgs||"[]")}Array.isArray(c)?s.attachments=c:s.attachments=[],Array.isArray(d)?s.preview_imgs=d:s.preview_imgs=[]}return Promise.resolve(n)})})}leaveThread(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.leaveThread(e.token,t,n).then(s=>Promise.resolve(s))})}archiveChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.archiveChannel(e.token,t,n).then(s=>Promise.resolve(s))})}listArchivedChannelDescs(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listArchivedChannelDescs(e.token,t).then(n=>Promise.resolve(n))})}getChannelSettingInClan(e,t,n,s,c,d,i,o,a,u,h){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listChannelSetting(e.token,t,n,s,c,d,i,o,a,u,h).then(g=>Promise.resolve(g))})}getChannelCanvasList(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getChannelCanvasList(e.token,t,n,s,c).then(d=>{let i={channel_canvases:[]};return d.channel_canvases==null||(i.clan_id=d.clan_id,i.channel_id=d.channel_id,i.channel_canvases=d.channel_canvases,i.count=d.count),Promise.resolve(i)})})}getChannelCanvasDetail(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getChannelCanvasDetail(e.token,t,n,s).then(c=>Promise.resolve(c))})}editChannelCanvases(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.editChannelCanvases(e.token,t).then(n=>Promise.resolve(n))})}deleteChannelCanvas(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteChannelCanvas(e.token,t,n,s).then(c=>c!==void 0)})}addFavoriteChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addChannelFavorite(e.token,{channel_id:t,clan_id:n}).then(s=>s)})}removeFavoriteChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeChannelFavorite(e.token,t,n).then(s=>s)})}getListFavoriteChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getListFavoriteChannel(e.token,t).then(n=>n)})}listActivity(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listActivity(e.token).then(t=>t)})}createActiviy(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createActiviy(e.token,t).then(n=>n)})}createQRLogin(e){return l(this,null,function*(){let t=yield this.transport.createQRLogin(this.serverkey,"",e);return{login_id:t.login_id,create_time_second:t.create_time_second}})}checkLoginRequest(e){return l(this,null,function*(){let t=yield this.transport.checkLoginRequest(this.serverkey,"",e);return t!=null&&t.token?new O(t.token||"",t.refresh_token||"",t.created||!1,t.api_url||"",t.ws_url||"",t.id_token||"",t.is_remember||!1):null})}confirmLogin(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.confirmLogin(e.token,t,n).then(s=>s)})}getChanEncryptionMethod(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getChanEncryptionMethod(e.token,t).then(n=>n)})}setChanEncryptionMethod(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.setChanEncryptionMethod(e.token,t,{method:n}).then(s=>s)})}getPubKeys(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getPubKeys(e.token,t).then(n=>n)})}pushPubKey(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.pushPubKey(e.token,{PK:t}).then(n=>n)})}getKeyServer(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getKeyServer(e.token).then(t=>t)})}listAuditLog(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listAuditLog(e.token,t,n,s,c).then(d=>d)})}listOnboarding(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listOnboarding(e.token,t,n,s,c).then(d=>d)})}getOnboardingDetail(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getOnboardingDetail(e.token,t,n).then(s=>Promise.resolve(s))})}createOnboarding(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createOnboarding(e.token,t).then(n=>n)})}updateOnboarding(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateOnboarding(e.token,t,n).then(s=>s!==void 0)})}deleteOnboarding(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteOnboarding(e.token,t,n).then(s=>s!==void 0)})}generateClanWebhook(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.generateClanWebhook(e.token,t).then(n=>Promise.resolve(n))})}listClanWebhook(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listClanWebhook(e.token,t).then(n=>Promise.resolve(n))})}deleteClanWebhookById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteClanWebhookById(e.token,t,n).then(s=>s!==void 0)})}updateClanWebhookById(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanWebhookById(e.token,t,n).then(s=>s!==void 0)})}listOnboardingStep(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listOnboardingStep(e.token,t,n,s).then(c=>Promise.resolve(c))})}updateOnboardingStepByClanId(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateOnboardingStepByClanId(e.token,t,n).then(s=>s!==void 0)})}updateUserStatus(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateUserStatus(e.token,t).then(n=>n!==void 0)})}updateUserCustomStatus(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateUserCustomStatus(e.token,t).then(n=>n!==void 0)})}getUserStatus(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getUserStatus(e.token).then(t=>Promise.resolve(t))})}listSdTopic(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listSdTopic(e.token,t,n).then(s=>Promise.resolve(s))})}createSdTopic(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createSdTopic(e.token,t).then(n=>n)})}getTopicDetail(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getTopicDetail(e.token,t).then(n=>Promise.resolve(n))})}createRoomChannelApps(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createRoomChannelApps(e.token,t).then(n=>Promise.resolve(n))})}generateMeetToken(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.generateMeetToken(e.token,t).then(n=>Promise.resolve(n))})}listMezonOauthClient(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listMezonOauthClient(e.token).then(t=>Promise.resolve(t))})}getMezonOauthClient(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getMezonOauthClient(e.token,t,n).then(s=>Promise.resolve(s))})}updateMezonOauthClient(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateMezonOauthClient(e.token,t).then(n=>Promise.resolve(n))})}searchThread(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.searchThread(e.token,t,n,s).then(c=>Promise.resolve(c))})}generateHashChannelApps(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.generateHashChannelApps(e.token,t).then(n=>Promise.resolve(n))})}registrationPassword(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.registrationEmail(e.token,{email:t,password:n,old_password:s}).then(c=>Promise.resolve(c))})}addUserEvent(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addUserEvent(e.token,t).then(n=>n!==void 0)})}deleteUserEvent(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteUserEvent(e.token,t,n).then(s=>s!==void 0)})}updateRoleOrder(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateRoleOrder(e.token,t).then(n=>Promise.resolve(n))})}deleteAccount(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteAccount(e.token).then(t=>Promise.resolve(t))})}createExternalMezonMeet(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createExternalMezonMeet(e.token).then(t=>Promise.resolve(t))})}generateMeetTokenExternal(e,t,n,s,c){return l(this,null,function*(){return this.transport.generateMeetTokenExternal("",e,t,n,s,c).then(d=>Promise.resolve(d))})}removeMezonMeetParticipant(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeParticipantMezonMeet(e.token,t).then(n=>Promise.resolve(n))})}muteMezonMeetParticipant(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.muteParticipantMezonMeet(e.token,t).then(n=>Promise.resolve(n))})}updateClanOrder(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateClanOrder(e.token,t).then(n=>n!==void 0)})}listClanDiscover(e,t){return l(this,null,function*(){return this.transport.clanDiscover(this.serverkey,"",e,t).then(n=>Promise.resolve(n))})}listQuickMenuAccess(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listQuickMenuAccess(e.token,t,n,s).then(c=>Promise.resolve(c))})}deleteQuickMenuAccess(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteQuickMenuAccess(e.token,t,n).then(s=>s!==void 0)})}addQuickMenuAccess(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addQuickMenuAccess(e.token,t).then(n=>n!==void 0)})}updateQuickMenuAccess(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateQuickMenuAccess(e.token,t).then(n=>n!==void 0)})}listForSaleItems(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listForSaleItems(e.token,t).then(n=>Promise.resolve(n))})}isFollower(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.isFollower(e.token,t).then(n=>Promise.resolve(n))})}transferOwnership(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.transferOwnership(e.token,t).then(n=>n!==void 0)})}isBanned(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.isBanned(e.token,t).then(n=>Promise.resolve(n))})}reportMessageAbuse(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.reportMessageAbuse(e.token,t,n).then(s=>s!==void 0)})}updateMezonVoiceState(e,t,n,s,c,d){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateMezonVoiceState(e.token,t,n,s,c,d).then(i=>i!==void 0)})}sendChannelMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.sendChannelMessage(e.token,t,n,s,c,d,i,o,a,u,h,g,f,A).then(y=>Promise.resolve(y))})}updateChannelMessage(e,t,n,s,c,d,i,o,a,u,h,g){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChannelMessage(e.token,t,n,s,c,d,i,o,a,u,h,g).then(f=>Promise.resolve(f))})}deleteChannelMessage(e,t,n,s,c,d,i,o,a,u){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.deleteChannelMessage(e.token,t,n,s,c,d,i,o,a,u).then(h=>Promise.resolve(h))})}messageButtonClick(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.messageButtonClick(e.token,t,n,s,c,d,i).then(o=>Promise.resolve(o))})}dropdownBoxSelected(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.dropdownBoxSelected(e.token,t,n,s,c,d,i).then(o=>Promise.resolve(o))})}activeArchivedThread(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.activeArchivedThread(e.token,t,n).then(s=>Promise.resolve(s))})}addAgentToChannel(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.addAgentToChannel(e.token,t,n).then(s=>Promise.resolve(s))})}disconnectAgent(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.disconnectAgent(e.token,t,n).then(s=>Promise.resolve(s))})}listMutedChannel(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listMutedChannel(e.token,t).then(n=>Promise.resolve(n))})}channelMessageReact(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.channelMessageReact(e.token,t,n,s,c,d,i,o,a,u,h,g,f,A).then(y=>Promise.resolve(y))})}createPoll(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.createPoll(e.token,t)})}votePoll(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.votePoll(e.token,t)})}closePoll(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.closePoll(e.token,t)})}getPoll(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.getPoll(e.token,t)})}followUsers(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.followUsers(t)})}joinClanChat(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.joinClanChat(t)})}follower(e){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.follower()})}joinChat(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.joinChat(t,n,s,c)})}leaveChat(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.leaveChat(t,n,s,c)})}removeChatMessage(e,t,n,s,c,d,i,o,a,u){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.removeChatMessage(t,n,s,c,d,i,o,a,u)})}unfollowUsers(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.unfollowUsers(t)})}updateChatMessage(e,t,n,s,c,d,i,o,a,u,h,g){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateChatMessage(t,n,s,c,d,i,o,a,u,h,g)})}updateStatus(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.updateStatus(t)})}writeQuickMenuEvent(e,t,n,s,c,d,i,o,a,u,h,g,f,A,y){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeQuickMenuEvent(t,n,s,c,d,i,o,a,u,h,g,f,A,y)})}writeEphemeralMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A,y,C){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeEphemeralMessage(t,n,s,c,d,i,o,a,u,h,g,f,A,y,C)})}writeChatMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeChatMessage(t,n,s,c,d,i,o,a,u,h,g,f,A)})}writeMessageReaction(e,t,n,s,c,d,i,o,a,u,h,g,f,A,y){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeMessageReaction(t,n,s,c,d,i,o,a,u,h,g,f,A,y)})}writeMessageTyping(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeMessageTyping(t,n,s,c,d,i)})}writeLastSeenMessage(e,t,n,s,c,d,i){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeLastSeenMessage(t,n,s,c,d,i)})}writeLastPinMessage(e,t,n,s,c,d,i,o,a,u,h,g,f,A){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeLastPinMessage(t,n,s,c,d,i,o,a,u,h,g,f,A)})}writeCustomStatus(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeCustomStatus(t,n,s,c)})}writeVoiceReaction(e,t,n){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeVoiceReaction(t,n)})}forwardWebrtcSignaling(e,t,n,s,c,d){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.forwardWebrtcSignaling(t,n,s,c,d)})}makeCallPush(e,t,n,s,c){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.makeCallPush(t,n,s,c)})}writeChannelAppEvent(e,t,n,s){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.writeChannelAppEvent(t,n,s)})}listDataSocket(e,t){return l(this,null,function*(){return this.autoFallbackHttp&&this._connectionState!==p.CONNECTED&&(yield this.transport.setFallbackSession(e)),this.transport.listDataSocket(t)})}};z.DefaultHeartbeatTimeoutMs=1e4,z.DefaultConnectTimeoutMs=3e4;var Y=z;export{se as ApiAppRole,oe as ChannelStreamMode,re as ChannelType,Y as Client,p as ConnectionState,Q as CreateChannelMessageFromEvent,ae as NotificationType,N as RefreshTokenManager,O as Session,ce as WebrtcSignalingType,fe as b64DecodeUnicode,_e as b64EncodeUnicode,m as buildFetchOptions,T as decodeAttachments,k as decodeChannelTimelineAttachments,U as decodeMentions,H as decodeNotificationFcm,B as decodeReactions,D as decodeRefs,ye as encodeAttachments,Ae as encodeMentions,Pe as encodeNotificationFcm,Ce as encodeReactions,be as encodeRefs,P as safeJSONParse};