UNPKG

laudantiumculpa

Version:
1 lines 262 kB
import{e,u as t,V as n,c as r,A as i,aa as s,f as a,h as o,g as u,U as c,ab as l,O as d,a as h,T as f,o as p,p as m,s as v,a5 as y,ac as _,ad as g,ae as b,C as I,af as E,ag as T,ah as w,W as S,ai as M,_ as U,b as A,aj as N,$ as C,t as k,r as P,ak as O,al as R,am as x,an as D,ao as L,ap as F,aq as q,ar as z,as as B,B as K,D as j,at as Q,i as G,au as V,av as H,aw as W,ax as Y,ay as J,az as X,aA as Z,aB as $,aC as ee,aD as te,aE as ne,aF as re,m as ie,F as se,N as ae,aG as oe,w as ue,x as ce,aH as le,aI as de,d as he,aJ as fe,aK as pe,aL as me,aM as ve,aN as ye,z as _e,aO as ge,aP as be,aQ as Ie,aR as Ee,aS as Te,aT as we,y as Se,aU as Me,aV as Ue}from"./__bundle-ed5804d1.js";var Ae,Ne=function(){function r(e,t,n){var r,i;this.width=0,this.height=0,this.realWidth=0,this.realHeight=0,this._requireAuth=!1,this._iid=e,this.plainUrl=t.url,this.width=t.width,this.height=t.height,this.realWidth=null!==(r=t.real_width)&&void 0!==r?r:t.width,this.realHeight=null!==(i=t.real_height)&&void 0!==i?i:t.height,this._requireAuth=n}return r.payloadify=function(n){return e(t(n instanceof r?{url:n.plainUrl,width:n.width,height:n.height,real_width:n.realWidth,real_height:n.realHeight}:{url:"",width:n.maxWidth,height:n.maxHeight,real_width:0,real_height:0}))},Object.defineProperty(r.prototype,"url",{get:function(){var e=n.of(this._iid).sessionManager;return this._requireAuth&&e.ekey?"".concat(this.plainUrl,"?auth=").concat(e.ekey):this.plainUrl},enumerable:!1,configurable:!0}),r}(),Ce=function(t){function n(n){var r=t.call(this)||this;if(r.method=i.POST,r.path="".concat(s),r.params=e({file:n.file,channel_url:n.channelUrl}),n.thumbnailSizes)for(var a=0;a<n.thumbnailSizes.length;a++){var o=n.thumbnailSizes[a],u=o.maxWidth,c=o.maxHeight;r.params["thumbnail".concat(a+1)]="".concat(u,",").concat(c)}return r.requestId=n.requestId,r}return r(n,t),n}(a),ke=function(e){function t(t,n){var r,i,s,a,o=this;return(o=e.call(this,t,n)||this).url=n.url,o.fileSize=null!==(r=n.file_size)&&void 0!==r?r:0,o.thumbnails=null!==(s=null===(i=n.thumbnails)||void 0===i?void 0:i.map((function(e){return new Ne(t,e,!1)})))&&void 0!==s?s:[],o.requireAuth=null!==(a=n.require_auth)&&void 0!==a&&a,o}return r(t,e),t}(o),Pe=function(n){function i(e,t){var r,i,s,a,o,u=this;return(u=n.call(this,e)||this).replyCount=0,u.memberCount=0,u.lastRepliedAt=0,u.updatedAt=0,u.replyCount=null!==(r=t.reply_count)&&void 0!==r?r:0,u.memberCount=null!==(i=t.member_count)&&void 0!==i?i:0,u.mostRepliedUsers=t.most_replies&&d("object",t.most_replies)?t.most_replies.map((function(e){return new c(u._iid,e)})):[],u.unreadReplyCount=null!==(s=t.unread_message_count)&&void 0!==s?s:0,u.isPushNotificationEnabled="number"==typeof t.push_enabled?t.push_enabled>0:void 0,u.lastRepliedAt=null!==(a=t.last_replied_at)&&void 0!==a?a:0,u.updatedAt=null!==(o=t.updated_at)&&void 0!==o?o:0,u}return r(i,n),i.payloadify=function(r){return e(t(u(u({},n.payloadify.call(this,r)),{reply_count:r.replyCount,unread_message_count:r.unreadReplyCount,member_count:r.memberCount,most_replies:Array.isArray(r.mostRepliedUsers)?r.mostRepliedUsers.map((function(e){return c.payloadify(e)})):[],push_enabled:"boolean"==typeof r.isPushNotificationEnabled?r.isPushNotificationEnabled?1:0:void 0,last_replied_at:r.lastRepliedAt,updated_at:r.updatedAt})))},Object.defineProperty(i.prototype,"_isUpdateRequired",{get:function(){return void 0===this.unreadReplyCount||void 0===this.isPushNotificationEnabled},enumerable:!1,configurable:!0}),i.prototype._updateFrom=function(e){var t,n;this.unreadReplyCount=null!==(t=e.unreadReplyCount)&&void 0!==t?t:this.unreadReplyCount,this.isPushNotificationEnabled=null!==(n=e.isPushNotificationEnabled)&&void 0!==n?n:this.isPushNotificationEnabled},i}(l);!function(e){e.ADD="add",e.DELETE="delete"}(Ae||(Ae={}));var Oe,Re=function(e){this.messageId=0,this.operation=null,this.updatedAt=0;var t=h("string",e.msg_id)?parseInt(e.msg_id):e.msg_id,n=e.user_id,r=e.operation?e.operation.toLowerCase():null,i=e.reaction,s=e.updated_at;t&&h("string",n)&&h("string",r)&&f(Ae,r)&&h("string",i)&&i&&h("number",s)&&(this.messageId=t,this.userId=n,this.key=i,this.operation=r,this.updatedAt=s)},xe=function(){function n(e){var t,n,r,i=e.key,s=null!==(r=p([],m(e.user_ids),!1))&&void 0!==r?r:[],a=e.updated_at;h("string",i)&&i&&d("string",s)&&s.length>0&&h("number",a)&&(this.key=i,this.userIds=s,this.updatedAt=a);var o={};try{for(var u=v(this.userIds),c=u.next();!c.done;c=u.next()){o[c.value]=this.updatedAt}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}this._version=o}return Object.defineProperty(n.prototype,"isEmpty",{get:function(){return 0===this.userIds.length},enumerable:!1,configurable:!0}),n.payloadify=function(n){return e(t({key:n.key,user_ids:n.userIds,updated_at:n.updatedAt}))},n.prototype.applyEvent=function(e){if(e.key===this.key&&this.updatedAt<=e.updatedAt){if(!this._version[e.userId]||this._version[e.userId]<=e.updatedAt){var t=this.userIds.indexOf(e.userId);switch(e.operation){case Ae.ADD:t<0&&this.userIds.push(e.userId);break;case Ae.DELETE:t>=0&&this.userIds.splice(t,1)}this._version[e.userId]=e.updatedAt}this.updatedAt=Math.max(this.updatedAt,e.updatedAt)}},n}(),De=function(){function n(e){this.secureUrl=null,this.type=null,this.width=0,this.height=0,this.alt=null,this.url=e.url,e.secure_url&&(this.secureUrl=e.secure_url),e.type&&(this.type=e.type),e.width&&(this.width=e.width),e.height&&(this.height=e.height),e.alt&&(this.alt=e.alt)}return n.payloadify=function(n){var r,i;return e(t({url:n.url,secure_url:n.secureUrl,type:n.type,width:null!==(r=n.width)&&void 0!==r?r:0,height:null!==(i=n.height)&&void 0!==i?i:0,alt:n.alt}))},n}(),Le=function(){function n(e){this.title=null,this.url=null,this.description=null,this.defaultImage=null,e["og:title"]&&(this.title=e["og:title"]),e["og:url"]&&(this.url=e["og:url"]),e["og:description"]&&(this.description=e["og:description"]),e["og:image"]&&(this.defaultImage=new De(e["og:image"]))}return n.payloadify=function(n){return e(t({"og:title":n.title,"og:url":n.url,"og:description":n.description,"og:image":n.defaultImage?De.payloadify(n.defaultImage):null}))},n}(),Fe=function(){function n(e){var t,n;this.volume=0,this.name=null!==(t=e.name)&&void 0!==t?t:"default",this.volume=null!==(n=e.volume)&&void 0!==n?n:1}return n.prototype.serialize=function(){return{name:this.name,volume:this.volume}},n.payloadify=function(n){return e(t({name:n.name,volume:n.volume}))},n}();!function(e){e.GOOD="good",e.BAD="bad"}(Oe||(Oe={}));var qe,ze=function(){function n(e){this.id=e.id,this.rating=e.rating,this.comment=e.comment}return n.parseFeedbackStatusFromPayload=function(e){return e&&null!==e.id&&null!==e.rating?"SUBMITTED":"NOT_APPLICABLE"},n.payloadify=function(n){return e(t({id:n.id,rating:n.rating,comment:n.comment}))},n}(),Be=function(n){function i(e,t){var r,i=this;return(i=n.call(this,e,t)||this).isBlockedByMe=!1,i.role=f(y,t.role)?t.role:y.NONE,i.isBlockedByMe=null!==(r=t.is_blocked_by_me)&&void 0!==r&&r,i}return r(i,n),i.payloadify=function(r){return e(t(u(u({},n.payloadify.call(this,r)),{role:r.role,is_blocked_by_me:r.isBlockedByMe})))},i}(c),Ke=function(){function n(e){this.key=e.key,this.value=d("string",e.value)?p([],m(e.value),!1):[]}return n.payloadify=function(n){var r;return e(t({key:n.key,value:null!==(r=n.value)&&void 0!==r?r:[]}))},n}(),je=function(e){switch(e){case g.BASE:return"";case g.USER:return"MESG";case g.FILE:return"FILE";case g.ADMIN:return"ADMM"}},Qe=function(n){function i(e,t){var r,i,s,a,o,u,l,d,h,p,m=this;(m=n.call(this,e)||this).channelType=I.BASE,m.messageType=g.BASE,m.mentionType=null,m.mentionedUsers=null,m.mentionedUserIds=null,m.metaArrays=[],m.extendedMessage={},m.createdAt=0,m.updatedAt=0,m.channelUrl=t.channel_url,m.channelType=f(I,t.channel_type)?t.channel_type:I.GROUP,t.channel&&(t.channel.channel_url&&(m.channelUrl=t.channel.channel_url),t.channel.channel_type&&(m.channelType=t.channel.channel_type)),m.data=null!==(r=t.data)&&void 0!==r?r:"",m.customType=null!==(i=t.custom_type)&&void 0!==i?i:"",m.mentionType=f(E,t.mention_type)?t.mention_type:null,m.mentionedUsers=t.mentioned_users?t.mentioned_users.map((function(e){return new c(m._iid,e)})):null,m.mentionedUserIds=null!==(s=t.mentioned_user_ids)&&void 0!==s?s:null,m.mentionedUsers&&!m.mentionedUserIds&&(m.mentionedUserIds=m.mentionedUsers.map((function(e){return e.userId}))),m.mentionedMessageTemplate=null!==(a=t.mentioned_message_template)&&void 0!==a?a:"";var v=null!==(o=t.metaarray)&&void 0!==o?o:{},y=null!==(u=t.metaarray_key_order)&&void 0!==u?u:Object.keys(v).sort((function(e,t){return e.localeCompare(t)}));m.metaArrays=[];for(var _=0;_<y.length;_++){var b=y[_];m.metaArrays.push(new Ke({key:b,value:v[b]||[]}))}return t.sorted_metaarray&&(m.metaArrays=t.sorted_metaarray.map((function(e){return new Ke(e)}))),m.extendedMessage=null!==(l=t.extended_message)&&void 0!==l?l:{},m.extendedMessagePayload=t.extended_message_payload,m.createdAt=null!==(h=null!==(d=t.created_at)&&void 0!==d?d:t.ts)&&void 0!==h?h:0,m.updatedAt=null!==(p=t.updated_at)&&void 0!==p?p:0,m}return r(i,n),i.payloadify=function(r){var i,s;return e(t(u(u({},n.payloadify.call(this,r)),{channel_url:r.channelUrl,channel_type:r.channelType,type:je(r.messageType),data:r.data,custom_type:r.customType,mention_type:r.mentionType,mentioned_user_ids:r.mentionedUserIds,mentioned_users:null===(i=r.mentionedUsers)||void 0===i?void 0:i.map((function(e){return c.payloadify(e)})),mentioned_message_template:r.mentionedMessageTemplate,sorted_metaarray:null===(s=r.metaArrays)||void 0===s?void 0:s.map((function(e){return Ke.payloadify(e)})),extended_message:r.extendedMessage,extended_message_payload:r.extendedMessagePayload,created_at:r.createdAt,updated_at:r.updatedAt})))},i.prototype.isIdentical=function(e){return!0},i.prototype.isEqual=function(e){return _(this,e)},i.prototype.isUserMessage=function(){return this.messageType===g.USER},i.prototype.isFileMessage=function(){return this.messageType===g.FILE&&!Object.prototype.hasOwnProperty.call(this,"fileInfoList")},i.prototype.isMultipleFilesMessage=function(){return this.messageType===g.FILE&&Object.prototype.hasOwnProperty.call(this,"fileInfoList")},i.prototype.isAdminMessage=function(){return this.messageType===g.ADMIN},i.prototype.hasForm=function(){var e,t;return!!(null===(t=null===(e=this.extendedMessagePayload)||void 0===e?void 0:e.forms)||void 0===t?void 0:t[0])},i.prototype.serialize=function(){return b(this)},i.prototype.getMetaArraysByKeys=function(e){return this.metaArrays.filter((function(t){return e.includes(t.key)}))},i}(l);!function(e){e.Text="text",e.Phone="phone",e.Email="email",e.Password="password"}(qe||(qe={}));var Ge=function(){function n(e,t,n){this.messageId=e,this.key=t,this.fields=n,this.formKey=t}return Object.defineProperty(n.prototype,"isSubmitted",{get:function(){return void 0!==this.answers&&Object.keys(this.answers).length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSubmittable",{get:function(){return this.fields.every((function(e){return e.isSubmittable}))},enumerable:!1,configurable:!0}),n.prototype.getFieldAnswer=function(e){var t;return null===(t=this.answers)||void 0===t?void 0:t[e]},n.payloadify=function(n){var r;return e(t({key:null!==(r=n.formKey)&&void 0!==r?r:n.key,fields:n.fields.map((function(e){return Ve.payloadify(e)}))}))},n.isFormPayload=function(e){var t;return Boolean(null===(t=null==e?void 0:e.forms)||void 0===t?void 0:t[0])},n}(),Ve=function(){function n(e){this.key=e.key,this.inputType=e.input_type,this.title=e.title,this.required=e.required,this.regex=e.regex,this.placeholder=e.placeholder,this.fieldKey=e.key}return n.prototype.isValid=function(e){if(!this.regex)return!0;try{return new RegExp(this.regex).test(e)}catch(e){return!0}},Object.defineProperty(n.prototype,"isSubmittable",{get:function(){return!(null!=this.temporaryAnswer&&!this.isValid(this.temporaryAnswer)||this.required&&null==this.temporaryAnswer)},enumerable:!1,configurable:!0}),n.payloadify=function(n){var r;return e(t({key:null!==(r=n.fieldKey)&&void 0!==r?r:n.key,input_type:n.inputType,title:n.title,required:n.required,regex:n.regex,placeholder:n.placeholder}))},n}(),He=function(e){function t(t,n){var r,i,s=this;return(s=e.call(this,t)||this).channelUrl=null!==(r=n.channel_url)&&void 0!==r?r:"",s.channelType=null!==(i=n.channel_type)&&void 0!==i?i:I.GROUP,s.reader=new c(s._iid,n.user),s.readAt=n.ts,s}return r(t,e),t}(l),We=function(e){function t(t){var n=t.channelUrl;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:n}})||this}return r(t,e),t}(T),Ye=function(n){function s(r){var s=n.call(this)||this,a=r.channelUrl,o=r.channelType,u=r.userId,c=r.notificationIds;return s.method=i.PUT,s.path="".concat(w(o),"/").concat(encodeURIComponent(a),"/messages/mark_as_read"),s.params=e(t({user_id:u,message_ids:c})),s}return r(s,n),s}(a),Je=function(e){function t(t,n,r){var i=e.call(this,t,"READ",r)||this;return i.readStatus=new He(t,r),i}return r(t,e),t}(S),Xe=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.readAt=n.ts,r.unreadMessageCount=n.unread_message_count,r}return r(t,e),t}(o),Ze=function(e){function t(t){var n=t.channelUrl,r=t.messageId;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:n,parent_message_id:r}})||this}return r(t,e),t}(T),$e=function(e){function t(t){var n=t.channelType,r=t.channelUrl,s=t.messageId,a=t.pushEnabled,o=e.call(this)||this;return o.method=i.PUT,o.path="".concat(w(n),"/").concat(encodeURIComponent(r),"/messages/").concat(s,"/thread_push"),o.params={push_enabled:a},o}return r(t,e),t}(a);!function(e){function t(t,n){return e.call(this,t,n)||this}r(t,e)}(o);var et=function(t){function n(n){var r=t.call(this)||this;return r.method=i.POST,r.path="".concat(M,"/").concat(encodeURIComponent(n.channelUrl),"/messages/").concat(n.messageId,"/submit_forms"),r.params=e({forms:n.forms}),r}return r(n,t),n}(a),tt=function(e){function t(t){var n=t.channelType,r=t.channelUrl,s=t.messageId,a=t.rating,o=t.comment,u=e.call(this)||this;return u.method=i.POST,u.path="".concat(w(n),"/").concat(encodeURIComponent(r),"/messages/").concat(s,"/feedbacks"),u.params={rating:a,comment:o},u}return r(t,e),t}(a),nt=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.feedback=new ze(n),r}return r(t,e),t}(o),rt=function(e){function t(t){var n=t.channelType,r=t.channelUrl,s=t.messageId,a=t.feedbackId,o=t.rating,u=t.comment,c=e.call(this)||this;return c.method=i.PUT,c.path="".concat(w(n),"/").concat(encodeURIComponent(r),"/messages/").concat(s,"/feedbacks/").concat(a),c.params={rating:o,comment:u},c}return r(t,e),t}(a),it=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.feedback=new ze(n),r}return r(t,e),t}(o),st=function(e){function t(t){var n=t.channelType,r=t.channelUrl,s=t.messageId,a=t.feedbackId,o=e.call(this)||this;return o.method=i.DELETE,o.path="".concat(w(n),"/").concat(encodeURIComponent(r),"/messages/").concat(s,"/feedbacks/").concat(a),o}return r(t,e),t}(a);!function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.feedback=new ze(n),r}r(t,e)}(o);var at,ot,ut=function(i){function s(e,t){var n,r,s,a,o,c=this;return(c=i.call(this,e)||this).plainUrl="",c.fileName=null,c.mimeType=null,c.fileSize=0,c.thumbnails=[],c._requireAuth=!1,c.plainUrl=null!==(n=t.url)&&void 0!==n?n:"",c.fileName=null!==(r=t.file_name)&&void 0!==r?r:null,c.mimeType=null!==(s=t.file_type)&&void 0!==s?s:null,c.fileSize=null!==(a=t.file_size)&&void 0!==a?a:0,c._requireAuth=null!==(o=t.require_auth)&&void 0!==o&&o,c.thumbnails=t.thumbnails?t.thumbnails.map((function(e){var t;return new Ne(c._iid,"string"==typeof e?{url:e,width:0,height:0}:u(u({},e),{url:(null!==(t=e.url)&&void 0!==t?t:"").split("auth=")[0]}),c._requireAuth)})):[],c}return r(s,i),s.payloadify=function(n){var r;return e(t({url:n.plainUrl,file_name:n.fileName,file_type:n.mimeType,file_size:n.fileSize,thumbnails:null===(r=n.thumbnails)||void 0===r?void 0:r.map((function(e){var t;return{url:(null!==(t=e.plainUrl)&&void 0!==t?t:"").split("auth=")[0],width:e.width,height:e.height,real_width:e.realWidth,real_height:e.realHeight}})),require_auth:n._requireAuth}))},Object.defineProperty(s.prototype,"url",{get:function(){var e=n.of(this._iid).sessionManager;return this._requireAuth&&e.ekey?"".concat(this.plainUrl,"?auth=").concat(e.ekey):this.plainUrl},enumerable:!1,configurable:!0}),s}(l),ct=function(e){var t=e.channelUrl,n=e.channelType,r=e.parentMessage;this.channelUrl=t,this.channelType=n,this.parentMessage=r};!function(e){e.PENDING="pending",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled"}(at||(at={})),function(e){e.PENDING="pending",e.IN_QUEUE="in_queue",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled",e.REMOVED="removed"}(ot||(ot={}));var lt,dt=function(i){function s(e,t){var n,r,s,a,o,u,c,l,d,h,f=this;return(f=i.call(this,e,t)||this).parentMessage=null,f.silent=!1,f.isOperatorMessage=!1,f.threadInfo=null,f.reactions=[],f.appleCriticalAlertOptions=null,f.scheduledInfo=null,f.suggestedReplies=null,f.myFeedback=null,f.myFeedbackStatus="NOT_APPLICABLE",f.forms=null,f._isContinuousMessages=!1,f._scheduledStatus=null,f.messageId=null!==(r=null!==(n=t.msg_id)&&void 0!==n?n:t.message_id)&&void 0!==r?r:0,f.parentMessageId=null!==(s="string"==typeof t.parent_message_id?parseInt(t.parent_message_id):t.parent_message_id)&&void 0!==s?s:0,f.threadInfo=t.thread_info?new Pe(f._iid,t.thread_info):null,f.reactions=t.reactions?t.reactions.map((function(e){return new xe(e)})):[],f.ogMetaData=t.og_tag?new Le(t.og_tag):null,f.silent=null!==(a=t.silent)&&void 0!==a&&a,f.isOperatorMessage=null!==(o=t.is_op_msg)&&void 0!==o&&o,f.appleCriticalAlertOptions=t.apple_critical_alert_options?new Fe(t.apple_critical_alert_options):null,"number"==typeof t.scheduled_message_id&&"number"==typeof t.scheduled_at&&t.scheduled_status&&(f.scheduledInfo={scheduledMessageId:t.scheduled_message_id,scheduledAt:t.scheduled_at},f._scheduledStatus=t.scheduled_status),f._isContinuousMessages=null!==(u=t.is_continuous_messages)&&void 0!==u&&u,f.myFeedback=(null===(c=t.feedback)||void 0===c?void 0:c.id)?new ze(t.feedback):null,f.myFeedbackStatus=null!==(l=t.my_feedback_status)&&void 0!==l?l:ze.parseFeedbackStatusFromPayload(t.feedback),f.suggestedReplies=null!==(h=null===(d=t.extended_message_payload)||void 0===d?void 0:d.suggested_replies)&&void 0!==h?h:null,f.forms=Ge.isFormPayload(t.extended_message_payload)?t.extended_message_payload.forms.map((function(e){return new Ge(f.messageId,e.key,e.fields.map((function(e){return new Ve(e)})))})):null,f}return r(s,i),s.payloadify=function(n){var r,s;return e(t(u(u({},i.payloadify.call(this,n)),{message_id:n.messageId,parent_message_id:n.parentMessageId,thread_info:n.threadInfo?Pe.payloadify(n.threadInfo):null,reactions:n.reactions.map((function(e){return xe.payloadify(e)})),og_tag:n.ogMetaData?Le.payloadify(n.ogMetaData):null,silent:n.silent,is_op_msg:n.isOperatorMessage,apple_critical_alert_options:n.appleCriticalAlertOptions?Fe.payloadify(n.appleCriticalAlertOptions):null,scheduled_message_id:null===(r=n.scheduledInfo)||void 0===r?void 0:r.scheduledMessageId,scheduled_at:null===(s=n.scheduledInfo)||void 0===s?void 0:s.scheduledAt,scheduled_status:n._scheduledStatus,feedback:n.myFeedback?ze.payloadify(n.myFeedback):null,my_feedback_status:n.myFeedbackStatus,forms:n.forms?n.forms.map((function(e){return Ge.payloadify(e)})):null})))},s._getParentMessageInfoPayload=function(n){return e(t({type:je(n.messageType),ts:n.createdAt,user:n.sender?Be.payloadify(n.sender):null,message:n.message,file:{url:n.plainUrl,name:n.name,type:n.type,require_auth:n.requireAuth},files:Array.isArray(n.fileInfoList)?n.fileInfoList.map((function(e){return ut.payloadify(e)})):null}))},s.prototype.isIdentical=function(e){return this.messageId===e.messageId},s.prototype.applyThreadInfoUpdateEvent=function(e){return this.messageId===e.targetMessageId&&(e.threadInfo._isUpdateRequired&&this.threadInfo&&e.threadInfo._updateFrom(this.threadInfo),this.threadInfo=e.threadInfo,!0)},s.prototype.applyReactionEvent=function(e){if(this.messageId===e.messageId){for(var t=!1,n=0;n<this.reactions.length;n++)if(this.reactions[n].key===e.key){this.reactions[n].applyEvent(e),this.reactions[n].isEmpty&&this.reactions.splice(n,1),t=!0;break}t||"add"!==e.operation||this.reactions.push(new xe(xe.payloadify({key:e.key,userIds:[e.userId],updatedAt:e.updatedAt})))}},s.prototype.applyParentMessage=function(e){if(!this.parentMessage)return this.parentMessage=e,!0;if(this.parentMessageId===e.messageId){var t=this.parentMessage.updatedAt;if(e.updatedAt>=t)return this.parentMessage=e,!0}return!1},s.prototype._triggerThreadInfoUpdatedEvent=function(){return U(this,void 0,void 0,(function(){var e;return A(this,(function(t){return(e=n.of(this._iid).dispatcher).dispatch(new ct({channelType:I.GROUP,channelUrl:this.channelUrl,parentMessage:this})),e.dispatch(new N({messages:[this],source:C.EVENT_THREAD_INFO_UPDATED})),[2]}))}))},s.prototype.markThreadAsRead=function(){return U(this,void 0,void 0,(function(){var e,t;return A(this,(function(r){switch(r.label){case 0:return e=n.of(this._iid).requestQueue,t=new Ze({channelUrl:this.channelUrl,messageId:this.messageId}),[4,e.send(t)];case 1:return r.sent(),this.threadInfo&&0!==this.threadInfo.unreadReplyCount?(this.threadInfo.unreadReplyCount=0,[4,this._triggerThreadInfoUpdatedEvent()]):[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},s.prototype.setPushNotificationEnabled=function(e){return U(this,void 0,void 0,(function(){var t,r;return A(this,(function(i){switch(i.label){case 0:return t=n.of(this._iid).requestQueue,r=new $e({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,pushEnabled:e}),[4,t.send(r)];case 1:return i.sent(),this.threadInfo&&this.threadInfo.isPushNotificationEnabled!==e&&(this.threadInfo.isPushNotificationEnabled=e),[2]}}))}))},s.prototype.submitForm=function(e){return U(this,void 0,void 0,(function(){var t,r,i,s,a,o,u;return A(this,(function(c){switch(c.label){case 0:if(k(e.form&&e.form instanceof Ge||h("string",e.formId)&&h("object",e.answers)).throw(P.invalidParameters),t=n.of(this._iid),r=t.requestQueue,i=t.sdkState,s=t.logger,!e.form)return[3,2];if(!(a=e.form).isSubmittable)throw new P({code:O.INVALID_PARAMETER,message:"The given form is not submittable."});if(a.isSubmitted)throw new P({code:O.INVALID_PARAMETER,message:"The given form is already submitted."});if(a.messageId!=this.messageId)throw new P({code:O.INVALID_PARAMETER,message:"This form does not belong to the message."});return o=a.fields.reduce((function(e,t){return e[t.key]=t.temporaryAnswer,e}),{}),u=new et({userId:i.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:a.key,data:o}]}),[4,r.send(u)];case 1:return c.sent(),[3,4];case 2:return e.formId&&e.answers?(s.warn("The submitForm method with formId and answers is deprecated. Use submitForm({ form: Form }) instead."),u=new et({userId:i.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:e.formId,data:e.answers}]}),[4,r.send(u)]):[3,4];case 3:c.sent(),c.label=4;case 4:return[2]}}))}))},s.prototype.submitFeedback=function(e){return U(this,void 0,void 0,(function(){var t,r,i,s,a,o;return A(this,(function(u){switch(u.label){case 0:return t=n.of(this._iid),r=t.requestQueue,i=t.dispatcher,s=new tt({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,rating:e.rating,comment:e.comment}),[4,r.send(s)];case 1:return a=u.sent(),o=a.as(nt),this.myFeedback=o.feedback,this.myFeedbackStatus="SUBMITTED",i.dispatch(new N({messages:[this],source:C.EVENT_MESSAGE_FEEDBACK_ADDED})),[2]}}))}))},s.prototype.updateFeedback=function(e){return U(this,void 0,void 0,(function(){var t,r,i,s,a,o;return A(this,(function(u){switch(u.label){case 0:return t=n.of(this._iid),r=t.requestQueue,i=t.dispatcher,s=new rt({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:e.id,rating:e.rating,comment:e.comment}),[4,r.send(s)];case 1:return a=u.sent(),o=a.as(it),this.myFeedback=o.feedback,this.myFeedbackStatus="SUBMITTED",i.dispatch(new N({messages:[this],source:C.EVENT_MESSAGE_FEEDBACK_UPDATED})),[2]}}))}))},s.prototype.deleteFeedback=function(e){return U(this,void 0,void 0,(function(){var t,r,i,s;return A(this,(function(a){switch(a.label){case 0:return t=n.of(this._iid),r=t.requestQueue,i=t.dispatcher,s=new st({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:e}),[4,r.send(s)];case 1:return a.sent(),this.myFeedback=null,this.myFeedbackStatus="NO_FEEDBACK",i.dispatch(new N({messages:[this],source:C.EVENT_MESSAGE_FEEDBACK_DELETED})),[2]}}))}))},s}(Qe),ht=function(n){function i(e,t){var r,i,s,a,o=this;if((o=n.call(this,e,t)||this).reqId="",o.replyToChannel=!1,o.errorCode=0,o.sender=t.user?new Be(o._iid,t.user):t.sender_id,o.reqId=null!==(i=null!==(r=t.req_id)&&void 0!==r?r:t.request_id)&&void 0!==i?i:"",o.replyToChannel=null!==(s=t.is_reply_to_channel)&&void 0!==s&&s,t.request_state&&f(R,t.request_state)&&(o.sendingStatus=t.request_state),!o.sendingStatus)if(o.messageId>0)o.sendingStatus=R.SUCCEEDED;else if(o.scheduledInfo)switch(t.scheduled_status&&(o._scheduledStatus=t.scheduled_status),t.scheduled_status){case ot.SENT:case ot.IN_QUEUE:o.sendingStatus=R.SUCCEEDED;break;case ot.PENDING:o.sendingStatus=R.SCHEDULED;break;case ot.FAILED:case ot.REMOVED:o.sendingStatus=R.FAILED;break;case ot.CANCELED:o.sendingStatus=R.CANCELED}else o.sendingStatus=R.PENDING;return o.errorCode=null!==(a=t.error_code)&&void 0!==a?a:0,o}return r(i,n),i.payloadify=function(r){return e(t(u(u({},n.payloadify.call(this,r)),{user:Be.payloadify(r.sender),req_id:r.reqId,is_reply_to_channel:r.replyToChannel,request_state:r.sendingStatus,error_code:r.errorCode})))},Object.defineProperty(i.prototype,"isResendable",{get:function(){return(this.sendingStatus===R.FAILED||this.sendingStatus===R.CANCELED)&&x(this.errorCode)},enumerable:!1,configurable:!0}),i.prototype.isIdentical=function(e){return this.messageId>0&&e.messageId>0?this.messageId===e.messageId:this.reqId===e.reqId},i}(dt),ft={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:D.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1},pt=function(e){return h("number",e.prevResultSize)&&h("number",e.nextResultSize)&&h("boolean",e.isInclusive)&&h("boolean",e.reverse)&&h("string",e.messageTypeFilter)&&f(D,e.messageTypeFilter)&&d("string",e.customTypesFilter,!0)&&d("string",e.senderUserIdsFilter,!0)&&h("boolean",e.includeMetaArray)&&h("boolean",e.includeReactions)&&h("boolean",e.includeParentMessageInfo)},mt=function(n){function i(r,i){var s,a,o,c,l=this;if((l=n.call(this,r,i)||this).translations={},l.message=null!==(s=i.message)&&void 0!==s?s:"",l.messageType=g.ADMIN,l.translations=null!==(a=i.translations)&&void 0!==a?a:{},i.parent_message_info){var d=i.parent_message_info;l.parentMessage=Et(r,e(t(u(u({},d),{message_id:l.parentMessageId,channel_url:l.channelUrl,channel_type:l.channelType,file:d.file,url:null===(o=d.file)||void 0===o?void 0:o.url,require_auth:null===(c=d.file)||void 0===c?void 0:c.require_auth}))))}return l}return r(i,n),i.payloadify=function(r){return e(t(u(u({},n.payloadify.call(this,r)),{message:r.message,translations:r.translations,parent_message_info:r.parentMessage?n._getParentMessageInfoPayload.call(this,r.parentMessage):null})))},i.prototype.getThreadedMessagesByTimestamp=function(e,t){return U(this,void 0,void 0,(function(){var n;return A(this,(function(r){switch(r.label){case 0:return n=u(u({},ft),t),k(this.messageId>0&&h("number",e)&&pt(n)).throw(P.invalidParameters),[4,Qs.of(this._iid).getThreadedMessagesByTimestamp(this,e,n)];case 1:return[2,r.sent()]}}))}))},i}(dt),vt=function(){function n(e){var t,n;this.detail={},this.type=null!==(t=e.type)&&void 0!==t?t:"",this.vendor=null!==(n=e.vendor)&&void 0!==n?n:"",e.detail&&h("object",e.detail)&&!Array.isArray(e.detail)&&(this.detail=e.detail)}return n.payloadify=function(n){return e(t({type:n.type,vendor:n.vendor,detail:n.detail}))},n}(),yt=function(){function t(e){this.status=e.status,e.original_message_info&&(this.originalMessageInfo={createdAt:e.original_message_info.ts,messageId:e.original_message_info.id})}return t.payloadify=function(t){return e({status:t.status,original_message_info:t.originalMessageInfo?{id:t.originalMessageInfo.messageId,ts:t.originalMessageInfo.createdAt}:void 0})},t}(),_t=function(n){function i(r,i){var s,a,o,c,l,d,h,f=this;if((f=n.call(this,r,i)||this).message="",f.messageParams=null,f.translations={},f.translationTargetLanguages=[],f.messageSurvivalSeconds=-1,f.plugins=[],f._poll=null,f.message=i.message,f.messageType=g.USER,f.translations=null!==(o=i.translations)&&void 0!==o?o:{},f.translationTargetLanguages=null!==(c=i.target_langs)&&void 0!==c?c:[],0===Object.keys(f.translations).length&&f.translationTargetLanguages.length>0)try{for(var p=v(f.translationTargetLanguages),m=p.next();!m.done;m=p.next()){var y=m.value;f.translations[y]=""}}catch(e){s={error:e}}finally{try{m&&!m.done&&(a=p.return)&&a.call(p)}finally{if(s)throw s.error}}if(f.messageSurvivalSeconds=null!==(l=i.message_survival_seconds)&&void 0!==l?l:-1,f.plugins=i.plugins?i.plugins.map((function(e){return new vt(e)})):[],f._poll=i.poll?new L(f._iid,i.poll):null,i.parent_message_info){var _=i.parent_message_info;f.parentMessage=Et(r,e(t(u(u({},_),{created_at:_.ts,message_id:f.parentMessageId,channel_url:f.channelUrl,channel_type:f.channelType,file:_.file,url:null===(d=_.file)||void 0===d?void 0:d.url,require_auth:null===(h=_.file)||void 0===h?void 0:h.require_auth}))))}return i.review_info&&(f.messageReviewInfo=new yt(i.review_info)),f}return r(i,n),i.payloadify=function(r){return e(t(u(u({},n.payloadify.call(this,r)),{message:r.message,translations:r.translations,message_survival_seconds:r.messageSurvivalSeconds,plugins:r.plugins.map((function(e){return vt.payloadify(e)})),poll:r._poll?L.payloadify(r._poll):null,parent_message_info:r.parentMessage?n._getParentMessageInfoPayload.call(this,r.parentMessage):null,review_info:r.messageReviewInfo?yt.payloadify(r.messageReviewInfo):void 0})))},i.prototype.getThreadedMessagesByTimestamp=function(e,t){return U(this,void 0,void 0,(function(){var n;return A(this,(function(r){switch(r.label){case 0:return n=u(u({},ft),t),k(this.messageId>0&&h("number",e)&&pt(n)).throw(P.invalidParameters),[4,Qs.of(this._iid).getThreadedMessagesByTimestamp(this,e,n)];case 1:return[2,r.sent()]}}))}))},i.prototype.applyPoll=function(e){return!(this._poll&&this._poll.id===e.id&&this._poll.updatedAt>e.updatedAt)&&(this._poll=e,!0)},Object.defineProperty(i.prototype,"poll",{get:function(){return this._poll},enumerable:!1,configurable:!0}),i}(ht),gt=function(n){function i(r,i){var s,a,o,c,l,d=this;if((d=n.call(this,r,i)||this).messageParams=null,d.fileInfoList=[],d.messageSurvivalSeconds=-1,d.messageType=g.FILE,d.fileInfoList=null!==(a=null===(s=i.files)||void 0===s?void 0:s.map((function(e){return new ut(r,e)})))&&void 0!==a?a:[],d.messageSurvivalSeconds=null!==(o=i.message_survival_seconds)&&void 0!==o?o:-1,i.parent_message_info){var h=i.parent_message_info;d.parentMessage=Et(r,e(t(u(u({},h),{created_at:h.ts,message_id:d.parentMessageId,channel_url:d.channelUrl,channel_type:d.channelType,file:h.file,url:null===(c=h.file)||void 0===c?void 0:c.url,require_auth:null===(l=h.file)||void 0===l?void 0:l.require_auth}))))}return d}return r(i,n),i.prototype.getThreadedMessagesByTimestamp=function(e,t){return U(this,void 0,void 0,(function(){var n;return A(this,(function(r){switch(r.label){case 0:return n=u(u({},ft),t),k(this.messageId>0&&h("number",e)&&pt(n)).throw(P.invalidParameters),[4,Qs.of(this._iid).getThreadedMessagesByTimestamp(this,e,n)];case 1:return[2,r.sent()]}}))}))},i.payloadify=function(r){return e(t(u(u({},n.payloadify.call(this,r)),{files:Array.isArray(r.fileInfoList)?r.fileInfoList.map((function(e){return ut.payloadify(e)})):null,message_survival_seconds:r.messageSurvivalSeconds,parent_message_info:r.parentMessage?n._getParentMessageInfoPayload.call(this,r.parentMessage):null})))},i._isMultipleFilesMessagePayload=function(e){var t=e.files;return Array.isArray(t)&&t.length>=2},i._isMultipleFilesMessageSerializedData=function(e){var t=e.fileInfoList;return Array.isArray(t)},i}(ht);!function(e){e.SENT="SENT",e.READ="READ"}(lt||(lt={}));var bt=function(n){function i(e,t){var r,i,s=this;if((s=n.call(this,e,t)||this).notificationData=null,s.notificationId=t.notification_message_id,s.messageType=g.ADMIN,s.messageStatus=null!==(r=t.message_status)&&void 0!==r?r:lt.SENT,s.priority=null!==(i=t.priority)&&void 0!==i?i:F.NORMAL,0===s.extendedMessage.sub_type)try{var a=JSON.parse(s.extendedMessage.sub_data),o=a.label,u=a.tags,c=void 0===u?[]:u,l=a.template_key,d=a.template_variables;s.notificationData={label:o,tags:c,templateKey:l,templateVariables:d}}catch(e){}return s}return r(i,n),i.payloadify=function(r){return e(t(u(u({},n.payloadify.call(this,r)),{notification_message_id:r.notificationId,message_status:r.messageStatus,priority:r.priority})))},i.prototype.isIdentical=function(e){return this.notificationId===e.notificationId},i}(Qe),It=function(e){if(e.notificationId)return bt.payloadify(e);switch(e.messageType){case g.USER:return _t.payloadify(e);case g.FILE:return e.fileInfoList?gt.payloadify(e):Tt.payloadify(e);case g.ADMIN:return mt.payloadify(e);default:throw P.unknown}},Et=function(e,t){if(t.notification_message_id)return new bt(e,t);switch(t.type){case"MESG":return new _t(e,t);case"FILE":return gt._isMultipleFilesMessagePayload(t)?new gt(e,t):new Tt(e,t);case"ADMM":case"BRDM":return new mt(e,t);default:return null}},Tt=function(i){function s(n,r){var s,a,o,c,l,d,h,f,p,m,v,y,_,b,I=this;(I=i.call(this,n,r)||this).messageParams=null,I.plainUrl="",I.requireAuth=!1,I.thumbnails=[],I.messageSurvivalSeconds=-1,I.messageType=g.FILE;var E=r.file;if(I.plainUrl=(null!==(a=null!==(s=null==E?void 0:E.url)&&void 0!==s?s:r.url)&&void 0!==a?a:"").split("?auth=")[0],I.name=null!==(c=null!==(o=null==E?void 0:E.name)&&void 0!==o?o:r.name)&&void 0!==c?c:"File",I.size=null!==(d=null!==(l=null==E?void 0:E.size)&&void 0!==l?l:r.size)&&void 0!==d?d:0,I.data=null!==(f=null!==(h=null==E?void 0:E.data)&&void 0!==h?h:r.custom)&&void 0!==f?f:"",I.type=E?null!==(p=E.type)&&void 0!==p?p:"":null!==(m=r.type)&&void 0!==m?m:"",I.requireAuth=null!==(v=r.require_auth)&&void 0!==v&&v,I.thumbnails=r.thumbnails?r.thumbnails.map((function(e){var t;return new Ne(I._iid,"string"==typeof e?{url:e,width:0,height:0}:u(u({},e),{url:(null!==(t=e.url)&&void 0!==t?t:"").split("auth=")[0]}),I.requireAuth)})):[],I.messageSurvivalSeconds=null!==(y=r.message_survival_seconds)&&void 0!==y?y:-1,r.parent_message_info){var T=r.parent_message_info;I.parentMessage=Et(n,e(t(u(u({},T),{created_at:T.ts,message_id:I.parentMessageId,channel_url:I.channelUrl,channel_type:I.channelType,file:T.file,url:null===(_=T.file)||void 0===_?void 0:_.url,require_auth:null===(b=T.file)||void 0===b?void 0:b.require_auth}))))}return I}return r(s,i),s.payloadify=function(n){var r;return e(t(u(u({},i.payloadify.call(this,n)),{url:n.plainUrl,require_auth:n.requireAuth,file:{name:n.name,size:n.size,type:n.type,data:n.data},thumbnails:null===(r=n.thumbnails)||void 0===r?void 0:r.map((function(e){return{url:e.plainUrl,width:e.width,height:e.height,real_width:e.realWidth,real_height:e.realHeight}})),message_survival_seconds:n.messageSurvivalSeconds,parent_message_info:n.parentMessage?i._getParentMessageInfoPayload.call(this,n.parentMessage):null})))},Object.defineProperty(s.prototype,"url",{get:function(){var e=n.of(this._iid).sessionManager;return this.requireAuth&&e.ekey?"".concat(this.plainUrl,"?auth=").concat(e.ekey):this.plainUrl},enumerable:!1,configurable:!0}),s.prototype.getThreadedMessagesByTimestamp=function(e,t){return U(this,void 0,void 0,(function(){var n;return A(this,(function(r){switch(r.label){case 0:return n=u(u({},ft),t),k(this.messageId>0&&h("number",e)&&pt(n)).throw(P.invalidParameters),[4,Qs.of(this._iid).getThreadedMessagesByTimestamp(this,e,n)];case 1:return[2,r.sent()]}}))}))},s}(ht),wt=function(e){function t(t,n){var r=n.file,i=n.fileUrl,s=n.fileName,a=n.fileSize,o=n.mimeType,u=n.thumbnailSizes,c=n._uploadedMetaData,l=n._thumbnails,d=e.call(this,t)||this;return d._plainUrl=i,d.file=r,d.fileName=s,d.fileSize=a,d.mimeType=o,d.thumbnailSizes=u,d._uploadedMetaData=c,d._thumbnails=l,d}return r(t,e),t.getPlainUrl=function(e){return e instanceof t?e._plainUrl:e.fileUrl},Object.defineProperty(t.prototype,"fileUrl",{get:function(){var e,t=n.of(this._iid).sessionManager;return this._plainUrl&&(null===(e=this._uploadedMetaData)||void 0===e?void 0:e.requireAuth)&&t.ekey?"".concat(this._plainUrl,"?auth=").concat(t.ekey):this._plainUrl},set:function(e){this._plainUrl=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return{file:this.file,fileUrl:this._plainUrl,fileName:this.fileName,fileSize:this.fileSize,mimeType:this.mimeType,thumbnailSizes:this.thumbnailSizes,_thumbnails:this._thumbnails,_uploadedMetaData:this._uploadedMetaData}},t}(l),St=function(n){function i(r){var i,s,a,o,u=[];return r.mentionType===E.USERS&&(r.mentionedUserIds?u=r.mentionedUserIds:r.mentionedUsers&&(u=r.mentionedUsers.map((function(e){return e.userId})))),n.call(this,{code:"FILE",ackRequired:!0,payload:e(t({channel_url:r.channelUrl,files:r.files?Nt(r.files):null,url:r.url,name:null!==(i=r.fileName)&&void 0!==i?i:"",type:null!==(s=r.mimeType)&&void 0!==s?s:"",size:null!==(a=r.fileSize)&&void 0!==a?a:0,custom:r.data,custom_type:r.customType,thumbnails:null===(o=r._thumbnails)||void 0===o?void 0:o.map((function(e){return Ne.payloadify(e)})),require_auth:r.requireAuth,metaarray:r.metaArrays,mention_type:r.mentionType,mentioned_user_ids:u,push_option:r.pushNotificationDeliveryOption&&r.pushNotificationDeliveryOption!==q.DEFAULT?r.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:r.appleCriticalAlertOptions?Fe.payloadify(r.appleCriticalAlertOptions):null,silent:r.silent,reply_to_channel:r.isReplyToChannel,parent_message_id:r.parentMessageId?r.parentMessageId:null,req_id:r.reqId,pin_message:r.isPinnedMessage}))})||this}return r(i,n),i}(T),Mt=function(n){function s(r){var s,a,o=this;o=n.call(this)||this;var u=[];return r.mentionType===E.USERS&&(r.mentionedUserIds?u=r.mentionedUserIds:r.mentionedUsers&&(u=r.mentionedUsers.map((function(e){return e.userId})))),o.method=i.POST,o.path="".concat(w(r.channelType),"/").concat(encodeURIComponent(r.channelUrl),"/messages"),o.params=e(t({message_type:g.FILE,user_id:r.userId,files:r.files?Nt(r.files):null,url:r.fileUrl,mention_type:r.mentionType,mentioned_user_ids:u,file_name:r.fileName,file_size:r.fileSize,file_type:r.mimeType,data:r.data,custom_type:r.customType,thumbnails:null===(s=r._thumbnails)||void 0===s?void 0:s.map((function(e){return Ne.payloadify(e)})),require_auth:r.requireAuth,sorted_metaarray:null===(a=r.metaArrays)||void 0===a?void 0:a.map((function(e){return Ke.payloadify(e)})),push_option:r.pushNotificationDeliveryOption,parent_message_id:r.parentMessageId?r.parentMessageId:null,apple_critical_alert_options:r.appleCriticalAlertOptions?Fe.payloadify(r.appleCriticalAlertOptions):null,reply_to_channel:r.isReplyToChannel,req_id:r.reqId,pin_message:r.isPinnedMessage})),o}return r(s,n),s}(a),Ut=function(e){function t(t,r,i){var s,a,o,u,c=this;(c=e.call(this,t,"FILE",i)||this).message=i.files&&i.files.length>=2?new gt(t,i):new Tt(t,i);var l=n.of(t).sdkState;return c.isMentioned=z(c.message.mentionType,null!==(o=null!==(s=c.message.mentionedUserIds)&&void 0!==s?s:null===(a=c.message.mentionedUsers)||void 0===a?void 0:a.map((function(e){return e.userId})))&&void 0!==o?o:[],l.userId),c.forceUpdateLastMessage=null!==(u=i.force_update_last_message)&&void 0!==u&&u,c}return r(t,e),t}(S),At=function(e){function t(t,r){var i,s,a,o,u=this;(u=e.call(this,t,r)||this).message=r.files&&r.files.length>=2?new gt(t,r):new Tt(t,r);var c=n.of(t).sdkState;return u.isMentioned=z(u.message.mentionType,null!==(a=null!==(i=u.message.mentionedUserIds)&&void 0!==i?i:null===(s=u.message.mentionedUsers)||void 0===s?void 0:s.map((function(e){return e.userId})))&&void 0!==a?a:[],c.userId),u.forceUpdateLastMessage=null!==(o=r.force_update_last_message)&&void 0!==o&&o,u}return r(t,e),t}(o);function Nt(n){return n.map((function(n){var r,i;return e(t({url:wt.getPlainUrl(n),file_name:n.fileName,file_type:n.mimeType,file_size:n.fileSize,thumbnails:null===(r=n._thumbnails)||void 0===r?void 0:r.map((function(e){return Ne.payloadify(e)})),require_auth:null===(i=n._uploadedMetaData)||void 0===i?void 0:i.requireAuth}))}))}var Ct;!function(e){e[e.PENDING=0]="PENDING",e[e.UPLOADING=1]="UPLOADING",e[e.UPLOADED=2]="UPLOADED",e[e.SENDING=3]="SENDING",e[e.FAILED=4]="FAILED"}(Ct||(Ct={}));var kt=function(){function e(e,t){var n=t.sdkState,r=t.dispatcher,i=t.requestQueue,s=t.onlineDetector,a=t.cacheContext,o=this;this._queueMap=new Map,this._iid=e,this._sdkState=n,this._requestQueue=i,this._cacheContext=a,this._dispatcher=r,this._dispatcher.on((function(e){e instanceof K&&(o._connectionState=e.stateType)})),this._onlineDetector=s}return Object.defineProperty(e.prototype,"_shouldSendThroughWebSocket",{get:function(){return this._connectionState===j.CONNECTED||this._connectionState===j.CONNECTING||this._connectionState===j.RECONNECTING},enumerable:!1,configurable:!0}),e.prototype._sendFileMessage=function(e,t){return U(this,void 0,void 0,(function(){var n,r,i;return A(this,(function(s){switch(s.label){case 0:return n=this._createSendFileMessageRequestParams(e,t),this._shouldSendThroughWebSocket?(r=new St(n),[4,this._requestQueue.send(r)]):[3,2];case 1:return i=s.sent(),[2,i.as(Ut).message];case 2:return r=new Mt(u(u({},n),{userId:this._sdkState.userId})),[4,this._requestQueue.send(r)];case 3:return i=s.sent(),[2,i.as(At).message]}}))}))},e.prototype._createSendFileMessageRequestParams=function(e,t){var n=u(u({},t.params),{channelUrl:e.url,channelType:e.channelType,reqId:t.requestId,url:""});if(t.multipleFileUploadInfo){var r=t.params;n.files=r.fileInfoList}else{r=t.params;n.url=r.fileUrl,n.requireAuth=r.requireAuth}return n},e.prototype._resolveMessageQueue=function(e){var t;return U(this,void 0,void 0,(function(){var n,r,i,s,a,o,u,c,l,d,h,f,p;return A(this,(function(m){switch(m.label){case 0:if(!(n=this._queueMap.get(e.url)))return[3,21];if(n.isResolving)return[3,20];n.isResolving=!0,r=[],i=!0,m.label=1;case 1:m.trys.push([1,15,16,17]),s=v(n.messageQueue),a=s.next(),m.label=2;case 2:if(a.done)return[3,14];switch(o=a.value,o.state){case Ct.PENDING:case Ct.UPLOADING:return[3,3];case Ct.UPLOADED:return[3,4];case Ct.FAILED:return[3,12]}return[3,13];case 3:return i=!1,r.push(o),[3,13];case 4:if(!i)return[3,10];m.label=5;case 5:return m.trys.push([5,8,,9]),o.state=Ct.SENDING,[4,this._sendFileMessage(e,o)];case 6:return u=m.sent(),o.deferred.resolve(u),[4,Q(100)];case 7:return m.sent(),[3,9];case 8:return c=m.sent(),o.deferred.reject(c),[3,9];case 9:return[3,11];case 10:r.push(o),m.label=11;case 11:return[3,13];case 12:return l=null!==(t=o.error)&&void 0!==t?t:P.unknown,o.deferred.reject(l.code===O.REQUEST_CANCELED?P.fileUploadCanceled:l),[3,13];case 13:return a=s.next(),[3,2];case 14:return[3,17];case 15:return d=m.sent(),f={error:d},[3,17];case 16:try{a&&!a.done&&(p=s.return)&&p.call(s)}finally{if(f)throw f.error}return[7];case 17:return h=n.isResolveRequestPending,n.messageQueue=r,n.isResolving=!1,n.isResolveRequestPending=!1,h?[4,this._resolveMessageQueue(e)]:[3,19];case 18:m.sent(),m.label=19;case 19:return[3,21];case 20:n.isResolveRequestPending=!0,m.label=21;case 21:return[2]}}))}))},e.prototype._uploadNextPendingItem=function(e){var t;return U(this,void 0,void 0,(function(){var n,r,i,s,a,o,u,c,l,d;return A(this,(function(h){switch(h.label){case 0:return(n=this._queueMap.get(e.url))&&(r=n.messageQueue.find((function(e){return e.state===Ct.PENDING})))?r.multipleFileUploadInfo?(i=r.multipleFileUploadInfo,s=i.uploadIndex,a=i.uploadCount,o=i.requestHandler,d=r.params,u=d.fileInfoList[s],!G(u.file)||(null===(t=u._uploadedMetaData)||void 0===t?void 0:t.isUploaded)?[3,2]:[4,this._tryUploadNextItemAndUpdateItemState(e,n,r)]):[3,4]:[3,9];case 1:return h.sent(),[3,3];case 2:r.state=s<a-1?Ct.PENDING:Ct.UPLOADED,h.label=3;case 3:return c=d.fileInfoList[s],l=r.multipleFileUploadInfo.uploadIndex++,r.multipleFileUploadInfo.isCopy||null==o||o._triggerOnFileUploaded(r.requestId,l,c,r.error),[3,7];case 4:return d=r.params,G(d.file)?[4,this._tryUploadNextItemAndUpdateItemState(e,n,r)]:[3,6];case 5:return h.sent(),[3,7];case 6:d.thumbnailSizes=[],r.state=Ct.UPLOADED,h.label=7;case 7:return this._uploadNextPendingItem(e),[4,this._resolveMessageQueue(e)];case 8:h.sent(),h.label=9;case 9:return[2]}}))}))},e.prototype._tryUploadNextItemAndUpdateItemState=function(e,t,r){return U(this,void 0,void 0,(function(){var i,s,a,o,u,c;return A(this,(function(l){switch(l.label){case 0:return[4,this._onlineDetector.isOnline()];case 1:if(i=l.sent(),!n.of(this._iid).sessionManager.currentUser||!i)return r.error=P.connectionRequired,r.state=Ct.FAILED,[2];if(!(t.uploadQueue.length<6))return[3,9];r.state=Ct.UPLOADING,t.uploadQueue.push(r),l.label=2;case 2:return l.trys.push([2,7,,8]),r.multipleFileUploadInfo?(s=r.multipleFileUploadInfo,a=s.uploadIndex,o=s.uploadCount,u=r.params,[4,this._uploadNextFileForMultipleFilesItemAndUpdateParams(e,r,u)]):[3,4];case 3:return l.sent(),r.state=a<o-1?Ct.PENDING:Ct.UPLOADED,[3,6];case 4:return u=r.params,[4,this._uploadNextFileForSingleFileItemAndUpdateParams(e,r,u)];case 5:l.sent(),r.state=Ct.UPLOADED,l.label=6;case 6:return[3,8];case 7:switch((c=l.sent()).code){case O.REQUEST_FAILED:r.error=new P({code:O.NETWORK_ERROR,message:"Failed to upload a file."});break;case O.REQUEST_CANCELED:r.error=P.fileUploadCanceled;break;default:r.error=c}return r.state=Ct.FAILED,[3,8];case 8:this._dequeueUploadItem(t,r),l.label=9;case 9:return[2]}}))}))},e.prototype._dequeueUploadItem=function(e,t){var n=e.uploadQueue.findIndex((function(e){return e.requestId===t.requestId}));n>=0&&e.uploadQueue.splice(n,1)},e.prototype._uploadNextFileForSingleFileItemAndUpdateParams=function(e,t,n){var r,i,s;return U(this,void 0,void 0,(function(){var a,o,u,c,l,d,h,f,p,m;return A(this,(function(v){switch(v.label){case 0:return a=new Ce({file:n.file,channelUrl:e.url,thumbnailSizes:n.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(a)];case 1:return o=v.sent(),u=o.as(ke),c=u.url,l=u.fileSize,d=void 0===l?n.fileSize:l,h=u.thumbnails,f=void 0===h?[]:h,p=u.requireAuth,m=void 0!==p&&p,n.fileName=null!==(r=n.fileName)&&void 0!==r?r:n.file.name,n.mimeType=null!==(i=n.mimeType)&&void 0!==i?i:n.file.type,n.fileSize=null!==(s=n.fileSize)&&void 0!==s?s:n.file.size,n.fileUrl=c,n.fileSize=d,n.requireAuth=m,n._thumbnails=f,[2]}}))}))},e.prototype._uploadNextFileForMultipleFilesItemAndUpdateParams=function(e,t,n){var r,i,s;return U(this,void 0,void 0,(function(){var a,o,c,l,d,h,f,p,m,v,y;return A(this,(function(_){switch(_.label){case 0:return a=t.multipleFileUploadInfo.uploadIndex,o=n.fileInfoList[a],c=new Ce({file:o.file,channelUrl:e.url,thumbnailSizes:o.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(c)];case 1:return l=_.sent(),d=l.as(ke),h=d.url,f=d.fileSize,p=void 0===f?o.fileSize:f,m=d.thumbnails,v=d.requireAuth,y=void 0!==v&&v,o.fileName=null!==(r=o.fileName)&&void 0!==r?r:o.file.name,o.mimeType=null!==(i=o.mimeType)&&void 0!==i?i:o.file.type,o.fileSize=null!==(s=o.fileSize)&&void 0!==s?s:o.file.size,o.file=void 0,o.fileUrl=h,o.fileSize=p,o._thumbnails=m,o._uploadedMetaData=u(u({},o._uploadedMetaData),{requireAuth:y,isUploaded:!0}),o instanceof wt||(n.fileInfoList[a]=new wt(this._iid,o)),[2]}}))}))},e.prototype.request=function(e,t,n,r){return void 0===r&&(r={}),U(this,void 0,void 0,(function(){var i,s,a,o,c;return A(this,(function(l){return this._queueMap.has(e.url)||(i={messageQueue:[],uploadQueue:[],isResolving:!1,isResolveRequestPending:!1},this._queueMap.set(e.url,i)),s=this._queueMap.get(e.url),a=new V,o={requestId:t,params:n,state:Ct.PENDING,deferred:a},function(e){return"fileInfoList"in e}(n)&&(c=u({uploadIndex:0,uploadCount:n.fileInfoList.length},r),o.multipleFileUploadInfo=c),s.messageQueue.push(o),this._uploadNextPendingItem(e),[2,a.promise]}))}))},e.prototype.cancel=function(e,t){var n,r,i=this._queueMap.get(e.url);if(i){var s=t?[i.messageQueue.find((function(e){return e.requestId===t}))]:p([],m(i.messageQueue),!1);try{for(var a=v(s),o=a.next();!o.done;o=a.next()){var u=o.value;if(u)switch(u.state){case Ct.PENDING:if(u.state=Ct.FAILED,u.error=P.requestCanceled,u.multipleFileUploadInfo&&!u.multipleFileUploadInfo.isCopy){var c=u.multipleFileUploadInfo,l=c.uploadIndex,d=c.requestHandler,h=u.params.fileInfoList[l];null==d||d._triggerOnFileUploaded(u.requestId,l,h,P.fileUploadCanceled)}this._resolveMessageQueue(e);break;case Ct.UPLOADING:this._requestQueue.cancel(u.requestId),this._dispatcher.dispatch(new B({requestId:u.requestId}))}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}else t&&(this._requestQueue.cancel(t),this._dispatcher.dispatch(new B({requestId:t})))},e}();var Pt,Ot={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:D.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,replyType:H.NONE,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1,showSubchannelMessagesOnly:!1},Rt=function(e){return h("number",e.prevResultSize)&&h("number",e.nextResultSize)&&h("boolean",e.isInclusive)&&h("boolean",e.reverse)&&h("string",e.messageTypeFilter)&&f(D,e.messageTypeFilter)&&d("string",e.customTypesFilter,!0)&&d("string",e.senderUserIdsFilter,!0)&&f(H,e.replyType)&&h("boolean",e.includeMetaArray)&&h("boolean",e.includeRea