text: !function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist",n(n.s=14)}([function(e,t,n){(function(t,n){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return(u=l()?Reflect.construct:function(e,t,n){var r=[null];return r.push.apply(r,t),r=new(Function.bind.apply(e,r)),n&&o(r,n.prototype),r}).apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,e)})(e)}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){var t=l();return function(){var n,r=a(e);return n=t?(n=a(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,!(n=n)||"object"!=typeof n&&"function"!=typeof n?d(r):n}}function p(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}var f=Object.prototype.toString;function g(e){return"[object Array]"===f.call(e)}function y(e){return void 0===e}function m(e){return null!==e&&"object"==typeof e}function _(e){return"[object Function]"===f.call(e)}function v(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),g(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var E={isArray:g,isArrayBuffer:function(e){return"[object ArrayBuffer]"===f.call(e)},isBuffer:function(e){return null!==e&&!y(e)&&null!==e.constructor&&!y(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:m,isUndefined:y,isDate:function(e){return"[object Date]"===f.call(e)},isFile:function(e){return"[object File]"===f.call(e)},isBlob:function(e){return"[object Blob]"===f.call(e)},isFunction:_,isStream:function(e){return m(e)&&_(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:v,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,i=arguments.length;r<i;r++)v(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,i=arguments.length;r<i;r++)v(arguments[r],n);return t},extend:function(e,t,n){return v(t,(function(t,r){e[r]=n&&"function"==typeof t?p(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}};function C(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function b(e,t,n){return t&&(n=n?n(t):E.isURLSearchParams(t)?t.toString():(r=[],E.forEach(t,(function(e,t){null!=e&&(E.isArray(e)?t+="[]":e=[e],E.forEach(e,(function(e){E.isDate(e)?e=e.toISOString():E.isObject(e)&&(e=JSON.stringify(e)),r.push(C(t)+"="+C(e))})))})),r.join("&")))&&(-1!==(t=e.indexOf("#"))&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+n),e;var r}function S(){this.handlers=[]}function A(e,t,n){return E.forEach(n,(function(n){e=n(e,t)})),e}function k(e){return!(!e||!e.__CANCEL__)}function I(e,t){E.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}function U(e,t,n,r,i){return t=t,n=n,r=r,i=i,(e=e=new Error(e)).config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}S.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},S.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},S.prototype.forEach=function(e){E.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var O,T,R,N=S,w=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],M=E.isStandardBrowserEnv()?(T=/(msie|trident)/i.test(navigator.userAgent),R=document.createElement("a"),O=P(window.location.href),function(e){return(e=E.isString(e)?P(e):e).protocol===O.protocol&&e.host===O.host}):function(){return!0};function P(e){return T&&(R.setAttribute("href",e),e=R.href),R.setAttribute("href",e),{href:R.href,protocol:R.protocol?R.protocol.replace(/:$/,""):"",host:R.host,search:R.search?R.search.replace(/^\?/,""):"",hash:R.hash?R.hash.replace(/^#/,""):"",hostname:R.hostname,port:R.port,pathname:"/"===R.pathname.charAt(0)?R.pathname:"/"+R.pathname}}var L=E.isStandardBrowserEnv()?{write:function(e,t,n,r,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),E.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),E.isString(r)&&a.push("path="+r),E.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){return(e=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)")))?decodeURIComponent(e[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},D={"Content-Type":"application/x-www-form-urlencoded"};function H(e,t){!E.isUndefined(e)&&E.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var F,G={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(F=function(e){return new Promise((function(t,n){var r=e.data,i=e.headers;E.isFormData(r)&&delete i["Content-Type"];var s=new XMLHttpRequest;e.auth&&(a=e.auth.username||"",o=e.auth.password||"",i.Authorization="Basic "+btoa(a+":"+o));var a,o,l=(a=e.baseURL,o=e.url,a&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(o)?(l=a,(a=o)?l.replace(/\/+$/,"")+"/"+a.replace(/^\/+/,""):l):o);if(s.open(e.method.toUpperCase(),b(l,e.params,e.paramsSerializer),!0),s.timeout=e.timeout,s.onreadystatechange=function(){var r,i,a,o,l,u,c;s&&4===s.readyState&&(0!==s.status||s.responseURL&&0===s.responseURL.indexOf("file:"))&&(u="getAllResponseHeaders"in s?(l=s.getAllResponseHeaders(),a={},l&&E.forEach(l.split("\n"),(function(e){i=e.indexOf(":"),r=E.trim(e.substr(0,i)).toLowerCase(),i=E.trim(e.substr(i+1)),r&&(a[r]&&0<=w.indexOf(r)||(a[r]="set-cookie"===r?(a[r]||[]).concat([i]):a[r]?a[r]+", "+i:i))})),a):null,c={data:e.responseType&&"text"!==e.responseType?s.response:s.responseText,status:s.status,statusText:s.statusText,headers:u,config:e,request:s},o=t,l=n,!(c=(u=c).config.validateStatus)||c(u.status)?o(u):l(U("Request failed with status code "+u.status,u.config,null,u.request,u)),s=null)},s.onabort=function(){s&&(n(U("Request aborted",e,"ECONNABORTED",s)),s=null)},s.onerror=function(){n(U("Network Error",e,null,s)),s=null},s.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(U(t,e,"ECONNABORTED",s)),s=null},E.isStandardBrowserEnv()&&(o=L,(o=(e.withCredentials||M(l))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0)&&(i[e.xsrfHeaderName]=o)),"setRequestHeader"in s&&E.forEach(i,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete i[t]:s.setRequestHeader(t,e)})),E.isUndefined(e.withCredentials)||(s.withCredentials=!!e.withCredentials),e.responseType)try{s.responseType=e.responseType}catch(a){if("json"!==e.responseType)throw a}"function"==typeof e.onDownloadProgress&&s.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&s.upload&&s.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){s&&(s.abort(),n(e),s=null)})),void 0===r&&(r=null),s.send(r)}))}),F),transformRequest:[function(e,t){return I(t,"Accept"),I(t,"Content-Type"),E.isFormData(e)||E.isArrayBuffer(e)||E.isBuffer(e)||E.isStream(e)||E.isFile(e)||E.isBlob(e)?e:E.isArrayBufferView(e)?e.buffer:E.isURLSearchParams(e)?(H(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):E.isObject(e)?(H(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return 200<=e&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};E.forEach(["delete","get","head"],(function(e){G.headers[e]={}})),E.forEach(["post","put","patch"],(function(e){G.headers[e]=E.merge(D)}));var x=G;function j(e){e.cancelToken&&e.cancelToken.throwIfRequested()}function B(e){return j(e),e.headers=e.headers||{},e.data=A(e.data,e.headers,e.transformRequest),e.headers=E.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),E.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||x.adapter)(e).then((function(t){return j(e),t.data=A(t.data,t.headers,e.transformResponse),t}),(function(t){return k(t)||(j(e),t&&t.response&&(t.response.data=A(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}function q(e,t){t=t||{};var n={},r=["url","method","params","data"],i=["headers","auth","proxy"],s=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];E.forEach(r,(function(e){void 0!==t[e]&&(n[e]=t[e])})),E.forEach(i,(function(r){E.isObject(t[r])?n[r]=E.deepMerge(e[r],t[r]):void 0!==t[r]?n[r]=t[r]:E.isObject(e[r])?n[r]=E.deepMerge(e[r]):void 0!==e[r]&&(n[r]=e[r])})),E.forEach(s,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}));var a=r.concat(i).concat(s);return s=Object.keys(t).filter((function(e){return-1===a.indexOf(e)})),E.forEach(s,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])})),n}function z(e){this.defaults=e,this.interceptors={request:new N,response:new N}}z.prototype.request=function(e,t){"string"==typeof e?(e=t||{}).url=arguments[0]:e=e||{},(e=q(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=[B,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){n.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){n.push(e.fulfilled,e.rejected)}));n.length;)r=r.then(n.shift(),n.shift());return r},z.prototype.getUri=function(e){return b((e=q(this.defaults,e)).url,e.params,e.paramsSerializer).replace(/^\?/,"")},E.forEach(["delete","get","head","options"],(function(e){z.prototype[e]=function(t,n){return this.request(E.merge(n||{},{method:e,url:t}))}})),E.forEach(["post","put","patch"],(function(e){z.prototype[e]=function(t,n,r){return this.request(E.merge(r||{},{method:e,url:t,data:n}))}}));var Y=z;function K(e){this.message=e}K.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},K.prototype.__CANCEL__=!0;var V=K;function Q(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new V(e),t(n.reason))}))}Q.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Q.source=function(){var e;return{token:new Q((function(t){e=t})),cancel:e}};var W=Q;function J(e){var t=new Y(e);return e=p(Y.prototype.request,t),E.extend(e,Y.prototype,t),E.extend(e,t),e}var X=J(x);function $(e){try{return!!e()}catch(e){return!0}}function Z(e){return re.call(e).slice(8,-1)}function ee(e){if(null==e)throw TypeError("Can't call method on "+e);return e}function te(e){return se(ee(e))}X.Axios=Y,X.create=function(e){return J(q(X.defaults,e))},X.Cancel=V,X.CancelToken=W,X.isCancel=k,X.all=function(e){return Promise.all(e)},X.spread=function(e){return function(t){return e.apply(null,t)}},(St=X).default=X;var ne=St,re={}.toString,ie="".split,se=$((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==Z(e)?ie.call(e,""):Object(e)}:Object,ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:{};function oe(e,t){return e(t={exports:{}},t.exports),t.exports}function le(e){return"object"==typeof e?null!==e:"function"==typeof e}function ue(e){return Ue?Ie.createElement(e):{}}function ce(e){if(!le(e))throw TypeError(String(e)+" is not an object");return e}function de(e,t){if(!le(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!le(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!le(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!le(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}function he(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}function pe(e,t){try{Ne(Ae,e,t)}catch(n){Ae[e]=t}return t}function fe(e,t){return Pe.call(e,t)}function ge(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++Le+De).toString(36)}function ye(e){return fe(Fe,e)||(He&&fe(Ge,e)?Fe[e]=Ge[e]:Fe[e]=xe("Symbol."+e)),Fe[e]}function me(e){return isNaN(e=+e)?0:(0<e?Be:je)(e)}function _e(e){return 0<e?qe(me(e),9007199254740991):0}function ve(e,t){var n,r=te(e),i=0,s=[];for(n in r)!fe(Ve,n)&&fe(r,n)&&s.push(n);for(;t.length>i;)fe(r,n=t[i++])&&(~Qe(s,n)||s.push(n));return s}function Ee(e){return"function"==typeof e?e:void 0}function Ce(){}function be(e){return"<script>"+e+"</"+nt+">"}var Se,Ae=(Ke=function(e){return e&&e.Math==Math&&e})("object"==typeof globalThis&&globalThis)||Ke("object"==typeof window&&window)||Ke("object"==typeof self&&self)||Ke("object"==typeof ae&&ae)||function(){return this}()||Function("return this")(),ke=!$((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Ie=Ae.document,Ue=le(Ie)&&le(Ie.createElement),Oe=!ke&&!$((function(){return 7!=Object.defineProperty(ue("div"),"a",{get:function(){return 7}}).a})),Te=Object.defineProperty,Re={f:ke?Te:function(e,t,n){if(ce(e),t=de(t,!0),ce(n),Oe)try{return Te(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},Ne=ke?function(e,t,n){return Re.f(e,t,he(1,n))}:function(e,t,n){return e[t]=n,e},we=Ae[qt="__core-js_shared__"]||pe(qt,{}),Me=oe((function(e){(e.exports=function(e,t){return we[e]||(we[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.8.1",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),Pe={}.hasOwnProperty,Le=0,De=Math.random(),He=!!Object.getOwnPropertySymbols&&!$((function(){return!String(Symbol())})),Fe=(W=He&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Me("wks")),Ge=Ae.Symbol,xe=W?Ge:Ge&&Ge.withoutSetter||ge,je=Math.ceil,Be=Math.floor,qe=Math.min,ze=Math.max,Ye=Math.min,Ke={includes:(St=function(e){return function(t,n,r){var i,s=te(t),a=_e(s.length),o=function(e,t){return(e=me(e))<0?ze(e+t,0):Ye(e,t)}(r,a);if(e&&n!=n){for(;o<a;)if((i=s[o++])!=i)return!0}else for(;o<a;o++)if((e||o in s)&&s[o]===n)return e||o||0;return!e&&-1}})(!0),indexOf:St(!1)},Ve={},Qe=Ke.indexOf,We=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Je=Object.keys||function(e){return ve(e,We)},Xe=ke?Object.defineProperties:function(e,t){ce(e);for(var n,r=Je(t),i=r.length,s=0;s<i;)Re.f(e,n=r[s++],t[n]);return e},$e=Ae,Ze=(ae=function(e,t){return arguments.length<2?Ee($e[e])||Ee(Ae[e]):$e[e]&&$e[e][t]||Ae[e]&&Ae[e][t]})("document","documentElement"),et=Me("keys"),tt="prototype",nt="script",rt=(qt=function(e){return et[e]||(et[e]=ge(e))})("IE_PROTO"),it=function(){try{Se=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e;it=Se?function(e){e.write(be("")),e.close();var t=e.parentWindow.Object;return e=null,t}(Se):((e=ue("iframe")).style.display="none",Ze.appendChild(e),e.src=String("javascript:"),(e=e.contentWindow.document).open(),e.write(be("document.F=Object")),e.close(),e.F);for(var t=We.length;t--;)delete it[tt][We[t]];return it()};Ve[rt]=!0;var st=Object.create||function(e,t){var n;return null!==e?(Ce[tt]=ce(e),n=new Ce,Ce[tt]=null,n[rt]=e):n=it(),void 0===t?n:Xe(n,t)},at=ye("unscopables"),ot=Array.prototype;null==ot[at]&&Re.f(ot,at,{configurable:!0,value:st(null)}),W=function(e){ot[at][e]=!0};var lt={},ut=Function.toString;"function"!=typeof we.inspectSource&&(we.inspectSource=function(e){return ut.call(e)});var ct,dt,ht,pt,ft,gt,yt,mt,_t=we.inspectSource,vt="function"==typeof(St=Ae.WeakMap)&&/native code/.test(_t(St));function Et(e,t){var n,r,i,s=e.target,a=e.global,o=e.stat,l=a?Ae:o?Ae[s]||pe(s,{}):(Ae[s]||{}).prototype;if(l)for(n in t){if(r=t[n],i=e.noTargetGet?(i=Gt(l,n))&&i.value:l[n],!Ft(a?n:s+(o?".":"#")+n,e.forced)&&void 0!==i){if(typeof r==typeof i)continue;!function(e,t){for(var n=wt(t),r=Re.f,i=Ut.f,s=0;s<n.length;s++){var a=n[s];fe(e,a)||r(e,a,i(t,a))}}(r,i)}(e.sham||i&&i.sham)&&Ne(r,"sham",!0),Ot(l,n,r,e)}}function Ct(e){return Object(ee(e))}Me=Ae.WeakMap,yt=vt?(ct=we.state||(we.state=new Me),dt=ct.get,ht=ct.has,pt=ct.set,ft=function(e,t){return t.facade=e,pt.call(ct,e,t),t},gt=function(e){return dt.call(ct,e)||{}},function(e){return ht.call(ct,e)}):(mt=qt("state"),Ve[mt]=!0,ft=function(e,t){return t.facade=e,Ne(e,mt,t),t},gt=function(e){return fe(e,mt)?e[mt]:{}},function(e){return fe(e,mt)});var bt={set:ft,get:gt,has:yt,enforce:function(e){return yt(e)?gt(e):ft(e,{})},getterFor:function(e){return function(t){var n;if(!le(t)||(n=gt(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},St={}.propertyIsEnumerable,At=Object.getOwnPropertyDescriptor,kt={f:At&&!St.call({1:2},1)?function(e){return!!(e=At(this,e))&&e.enumerable}:St},It=Object.getOwnPropertyDescriptor,Ut={f:ke?It:function(e,t){if(e=te(e),t=de(t,!0),Oe)try{return It(e,t)}catch(e){}if(fe(e,t))return he(!kt.f.call(e,t),e[t])}},Ot=oe((function(e){var t=bt.get,n=bt.enforce,r=String(String).split("String");(e.exports=function(e,t,i,s){var a=!!s&&!!s.unsafe,o=!!s&&!!s.enumerable,l=!!s&&!!s.noTargetGet;"function"==typeof i&&("string"!=typeof t||fe(i,"name")||Ne(i,"name",t),(s=n(i)).source||(s.source=r.join("string"==typeof t?t:""))),e!==Ae?(a?!l&&e[t]&&(o=!0):delete e[t],o?e[t]=i:Ne(e,t,i)):o?e[t]=i:pe(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||_t(this)}))})),Tt=We.concat("length","prototype"),Rt={f:Object.getOwnPropertyNames||function(e){return ve(e,Tt)}},Nt={f:Object.getOwnPropertySymbols},wt=ae("Reflect","ownKeys")||function(e){var t=Rt.f(ce(e)),n=Nt.f;return n?t.concat(n(e)):t},Mt=/#|\.prototype\./,Pt=(Me=function(e,t){return(e=Lt[Pt(e)])==Ht||e!=Dt&&("function"==typeof t?$(t):!!t)}).normalize=function(e){return String(e).replace(Mt,".").toLowerCase()},Lt=Me.data={},Dt=Me.NATIVE="N",Ht=Me.POLYFILL="P",Ft=Me,Gt=Ut.f,xt=(St=!$((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),qt("IE_PROTO")),jt=Object.prototype,Bt=St?Object.getPrototypeOf:function(e){return fe(e=Ct(e),xt)?e[xt]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?jt:null},qt=(Me=ye("iterator"),!1);function zt(e,t,n){e&&!fe(e=n?e:e.prototype,Wt)&&Qt(e,Wt,{configurable:!0,value:t})}function Yt(){return this}function Kt(){return this}[].keys&&("next"in(St=[].keys())?(Vt=Bt(Bt(St)))!==Object.prototype&&(fn=Vt):qt=!0),null==fn&&(fn={}),fe(fn,Me)||Ne(fn,Me,(function(){return this}));var Vt={IteratorPrototype:fn,BUGGY_SAFARI_ITERATORS:qt},Qt=Re.f,Wt=ye("toStringTag"),Jt=Vt.IteratorPrototype,Xt=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(n){}return function(n,r){return ce(n),function(e){if(!le(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),$t=Vt.IteratorPrototype,Zt=Vt.BUGGY_SAFARI_ITERATORS,en=ye("iterator"),tn="values",nn="entries",rn=(Me=function(e,t,n,r,i,s,a){function o(e){if(e===i&&f)return f;if(!Zt&&e in h)return h[e];switch(e){case"keys":case tn:case nn:return function(){return new n(this,e)}}return function(){return new n(this)}}!function(e,t,n){t+=" Iterator",e.prototype=st(Jt,{next:he(1,n)}),zt(e,t,!1),lt[t]=Yt}(n,t,r);var l,u,c=t+" Iterator",d=!1,h=e.prototype,p=h[en]||h["@@iterator"]||i&&h[i],f=!Zt&&p||o(i);if((r="Array"==t&&h.entries||p)&&(e=Bt(r.call(new e)),$t!==Object.prototype&&e.next&&(Bt(e)!==$t&&(Xt?Xt(e,$t):"function"!=typeof e[en]&&Ne(e,en,Kt)),zt(e,c,!0))),i==tn&&p&&p.name!==tn&&(d=!0,f=function(){return p.call(this)}),h[en]!==f&&Ne(h,en,f),lt[t]=f,i)if(l={values:o(tn),keys:s?f:o("keys"),entries:o(nn)},a)for(u in l)!Zt&&!d&&u in h||Ot(h,u,l[u]);else Et({target:t,proto:!0,forced:Zt||d},l);return l},"Array Iterator"),sn=bt.set,an=bt.getterFor(rn),on=Me(Array,"Array",(function(e,t){sn(this,{type:rn,target:te(e),index:0,kind:t})}),(function(){var e=an(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?{value:e.target=void 0,done:!0}:"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");lt.Arguments=lt.Array,W("keys"),W("values"),W("entries"),(fn={})[ye("toStringTag")]="z",qt="[object z]"===String(fn);var ln=ye("toStringTag"),un="Arguments"==Z(function(){return arguments}()),cn=qt?Z:function(e){var t;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(e=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),ln))?e:un?Z(t):"Object"==(e=Z(t))&&"function"==typeof t.callee?"Arguments":e};function dn(e,t){return RegExp(e,t)}Vt=qt?{}.toString:function(){return"[object "+cn(this)+"]"},qt||Ot(Object.prototype,"toString",Vt,{unsafe:!0}),W={UNSUPPORTED_Y:$((function(){var e=dn("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:$((function(){var e=dn("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))};var hn=RegExp.prototype.exec,pn=String.prototype.replace,fn=hn,gn=(qt=/a/,Vt=/b*/g,hn.call(qt,"a"),hn.call(Vt,"a"),0!==qt.lastIndex||0!==Vt.lastIndex),yn=W.UNSUPPORTED_Y||W.BROKEN_CARET,mn=void 0!==/()??/.exec("")[1];(gn||mn||yn)&&(fn=function(e){var t,n,r,i,s=this,a=yn&&s.sticky,o=function(){var e=ce(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}.call(s),l=s.source,u=0,c=e;return a&&(-1===(o=o.replace("y","")).indexOf("g")&&(o+="g"),c=String(e).slice(s.lastIndex),0<s.lastIndex&&(!s.multiline||s.multiline&&"\n"!==e[s.lastIndex-1])&&(l="(?: "+l+")",c=" "+c,u++),n=new RegExp("^(?:"+l+")",o)),mn&&(n=new RegExp("^"+l+"$(?!\\s)",o)),gn&&(t=s.lastIndex),r=hn.call(a?n:s,c),a?r?(r.input=r.input.slice(u),r[0]=r[0].slice(u),r.index=s.lastIndex,s.lastIndex+=r[0].length):s.lastIndex=0:gn&&r&&(s.lastIndex=s.global?r.index+r[0].length:t),mn&&r&&1<r.length&&pn.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var _n=fn;Et({target:"RegExp",proto:!0,forced:/./.exec!==_n},{exec:_n});var vn=(fn={codeAt:(W=function(e){return function(t,n){var r,i=String(ee(t)),s=me(n);return t=i.length,s<0||t<=s?e?"":void 0:(n=i.charCodeAt(s))<55296||56319<n||s+1===t||(r=i.charCodeAt(s+1))<56320||57343<r?e?i.charAt(s):n:e?i.slice(s,s+2):r-56320+(n-55296<<10)+65536}})(!1),charAt:W(!0)}).charAt,En="String Iterator",Cn=bt.set,bn=bt.getterFor(En);function Sn(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}function An(e,t){var n=e.exec;if("function"==typeof n){if("object"!=typeof(n=n.call(e,t)))throw TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==Z(e))throw TypeError("RegExp#exec called on incompatible receiver");return _n.call(e,t)}Me(String,"String",(function(e){Cn(this,{type:En,string:String(e),index:0})}),(function(){var e=bn(this),t=e.string,n=e.index;return n>=t.length?{value:void 0,done:!0}:(n=vn(t,n),e.index+=n.length,{value:n,done:!1})}));var kn,In,Un,On,Tn,Rn,Nn,wn,Mn=ye("species"),Pn=($((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),"$0"==="a".replace(/./,"$0")),Ln=!!/./[W=ye("replace")]&&""===/./[W]("a","$0"),Dn=!$((function(){var e=/(?:)/,t=e.exec;return e.exec=function(){return t.apply(this,arguments)},2!==(e="ab".split(e)).length||"a"!==e[0]||"b"!==e[1]})),Hn=ye("match"),Fn=ye("species"),Gn=fn.charAt,xn=[].push,jn=Math.min,Bn=4294967295,qn=!$((function(){return!RegExp(Bn,"y")}));function zn(e,t,n){for(var r in t)Ot(e,r,t[r],n);return e}function Yn(e,t,n){if(Sn(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}function Kn(e){var t=e.return;return void 0!==t&&ce(t.call(e)).value}function Vn(e,t){this.stopped=e,this.result=t}function Qn(e,t,n){function r(e){return s&&Kn(s),new Vn(!0,e)}function i(e){return h?(ce(e),f?g(e[0],e[1],r):g(e[0],e[1])):f?g(e,r):g(e)}var s,a,o,l,u,c,d=n&&n.that,h=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),f=!(!n||!n.INTERRUPTED),g=Yn(t,d,1+h+f);if(p)s=e;else{if("function"!=typeof(d=function(e){if(null!=e)return e[er]||e["@@iterator"]||lt[cn(e)]}(e)))throw TypeError("Target is not iterable");if(void 0!==(p=d)&&(lt.Array===p||Zn[$n]===p)){for(a=0,o=_e(e.length);a<o;a++)if((l=i(e[a]))&&l instanceof Vn)return l;return new Vn(!1)}s=d.call(e)}for(u=s.next;!(c=u.call(s)).done;){try{l=i(c.value)}catch(e){throw Kn(s),e}if("object"==typeof l&&l&&l instanceof Vn)return l}return new Vn(!1)}function Wn(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}In=function(e,t,n){var r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||1<".".split(/()()/).length||"".split(/.?/).length?function(e,n){var r=String(ee(this)),i=void 0===n?Bn:n>>>0;if(0==i)return[];if(void 0===e)return[r];if(!le(u=e)||(void 0!==(n=u[Hn])?!n:"RegExp"!=Z(u)))return t.call(r,e,i);for(var s,a,o,l=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),c=0,d=new RegExp(e.source,u+"g");(s=_n.call(d,r))&&!(c<(a=d.lastIndex)&&(l.push(r.slice(c,s.index)),1<s.length&&s.index<r.length&&xn.apply(l,s.slice(1)),o=s[0].length,c=a,l.length>=i));)d.lastIndex===s.index&&d.lastIndex++;return c===r.length?!o&&d.test("")||l.push(""):l.push(r.slice(c)),l.length>i?l.slice(0,i):l}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t;return[function(t,n){var i=ee(this),s=null==t?void 0:t[e];return void 0!==s?s.call(t,i,n):r.call(String(i),t,n)},function(e,i){var s=n(r,e,this,i,r!==t);if(s.done)return s.value;var a=ce(e),o=String(this),l=(s=a,e=RegExp,e=void 0===(s=ce(s).constructor)||null==(u=ce(s)[Fn])?e:Sn(u),a.unicode),u=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(qn?"y":"g"),c=new e(qn?a:"^(?:"+a.source+")",u),d=void 0===i?Bn:i>>>0;if(0==d)return[];if(0===o.length)return null===An(c,o)?[o]:[];for(var h,p=0,f=0,g=[];f<o.length;){c.lastIndex=qn?f:0;var y,m=An(c,qn?o:o.slice(f));if(null===m||(y=jn(_e(c.lastIndex+(qn?0:f)),o.length))===p)f=(h=f)+(l?Gn(o,h).length:1);else{if(g.push(o.slice(p,f)),g.length===d)return g;for(var _=1;_<=m.length-1;_++)if(g.push(m[_]),g.length===d)return g;f=p=y}}return g.push(o.slice(p)),g}]},Un=!qn,Rn=ye(kn="split"),Nn=!$((function(){var e={};return e[Rn]=function(){return 7},7!=""[kn](e)})),wn=Nn&&!$((function(){var e=!1,t=/a/;return(t={constructor:{}}).constructor[Mn]=function(){return t},t.flags="",t[Rn]=/./[Rn],t.exec=function(){return e=!0,null},t[Rn](""),!e})),Nn&&wn&&Dn||(On=/./[Rn],In=(wn=In(Rn,""[kn],(function(e,t,n,r,i){return t.exec===_n?Nn&&!i?{done:!0,value:On.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:Pn,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:Ln}))[0],Tn=wn[1],Ot(String.prototype,kn,In),Ot(RegExp.prototype,Rn,(function(e,t){return Tn.call(e,this,t)}))),Un&&Ne(RegExp.prototype[Rn],"sham",!0);var Jn=!$((function(){return Object.isExtensible(Object.preventExtensions({}))})),Xn=oe((function(e){function t(e){n(e,r,{value:{objectID:"O"+ ++i,weakData:{}}})}var n=Re.f,r=ge("meta"),i=0,s=Object.isExtensible||function(){return!0},a=e.exports={REQUIRED:!1,fastKey:function(e,n){if(!le(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!fe(e,r)){if(!s(e))return"F";if(!n)return"E";t(e)}return e[r].objectID},getWeakData:function(e,n){if(!fe(e,r)){if(!s(e))return!0;if(!n)return!1;t(e)}return e[r].weakData},onFreeze:function(e){return Jn&&a.REQUIRED&&s(e)&&!fe(e,r)&&t(e),e}};Ve[r]=!0})),$n=(Xn.REQUIRED,Xn.fastKey,Xn.getWeakData,Xn.onFreeze,ye("iterator")),Zn=Array.prototype,er=ye("iterator"),tr=ye("iterator"),nr=!1;try{var rr=0,ir={next:function(){return{done:!!rr++}},return:function(){nr=!0}};ir[tr]=function(){return this},Array.from(ir,(function(){throw 2}))}catch(h){}function sr(e,t,n){function r(e){var t=p[e];Ot(p,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(c&&!le(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return c&&!le(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(c&&!le(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})}var i,s,a,o,l,u=-1!==e.indexOf("Map"),c=-1!==e.indexOf("Weak"),d=u?"set":"add",h=Ae[e],p=h&&h.prototype,f=h,g={};return Ft(e,"function"!=typeof h||!(c||p.forEach&&!$((function(){(new h).entries().next()}))))?(f=n.getConstructor(t,e,u,d),Xn.REQUIRED=!0):Ft(e,!0)&&(s=(i=new f)[d](c?{}:-0,1)!=i,a=$((function(){i.has(1)})),o=function(e,t){if(!nr)return!1;var n=!1;try{var r={};r[tr]=function(){return{next:function(){return{done:n=!0}}}},function(e){new h(e)}(r)}catch(e){}return n}(),l=!c&&$((function(){for(var e=new h,t=5;t--;)e[d](t,t);return!e.has(-0)})),o||(((f=t((function(t,n){Wn(t,f,e);var r,i,s,a=(a=new h,r=t,t=f,Xt&&"function"==typeof(i=r.constructor)&&i!==t&&le(s=i.prototype)&&s!==t.prototype&&Xt(a,s),a);return null!=n&&Qn(n,a[d],{that:a,AS_ENTRIES:u}),a}))).prototype=p).constructor=f),(a||l)&&(r("delete"),r("has"),u&&r("get")),(l||s)&&r(d),c&&p.clear&&delete p.clear),g[e]=f,Et({global:!0,forced:f!=h},g),zt(f,e),c||n.setStrong(f,e,u),f}function ar(e,t){var n;return ur(e)&&("function"==typeof(n=e.constructor)&&(n===Array||ur(n.prototype))||le(n)&&null===(n=n[cr]))&&(n=void 0),new(void 0===n?Array:n)(0===t?0:t)}function or(e){return e.frozen||(e.frozen=new _r)}function lr(e,t){return gr(e.entries,(function(e){return e[0]===t}))}var ur=Array.isArray||function(e){return"Array"==Z(e)},cr=ye("species"),dr=[].push,hr=(W={forEach:(Me=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,s=6==e,a=7==e,o=5==e||s;return function(l,u,c,d){for(var h,p,f=Ct(l),g=se(f),y=Yn(u,c,3),m=_e(g.length),_=0,v=(d=d||ar,t?d(l,m):n||a?d(l,0):void 0);_<m;_++)if((o||_ in g)&&(p=y(h=g[_],_,f),e))if(t)v[_]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return _;case 2:dr.call(v,h)}else switch(e){case 4:return!1;case 7:dr.call(v,h)}return s?-1:r||i?i:v}})(0),map:Me(1),filter:Me(2),some:Me(3),every:Me(4),find:Me(5),findIndex:Me(6),filterOut:Me(7)},Xn.getWeakData),pr=bt.set,fr=bt.getterFor,gr=W.find,yr=W.findIndex,mr=0,_r=function(){this.entries=[]};_r.prototype={get:function(e){if(e=lr(this,e))return e[1]},has:function(e){return!!lr(this,e)},set:function(e,t){var n=lr(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=yr(this.entries,(function(t){return t[0]===e}));return~t&&this.entries.splice(t,1),!!~t}};var vr,Er={getConstructor:function(e,t,n,r){function i(e,t,n){var r=a(e),i=hr(ce(t),!0);return!0===i?or(r).set(t,n):i[r.id]=n,e}var s=e((function(e,i){Wn(e,s,t),pr(e,{type:t,id:mr++,frozen:void 0}),null!=i&&Qn(i,e[r],{that:e,AS_ENTRIES:n})})),a=fr(t);return zn(s.prototype,{delete:function(e){var t=a(this);if(!le(e))return!1;var n=hr(e);return!0===n?or(t).delete(e):n&&fe(n,t.id)&&delete n[t.id]},has:function(e){var t=a(this);if(!le(e))return!1;var n=hr(e);return!0===n?or(t).has(e):n&&fe(n,t.id)}}),zn(s.prototype,n?{get:function(e){var t=a(this);if(le(e)){var n=hr(e);return!0===n?or(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return i(this,e,t)}}:{add:function(e){return i(this,e,!0)}}),s}},Cr=(oe((function(e){function t(e){return function(t){return e(this,arguments.length?t:void 0)}}var n,r,i,s,a,o=bt.enforce,l=!Ae.ActiveXObject&&"ActiveXObject"in Ae,u=Object.isExtensible;e=e.exports=sr("WeakMap",t,Er),vt&&l&&(n=Er.getConstructor(t,"WeakMap",!0),Xn.REQUIRED=!0,e=e.prototype,r=e.delete,i=e.has,s=e.get,a=e.set,zn(e,{delete:function(e){if(!le(e)||u(e))return r.call(this,e);var t=o(this);return t.frozen||(t.frozen=new n),r.call(this,e)||t.frozen.delete(e)},has:function(e){if(!le(e)||u(e))return i.call(this,e);var t=o(this);return t.frozen||(t.frozen=new n),i.call(this,e)||t.frozen.has(e)},get:function(e){if(!le(e)||u(e))return s.call(this,e);var t=o(this);return t.frozen||(t.frozen=new n),i.call(this,e)?s.call(this,e):t.frozen.get(e)},set:function(e,t){var r;return le(e)&&!u(e)?((r=o(this)).frozen||(r.frozen=new n),i.call(this,e)?a.call(this,e,t):r.frozen.set(e,t)):a.call(this,e,t),this}}))})),{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}),br=ye("iterator"),Sr=ye("toStringTag"),Ar=on.values;for(vr in Cr){var kr=Ae[vr],Ir=kr&&kr.prototype;if(Ir){if(Ir[br]!==Ar)try{Ne(Ir,br,Ar)}catch(h){Ir[br]=Ar}if(Ir[Sr]||Ne(Ir,Sr,vr),Cr[vr])for(var Ur in on)if(Ir[Ur]!==on[Ur])try{Ne(Ir,Ur,on[Ur])}catch(h){Ir[Ur]=on[Ur]}}}var Or=function(){function e(){r(this,e)}return s(e,null,[{key:"write",value:function(){var e;wr.isDebugMode&&(e=console).log.apply(e,arguments)}},{key:"error",value:function(){var e;wr.isDebugMode&&(e=console).error.apply(e,arguments)}}]),e}(),Tr=new WeakMap,Rr=null,Nr=null,wr=function(){function e(){r(this,e)}return s(e,null,[{key:"setDebugMode",value:function(){Tr.set(this,!0)}},{key:"unsetDebugMode",value:function(){Tr.set(this,!1)}},{key:"getParamsFromCallback",value:function(e,t){return{result:e,err:t,reversed:!1}}},{key:"callback",value:function(t,n,r){r&&((n=e.getParamsFromCallback(t,n)).err&&Or.error(n.err),n.reversed?r(n.err,n.result):r(n.result,n.err))}},{key:"isSendBirdSdkCompatible",value:function(e){var t,n="3.0.55".split("."),r=e.split(".");if(n.length!==r.length)return!1;for(t in n)if(parseInt(n[t])>parseInt(r[t]))return!1;return!0}},{key:"sendBird",get:function(){return Rr},set:function(e){Rr=e}},{key:"isDebugMode",get:function(){return Tr.get(this)}},{key:"apiHost",get:function(){var e;return Nr||(e=Rr.getInstance(),Nr="https://desk-api-".concat(e.getApplicationId(),".sendbird.com/sapi")),Nr},set:function(e){Nr=e}},{key:"sdkVersion",get:function(){return"1.0.19"}},{key:"minSendBirdVersion",get:function(){return"3.0.55"}}]),e}(),Mr=(fn=Re.f,(Me=Function.prototype).toString),Pr=/^\s*function ([^ (]*)/;function Lr(e,t,n){(t=de(t))in e?Re.f(e,t,he(0,n)):e[t]=n}!ke||"name"in Me||fn(Me,"name",{configurable:!0,get:function(){try{return Mr.call(this).match(Pr)[1]}catch(e){return""}}});var Dr={ERROR_SENDBIRD_SDK_MISSING:{code:100,message:"SendBird SDK is missing."},ERROR_SENDBIRD_SDK_VERSION_NOT_SUPPORTED:{code:101,message:"This SendBird SDK version is not supported."},ERROR_SENDBIRD_DESK_INIT_MISSING:{code:102,message:"SendBird Desk SDK is not initialized. It should be done before authentication."},ERROR_SENDBIRD_SDK_MESSAGE_LIST_FAILED:{code:200,message:"Cannot load messages in SDK client."},ERROR_INVALID_PARAMETER:{code:403,message:"Invalid parameter."},ERROR_DATA_NOT_FOUND:{code:404,message:"Data not found."},ERROR_REQUEST_TIMEOUT:{code:409,message:"Request timed-out."},ERROR_REQUEST:{code:500,message:"Request failed."},ERROR_REQUEST_CANCELED:{code:501,message:"Request canceled."}},Hr=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(t,c(Error));var e=h(t);function t(n,i){var s;return r(this,t),s=e.call(this,n),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(d(s),s.constructor):s.stack=new Error(n).stack,s.name="SendBirdDeskError",s.message=n,s.code=i,s}return s(t,null,[{key:"create",value:function(e){return e?new t(e.message,e.code):new Error("SendBirdDeskError type missing.")}},{key:"throw",value:function(e){if(e)throw new t(e.message,e.code)}},{key:"Type",get:function(){return Dr}}]),t}(),Fr=new $e.WeakMap,Gr=function(){function e(){r(this,e)}return s(e,null,[{key:"connect",value:function(e,t,n){var r=this;"function"==typeof t&&(n=t,t="");var i,s=wr.sendBird;s?(i=s.getInstance(),s="".concat(wr.apiHost,"/customers/auth/"),t={sendbirdAccessToken:t||"","content-type":"application/json"},e={sendbirdAppId:i.getApplicationId(),sendbirdId:e},ne.create({headers:t}).post(s,e).then((function(e){Fr.set(r,{deskToken:e.data.token}),Or.write("[REQ] connection established"),wr.callback(e.data,null,n)})).catch((function(e){wr.callback(null,e,n)}))):wr.callback(null,Hr.create(Hr.Type.ERROR_SENDBIRD_SDK_MISSING),n)}},{key:"header",get:function(){return{sendbirdDeskToken:Fr.get(this).deskToken,"content-type":"application/json","user-agent":"desk-js@".concat("1.0.19")}}},{key:"getParam",get:function(){var e=wr.sendBird;return e?(e=e.getInstance(),"sendbirdAppId=".concat(e.getApplicationId())):""}},{key:"postParam",get:function(){var e=wr.sendBird;return e?{sendbirdAppId:e.getInstance().getApplicationId()}:{}}}]),e}(),xr=function(){function e(t){r(this,e),this.fetchFromJSON(t)}return s(e,[{key:"fetchFromJSON",value:function(e){this.userId=e?e.user:0,this.name=e?e.displayName:"",this.profileUrl=e?e.photoThumbnailUrl:""}}]),e}();fn=ae("navigator","userAgent")||"",ae=(Me=Ae.process)&&Me.versions,(Me=ae&&ae.v8)?Jr=(Vr=Me.split("."))[0]+Vr[1]:fn&&(!(Vr=fn.match(/Edge\/(\d+)/))||74<=Vr[1])&&(Vr=fn.match(/Chrome\/(\d+)/))&&(Jr=Vr[1]);var jr=Jr&&+Jr,Br=ye("species"),qr=(ae=function(e){return 51<=jr||!$((function(){var t=[];return(t.constructor={})[Br]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},ye("isConcatSpreadable")),zr=9007199254740991,Yr="Maximum allowed index exceeded";function Kr(e){throw e}Me=51<=jr||!$((function(){var e=[];return e[qr]=!1,e.concat()[0]!==e})),fn=ae("concat"),Et({target:"Array",proto:!0,forced:!Me||!fn},{concat:function(){for(var e,t,n,r=Ct(this),i=ar(r,0),s=0,a=-1,o=arguments.length;a<o;a++)if(function(e){if(!le(e))return!1;var t=e[qr];return void 0!==t?!!t:ur(e)}(n=-1===a?r:arguments[a])){if(t=_e(n.length),zr<s+t)throw TypeError(Yr);for(e=0;e<t;e++,s++)e in n&&Lr(i,s,n[e])}else{if(zr<=s)throw TypeError(Yr);Lr(i,s++,n)}return i.length=s,i}});var Vr=function(e,t){var n=[][e];return!!n&&$((function(){n.call(null,t||function(){throw 1},1)}))},Qr=Object.defineProperty,Wr={},Jr=function(e,t){if(fe(Wr,e))return Wr[e];var n=[][e],r=!!fe(t=t||{},"ACCESSORS")&&t.ACCESSORS,i=fe(t,0)?t[0]:Kr,s=fe(t,1)?t[1]:void 0;return Wr[e]=!!n&&!$((function(){if(r&&!ke)return 1;var e={length:-1};r?Qr(e,1,{enumerable:!0,get:Kr}):e[1]=1,n.call(e,i,s)}))},Xr=W.forEach;Me=Vr("forEach"),fn=Jr("forEach"),Et({target:"Array",proto:!0,forced:[].forEach!=(fn=Me&&fn?[].forEach:function(e,t){return Xr(this,e,1<arguments.length?t:void 0)})},{forEach:fn});var $r=Ke.indexOf,Zr=[].indexOf,ei=!!Zr&&1/[1].indexOf(1,-0)<0;fn=Vr("indexOf"),Ke=Jr("indexOf",{ACCESSORS:!0,1:0}),Et({target:"Array",proto:!0,forced:ei||!fn||!Ke},{indexOf:function(e,t){return ei?Zr.apply(this,arguments)||0:$r(this,e,1<arguments.length?t:void 0)}});var ti=[].join;fn=se!=Object,Ke=Vr("join",","),Et({target:"Array",proto:!0,forced:fn||!Ke},{join:function(e){return ti.call(te(this),void 0===e?",":e)}});var ni=W.map;Ke=ae("map"),ae=Jr("map"),Et({target:"Array",proto:!0,forced:!Ke||!ae},{map:function(e,t){return ni(this,e,1<arguments.length?t:void 0)}});var ri=W.some;function ii(e,t){var n=wr.sendBird;n?((n=n.getInstance().GroupChannel.createMyGroupChannelListQuery()).customTypesFilter=[li],n.channelUrlsFilter=e,n.includeEmpty=!0,n.next(t)):wr.callback(null,Hr.create(Hr.Type.ERROR_SENDBIRD_SDK_MISSING),t)}function si(t,n){var r=ci.Status.OPEN;ci.isStatus(t.status)&&(r=t.status);var i=r!==ci.Status.CLOSED?"status=ASSIGNED&status=UNASSIGNED":"status=CLOSED";i="".concat(wr.apiHost,"/tickets/")+"?".concat(Gr.getParam,"&limit=").concat(t.limit||ci.defaultLimit,"&offset=").concat(t.offset||0)+"&".concat(i,"&order=").concat(t.order||"-updated_at"),t.channelUrl&&(i+="&channelUrl=".concat(t.channelUrl)),t.customFieldFilter&&"object"===e(t.customFieldFilter)&&(i+="&customFields="+encodeURIComponent(Object.keys(t.customFieldFilter).map((function(e){return"".concat(e,":").concat(encodeURIComponent(t.customFieldFilter[e]))})).join(","))),ne.create({headers:Gr.header}).get(i).then((function(e){if(e&&e.data){var t,i=[],s=[];for(t in e.data.results){var a=new ci(e.data.results[t]);ui[a.channelUrl]=a,s.push(a.channelUrl),i.push(a)}ii(s,(function(e,t){var s=(t=wr.getParamsFromCallback(e,t)).result;t.err||i.forEach((function(e){for(var t in s){var n=s[t];if(e.channelUrl===n.url){e.channel=n;break}}})),Or.write("[REQ] ".concat(r," ticket list:"),i),wr.callback(i,t.err,n)}))}else wr.callback([],null,n)})).catch((function(e){return wr.callback(null,e,n)}))}Vr=Vr("some"),Jr=Jr("some"),Et({target:"Array",proto:!0,forced:!Vr||!Jr},{some:function(e,t){return ri(this,e,1<arguments.length?t:void 0)}}),Et({target:"Object",stat:!0,forced:Jr=$((function(){Je(1)}))},{keys:function(e){return Je(Ct(e))}});var ai=function(){function e(){r(this,e)}return s(e,null,[{key:"CustomType",get:function(){return{RICH_MESSAGE:"SENDBIRD_DESK_RICH_MESSAGE",ADMIN_MESSAGE:"SENDBIRD_DESK_ADMIN_MESSAGE_CUSTOM_TYPE"}}},{key:"DataType",get:function(){return{TICKET_INQUIRE_CLOSURE:"SENDBIRD_DESK_INQUIRE_TICKET_CLOSURE",TICKET_ASSIGN:"TICKET_ASSIGN",TICKET_TRANSFER:"TICKET_TRANSFER",TICKET_CLOSE:"TICKET_CLOSE",TICKET_FEEDBACK:"SENDBIRD_DESK_CUSTOMER_SATISFACTION",URL_PREVIEW:"SENDBIRD_DESK_URL_PREVIEW"}}},{key:"ClosureState",get:function(){return{WAITING:"WAITING",CONFIRMED:"CONFIRMED",DECLINED:"DECLINED"}}},{key:"FeedbackState",get:function(){return{WAITING:"WAITING",CONFIRMED:"CONFIRMED"}}},{key:"UrlRegExp",get:function(){return/(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?/gi}}]),e}(),oi=function(){function e(t){r(this,e),this.fetchFromJSON(t)}return s(e,[{key:"fetchFromJSON",value:function(e){this.channelUrl=e?e.channel_url:"",this.name=e?e.name:""}}]),e}(),li="SENDBIRD_DESK_CHANNEL_CUSTOM_TYPE",ui={},ci=function(){function t(e){r(this,t),this.fetchFromJSON(e)}return s(t,[{key:"fetchFromJSON",value:function(e){if(this.id=e?e.id:0,this.title=e?e.channelName:"",this.status=e?e.status:"",this.info=e&&e.info?JSON.parse(e.info):null,this.priority=e?e.priority:t.Priority.MEDIUM,this.agent=e&&e.recentAssignment&&e.recentAssignment.agent?new xr(e.recentAssignment.agent):null,this.customer=e?e.customer:null,this.customFields={},this.group=e?e.group:0,this.relatedChannels=[],this.channel=this.channel,this.channelUrl=e?e.channelUrl:null,this.updatedAt=(e?new Date(e.updatedAt):new Date).getTime(),e&&e.customFields)for(var n=e.customFields,r=0;r<n.length;r++){var i=n[r].key,s=n[r].value;this.customFields[i]=s}if(e&&e.relatedChannels)try{var a=JSON.parse(e.relatedChannels);Array.isArray(a)&&(this.relatedChannels=a.map((function(e){return new oi(e)})))}catch(e){}}},{key:"refresh",value:function(e){var t=this,n="".concat(wr.apiHost,"/tickets/").concat(this.id,"/?").concat(Gr.getParam);ne.create({headers:Gr.header}).get(n).then((function(n){t.fetchFromJSON(n.data),ii([t.channelUrl],(function(n,r){0<(r=wr.getParamsFromCallback(n,r).result).length&&(t.channel=r[0]),ui[t.channelUrl]=t,Or.write("[REQ] ticket refresh:",t),wr.callback(t,null,e)}))})).catch((function(t){return wr.callback(null,t,e)}))}},{key:"reopen",value:function(e){var t=this,n="".concat(wr.apiHost,"/tickets/").concat(this.id,"/reopen"),r=Gr.postParam;ne.create({headers:Gr.header}).patch(n,r).then((function(n){n&&n.data&&n.data.channelUrl?(t.fetchFromJSON(n.data),ii([t.channelUrl],(function(n,r){0<(r=wr.getParamsFromCallback(n,r).result).length&&(t.channel=r[0]),ui[t.channelUrl]=t,Or.write("[REQ] ticket reopen:",t),wr.callback(t,null,e)}))):wr.callback(t,null,e)})).catch((function(t){return wr.callback(null,t,e)}))}},{key:"cancel",value:function(e,t){var n,r,i=this;"function"==typeof e&&(t=e,e=null),e&&"string"!=typeof e?wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER),t):(n="".concat(wr.apiHost,"/tickets/").concat(this.id,"/cancel"),r=Gr.postParam,e&&(r.groupKeyForTransfer=e),ne.create({headers:Gr.header}).patch(n,r).then((function(e){e&&e.data&&e.data.channelUrl?(i.fetchFromJSON(e.data),ii([i.channelUrl],(function(e,n){0<(n=wr.getParamsFromCallback(e,n).result).length&&(i.channel=n[0]),ui[i.channelUrl]=i,Or.write("[REQ] ticket cancel:",i),wr.callback(i,null,t)}))):wr.callback(i,null,t)})).catch((function(e){return wr.callback(null,e,t)})))}},{key:"close",value:function(e,t){var n=this;if(1===arguments.length){if("function"!=typeof e)return void wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER),t);t=e,e=null}else if("string"!=typeof e||"function"!=typeof t)return void wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER),t);var r="".concat(wr.apiHost,"/tickets/").concat(this.id,"/close"),i=Gr.postParam;e&&(i.closeComment=e),ne.create({headers:Gr.header}).patch(r,i).then((function(e){e.data.channelUrl?(n.fetchFromJSON(e.data),ii([n.channelUrl],(function(e,r){0<(r=wr.getParamsFromCallback(e,r).result).length&&(n.channel=r[0]),ui[n.channelUrl]=n,Or.write("[REQ] ticket close:",n),wr.callback(n,null,t)}))):wr.callback(n,null,t)})).catch((function(e){return wr.callback(null,e,t)}))}},{key:"selectQuestion",value:function(e,t,n){var r,i,s=this;"number"==typeof e&&"string"==typeof t?(r="".concat(wr.apiHost,"/tickets/").concat(this.id,"/select_question"),(i=Gr.postParam).faqFileId=e,i.question=t,ne.create({headers:Gr.header}).post(r,i).then((function(e){Or.write("[REQ] ticket select option:",s),wr.callback(e.data,null,n)})).catch((function(e){return wr.callback(null,e,n)}))):wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER),n)}},{key:"setPriority",value:function(e,n){var r,i,s=this;Object.keys(t.Priority).map((function(e){return t.Priority[e]})).indexOf(e)<0?wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER),n):(r="".concat(wr.apiHost,"/tickets/").concat(this.id,"/"),(i=Gr.postParam).priority=e,ne.create({headers:Gr.header}).patch(r,i).then((function(e){s.fetchFromJSON(e.data),wr.callback(s,null,n)})).catch((function(e){wr.callback(null,e,n)})))}},{key:"setRelatedChannelUrls",value:function(e,t){var n,r,i=this;Array.isArray(e)&&!e.some((function(e){return"string"!=typeof e}))?(n="".concat(wr.apiHost,"/tickets/").concat(this.id,"/"),(r=Gr.postParam).relatedChannelUrls=e.join(","),ne.create({headers:Gr.header}).patch(n,r).then((function(e){i.fetchFromJSON(e.data),wr.callback(i,null,t)})).catch((function(e){wr.callback(null,e,t)}))):wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER),t)}},{key:"setCustomFields",value:function(t,n){var r=this;if("object"!==e(t)||null===t||Array.isArray(t))wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER),n);else{var i,s={};for(i in t)s[i]="string"==typeof t[i]?t[i]:JSON.stringify(t[i]);var a="".concat(wr.apiHost,"/tickets/").concat(this.id,"/custom_fields/"),o=Gr.postParam;o.customFields=JSON.stringify(s),ne.create({headers:Gr.header}).patch(a,o).then((function(e){r.fetchFromJSON(e.data),wr.callback(r,null,n)})).catch((function(e){wr.callback(null,e,n)}))}}}],[{key:"isStatus",value:function(e){for(var n in t.Status)if(t.Status[n]===e)return!0;return!1}},{key:"isPriority",value:function(e){for(var n in t.Priority)if(t.Priority[n]===e)return!0;return!1}},{key:"isDeskCustomType",value:function(e){return e===li}},{key:"clearCache",value:function(e){e?(delete ui[e],Or.write("[SYS] cached ticket for ".concat(e," cleared"))):(ui={},Or.write("[SYS] all cached ticket cleared"))}},{key:"create",value:function(n,r,i,s,a,o,l,u){if(c=wr.sendBird)if("function"==typeof i&&(u=i,l=o=a=s=i=null),"function"==typeof s&&(u=s,l=o=a=s=null),"function"==typeof a&&(u=a,l=o=a=null),"function"==typeof o&&(u=o,l=o=null),"function"==typeof l&&(u=l,l=null),"string"!=typeof n||"string"!=typeof r||i&&"string"!=typeof i||s&&"object"!==e(s)||a&&!t.isPriority(a)||o&&(!Array.isArray(o)||o.some((function(e){return"string"!=typeof e})))||Array.isArray(s)||l&&"string"!=typeof l)wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER),u);else{var c,d=c.getInstance(),h="".concat(wr.apiHost,"/tickets/");if((c=Gr.postParam).channelName=n,c.channelType="SENDBIRD_JAVASCRIPT",i&&(c.groupKey=i),s){var p,f={};for(p in s)f[p]="string"==typeof s[p]?s[p]:JSON.stringify(s[p]);c.customFields=JSON.stringify(f)}a&&(c.priority=a),o&&(c.relatedChannelUrls=o.join(",")),l&&(c.botKey=l),c.info=JSON.stringify({ticket:{subject:n,requester:{name:r,email:d.getCurrentUserId()}}}),ne.create({headers:Gr.header}).post(h,c).then((function(e){var n=new t(e.data);ii([n.channelUrl],(function(e,t){0<(t=wr.getParamsFromCallback(e,t).result).length&&(n.channel=t[0]),ui[n.channelUrl]=n,Or.write("[REQ] ticket create:",n),wr.callback(n,null,u)}))})).catch((function(e){return wr.callback(null,e,u)}))}else wr.callback(null,Hr.create(Hr.Type.ERROR_SENDBIRD_SDK_MISSING),u)}},{key:"getOpenCount",value:function(e){var t="".concat(wr.apiHost,"/tickets/count/?").concat(Gr.getParam);ne.create({headers:Gr.header}).get(t).then((function(t){return wr.callback(t.data,null,e)})).catch((function(t){return wr.callback(null,t,e)}))}},{key:"getByChannelUrl",value:function(e,n){var r;ui[e]?wr.callback(ui[e],null,n):(r="".concat(wr.apiHost,"/tickets/?").concat(Gr.getParam,"&limit=10&channelUrl=").concat(e),ne.create({headers:Gr.header}).get(r).then((function(r){var i=null;r&&r.data&&0<r.data.results.length&&(i=new t(r.data.results[0])),i?ii([e],(function(t,r){0<(r=wr.getParamsFromCallback(t,r).result).length&&(i.channel=r[0]),ui[e]=i,Or.write("[REQ] get ticket for channel ".concat(e,":"),i),wr.callback(i,null,n)})):wr.callback(null,Hr.Type.ERROR_DATA_NOT_FOUND,n)})).catch((function(e){return wr.callback(null,e,n)})))}},{key:"getOpenedList",value:function(e,t,n){"function"==typeof t&&(n=t,t=null),si({offset:e,customFieldFilter:t,status:this.Status.OPEN},n)}},{key:"getClosedList",value:function(e,t,n){"function"==typeof t&&(n=t,t=null),si({offset:e,customFieldFilter:t,status:this.Status.CLOSED},n)}},{key:"getUrlPreview",value:function(e,t){var n="".concat(wr.apiHost,"/tickets/url_preview/"),r=Gr.postParam;r.url=e,ne.create({headers:Gr.header}).post(n,r).then((function(e){return wr.callback(e.data,null,t)})).catch((function(e){return wr.callback(null,e,t)}))}},{key:"confirmEndOfChat",value:function(e,n,r){"string"==typeof n&&-1<["yes","no"].indexOf(n)?t.getByChannelUrl(e.channelUrl,(function(t,i){var s=wr.getParamsFromCallback(t,i).result;t="".concat(wr.apiHost,"/tickets/").concat(s.id,"/edit_message/"),(i=Gr.postParam).messageId=e.messageId,i.messageData=JSON.stringify({type:ai.DataType.TICKET_INQUIRE_CLOSURE,body:{state:"yes"===n?ai.ClosureState.CONFIRMED:ai.ClosureState.DECLINED,ticketId:s.id}}),ne.create({headers:Gr.header}).patch(t,i).then((function(e){Or.write("[REQ] confirmed end of chat:",s),wr.callback(e.data,null,r)})).catch((function(e){return wr.callback(null,e,r)}))})):wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER))}},{key:"submitFeedback",value:function(e,n,r,i){var s=2<arguments.length&&void 0!==r?r:"",a=3<arguments.length?i:void 0;e&&0<e.messageId&&e.channelUrl&&"number"==typeof n&&1<=n&&n<=5&&"string"==typeof s?t.getByChannelUrl(e.channelUrl,(function(t,r){var i=wr.getParamsFromCallback(t,r).result;t="".concat(wr.apiHost,"/tickets/").concat(i.id,"/edit_message/"),(r=Gr.postParam).messageId=e.messageId,r.messageData=JSON.stringify({type:ai.DataType.TICKET_FEEDBACK,body:{state:ai.FeedbackState.CONFIRMED,customerSatisfactionScore:n,customerSatisfactionComment:s,ticketId:i.id}}),ne.create({headers:Gr.header}).patch(t,r).then((function(e){Or.write("[REQ] customer feedback:",i),wr.callback(e.data,null,a)})).catch((function(e){return wr.callback(null,e,a)}))})):wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER))}},{key:"Status",get:function(){return{INITIALIZED:"INITIALIZED",PROACTIVE:"PROACTIVE",UNASSIGNED:"UNASSIGNED",ASSIGNED:"ASSIGNED",OPEN:"OPEN",CLOSED:"CLOSED"}}},{key:"Priority",get:function(){return{URGENT:"URGENT",HIGH:"HIGH",MEDIUM:"MEDIUM",LOW:"LOW"}}},{key:"defaultLimit",get:function(){return 10}}]),t}(),di=!1;return function(){function t(){r(this,t)}return s(t,null,[{key:"init",value:function(e){try{e||(window&&window.SendBird&&(e=window.SendBird),n&&n.SendBird&&(e=n.SendBird)),e&&e.version?(wr.sendBird=e,wr.isSendBirdSdkCompatible(e.version)?di=!0:Hr.throw(Hr.Type.ERROR_SENDBIRD_SDK_VERSION_NOT_SUPPORTED)):Hr.throw(Hr.Type.ERROR_SENDBIRD_SDK_MISSING)}catch(e){Hr.throw(Hr.Type.ERROR_SENDBIRD_SDK_MISSING)}}},{key:"authenticate",value:function(e,t,n){di?Gr.connect(e,t,n):Hr.throw(Hr.Type.ERROR_SENDBIRD_DESK_INIT_MISSING)}},{key:"isDeskChannel",value:function(e){return ci.isDeskCustomType(e.customType)}},{key:"setApiHost",value:function(e){wr.apiHost=e}},{key:"setDebugMode",value:function(){wr.setDebugMode()}},{key:"setCustomerCustomFields",value:function(t,n){if("object"!==e(t)||null===t||Array.isArray(t))wr.callback(null,Hr.create(Hr.Type.ERROR_INVALID_PARAMETER),n);else{var r,i={};for(r in t)i[r]="string"==typeof t[r]?t[r]:JSON.stringify(t[r]);var s="".concat(wr.apiHost,"/customers/custom_fields/"),a=Gr.postParam;a.customFields=JSON.stringify(i),ne.create({headers:Gr.header}).patch(s,a).then((function(e){var t,r={};for(t in e.data.customFields){var i=e.data.customFields[t];r[i.key]=i.value}wr.callback(r,null,n)})).catch((function(e){wr.callback(null,e,n)}))}}},{key:"version",get:function(){return wr.sdkVersion}},{key:"Error",get:function(){return Hr}},{key:"Agent",get:function(){return xr}},{key:"Ticket",get:function(){return ci}},{key:"Message",get:function(){return ai}},{key:"RelatedChannel",get:function(){return oi}},{key:"UrlRegExp",get:function(){return ai.UrlRegExp}}]),t}()}()}).call(this,n(3),n(4))},function(e,t,n){"use strict";var r=n(6),i=Object.prototype.toString;function s(e){return"[object Array]"===i.call(e)}function a(e){return void 0===e}function o(e){return null!==e&&"object"==typeof e}function l(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===i.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===i.call(e)},isBuffer:function(e){return null!==e&&!a(e)&&null!==e.constructor&&!a(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:o,isPlainObject:l,isUndefined:a,isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:u,isStream:function(e){return o(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:c,merge:function e(){var t={};function n(n,r){l(t[r])&&l(n)?t[r]=e(t[r],n):l(n)?t[r]=e({},n):s(n)?t[r]=n.slice():t[r]=n}for(var r=0,i=arguments.length;r<i;r++)c(arguments[r],n);return t},extend:function(e,t,n){return c(t,(function(t,i){e[i]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t,n){(function(t,r,i){e.exports=function(e,n,s){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=a(e),l=a(n),u=a(s);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function E(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function C(e,t,n){return(C=E()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&v(i,n.prototype),i}).apply(null,arguments)}function b(e){var t="function"==typeof Map?new Map:void 0;return(b=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return C(e,arguments,_(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),v(r,e)})(e)}function S(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return S(e)}function k(e){var t=E();return function(){var n,r=_(e);if(t){var i=_(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return A(this,n)}}function I(e,t,n){return(I="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function U(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,s=[],a=!0,o=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(s.push(r.value),!t||s.length!==t);a=!0);}catch(e){o=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(o)throw i}}return s}}(e,t)||T(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||T(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,t){if(e){if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function N(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=T(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw s}}}}var w=function(){function e(){p(this,e)}return g(e,null,[{key:"OS_VERSION",get:function(){return"undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.replace(/,/g,"."):"noAgent"}},{key:"SDK_VERSION",get:function(){return"3.0.160"}},{key:"SDK_MAJOR_VERSION",get:function(){return e.SDK_VERSION.split(".")[0]}},{key:"DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL",get:function(){return 100}},{key:"INTERNAL_CALL",get:function(){return"ic"}}]),e}(),M={},P=new WeakMap,L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};p(this,e),P.set(this,"object"===h(t)&&t?t:{})}return g(e,[{key:"container",get:function(){return P.get(this)}},{key:"get",value:function(e){return P.get(this)[e]}},{key:"set",value:function(e,t){P.get(this)[e]=t}},{key:"remove",value:function(e){var t=P.get(this);t.hasOwnProperty(e)&&delete t[e]}}],[{key:"create",value:function(t,n){return M[t]=new e(n),M[t]}},{key:"get",value:function(e){return e||(e=fn.getInstance()._iid),M[e]}}]),e}(),D=function(e){m(n,e);var t=k(n);function n(e,r){var i;return p(this,n),(i=t.call(this,r)).name="SendBirdException",i.code=r||0,i.message=e,i}return g(n,[{key:"isSessionKeyExpiredError",get:function(){return this.code===n.SESSION_KEY_EXPIRED}},{key:"isSessionTokenExpiredError",get:function(){return this.code===n.SESSION_TOKEN_EXPIRED}},{key:"isSessionTokenRevokedError",get:function(){return this.code===n.SESSION_TOKEN_REVOKED}}],[{key:"SESSION_KEY_EXPIRED",get:function(){return 400309}},{key:"SESSION_TOKEN_EXPIRED",get:function(){return 400302}},{key:"SESSION_TOKEN_REVOKED",get:function(){return 400310}},{key:"INVALID_INITIALIZATION",get:function(){return 800100}},{key:"CONNECTION_REQUIRED",get:function(){return 800101}},{key:"CONNECTION_CANCELED",get:function(){return 800102}},{key:"INVALID_PARAMETER",get:function(){return 800110}},{key:"NETWORK_ERROR",get:function(){return 800120}},{key:"NETWORK_ROUTING_ERROR",get:function(){return 800121}},{key:"MALFORMED_DATA",get:function(){return 800130}},{key:"MALFORMED_ERROR_DATA",get:function(){return 800140}},{key:"WRONG_CHANNEL_TYPE",get:function(){return 800150}},{key:"MARK_AS_READ_RATE_LIMIT_EXCEEDED",get:function(){return 800160}},{key:"QUERY_IN_PROGRESS",get:function(){return 800170}},{key:"ACK_TIMEOUT",get:function(){return 800180}},{key:"LOGIN_TIMEOUT",get:function(){return 800190}},{key:"WEBSOCKET_CONNECTION_CLOSED",get:function(){return 800200}},{key:"WEBSOCKET_CONNECTION_FAILED",get:function(){return 800210}},{key:"REQUEST_FAILED",get:function(){return 800220}},{key:"FILE_UPLOAD_CANCEL_FAILED",get:function(){return 800230}},{key:"REQUEST_CANCELED",get:function(){return 800240}},{key:"REQUEST_DUPLICATED",get:function(){return 800250}},{key:"FILE_SIZE_LIMIT_EXCEEDED",get:function(){return 800260}},{key:"SESSION_TOKEN_REQUEST_FAILED",get:function(){return 800500}},{key:"SESSION_REFRESH_SUCCESS",get:function(){return 800501}},{key:"SESSION_REFRESH_FAILED",get:function(){return 800502}}]),n}(b(Error)),H=function(){function e(){p(this,e),this.sessionToken=null,this.sessionKey=null,this.eKey=null}return g(e,[{key:"hasSession",value:function(){return!!this.sessionKey}}]),e}(),F={},G=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};p(this,e),this._iid=t,Object.keys(r).forEach((function(e){var t=r[e];"function"==typeof t&&(n[e]=n.getClonedClass(t))})),F[t]=this}return g(e,[{key:"getClonedClass",value:function(e){var t=this._iid;return function(n){m(i,n);var r=k(i);function i(){return p(this,i),r.apply(this,arguments)}return g(i,[{key:"_iid",get:function(){return t}}],[{key:"_iid",get:function(){return t}},{key:"_name",get:function(){return e.name}}]),i}(e)}}],[{key:"get",value:function(e){return e?F[e]:{}}}]),e}(),x={verbose:"VERBOSE",info:"INFO",debug:"DEBUG",warn:"WARN",error:"ERROR",none:"NONE"},j=function(e){m(n,e);var t=k(n);function n(){return p(this,n),t.apply(this,arguments)}return g(n,[{key:"log",value:function(e){for(var t,n,r,i,s,a=this.getLogLevelText(e);a.length<8;)a+=" ";for(var o=arguments.length,l=new Array(o>1?o-1:0),u=1;u<o;u++)l[u-1]=arguments[u];switch(l.unshift("[".concat(a,"]")),e){case"verbose":(t=console).log.apply(t,l);break;case"debug":(n=console).log.apply(n,l);break;case"info":(r=console).info.apply(r,l);break;case"warn":(i=console).warn.apply(i,l);break;case"error":(s=console).error.apply(s,l)}}},{key:"groupStart",value:function(){var e;(e=console).group.apply(e,arguments)}},{key:"groupEnd",value:function(){var e;(e=console).groupEnd.apply(e,arguments)}}]),n}(function(){function e(){p(this,e)}return g(e,[{key:"getLogLevelText",value:function(e){return x[e]}}]),e}()),B={DEBUG:"debug",PRODUCTION:"production"},q=B.PRODUCTION,z={VERBOSE:"verbose",DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error",NONE:"none"},Y=[z.NONE,z.ERROR,z.WARN,z.INFO,z.DEBUG,z.VERBOSE],K=z.WARN,V=Y.indexOf(K),Q=[new j],W=function(){function e(){p(this,e)}return g(e,null,[{key:"Mode",get:function(){return B}},{key:"mode",get:function(){return q},set:function(t){Object.keys(e.Mode).map((function(t){return e.Mode[t]})).indexOf(t)>-1&&(q=t)}},{key:"supportedLogLevels",get:function(){return z}},{key:"logLevel",get:function(){return Y[V]},set:function(e){Y.includes(e)||(e=K),V=Y.indexOf(e)}},{key:"defaultLogLevel",get:function(){return K}},{key:"isDisplayableLogLevel",value:function(e){var t=Y.indexOf(e);return 0<=t&&t<=V}},{key:"log",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.isDisplayableLogLevel(t)&&Q.forEach((function(e){return e.log.apply(e,[t].concat(r))}))}},{key:"verbose",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.log.apply(e,[z.VERBOSE].concat(n))}},{key:"debug",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.log.apply(e,[z.DEBUG].concat(n))}},{key:"info",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.log.apply(e,[z.INFO].concat(n))}},{key:"warn",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.log.apply(e,[z.WARN].concat(n))}},{key:"error",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.log.apply(e,[z.ERROR].concat(n))}},{key:"group",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=[];Array.isArray(n[n.length-1])&&(i=n.pop()),i.some((function(t){return e.isDisplayableLogLevel(t.level)}))&&Q.filter((function(e){return e instanceof j})).forEach((function(e){e.groupStart.apply(e,n),i.forEach((function(t){return e.log.apply(e,[t.level].concat(O(t.messages)))})),e.groupEnd()}))}}]),e}(),J=function(){function e(){p(this,e),this._queue=[],this.locked=!1}return g(e,[{key:"lock",value:function(e){var t=this;this.locked?this._queue.push(e):(this.locked=!0,e((function(){return t.unlock()})))}},{key:"unlock",value:function(){if(this.locked=!1,this._queue.length>0){var e=this._queue.shift();this.lock(e)}}}]),e}(),X=function(){function e(t){p(this,e),this.sb=t,this.mutex=new J,this.pingTimer=null,this.pingTimeoutTimer=null}return g(e,[{key:"ping",value:function(){var e=this,t=G.get(this.sb._iid).Command.bPing(),n=L.get(this.sb._iid).container,r=n.wsAdapter,i=n.pongTimeout;r.client.send(t),W.debug("`PING`"),this.pingTimeoutTimer=setTimeout((function(){W.debug("`PING` timeout."),e.stop(),r.client.handler&&r.client.handler.onError()}),i)}},{key:"pong",value:function(){this.pingTimeoutTimer&&(clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=null)}},{key:"refreshTimer",value:function(){var e=this,t=L.get(this.sb._iid).container.pingInterval;this.mutex.lock((function(n){e.stop(),e.pingTimer=setInterval((function(){e.ping()}),t),n()}))}},{key:"start",value:function(){this.refreshTimer(),this.ping()}},{key:"stop",value:function(){this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null),this.pingTimeoutTimer&&(clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=null)}}]),e}();function $(){return"undefined"==typeof window&&void 0!==t&&("node"===t.title||void 0!==t.versions&&t.versions.node||"[object process]"===String(t))}var Z=[D.CONNECTION_REQUIRED,D.NETWORK_ERROR,D.ACK_TIMEOUT,D.WEBSOCKET_CONNECTION_CLOSED,D.WEBSOCKET_CONNECTION_FAILED,D.FILE_UPLOAD_CANCEL_FAILED,D.REQUEST_CANCELED,500901,500910,900200],ee=function(){function e(){p(this,e)}return g(e,null,[{key:"deepEqual",value:function(e,t){if(e!==t){var n=d({},e),r=d({},t);return!(n.messageId&&r.messageId&&n.messageId!==r.messageId||n.reqId&&r.reqId&&n.reqId!==r.reqId||(n.hasOwnProperty("messageId")&&delete n.messageId,n.hasOwnProperty("reqId")&&delete n.reqId,r.hasOwnProperty("messageId")&&delete r.messageId,r.hasOwnProperty("reqId")&&delete r.reqId,JSON.stringify(n)!==JSON.stringify(r)))}return!0}},{key:"isResendableError",value:function(e){return e>0&&Z.indexOf(e)>=0}},{key:"isFile",value:function(e){var t="object"===h(e)&&null!==e&&"string"==typeof e.name&&"string"==typeof e.uri&&"string"==typeof e.type;if(!t)if($()){if(void 0!==r)return e instanceof r}else{if("undefined"!=typeof Blob)return e instanceof Blob;if("undefined"!=typeof File)return e instanceof File}return t}}]),e}(),te=function(){function e(t){var n=this;p(this,e),this.fields={},t&&Object.keys(t).forEach((function(e){n.fields[e]={value:t[e]},ee.isFile(t[e])&&(n.fields[e].filename=t[e].name)})),this.options={},this.internal=!1,this.upload={reqId:null,deleteRequest:null,progressHandler:null}}return g(e,[{key:"add",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.fields[e]={value:t,filename:n}}},{key:"remove",value:function(e){this.fields.hasOwnProperty(e)&&delete this.fields[e]}},{key:"yield",value:function(){for(var e=this,t=!1,n=Object.keys(this.fields),r=0;r<n.length;r++){var i=n[r];if(ee.isFile(this.fields[i].value)){t=!0;break}}if(t){var s=new l.default;return Object.keys(this.fields).forEach((function(t){var n=e.fields[t];if(ee.isFile(n.value)){var r=n.value;r.filename||r.name?s.append(t,n.value,r.filename||r.name):r.data?s.append(t,n.value,r.data.name):s.append(t,n.value,"unnamed")}else s.append(t,n.value)})),s}var a={};return Object.keys(this.fields).forEach((function(t){a[t]=e.fields[t].value})),a}}]),e}(),ne=888e3,re=function(){function e(t){p(this,e),this.sb=t,this.cls=G.get(this.sb._iid)}return g(e,[{key:"checkRouting",value:function(e){if(this.sb.customApiHost&&this.sb.customWsHost)"function"==typeof e&&e(null,{apiHost:this.sb.customApiHost,wsHost:this.sb.customWsHost});else{var t=this.sb.getApplicationId();e(null,{apiHost:"https://api-".concat(t,".sendbird.com"),wsHost:"wss://ws-".concat(t,".sendbird.com")})}}},{key:"_buildUrl",value:function(e){var t=e.apiHost,n=e.url,r=e.params;return n?r&&r.internal?"".concat(t,"/v").concat(w.SDK_MAJOR_VERSION,"/sdk").concat(n):"".concat(t,"/v").concat(w.SDK_MAJOR_VERSION).concat(n):t}},{key:"_createHeader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.noSessionKey,r=void 0!==n&&n,i=t.accessToken,s=void 0===i?null:i,a=e instanceof l.default&&"function"==typeof e.getHeaders?e.getHeaders():{},o=L.get(this.sb._iid),u=o.container,c=u.appId,d=u.auth,h=u.extensions,p=u.getUserAgentWithExtensions;return a.SendBird="JS,".concat(w.OS_VERSION,",").concat(w.SDK_VERSION,",").concat(c),a["SB-User-Agent"]=encodeURIComponent(p(h)),!r&&d.sessionKey&&(a["Session-Key"]=d.sessionKey),s&&(a["App-Id"]=c,a["Access-Token"]=s),a["Request-Sent-Timestamp"]=(new Date).getTime().toString(),a}},{key:"_createQuery",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{var n=[];return Object.keys(t).forEach((function(e){var r,i=t[e];null!=i&&(r="object"===h(i)?Array.isArray(i)?i.map((function(e){return encodeURIComponent("string"==typeof e?e.trim():e)})).join(","):encodeURIComponent(JSON.stringify(i)):encodeURIComponent(i),n.push("".concat(e,"=").concat(r)))})),n.length>0?"".concat(e,"?").concat(n.join("&")):e}catch(t){return W.debug("createWithEncodedGetParams is failed. - ",t),e}}},{key:"_request",value:function(e,t,n,r){var i=this;this.checkRouting((function(s,a){if(s)r(new D("Request failed.",D.REQUEST_FAILED),null);else{var u=i._buildUrl({apiHost:a.apiHost,url:t,params:n}),c=n?n.yield():{},d=i._createHeader(c,n?n.options:{}),h=[{level:W.supportedLogLevels.DEBUG,messages:["url:",t]},{level:W.supportedLogLevels.DEBUG,messages:["data:",c]}],p=null;switch(e){case"GET":p=i._createQuery(u,c);break;case"POST":case"PUT":p=u;break;case"DELETE":p=i._createQuery(u,c)}var f=null;if("undefined"==typeof ServiceWorker||"undefined"==typeof ServiceWorkerRegistration||"undefined"!=typeof ServiceWorkerContainer||$()||"function"!=typeof fetch)switch(e){case"GET":f=o.default.get(p,{headers:d,validateStatus:i._validateStatus});break;case"POST":var g=null;if(c instanceof l.default){var y=o.default.CancelToken.source();g=y.token;var m=i.cls.FileMessageQueue,_=n.upload.reqId;_&&(h.push({level:W.supportedLogLevels.DEBUG,messages:["request id:",_]}),m.uploadRequest[_]=y)}f=o.default.post(p,"function"==typeof c.getBuffer?c.getBuffer():c,{headers:d,validateStatus:i._validateStatus,cancelToken:g,onUploadProgress:function(e){n.upload.progressHandler&&n.upload.progressHandler(e,n.upload.reqId)}});break;case"PUT":f=o.default.put(p,c,{headers:d,validateStatus:i._validateStatus});break;case"DELETE":f=o.default.delete(p,{headers:d,validateStatus:i._validateStatus})}else{var v={method:e,headers:d};switch(e){case"GET":break;case"POST":if(c instanceof l.default){if("function"==typeof AbortController){var E=new AbortController,C=E.signal;v.signal=C;var b=i.cls.FileMessageQueue,S=n.upload.reqId;S&&(h.push({level:W.supportedLogLevels.DEBUG,messages:["request id:",S]}),b.uploadRequest[S]=E)}v.body="function"==typeof c.getBuffer?c.getBuffer():c}else d["Content-Type"]="application/json; charset=utf-8",v.body=JSON.stringify(c);break;case"PUT":c instanceof l.default?v.body="function"==typeof c.getBuffer?c.getBuffer():c:(d["Content-Type"]="application/json; charset=utf-8",v.body=JSON.stringify(c))}f=fetch(p,v).then((function(e){return e.json().then((function(t){if(!i._validateStatus(e.status))throw{request:{isAbort:!1},response:{data:t}};return Promise.resolve({data:t})}))}))}W.group("".concat(e," request"),h),h=[],f.then((function(t){try{var i=t.data;"POST"===e&&"function"==typeof n.upload.deleteRequest&&n.upload.deleteRequest(),h.push({level:W.supportedLogLevels.DEBUG,messages:["data:",i]}),r(null,i)}catch(e){throw{code:ne,rawError:e}}})).catch((function(s){if(s.code===ne)throw s.rawError;"POST"===e&&"function"==typeof n.upload.deleteRequest&&n.upload.deleteRequest();var a=i._handleError(s);if(h.push({level:W.supportedLogLevels.DEBUG,messages:["error:",a]}),t&&n)if(n.options&&n.options.isSessionRefresh)r(a);else{var o=L.get(i.sb._iid).container.sessionManager;o.isSessionError(a)?o.refreshSessionIfExpiredError(a).then((function(){return r(new D("Session is refreshed successfully.",D.SESSION_REFRESH_SUCCESS))})).catch((function(e){return r(new D("Session refresh failed.",D.SESSION_REFRESH_FAILED))})):r(a)}else r(a,null)})).finally((function(){return W.group("".concat(e," response"),h)}))}}))}},{key:"_validateStatus",value:function(e){return e>=200&&e<400}},{key:"_handleError",value:function(e){var t=e.request,n=e.response;if(t){if(t.isAbort||t.aborted)return new D("Request has been canceled.",D.REQUEST_CANCELED);if(n){var r=n.data,i=r?r.message:"Request failed.",s=r?r.code:D.REQUEST_FAILED;return new D(i,s)}return new D("Request failed.",D.REQUEST_FAILED)}return new D("There was a network error.",D.NETWORK_ERROR)}},{key:"get",value:function(e,t,n){this._request("GET",e,t,n)}},{key:"dummyCall",value:function(e){this._request("GET",null,null,e)}},{key:"post",value:function(e,t,n){this._request("POST",e,t,n)}},{key:"put",value:function(e,t,n){this._request("PUT",e,t,n)}},{key:"delete",value:function(e,t,n){this._request("DELETE",e,t,n)}},{key:"refreshSessionKey",value:function(t,n){var r=this,i=t.accessToken;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_SESSION_KEY.replace("%s",encodeURIComponent(s.userId)),o=new te;o.options.isSessionRefresh=!0,o.options.noSessionKey=!0,o.options.accessToken=i,r.post(a,o,n)}}))}},{key:"updateCurrentUserInfo",value:function(t,n){var r=this,i=t.nickname,s=t.profileUrl,a=t.profileImage,o=t.preferredLanguages;this.sb.ConnectionManager.ready((function(t,l){if(t)n(t,null);else{var u=e.Path.USERS_USERID.replace("%s",encodeURIComponent(l.userId)),c=new te;i&&c.add("nickname",i),s&&c.add("profile_url",s),a&&c.add("profile_file",a,a.name),o&&c.add("preferred_languages",o),r.put(u,c,n)}}))}},{key:"getMyGroupChannelChangeLogs",value:function(t,n){var r=this,i=t.ts,s=t.token,a=t.customTypes,o=t.includeEmpty,l=t.includeFrozen;this.sb.ConnectionManager.ready((function(t,u){if(t)n(t,null);else{var c=e.Path.USERS_USERID_MY_GROUP_CHANNEL_CHANGELOGS.replace("%s",encodeURIComponent(u.userId)),d=new te({show_read_receipt:!0,show_delivery_receipt:!0,show_member:!0});s&&d.add("token",s),i&&d.add("change_ts",i),a&&a.length>0&&d.add("custom_types",a),"boolean"==typeof o&&d.add("show_empty",o),"boolean"==typeof l&&d.add("show_frozen",l),r.get(c,d,n)}}))}},{key:"getChannelInvitationPreference",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_GROUP_CHANNEL_INVITATION_PREFERENCE.replace("%s",encodeURIComponent(i.userId));r.get(s,null,n)}}))}},{key:"getGroupChannelCount",value:function(t,n){var r=this,i=t.memberStateFilter;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=r.cls.GroupChannel,o=e.Path.USERS_USERID_GROUP_CHANNEL_COUNT.replace("%s",encodeURIComponent(s.userId)),l="";switch(i){case a.MemberStateFilter.JOINED:l="joined";break;case a.MemberStateFilter.INVITED:l="invited";break;case a.MemberStateFilter.INVITED_BY_FRIEND:l="invited_by_friend";break;case a.MemberStateFilter.INVITED_BY_NON_FRIEND:l="invited_by_non_friend";break;default:l="all"}var u=new te({state:l});r.get(o,u,n)}}))}},{key:"getUnreadItemCount",value:function(t,n){var r=this,i=t.keys;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_UNREAD_ITEM_COUNT.replace("%s",encodeURIComponent(s.userId)),o=new te({item_keys:i});r.get(a,o,n)}}))}},{key:"getTotalUnreadMessageCount",value:function(t,n){var r=this,i=t.customTypesFilter,s=t.superChannelFilter;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.USERS_USERID_UNREAD_MESSAGE_COUNT.replace("%s",encodeURIComponent(a.userId)),l=new te({super_mode:s});null!==i&&i.length>0&&l.add("custom_types",i),r.get(o,l,n)}}))}},{key:"getTotalUnreadChannelCount",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_UNREAD_CHANNEL_COUNT.replace("%s",encodeURIComponent(i.userId));r.get(s,null,n)}}))}},{key:"searchMessages",value:function(t,n){var r=this,i=t.keyword,s=t.limit,a=t.reverse,o=t.exactMatch,l=t.channelUrl,u=t.channelCustomType,c=t.messageTimestampFrom,d=t.messageTimestampTo,h=t.order,p=t.nextToken,f=t.advancedQuery,g=t.targetFields;this.sb.ConnectionManager.ready((function(t,y){if(t)n(t,null);else{var m=e.Path.SEARCH_MESSAGE,_=new te({limit:s,reverse:a,query:i,custom_type:u});c&&_.add("message_ts_from",c),d&&_.add("message_ts_to",d),l&&_.add("channel_url",l),h&&_.add("sort_field",h),"boolean"==typeof o&&_.add("exact_match",o),null!==p&&p.length>0&&_.add("after",p),"boolean"==typeof f&&_.add("advanced_query",f),g&&Array.isArray(g)&&_.add("target_fields",g),r.get(m,_,n)}}))}},{key:"markAsReadAll",value:function(t,n){var r=this,i=t.channelUrls;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_MARKASREADALL.replace("%s",encodeURIComponent(s.userId)),o=new te;i&&o.add("channel_urls",i),r.put(a,o,n)}}))}},{key:"markAsDelivered",value:function(t,n){var r=this,i=t.channelUrl,s=t.userId;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES_MARKASDELIVERED.replace("%s",encodeURIComponent(i)),l=new te;s&&l.add("user_id",s),r.put(o,l,n)}}))}},{key:"setChannelInvitationPreference",value:function(t,n){var r=this,i=t.isAutoAccept;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_GROUP_CHANNEL_INVITATION_PREFERENCE.replace("%s",encodeURIComponent(s.userId)),o=new te({auto_accept:i});r.put(a,o,n)}}))}},{key:"blockUser",value:function(t,n){var r=this,i=t.blockedUserId;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_BLOCK.replace("%s",encodeURIComponent(s.userId)),o=new te({target_id:i});r.post(a,o,n)}}))}},{key:"unblockUser",value:function(t,n){var r=this,i=t.unblockedUserId;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_BLOCK_TARGETID.replace("%s",encodeURIComponent(s.userId)).replace("%s",encodeURIComponent(i));r.delete(a,null,n)}}))}},{key:"getPushTriggerOption",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_PUSHPREFERENCE.replace("%s",encodeURIComponent(i.userId));r.get(s,null,n)}}))}},{key:"setPushTriggerOption",value:function(t,n){var r=this,i=t.pushTriggerOption;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_PUSHPREFERENCE.replace("%s",encodeURIComponent(s.userId)),o=new te({push_trigger_option:i});r.put(a,o,n)}}))}},{key:"getPushTokens",value:function(t,n){var r=this,i=t.ts,s=t.token,a=t.type;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.USERS_USERID_PUSH_DEVICE_TOKENS.replace("%s",encodeURIComponent(o.userId)).replace("%s",encodeURIComponent(a)),u=new te;s&&u.add("token",s),i&&u.add("created_ts",i),r.get(l,u,n)}}))}},{key:"getPushTemplate",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_PUSH_TEMPLATE.replace("%s",encodeURIComponent(i.userId));r.get(s,null,n)}}))}},{key:"setPushTemplate",value:function(t,n){var r=this,i=t.templateName;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_PUSH_TEMPLATE.replace("%s",encodeURIComponent(s.userId)),o=new te({name:i});r.put(a,o,n)}}))}},{key:"getDoNotDisturb",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_PUSHPREFERENCE.replace("%s",encodeURIComponent(i.userId));r.get(s,null,n)}}))}},{key:"setDoNotDisturb",value:function(t,n){var r=this,i=t.doNotDisturbOn,s=t.startHour,a=t.startMin,o=t.endHour,l=t.endMin,u=t.timezone;this.sb.ConnectionManager.ready((function(t,c){if(t)n(t,null);else{var d=e.Path.USERS_USERID_PUSHPREFERENCE.replace("%s",encodeURIComponent(c.userId)),h=new te({do_not_disturb:i,start_hour:s,start_min:a,end_hour:o,end_min:l,timezone:u});r.put(d,h,n)}}))}},{key:"getSnoozePeriod",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_PUSHPREFERENCE.replace("%s",encodeURIComponent(i.userId));r.get(s,null,n)}}))}},{key:"setSnoozePeriod",value:function(t,n){var r=this,i=t.snoozeOn,s=t.startTs,a=t.endTs;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.USERS_USERID_PUSHPREFERENCE.replace("%s",encodeURIComponent(o.userId)),u=new te({snooze_enabled:i,snooze_start_ts:s,snooze_end_ts:a});r.put(l,u,n)}}))}},{key:"registerGCMPushToken",value:function(t,n){var r=this,i=t.token;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_PUSH_GCM.replace("%s",encodeURIComponent(s.userId)),o=new te({gcm_reg_token:i,always_push:!0});r.post(a,o,n)}}))}},{key:"unregisterGCMPushToken",value:function(t,n){var r=this,i=t.token;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_PUSH_GCM_TOKEN.replace("%s",encodeURIComponent(s.userId)).replace("%s",encodeURIComponent(i));r.delete(a,null,n)}}))}},{key:"unregisterAllGCMPushTokens",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_PUSH_GCM.replace("%s",encodeURIComponent(i.userId));r.delete(s,null,n)}}))}},{key:"registerAPNSPushToken",value:function(t,n){var r=this,i=t.token;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_PUSH_APNS.replace("%s",encodeURIComponent(s.userId)),o=new te({apns_device_token:i,always_push:!0});r.post(a,o,n)}}))}},{key:"unregisterAPNSPushToken",value:function(t,n){var r=this,i=t.token;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_PUSH_APNS_TOKEN.replace("%s",encodeURIComponent(s.userId)).replace("%s",encodeURIComponent(i));r.delete(a,null,n)}}))}},{key:"unregisterAllAPNSPushTokens",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_PUSH_APNS.replace("%s",encodeURIComponent(i.userId));r.delete(s,null,n)}}))}},{key:"unregisterAllPushTokens",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_PUSH.replace("%s",encodeURIComponent(i.userId));r.delete(s,null,n)}}))}},{key:"loadFriendList",value:function(t,n){var r=this,i=t.token,s=t.limit;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.FRIENDS.replace("%s",encodeURIComponent(a.userId)),l=new te({limit:s,token:i});r.get(o,l,n)}}))}},{key:"getFriendChangeLogsByToken",value:function(t,n){var r=this,i=t.token;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.FRIENDS_CHANGE_LOGS.replace("%s",encodeURIComponent(s.userId)),o=new te;i&&o.add("token",i),r.get(a,o,n)}}))}},{key:"addFriends",value:function(t,n){var r=this,i=t.userIds;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.FRIENDS.replace("%s",encodeURIComponent(s.userId)),o=new te({user_ids:i});r.post(a,o,n)}}))}},{key:"deleteFriends",value:function(t,n){var r=this,i=t.userIds;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.FRIENDS.replace("%s",encodeURIComponent(s.userId)),o=new te({user_ids:i});r.delete(a,o,n)}}))}},{key:"uploadFriendDiscoveries",value:function(t,n){var r=this,i=t.discoveries;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.FRIENDS_DISCOVERIES.replace("%s",encodeURIComponent(s.userId)),o=[];i.forEach((function(e){o.push({friend_discovery_key:e.friendDiscoveryKey,friend_name:"string"==typeof e.friendName||e.friendName?e.friendName:null})}));var l=new te({friend_discoveries:o});r.put(a,l,n)}}))}},{key:"deleteFriendDiscoveries",value:function(t,n){var r=this,i=t.discoveryKeys;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.FRIENDS_DISCOVERIES.replace("%s",encodeURIComponent(s.userId)),o=new te({friend_discovery_keys:i});r.delete(a,o,n)}}))}},{key:"loadUserList",value:function(t,n){var r=this,i=t.token,s=t.limit,a=t.userIdsFilter,o=t.metaDataKeyFilter,l=t.metaDataValuesFilter,u=t.nicknameStartsWithFilter;this.sb.ConnectionManager.ready((function(t,c){if(t)n(t,null);else{var d=e.Path.USERS,h=new te({token:i,limit:s});a&&a.length>0&&h.add("user_ids",a),o&&l&&l.length>0&&(h.add("metadatakey",o),h.add("metadatavalues_in",l)),u&&h.add("nickname_startswith",u),r.get(d,h,n)}}))}},{key:"loadBlockedUserList",value:function(t,n){var r=this,i=t.token,s=t.limit,a=t.userIdsFilter;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.USERS_USERID_BLOCK.replace("%s",encodeURIComponent(o.userId)),u=new te({token:i,limit:s});a&&a.length>0&&u.add("user_ids",a),r.get(l,u,n)}}))}},{key:"createUserMetaData",value:function(t,n){var r=this,i=t.metaData;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_METADATA.replace("%s",encodeURIComponent(s.userId)),o=new te({metadata:i});r.post(a,o,n)}}))}},{key:"updateUserMetaData",value:function(t,n){var r=this,i=t.metaData,s=t.upsert;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.USERS_USERID_METADATA.replace("%s",encodeURIComponent(a.userId)),l=new te({metadata:i,upsert:s});r.put(o,l,n)}}))}},{key:"deleteUserMetaData",value:function(t,n){var r=this,i=t.metaDataKey;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_METADATA_KEY.replace("%s",encodeURIComponent(s.userId)).replace("%s",encodeURIComponent(i));r.delete(a,null,n)}}))}},{key:"deleteAllUserMetaData",value:function(t,n){var r=this;this.sb.ConnectionManager.ready((function(t,i){if(t)n(t,null);else{var s=e.Path.USERS_USERID_METADATA.replace("%s",encodeURIComponent(i.userId));r.delete(s,null,n)}}))}},{key:"getMessageChangeLogs",value:function(t,n){var r=this,i=t.channelUrl,s=t.ts,a=t.timestamp,o=t.token,l=t.isOpenChannel,u=t.includeMetaArray,c=t.includeReaction,d=t.includeReactions,h=t.includeReplies,p=t.includeParentMessageText,f=t.includeThreadInfo,g=t.replyType,y=t.includeParentMessageInfo,m=t.includePollDetails;this.sb.ConnectionManager.ready((function(t,_){if(t)n(t,null);else{var v=l?e.Path.OPENCHANNELS_CHANNELURL_MESSAGES_CHANGELOGS.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES_CHANGELOGS.replace("%s",encodeURIComponent(i)),E=new te;o&&E.add("token",o),s&&E.add("change_ts",s),a&&E.add("change_ts",a),"boolean"==typeof u&&E.add("with_sorted_meta_array",u),"boolean"==typeof d?E.add("include_reactions",d):E.add("include_reactions","boolean"==typeof c&&c),"boolean"==typeof f&&E.add("include_thread_info",f),"string"==typeof g?E.add("include_reply_type",g):E.add("include_reply_type","boolean"==typeof h&&h?r.cls.BaseMessage.ReplyType.ALL:r.cls.BaseMessage.ReplyType.NONE),"boolean"==typeof y?E.add("include_parent_message_info",y):E.add("include_parent_message_info","boolean"==typeof p&&p),"boolean"==typeof m&&E.add("include_poll_details",m),r.get(v,E,n)}}))}},{key:"getMyMutedInfo",value:function(t,n){var r=this,i=t.channelUrl,s=t.userId,a=t.isGroupChannel;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=a?e.Path.GROUPCHANNELS_CHANNELURL_MUTE_USERID.replace("%s",encodeURIComponent(i)).replace("%s",encodeURIComponent(s)):e.Path.OPENCHANNELS_CHANNELURL_MUTE_USERID.replace("%s",encodeURIComponent(i)).replace("%s",encodeURIComponent(s));r.get(l,null,n)}}))}},{key:"loadBannedUserList",value:function(t,n){var r=this,i=t.token,s=t.limit,a=t.channelUrl,o=t.isOpenChannel;this.sb.ConnectionManager.ready((function(t,l){if(t)n(t,null);else{var u=o?e.Path.OPENCHANNELS_CHANNELURL_BAN.replace("%s",encodeURIComponent(a)):e.Path.GROUPCHANNELS_CHANNELURL_BAN.replace("%s",encodeURIComponent(a)),c=new te({token:i,limit:s});r.get(u,c,n)}}))}},{key:"loadMutedUserList",value:function(t,n){var r=this,i=t.token,s=t.limit,a=t.channelUrl,o=t.isOpenChannel;this.sb.ConnectionManager.ready((function(t,l){if(t)n(t,null);else{var u=o?e.Path.OPENCHANNELS_CHANNELURL_MUTE.replace("%s",encodeURIComponent(a)):e.Path.GROUPCHANNELS_CHANNELURL_MUTE.replace("%s",encodeURIComponent(a)),c=new te({token:i,limit:s});r.get(u,c,n)}}))}},{key:"getMessageList",value:function(t,n){var r=this,i=t.channel,s=t.token,a=t.tokenType,o=t.isInclusive,l=t.prevResultSize,u=void 0===l?0:l,c=t.nextResultSize,d=void 0===c?0:c,h=t.shouldReverse,p=t.messageType,f=t.customType,g=t.customTypes,y=t.senderUserIds,m=t.includeMetaArray,_=t.includeReaction,v=t.includeReactions,E=t.includeReplies,C=t.includeParentMessageText,b=t.includeThreadInfo,S=t.replyType,A=t.includeParentMessageInfo,k=t.showSubchannelMessagesOnly,I=t.includePollDetails,U=t.rootMessageId,O=t.parentMessageId;this.sb.ConnectionManager.ready((function(t,l){if(t)n(t,null);else{var c=i.isOpenChannel()?e.Path.OPENCHANNELS_CHANNELURL_MESSAGES.replace("%s",i.url):e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES.replace("%s",i.url),T=new te({is_sdk:String(!0),prev_limit:String(u),next_limit:String(d),include:String(o),reverse:String(h)});"timestamp"===a?T.add("message_ts",s):"messageId"===a&&T.add("message_id",String(s)),p&&T.add("message_type",String(p)),Array.isArray(g)&&(0===g.length&&("string"==typeof f?g.push(f):g.push("*")),T.add("custom_types",g)),Array.isArray(y)&&y.length>0&&T.add("sender_ids",y),"boolean"==typeof m&&T.add("with_sorted_meta_array",m),"boolean"==typeof v?T.add("include_reactions",v):T.add("include_reactions","boolean"==typeof _&&_),"boolean"==typeof b&&T.add("include_thread_info",b),"string"==typeof S?T.add("include_reply_type",S):T.add("include_reply_type","boolean"==typeof E&&E?r.cls.BaseMessage.ReplyType.ALL:r.cls.BaseMessage.ReplyType.NONE),"boolean"==typeof A?T.add("include_parent_message_info",A):T.add("include_parent_message_info","boolean"==typeof C&&C),"boolean"==typeof k&&i.isOpenChannel()&&T.add("show_subchannel_messages_only",k),"boolean"==typeof I&&T.add("include_poll_details",I),U&&T.add("root_message_id",U),O&&T.add("parent_message_id",O),r.get(c,T,n)}}))}},{key:"translateUserMessage",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.messageId,o=t.translationTargetLanguages;this.sb.ConnectionManager.ready((function(t,l){if(t)n(t,null);else{var u=s?e.Path.OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_TRANSLATION.replace("%s",encodeURIComponent(i)).replace("%s",a):e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_TRANSLATION.replace("%s",encodeURIComponent(i)).replace("%s",a),c=new te({target_langs:o});r.post(u,c,n)}}))}},{key:"getMessage",value:function(t,n){var r=this,i=t.channel,s=t.messageId,a=t.includeMetaArray,o=t.includeReactions,l=t.includeParentMessageText,u=t.includeThreadInfo,c=t.includeParentMessageInfo,d=t.includePollDetails;this.sb.ConnectionManager.ready((function(t,h){if(t)n(t,null);else{var p=i.isOpenChannel()?e.Path.OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID.replace("%s",encodeURIComponent(i.url)).replace("%s",encodeURIComponent(s)):e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID.replace("%s",encodeURIComponent(i.url)).replace("%s",encodeURIComponent(s)),f=new te({is_sdk:String(!0)});"boolean"==typeof a&&f.add("with_sorted_meta_array",a),"boolean"==typeof o&&f.add("include_reactions",o),"boolean"==typeof u&&f.add("include_thread_info",u),"boolean"==typeof c?f.add("include_parent_message_info",c):f.add("include_parent_message_info","boolean"==typeof l&&l),"boolean"==typeof d&&f.add("include_poll_details",d),r.get(p,f,n)}}))}},{key:"deleteMessage",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.messageId;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=s?e.Path.OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID.replace("%s",encodeURIComponent(i)).replace("%s",encodeURIComponent(a)):e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID.replace("%s",encodeURIComponent(i)).replace("%s",encodeURIComponent(a));r.delete(l,null,n)}}))}},{key:"muteUser",value:function(t,n){var r=this,i=t.channelUrl,s=t.userId,a=t.description,o=t.seconds,l=t.isGroupChannel;this.sb.ConnectionManager.ready((function(t,u){if(t)n(t,null);else{var c=l?e.Path.GROUPCHANNELS_CHANNELURL_MUTE.replace("%s",encodeURIComponent(i)):e.Path.OPENCHANNELS_CHANNELURL_MUTE.replace("%s",encodeURIComponent(i)),d=new te({user_id:s});o&&(o>0||-1!==o)&&d.add("seconds",o),a&&d.add("description",a),r.post(c,d,n)}}))}},{key:"unmuteUser",value:function(t,n){var r=this,i=t.channelUrl,s=t.userId,a=t.isGroupChannel;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=a?e.Path.GROUPCHANNELS_CHANNELURL_MUTE_USERID.replace("%s",encodeURIComponent(i)).replace("%s",encodeURIComponent(s)):e.Path.OPENCHANNELS_CHANNELURL_MUTE_USERID.replace("%s",encodeURIComponent(i)).replace("%s",encodeURIComponent(s));r.delete(l,null,n)}}))}},{key:"banUser",value:function(t,n){var r=this,i=t.channelUrl,s=t.userId,a=t.description,o=t.seconds,l=t.isGroupChannel;this.sb.ConnectionManager.ready((function(t,u){if(t)n(t,null);else{var c=l?e.Path.GROUPCHANNELS_CHANNELURL_BAN.replace("%s",encodeURIComponent(i)):e.Path.OPENCHANNELS_CHANNELURL_BAN.replace("%s",encodeURIComponent(i)),d=new te({user_id:s});a&&d.add("description",a),d.add("seconds",String(o)),r.post(c,d,n)}}))}},{key:"unbanUser",value:function(t,n){var r=this,i=t.channelUrl,s=t.userId,a=t.isGroupChannel;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=a?e.Path.GROUPCHANNELS_CHANNELURL_BAN_USERID.replace("%s",encodeURIComponent(i)).replace("%s",encodeURIComponent(s)):e.Path.OPENCHANNELS_CHANNELURL_BAN_USERID.replace("%s",encodeURIComponent(i)).replace("%s",encodeURIComponent(s));r.delete(l,null,n)}}))}},{key:"getMetaCounters",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.keys;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=s?e.Path.OPENCHANNELS_CHANNELURL_METACOUNTER.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_METACOUNTER.replace("%s",encodeURIComponent(i)),u=new te({keys:a});r.get(l,u,n)}}))}},{key:"createMetaCounters",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.metaCounter;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=s?e.Path.OPENCHANNELS_CHANNELURL_METACOUNTER.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_METACOUNTER.replace("%s",encodeURIComponent(i)),u=new te({metacounter:a});r.post(l,u,n)}}))}},{key:"updateMetaCounters",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.metaCounter,o=t.upsert,l=t.mode;this.sb.ConnectionManager.ready((function(t,u){if(t)n(t,null);else{var c=s?e.Path.OPENCHANNELS_CHANNELURL_METACOUNTER.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_METACOUNTER.replace("%s",encodeURIComponent(i)),d=new te({metacounter:a,upsert:o,mode:l});r.put(c,d,n)}}))}},{key:"deleteMetaCounter",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.key;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=s?e.Path.OPENCHANNELS_CHANNELURL_METACOUNTER_KEY.replace("%s",encodeURIComponent(i)).replace("%s",a):e.Path.GROUPCHANNELS_CHANNELURL_METACOUNTER_KEY.replace("%s",encodeURIComponent(i)).replace("%s",a);r.delete(l,null,n)}}))}},{key:"deleteAllMetaCounters",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=s?e.Path.OPENCHANNELS_CHANNELURL_METACOUNTER.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_METACOUNTER.replace("%s",encodeURIComponent(i));r.delete(o,null,n)}}))}},{key:"getMetaData",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.keys;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=s?e.Path.OPENCHANNELS_CHANNELURL_METADATA.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_METADATA.replace("%s",encodeURIComponent(i)),u=new te({keys:a,include_ts:!0});r.get(l,u,n)}}))}},{key:"createMetaData",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.metaData;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=s?e.Path.OPENCHANNELS_CHANNELURL_METADATA.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_METADATA.replace("%s",encodeURIComponent(i)),u=new te({metadata:a,include_ts:!0});r.post(l,u,n)}}))}},{key:"updateMetaData",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.metaData,o=t.upsert;this.sb.ConnectionManager.ready((function(t,l){if(t)n(t,null);else{var u=s?e.Path.OPENCHANNELS_CHANNELURL_METADATA.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_METADATA.replace("%s",encodeURIComponent(i)),c=new te({metadata:a,upsert:o,include_ts:!0});r.put(u,c,n)}}))}},{key:"deleteMetaData",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.key;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=s?e.Path.OPENCHANNELS_CHANNELURL_METADATA_KEY.replace("%s",encodeURIComponent(i)).replace("%s",a):e.Path.GROUPCHANNELS_CHANNELURL_METADATA_KEY.replace("%s",encodeURIComponent(i)).replace("%s",a),u=new te({include_ts:!0});r.delete(l,u,n)}}))}},{key:"deleteAllMetaData",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=s?e.Path.OPENCHANNELS_CHANNELURL_METADATA.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_METADATA.replace("%s",encodeURIComponent(i)),l=new te({include_ts:!0});r.delete(o,l,n)}}))}},{key:"loadOperatorList",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.token,o=t.limit;this.sb.ConnectionManager.ready((function(t,l){if(t)n(t,null);else{var u=s?e.Path.OPENCHANNELS_OPERATORS.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_OPERATORS.replace("%s",encodeURIComponent(i)),c=new te({token:a,limit:o});r.get(u,c,n)}}))}},{key:"getOpenChannel",value:function(t,n){var r=this,i=t.channelUrl,s=t.internalCall;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.OPENCHANNELS_CHANNELURL.replace("%s",encodeURIComponent(i)),l=new te({});l.internal=s===w.INTERNAL_CALL,r.get(o,l,n)}}))}},{key:"loadOpenChannelList",value:function(t,n){var r=this,i=t.token,s=t.limit,a=t.nameKeyword,o=t.urlKeyword,l=t.customTypes,u=t.includeFrozen,c=t.includeMetaData;this.sb.ConnectionManager.ready((function(t,d){if(t)n(t,null);else{var h=e.Path.OPENCHANNELS,p=new te({token:i,limit:s});a&&p.add("name_contains",a),o&&p.add("url_contains",o),l&&l.length>0&&p.add("custom_types",l),"boolean"==typeof u&&p.add("show_frozen",u),"boolean"==typeof c&&p.add("show_metadata",c),r.get(h,p,n)}}))}},{key:"loadParticipantList",value:function(t,n){var r=this,i=t.token,s=t.limit,a=t.channelUrl;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.OPENCHANNELS_CHANNELURL_PARTICIPANTS.replace("%s",encodeURIComponent(a)),u=new te({token:i,limit:s});r.get(l,u,n)}}))}},{key:"createOpenChannel",value:function(t,n){var r=this,i=t.name,s=t.coverUrlOrImage,a=t.data,o=t.operatorUserIds,l=t.customType,u=t.channelUrl;this.sb.ConnectionManager.ready((function(t,c){if(t)n(t,null);else{var d=e.Path.OPENCHANNELS,h=new te;"string"==typeof s&&h.add("cover_url",s),ee.isFile(s)&&h.add("cover_file",s),null!==u&&"string"==typeof u&&h.add("channel_url",u),null!==i&&"string"==typeof i&&h.add("name",i),a&&h.add("data",a),o&&(Array.isArray(o)?h.add("operators",o):h.add("operators",[o])),l&&h.add("custom_type",l),r.post(d,h,n)}}))}},{key:"updateOpenChannel",value:function(t,n){var r=this,i=t.channelUrl,s=t.name,a=t.coverUrlOrImage,o=t.data,l=t.operatorUserIds,u=t.customType;this.sb.ConnectionManager.ready((function(t,c){if(t)n(t,null);else{var d=e.Path.OPENCHANNELS_CHANNELURL.replace("%s",encodeURIComponent(i)),h=new te;"string"==typeof a&&h.add("cover_url",a),ee.isFile(a)&&h.add("cover_file",a,a.name),null!==s&&"string"==typeof s&&h.add("name",s),null!==o&&"string"==typeof o&&h.add("data",o),null!==l&&(Array.isArray(l)?h.add("operator_ids",l):h.add("operator_ids",[l])),null!==u&&"string"==typeof u&&h.add("custom_type",u),r.put(d,h,n)}}))}},{key:"deleteOpenChannel",value:function(t,n){var r=this,i=t.channelUrl;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.OPENCHANNELS_CHANNELURL.replace("%s",encodeURIComponent(i));r.delete(a,null,n)}}))}},{key:"getGroupChannel",value:function(t,n){var r=this,i=t.channelUrl,s=t.showMember,a=t.internalCall;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.GROUPCHANNELS_CHANNELURL.replace("%s",encodeURIComponent(i)),u=new te({show_member:s,show_read_receipt:!0,show_delivery_receipt:!0});u.internal=a===w.INTERNAL_CALL,r.get(l,u,n)}}))}},{key:"loadGroupChannelList",value:function(t,n){var r=this,i=t.token,s=t.limit,a=t.includeEmpty,o=t.order,l=t.userIdsFilter,u=t.nicknameContainsFilter,c=t.channelNameContainsFilter,d=t.channelUrlsFilter,h=t.customTypesFilter,p=t.customTypeStartsWithFilter,f=t.memberStateFilter,g=t.superChannelFilter,y=t.publicChannelFilter,m=t.unreadChannelFilter,_=t.metadataOrderKeyFilter,v=t.metadataKey,E=t.metadataValues,C=t.metadataValueStartsWith,b=t.hiddenChannelFilter,S=t.searchFilter,A=t.includeFrozen,k=t.includeMetaData;this.sb.ConnectionManager.ready((function(t,I){if(t)n(t,null);else{var U=e.Path.MYGROUPCHANNELS.replace("%s",encodeURIComponent(I.userId)),O=new te({token:i,limit:s,order:o,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:String(a),member_state_filter:f});h&&h.length>0&&O.add("custom_types",h),u&&O.add("members_nickname_contains",u),c&&O.add("name_contains",c),S.hasOwnProperty("search_query")&&S.hasOwnProperty("search_fields")&&(O.add("search_query",S.search_query),O.add("search_fields",S.search_fields)),l.userIds&&l.userIds.length>0&&(l.includeMode?(O.add("members_include_in",l.userIds),O.add("query_type",l.queryType.toUpperCase())):O.add("members_exactly_in",l.userIds)),d&&d.length>0&&O.add("channel_urls",d),O.add("super_mode",g),O.add("public_mode",y),O.add("unread_filter",m),_&&O.add("metadata_order_key",_),v&&O.add("metadata_key",v),E&&E.length>0&&O.add("metadata_values",E),C&&O.add("metadata_value_startswith",C),p&&O.add("custom_type_startswith",p),b&&O.add("hidden_mode",b),"boolean"==typeof A&&O.add("show_frozen",A),"boolean"==typeof k&&O.add("show_metadata",k),r.get(U,O,n)}}))}},{key:"loadPublicGroupChannelList",value:function(t,n){var r=this,i=t.token,s=t.limit,a=t.includeEmpty,o=t.order,l=t.channelNameContainsFilter,u=t.channelUrlsFilter,c=t.customTypesFilter,d=t.customTypeStartsWithFilter,h=t.superChannelFilter,p=t.membershipFilter,f=t.metadataOrderKeyFilter,g=t.metadataKey,y=t.metadataValues,m=t.metadataValueStartsWith,_=t.includeFrozen,v=t.includeMetaData;this.sb.ConnectionManager.ready((function(t,E){if(t)n(t,null);else{var C=r.cls.GroupChannel,b=e.Path.GROUPCHANNELS,S=new te({token:i,limit:s,order:o,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:String(a),public_mode:C.PublicChannelFilter.PUBLIC,public_membership_mode:p});c&&c.length>0&&S.add("custom_types",c),l&&S.add("name_contains",l),u&&u.length>0&&S.add("channel_urls",u),S.add("super_mode",h),f&&S.add("metadata_order_key",f),g&&S.add("metadata_key",g),y&&y.length>0&&S.add("metadata_values",y),m&&S.add("metadata_value_startswith",m),d&&S.add("custom_type_startswith",d),"boolean"==typeof _&&S.add("show_frozen",_),"boolean"==typeof v&&S.add("show_metadata",v),r.get(b,S,n)}}))}},{key:"createGroupChannel",value:function(t,n){var r=this,i=t.isDistinct,s=t.isSuper,a=t.isBroadcast,o=t.isPublic,l=t.channelUrl,u=t.isDiscoverable,c=t.isStrict,d=t.name,h=t.data,p=t.customType,f=t.coverUrl,g=t.coverImage,y=t.accessCode,m=t.isEphemeral,_=t._invitedUserIds,v=void 0===_?[]:_,E=t.operatorUserIds,C=t.messageSurvivalSeconds;this.sb.ConnectionManager.ready((function(t,_){if(t)n(t,null);else{var b=e.Path.GROUPCHANNELS,S=new te({user_ids:[_.userId].concat(O(v)).filter((function(e,t,n){return t===n.indexOf(e)}))});null!==f&&"string"==typeof f&&S.add("cover_url",f),ee.isFile(g)&&S.add("cover_file",g,g.name),null!==l&&S.add("channel_url",l),null!==i&&S.add("is_distinct",i),null!==s&&S.add("is_super",s),null!==a&&S.add("is_broadcast",a),null!==o&&S.add("is_public",o),null!==u&&S.add("is_discoverable",u),null!==c&&S.add("strict",c),null!==m&&S.add("is_ephemeral",m),y&&S.add("access_code",y),null!==d&&"string"==typeof d&&S.add("name",d),h&&S.add("data",h),p&&S.add("custom_type",p),Array.isArray(E)&&E.length>0&&S.add("operator_ids",E),null!==C&&C>-1&&S.add("message_survival_seconds",C),r.post(b,S,n)}}))}},{key:"updateGroupChannel",value:function(t,n){var r=this,i=t.isDistinct,s=t.isPublic,a=t.channelUrl,o=t.isDiscoverable,l=t.name,u=t.data,c=t.customType,d=t.coverUrl,h=t.coverImage,p=t.accessCode,f=t.operatorUserIds,g=t.messageSurvivalSeconds;this.sb.ConnectionManager.ready((function(t,y){if(t)n(t,null);else{var m=e.Path.GROUPCHANNELS_CHANNELURL.replace("%s",encodeURIComponent(a)),_=new te;null!==i&&_.add("is_distinct",i),null!==s&&_.add("is_public",s),null!==o&&_.add("is_discoverable",o),null!==p&&_.add("access_code",p),null!==d&&"string"==typeof d&&_.add("cover_url",d),ee.isFile(h)&&_.add("cover_file",h,h.name),null!==l&&"string"==typeof l&&_.add("name",l),null!==u&&"string"==typeof u&&_.add("data",u),null!==c&&"string"==typeof c&&_.add("custom_type",c),null!==f&&(Array.isArray(f)?_.add("operator_ids",f):f&&_.add("operator_ids",[f])),null!==g&&g>-1&&_.add("message_survival_seconds",g),r.put(m,_,n)}}))}},{key:"addOperators",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=void 0!==s&&s,o=t.operatorUserIds;this.sb.ConnectionManager.ready((function(t,s){if(!t){var l=(a?e.Path.OPENCHANNELS_CHANNELURL_OPERATORS:e.Path.GROUPCHANNELS_CHANNELURL_OPERATORS).replace("%s",encodeURIComponent(i)),u=new te({operator_ids:o});r.post(l,u,n)}}))}},{key:"removeOperators",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=void 0!==s&&s,o=t.operatorUserIds;this.sb.ConnectionManager.ready((function(t,s){if(!t){var l=(a?e.Path.OPENCHANNELS_CHANNELURL_OPERATORS:e.Path.GROUPCHANNELS_CHANNELURL_OPERATORS).replace("%s",encodeURIComponent(i)),u=new te({operator_ids:o});r.delete(l,u,n)}}))}},{key:"inviteToGroupChannel",value:function(t,n){var r=this,i=t.channelUrl,s=t.userIds;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.GROUPCHANNELS_CHANNELURL_INVITE.replace("%s",encodeURIComponent(i)),l=new te({user_ids:s});r.post(o,l,n)}}))}},{key:"acceptInvitation",value:function(t,n){var r=this,i=t.channelUrl,s=t.accessCode;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.GROUPCHANNELS_CHANNELURL_ACCEPT_INVITATION.replace("%s",encodeURIComponent(i)),l=new te({user_id:a.userId});s&&l.add("access_code",s),r.put(o,l,n)}}))}},{key:"declineInvitation",value:function(t,n){var r=this,i=t.channelUrl;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.GROUPCHANNELS_CHANNELURL_DECLINE_INVITATION.replace("%s",encodeURIComponent(i)),o=new te({user_id:s.userId});r.put(a,o,n)}}))}},{key:"joinGroupChannel",value:function(t,n){var r=this,i=t.channelUrl,s=t.accessCode;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.GROUPCHANNELS_CHANNELURL_JOIN.replace("%s",encodeURIComponent(i)),l=new te({user_id:a.userId});s&&l.add("access_code",s),r.put(o,l,n)}}))}},{key:"leaveGroupChannel",value:function(t,n){var r=this,i=t.channelUrl;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.GROUPCHANNELS_CHANNELURL_LEAVE.replace("%s",encodeURIComponent(i)),o=new te({user_id:s.userId});r.put(a,o,n)}}))}},{key:"hideGroupChannel",value:function(t,n){var r=this,i=t.channelUrl,s=t.hidePreviousMessages,a=t.allowAutoUnhide;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.GROUPCHANNELS_CHANNELURL_HIDE.replace("%s",encodeURIComponent(i)),u=new te({user_id:o.userId,hide_previous_messages:s,allow_auto_unhide:a});r.put(l,u,n)}}))}},{key:"unhideGroupChannel",value:function(t,n){var r=this,i=t.channelUrl;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.GROUPCHANNELS_CHANNELURL_HIDE.replace("%s",encodeURIComponent(i));r.delete(a,null,n)}}))}},{key:"freeze",value:function(t,n){var r=this,i=t.channelUrl,s=t.isGroupChannel,a=t.freezing;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=s?e.Path.GROUPCHANNELS_CHANNELURL_FREEZE.replace("%s",encodeURIComponent(i)):e.Path.OPENCHANNELS_CHANNELURL_FREEZE.replace("%s",encodeURIComponent(i)),u=new te({freeze:a});r.put(l,u,n)}}))}},{key:"deleteGroupChannel",value:function(t,n){var r=this,i=t.channelUrl;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.GROUPCHANNELS_CHANNELURL.replace("%s",encodeURIComponent(i));r.delete(a,null,n)}}))}},{key:"loadMemberList",value:function(t,n){var r=this,i=t.channelUrl,s=t.token,a=t.limit,o=t.mutedMemberFilter,l=t.order,u=t.memberStateFilter,c=t.nicknameStartsWithFilter;this.sb.ConnectionManager.ready((function(t,d){if(t)n(t,null);else{var h=e.Path.GROUPCHANNELS_MEMBERS.replace("%s",encodeURIComponent(i)),p=new te({token:s,limit:a,order:l.toLowerCase(),muted_member_filter:o.toLowerCase(),member_state_filter:u,show_member_is_muted:!0,show_read_receipt:!0,show_delivery_receipt:!0});c&&p.add("nickname_startswith",c),r.get(h,p,n)}}))}},{key:"report",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.reportCategory,o=t.reportingUserId,l=t.reportDescription;this.sb.ConnectionManager.ready((function(t,u){if(t)n(t,null);else{var c=e.Path.REPORT_CHANNELS.replace("%s",encodeURIComponent(s?"open_channels":"group_channels")).replace("%s",encodeURIComponent(i)),d=new te({report_category:a});null!=o&&d.add("reporting_user_id",o),null!=l&&d.add("report_description",l),r.post(c,d,n)}}))}},{key:"reportUser",value:function(t,n){var r=this,i=t.offendingUserId,s=t.channelUrl,a=t.isOpenChannel,o=t.reportCategory,l=t.reportingUserId,u=t.reportDescription;this.sb.ConnectionManager.ready((function(t,c){if(t)n(t,null);else{var d=e.Path.REPORT_USERS.replace("%s",encodeURIComponent(i)),h=new te({channel_url:s,channel_type:a?"open_channels":"group_channels",report_category:o});null!=l&&h.add("reporting_user_id",l),null!=u&&h.add("report_description",u),r.post(d,h,n)}}))}},{key:"reportMessage",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.messageId,o=t.reportCategory,l=t.reportingUserId,u=t.reportDescription,c=t.offendingUserId;this.sb.ConnectionManager.ready((function(t,d){if(t)n(t,null);else{var h=e.Path.REPORT_MESSAGES.replace("%s",encodeURIComponent(s?"open_channels":"group_channels")).replace("%s",encodeURIComponent(i)).replace("%s",encodeURIComponent(a)),p=new te({report_category:o,offending_user_id:c});null!=l&&p.add("reporting_user_id",l),null!=u&&p.add("report_description",u),r.post(h,p,n)}}))}},{key:"sendUserMessage",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.message,o=t.data,l=t.customType,u=t.translationTargetLanguages,c=t.metaArrays,d=t.mentionType,h=t.mentionedUserIds,p=t.pushNotificationDeliveryOption,f=t.rootMessageId,g=t.parentMessageId,y=t.appleCriticalAlertOptions,m=t.pollId,_=t.isReplyToChannel;this.sb.ConnectionManager.ready((function(t,v){if(t)n(t,null);else{var E=r.cls.FileMessageParams,C=s?e.Path.OPENCHANNELS_CHANNELURL_MESSAGES.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES.replace("%s",encodeURIComponent(i)),b=new te({message_type:"MESG",user_id:v.userId,message:a,mention_type:d,mentioned_user_ids:[]});null!=o&&b.add("data",o),null!=l&&b.add("custom_type",l),u&&b.add("translation_target_langs",u),c&&c.length>0&&b.add("sorted_metaarray",c.map((function(e){return e.encode()}))),d===r.cls.BaseMessageParams.MentionType.CHANNEL?b.add("mentioned_user_ids",[]):Array.isArray(h)&&h.length>0&&b.add("mentioned_user_ids",h),p&&p!==E.PushNotificationDeliveryOption.DEFAULT&&b.add("push_option",p),f&&b.add("root_message_id",f),g&&b.add("parent_message_id",g),y&&b.add("apple_critical_alert_options",y.serialize()),"number"==typeof m?b.add("poll_id",m):null===m&&b.add("poll_id",-1),_&&b.add("reply_to_channel",_),r.post(C,b,n)}}))}},{key:"sendFileMessage",value:function(t,n){var r=this,i=t.channelUrl,s=t.isOpenChannel,a=t.fileUrl,o=t.fileName,l=t.fileSize,u=t.fileType,c=t.data,d=t.customType,h=t.thumbnailSizes,p=t.requireAuth,f=t.metaArrays,g=t.mentionType,y=t.mentionedUserIds,m=t.pushNotificationDeliveryOption,_=t.rootMessageId,v=t.parentMessageId,E=t.appleCriticalAlertOptions,C=t.isReplyToChannel;this.sb.ConnectionManager.ready((function(t,b){if(t)n(t,null);else{var S=r.cls.FileMessageParams,A=s?e.Path.OPENCHANNELS_CHANNELURL_MESSAGES.replace("%s",encodeURIComponent(i)):e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES.replace("%s",encodeURIComponent(i)),k=new te({message_type:"FILE",user_id:b.userId,url:a,mention_type:g,mentioned_user_ids:[]});null!=o&&k.add("file_name",o),null!=l&&k.add("file_size",l),null!=u&&k.add("file_type",u),null!=c&&k.add("custom_field",c),null!=d&&k.add("custom_type",d),h&&k.add("thumbnails",h),p&&k.add("require_auth",p),f&&f.length>0&&k.add("sorted_metaarray",f.map((function(e){return e.encode()}))),g===r.cls.BaseMessageParams.MentionType.CHANNEL?k.add("mentioned_user_ids",[]):Array.isArray(y)&&y.length>0&&k.add("mentioned_user_ids",y),m&&m!==S.PushNotificationDeliveryOption.DEFAULT&&k.add("push_option",m),_&&k.add("root_message_id",_),v&&k.add("parent_message_id",v),E&&k.add("apple_critical_alert_options",E.serialize()),C&&k.add("reply_to_channel",C),r.post(A,k,n)}}))}},{key:"uploadFile",value:function(t,n){var r=this,i=t.file,s=t.thumbnailSizes,a=t.channelUrl,o=t.progressHandler,l=t.reqId;this.sb.ConnectionManager.ready((function(t,u){if(t)n(t,null);else{var c=L.get(r.sb._iid).container.appInfo;if(c)if("number"==typeof i.size||i.size||(i.size=0),"number"==typeof i.size)if(i.size<=c.uploadSizeLimit){var d=e.Path.STORAGE_FILE,h=new te;if(h.add("file",i,i.name),a&&"string"==typeof a&&h.add("channel_url",a),s)for(var p=0;p<s.length;p++)h.add("thumbnail"+(p+1),s[p].maxWidth+","+s[p].maxHeight);h.upload.reqId=l,h.upload.deleteRequest=function(){var e=r.cls.FileMessageQueue;e.uploadRequest[l]&&delete e.uploadRequest[l]},h.upload.progressHandler=function(e){o&&"function"==typeof o&&o(e,l)},r.post(d,h,n)}else n(new D("The file size exceeded the upload limit: ".concat(c.uploadSizeLimit),D.FILE_SIZE_LIMIT_EXCEEDED),null);else n(new D("Invalid file size: ".concat(i.size),D.INVALID_PARAMETER),null);else n(new D("Connection should be made first.",D.CONNECTION_REQUIRED),null)}}))}},{key:"registerScheduledUserMessage",value:function(t,n){var r=this,i=t.groupChannelParams,s=t.channelUrl,a=t.isOpenChannel;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=a?e.Path.OPENCHANNELS_CHANNELURL_SCHEDULED_MESSAGES.replace("%s",encodeURIComponent(s)):e.Path.GROUPCHANNELS_CHANNELURL_SCHEDULED_MESSAGES.replace("%s",encodeURIComponent(s)),u=new te({scheduled_dt:i._getScheduleString(),user_id:o.userId,message:i.message,data:i.data});i.customType&&u.add("custom_type",i.customType),i.metaArrayKeys&&Object.keys(i.metaArrayKeys).length>0&&u.add("metaarray",i.metaArrayKeys),i.mentionType&&u.add("mention_type",i._mentionType),i._mentionType===r.cls.BaseMessageParams.MentionType.CHANNEL?u.add("mentioned_user_ids",[]):Array.isArray(i._mentionedUserIds)&&i._mentionedUserIds.length>0&&u.add("mentioned_user_ids",i._mentionedUserIds),i.translationTargetLanguages&&i.translationTargetLanguages.length>0&&u.add("translation_target_langs",i.translationTargetLanguages),i.pushNotificationDeliveryOption&&i.pushNotificationDeliveryOption!==r.cls.BaseMessageParams.PushNotificationDeliveryOption.DEFAULT&&u.add("push_option",i.pushNotificationDeliveryOption),i.appleCriticalAlertOptions&&u.add("apple_critical_alert_options",i.appleCriticalAlertOptions.serialize()),r.post(l,u,n)}}))}},{key:"getMyPushTriggerOption",value:function(t,n){var r=this,i=t.channelUrl;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_PUSHPREFERENCE_CHANNELURL.replace("%s",encodeURIComponent(s.userId)).replace("%s",encodeURIComponent(i));r.get(a,null,n)}}))}},{key:"setMyPushTriggerOption",value:function(t,n){var r=this,i=t.channelUrl,s=t.pushTriggerOption,a=t.enable;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.USERS_USERID_PUSHPREFERENCE_CHANNELURL.replace("%s",encodeURIComponent(o.userId)).replace("%s",encodeURIComponent(i)),u=new te;s&&u.add("push_trigger_option",s),"boolean"==typeof a&&u.add("enable",a),r.put(l,u,n)}}))}},{key:"setMyCountPreference",value:function(t,n){var r=this,i=t.channelUrl,s=t.countPreference;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.USERS_COUNT_PREFERENCE.replace("%s",encodeURIComponent(a.userId)).replace("%s",encodeURIComponent(i)),l=new te({count_preference:s});r.put(o,l,n)}}))}},{key:"resetMyHistory",value:function(t,n){var r=this,i=t.channelUrl;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.GROUPCHANNELS_RESET_USER_HISTORY.replace("%s",encodeURIComponent(i));r.put(a,null,n)}}))}},{key:"addReaction",value:function(t,n){var r=this,i=t.isGroupChannel,s=t.channelUrl,a=t.messageId,o=t.key;this.sb.ConnectionManager.ready((function(t,l){if(t)n(t,null);else{var u=i?e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_REACTION.replace("%s",encodeURIComponent(s)).replace("%s",encodeURIComponent(a)):e.Path.OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_REACTION.replace("%s",encodeURIComponent(s)).replace("%s",encodeURIComponent(a)),c=new te({reaction:o});r.post(u,c,n)}}))}},{key:"deleteReaction",value:function(t,n){var r=this,i=t.isGroupChannel,s=t.channelUrl,a=t.messageId,o=t.key;this.sb.ConnectionManager.ready((function(t,l){if(t)n(t,null);else{var u=i?e.Path.GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_REACTION.replace("%s",encodeURIComponent(s)).replace("%s",encodeURIComponent(a)):e.Path.OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_REACTION.replace("%s",encodeURIComponent(s)).replace("%s",encodeURIComponent(a)),c=new te({reaction:o});r.delete(u,c,n)}}))}},{key:"getAllEmoji",value:function(t){var n=this;this.sb.ConnectionManager.ready((function(r,i){r?t(r,null):n.get(e.Path.EMOJI_CATEGORIES,null,t)}))}},{key:"getEmojiCategory",value:function(t,n){var r=this,i=t.categoryId;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.EMOJI_CATEGORIES_CATEGORYID.replace("%s",i);r.get(a,null,n)}}))}},{key:"getEmoji",value:function(t,n){var r=this,i=t.emojiKey;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.EMOJIS_EMOJIKEY.replace("%s",i);r.get(a,null,n)}}))}},{key:"getAllowFriendDiscovery",value:function(t){var n=this;this.sb.ConnectionManager.ready((function(r,i){if(r)t(r,null);else{var s=e.Path.USERS_USERID_ALLOW_FRIEND_DISCOVERY.replace("%s",encodeURIComponent(i.userId));n.get(s,null,t)}}))}},{key:"setAllowFriendDiscovery",value:function(t,n){var r=this,i=t.allowFriendDiscovery;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.USERS_USERID_ALLOW_FRIEND_DISCOVERY.replace("%s",encodeURIComponent(s.userId)),o=new te;"boolean"==typeof i&&o.add("allow_friend_discovery",i),r.put(a,o,n)}}))}},{key:"getPollList",value:function(t,n){var r=this,i=t.channelUrl,s=t.token,a=t.limit;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.POLLS,u=new te({channel_url:i});s&&u.add("token",s),a&&u.add("limit",a),r.get(l,u,n)}}))}},{key:"getPoll",value:function(t,n){var r=this,i=t.channelUrl,s=t.pollId,a=t.showPartialVoters;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.POLLS_POLLID.replace("%s",s),u=new te({channel_url:i});"boolean"==typeof a&&u.add("show_partial_voter_list",a),r.get(l,u,n)}}))}},{key:"createPoll",value:function(t,n){var r=this,i=t.title,s=t.options,a=t.data,o=t.isAnonymous,l=t.allowUserSuggestion,u=t.allowMultipleVotes,c=t.closeAt;this.sb.ConnectionManager.ready((function(t,d){if(t)n(t,null);else{var p=e.Path.POLLS,f=new te({title:i,options:s});"object"===h(a)&&f.add("data",a),"boolean"==typeof o&&f.add("is_anonymous",o),"boolean"==typeof l&&f.add("allow_user_suggestion",l),"boolean"==typeof u&&f.add("allow_multiple_votes",u),"number"==typeof c&&f.add("close_at",c),r.post(p,f,n)}}))}},{key:"updatePoll",value:function(t,n){var r=this,i=t.pollId,s=t.title,a=t.options,o=t.data,l=t.isAnonymous,u=t.allowUserSuggestion,c=t.allowMultipleVotes,d=t.closeAt;this.sb.ConnectionManager.ready((function(t,p){if(t)n(t,null);else{var f=e.Path.POLLS_POLLID.replace("%s",i),g=new te;"string"==typeof s&&g.add("title",s),Array.isArray(a)&&g.add("options",a),"object"===h(o)&&g.add("data",o),"boolean"==typeof l&&g.add("is_anonymous",l),"boolean"==typeof u&&g.add("allow_user_suggestion",u),"boolean"==typeof c&&g.add("allow_multiple_votes",c),"number"==typeof d&&g.add("close_at",d),r.put(f,g,n)}}))}},{key:"deletePoll",value:function(t,n){var r=this,i=t.pollId;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.POLLS_POLLID.replace("%s",i);r.delete(a,null,n)}}))}},{key:"votePoll",value:function(t,n){var r=this,i=t.channelUrl,s=t.pollId,a=t.optionIds;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.POLLS_POLLID_VOTE.replace("%s",s),u=new te({channel_url:i});Array.isArray(a)&&u.add("option_ids",a),r.put(l,u,n)}}))}},{key:"closePoll",value:function(t,n){var r=this,i=t.pollId;this.sb.ConnectionManager.ready((function(t,s){if(t)n(t,null);else{var a=e.Path.POLLS_POLLID_CLOSE.replace("%s",i);r.put(a,null,n)}}))}},{key:"getPollOption",value:function(t,n){var r=this,i=t.channelUrl,s=t.pollId,a=t.optionId;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.POLLS_POLLID_OPTIONS_OPTIONID.replace("%s",s).replace("%s",a),u=new te({channel_url:i});r.get(l,u,n)}}))}},{key:"addPollOption",value:function(t,n){var r=this,i=t.channelUrl,s=t.pollId,a=t.text;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.POLLS_POLLID_OPTIONS.replace("%s",s),u=new te({channel_url:i,text:a});r.post(l,u,n)}}))}},{key:"updatePollOption",value:function(t,n){var r=this,i=t.pollId,s=t.optionId,a=t.text;this.sb.ConnectionManager.ready((function(t,o){if(t)n(t,null);else{var l=e.Path.POLLS_POLLID_OPTIONS_OPTIONID.replace("%s",i).replace("%s",s),u=new te({text:a});r.put(l,u,n)}}))}},{key:"deletePollOption",value:function(t,n){var r=this,i=t.pollId,s=t.optionId;this.sb.ConnectionManager.ready((function(t,a){if(t)n(t,null);else{var o=e.Path.POLLS_POLLID_OPTIONS_OPTIONID.replace("%s",i).replace("%s",s);r.delete(o,null,n)}}))}},{key:"getPollOptionVoterList",value:function(t,n){var r=this,i=t.channelUrl,s=t.pollId,a=t.optionId,o=t.token,l=t.limit;this.sb.ConnectionManager.ready((function(t,u){if(t)n(t,null);else{var c=e.Path.POLLS_POLLID_OPTIONS_OPTIONID_VOTERS.replace("%s",s).replace("%s",a),d=new te({channel_url:i});o&&d.add("token",o),l&&d.add("limit",l),r.get(c,d,n)}}))}}],[{key:"Path",get:function(){return{USERS:"/users",USERS_USERID:"/users/%s",USERS_USERID_LOGIN:"/users/%s/login",USERS_USERID_SESSION_KEY:"/users/%s/session_key",USERS_USERID_METADATA:"/users/%s/metadata",USERS_USERID_METADATA_KEY:"/users/%s/metadata/%s",USERS_USERID_MARKASREADALL:"/users/%s/mark_as_read_all",USERS_USERID_MY_GROUP_CHANNEL_CHANGELOGS:"/users/%s/my_group_channels/changelogs",USERS_USERID_UNREAD_ITEM_COUNT:"/users/%s/unread_item_count",USERS_USERID_UNREAD_MESSAGE_COUNT:"/users/%s/unread_message_count",USERS_USERID_UNREAD_CHANNEL_COUNT:"/users/%s/unread_channel_count",USERS_USERID_PUSH_GCM_TOKEN:"/users/%s/push/gcm/%s",USERS_USERID_PUSH_GCM:"/users/%s/push/gcm",USERS_USERID_PUSH_DEVICE_TOKENS:"/users/%s/push/%s/device_tokens",USERS_USERID_PUSHPREFERENCE_CHANNELURL:"/users/%s/push_preference/%s",USERS_USERID_PUSHPREFERENCE:"/users/%s/push_preference/",USERS_USERID_PUSH_TEMPLATE:"/users/%s/push/template",USERS_USERID_BLOCK:"/users/%s/block",USERS_USERID_BLOCK_TARGETID:"/users/%s/block/%s",USERS_USERID_PUSH_APNS_TOKEN:"/users/%s/push/apns/%s",USERS_USERID_PUSH_APNS:"/users/%s/push/apns",USERS_USERID_PUSH:"/users/%s/push",USERS_USERID_GROUP_CHANNEL_INVITATION_PREFERENCE:"/users/%s/channel_invitation_preference",USERS_USERID_GROUP_CHANNEL_COUNT:"/users/%s/group_channel_count",USERS_COUNT_PREFERENCE:"/users/%s/count_preference/%s",USERS_USERID_ALLOW_FRIEND_DISCOVERY:"/users/%s/allow_friend_discovery",OPENCHANNELS:"/open_channels",OPENCHANNELS_CHANNELURL:"/open_channels/%s",OPENCHANNELS_CHANNELURL_MESSAGES:"/open_channels/%s/messages",OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID:"/open_channels/%s/messages/%s",OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_TRANSLATION:"/open_channels/%s/messages/%s/translation",OPENCHANNELS_CHANNELURL_MESSAGES_CHANGELOGS:"/open_channels/%s/messages/changelogs",OPENCHANNELS_CHANNELURL_SCHEDULED_MESSAGES:"/open_channels/%s/scheduled_messages",OPENCHANNELS_CHANNELURL_PARTICIPANTS:"/open_channels/%s/participants",OPENCHANNELS_CHANNELURL_OPERATORS:"/open_channels/%s/operators",OPENCHANNELS_CHANNELURL_METADATA:"/open_channels/%s/metadata",OPENCHANNELS_CHANNELURL_METADATA_KEY:"/open_channels/%s/metadata/%s",OPENCHANNELS_CHANNELURL_METACOUNTER:"/open_channels/%s/metacounter",OPENCHANNELS_CHANNELURL_METACOUNTER_KEY:"/open_channels/%s/metacounter/%s",OPENCHANNELS_CHANNELURL_BAN:"/open_channels/%s/ban",OPENCHANNELS_CHANNELURL_BAN_USERID:"/open_channels/%s/ban/%s",OPENCHANNELS_CHANNELURL_MUTE:"/open_channels/%s/mute",OPENCHANNELS_CHANNELURL_MUTE_USERID:"/open_channels/%s/mute/%s",OPENCHANNELS_CHANNELURL_FREEZE:"/open_channels/%s/freeze",OPENCHANNELS_OPERATORS:"/open_channels/%s/operators",OPENCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_REACTION:"/open_channels/%s/messages/%s/reactions",GROUPCHANNELS:"/group_channels",MYGROUPCHANNELS:"/users/%s/my_group_channels",GROUPCHANNELS_CHANNELURL:"/group_channels/%s",GROUPCHANNELS_CHANNELURL_INVITE:"/group_channels/%s/invite",GROUPCHANNELS_CHANNELURL_ACCEPT_INVITATION:"/group_channels/%s/accept",GROUPCHANNELS_CHANNELURL_DECLINE_INVITATION:"/group_channels/%s/decline",GROUPCHANNELS_CHANNELURL_HIDE:"/group_channels/%s/hide",GROUPCHANNELS_CHANNELURL_LEAVE:"/group_channels/%s/leave",GROUPCHANNELS_CHANNELURL_JOIN:"/group_channels/%s/join",GROUPCHANNELS_CHANNELURL_OPERATORS:"/group_channels/%s/operators",GROUPCHANNELS_CHANNELURL_MESSAGES:"/group_channels/%s/messages",GROUPCHANNELS_CHANNELURL_MESSAGES_MARKASREAD:"/group_channels/%s/messages/mark_as_read",GROUPCHANNELS_CHANNELURL_MESSAGES_MARKASDELIVERED:"/group_channels/%s/messages/mark_as_delivered",GROUPCHANNELS_CHANNELURL_MESSAGES_TOTALCOUNT:"/group_channels/%s/messages/total_count",GROUPCHANNELS_CHANNELURL_MESSAGES_UNREADCOUNT:"/group_channels/%s/messages/unread_count",GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID:"/group_channels/%s/messages/%s",GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_TRANSLATION:"/group_channels/%s/messages/%s/translation",GROUPCHANNELS_CHANNELURL_MESSAGES_CHANGELOGS:"/group_channels/%s/messages/changelogs",GROUPCHANNELS_CHANNELURL_SCHEDULED_MESSAGES:"/group_channels/%s/scheduled_messages",GROUPCHANNELS_CHANNELURL_MEMBERS:"/group_channels/%s/members",GROUPCHANNELS_CHANNELURL_METADATA:"/group_channels/%s/metadata",GROUPCHANNELS_CHANNELURL_METADATA_KEY:"/group_channels/%s/metadata/%s",GROUPCHANNELS_CHANNELURL_METACOUNTER:"/group_channels/%s/metacounter",GROUPCHANNELS_CHANNELURL_METACOUNTER_KEY:"/group_channels/%s/metacounter/%s",GROUPCHANNELS_RESET_USER_HISTORY:"/group_channels/%s/reset_user_history",GROUPCHANNELS_OPERATORS:"/group_channels/%s/operators",GROUPCHANNELS_MEMBERS:"/group_channels/%s/members",GROUPCHANNELS_CHANNELURL_BAN:"/group_channels/%s/ban",GROUPCHANNELS_CHANNELURL_BAN_USERID:"/group_channels/%s/ban/%s",GROUPCHANNELS_CHANNELURL_MUTE:"/group_channels/%s/mute",GROUPCHANNELS_CHANNELURL_MUTE_USERID:"/group_channels/%s/mute/%s",GROUPCHANNELS_CHANNELURL_FREEZE:"/group_channels/%s/freeze",GROUPCHANNELS_CHANNELURL_MESSAGES_MESSAGEID_REACTION:"/group_channels/%s/messages/%s/reactions",STORAGE_FILE:"/storage/file",STORAGE_PROFILE:"/storage/profile_image",FRIENDS:"/users/%s/friends",FRIENDS_CHANGE_LOGS:"/users/%s/friends/changelogs",FRIENDS_DISCOVERIES:"/users/%s/friend_discoveries",SEARCH_MESSAGE:"/search/messages",REPORT_USERS:"/report/users/%s",REPORT_CHANNELS:"/report/%s/%s",REPORT_MESSAGES:"/report/%s/%s/messages/%s",EMOJIS_EMOJIKEY:"/emojis/%s",EMOJI_CATEGORIES:"/emoji_categories",EMOJI_CATEGORIES_CATEGORYID:"/emoji_categories/%s",POLLS:"/polls",POLLS_POLLID:"/polls/%s",POLLS_POLLID_VOTE:"/polls/%s/vote",POLLS_POLLID_CLOSE:"/polls/%s/close",POLLS_POLLID_OPTIONS:"/polls/%s/options",POLLS_POLLID_OPTIONS_OPTIONID:"/polls/%s/options/%s",POLLS_POLLID_OPTIONS_OPTIONID_VOTERS:"/polls/%s/options/%s/voters"}}}]),e}(),ie=function(){function e(t,n){p(this,e),this.sb=t,this.ws=null,this.wsHost=null,this.WebSocket=null,this.handler=n||new e.ConnectionHandler,this.explicitDisconnect=!1,this.lastActiveMillis=0;try{this.WebSocket="undefined"==typeof WebSocket?u.default:WebSocket}catch(e){this.WebSocket=WebSocket}}return g(e,[{key:"connect",value:function(e,t,n){var r=this;W.debug("`WebSocketClient.connect` called.");var i=L.get(this.sb._iid).container,s=i.pinger,a=i.auth,o=i.extensions,l=i.getUserAgentWithExtensions,u=i.sessionManager;this.wsHost=n;try{var c="/?p=JS&pv="+encodeURIComponent(w.OS_VERSION)+"&sv="+encodeURIComponent(w.SDK_VERSION)+"&ai="+encodeURIComponent(this.sb.getApplicationId());if(a.sessionKey?c+="&key="+encodeURIComponent(a.sessionKey):c+="&user_id="+encodeURIComponent(e)+"&access_token="+encodeURIComponent(t),c+="&active=1",c+="&SB-User-Agent="+encodeURIComponent(l(o)),c+="&Request-Sent-Timestamp="+(new Date).getTime().toString(),c+="&include_extra_data="+encodeURIComponent(["premium_feature_list","file_upload_size_limit","application_attributes","emoji_hash"].join(",")),u.handler&&(c+="&expiring_session=1"),this.sb.Options.includePollDetails&&(c+="&include_poll_details=1"),this.ws=new this.WebSocket(this.wsHost+c),!this.ws)return this.sb.isReconnectingOnError=!0,void this.handler.onError("ws does not exist.")}catch(e){return this.sb.isReconnectingOnError=!0,void this.handler.onError(e)}try{this.sb.getDebugMode()&&"undefined"!=typeof window&&(window.ws=this.ws)}catch(e){W.debug("`window` object does not exist.")}var d=!1;this.ws.onopen=function(e){W.debug("`WebSocket.onopen` called."),r.handler.onOpen(e)},this.ws.onmessage=function(e){r.active();for(var t=e.data.split("\n"),n=0;n<t.length;n++){var i=t[n];if(i&&"string"==typeof i){try{if("PONG"===i.substring(0,4)){s.pong();continue}}catch(e){W.debug("`WebSocket.onmessage` command check error:",e)}r.handler.onMessage(i)}}},this.ws.onerror=function(e){W.debug("`WebSocket.onerror` called:",e),s&&s.stop(),d=!0,r.sb.isReconnectingOnError=!0,r.handler.onError(e)},this.ws.onclose=function(e){W.group("`WebSocket.onclose` called.",[{level:W.supportedLogLevels.DEBUG,messages:["e",e]},{level:W.supportedLogLevels.DEBUG,messages:["explicitDisconnect",r.explicitDisconnect]}]),s&&s.stop(),r.explicitDisconnect?r.handler.onClose(e):d||r.handler.onError(e),r.explicitDisconnect=!1}}},{key:"disconnect",value:function(e,t){W.group("`WebSocketClient.onclose` called.",[{level:W.supportedLogLevels.DEBUG,messages:["explicit",e]}]);var n=L.get(this.sb._iid).container.pinger;n&&n.stop(),this.explicitDisconnect=!0===e,this.ws&&(this.ws.onopen=function(){},this.ws.onmessage=function(){},this.ws.onclose=function(){t&&t()},this.ws.onerror=function(){},this.ws.close(),this.ws=null),this.explicitDisconnect?this.handler.onClose():this.handler.onError(),this.explicitDisconnect=!1}},{key:"send",value:function(e,t){if(1!==this.ws.readyState)t&&t(new D("Connection is not valid. Please reconnect.",D.WEBSOCKET_CONNECTION_CLOSED),null);else{var n=L.get(this.sb._iid).container.pinger;this.ws.send(e.encode()),"PING"!==e.command&&n.refreshTimer(),t&&t(null,null)}}},{key:"active",value:function(){this.lastActiveMillis=(new Date).getTime()}},{key:"getConnectionState",value:function(){try{return 1===this.ws.readyState?this.sb.ConnectionState.OPEN:0===this.ws.readyState?this.sb.ConnectionState.CONNECTING:this.sb.ConnectionState.CLOSED}catch(e){return this.sb.ConnectionState.CLOSED}}}]),e}();ie.ConnectionHandler=function e(){p(this,e),this.onReady=function(){},this.onOpen=function(){},this.onClose=function(){},this.onMessage=function(){},this.onError=function(){}};var se=function(){function e(t){p(this,e),this.sb=t,this.cls=G.get(this.sb._iid),this.client=new ie(this.sb),this.connectParams={retryCount:1},this.reconnectParams={interval:3,retryCount:3,multiplier:2,maxInterval:24},this.connectCount=0,this.reconnectCount=0,this.reconnectDelay=0}return g(e,[{key:"isConnected",get:function(){return this.client&&this.client.getConnectionState()===this.sb.ConnectionState.OPEN}},{key:"connect",value:function(e,t){var n=this,r=L.get(this.sb._iid).container,i=r.auth,s=r.apiClient,a=r.commandHandler;i.sessionToken=t||null;var o=this.cls.GroupChannel,l=null,u=new ie.ConnectionHandler;this.client=new ie(this.sb,u),u.onMessage=function(e){a.onRawCommandReceived(e)},this.sb.loginHandler=function(e,t){if(n.sb.connecting=!1,n.sb.reconnecting=!1,e)n.disconnect({clearSession:!0,err:e},null);else{clearInterval(n.sb.globalTimer);var r=function(){o.cachedChannels&&Object.keys(o.cachedChannels).forEach((function(e){var t=o.cachedChannels[e];t.invalidateTypingStatus()&&Object.keys(n.sb.channelHandlers).forEach((function(e){n.sb.channelHandlers[e].onTypingStatusUpdated(t)}))}))};r(),n.sb.globalTimer=setInterval((function(){return r()}),1e3),n.flushConnectionCallbacks(null,t),n.sb.ConnectionManager.processAllReadyHandler(null)}},u.onOpen=function(){n.connectCount=0,n.sb.loginTimer=setTimeout((function(){n.sb.loginTimer=null,n.sb.onLoginTimerCancel=null,n.flushConnectionCallbacks(new D("Connection timeout.",D.LOGIN_TIMEOUT),null),n.sb.disconnect(null)}),n.sb.Options.websocketResponseTimeout),n.sb.onLoginTimerCancel=function(){n.connectCount=0,n.flushConnectionCallbacks(new D("Connection has been canceled.",D.REQUEST_FAILED),null)},n.sb.connecting=!1},u.onError=function(r){W.debug("Connect: `WebSocketClient.ConnectionHandler.onError` called.",r),i.sessionKey?(n.sb.isReconnectingOnError=!0,n.sb.ConnectionManager.errorAllReadyHandler(),n.reconnect(e,!0),n.sb.connecting=!1):n.connectCount<n.connectParams.retryCount?(n.connectCount++,n.client.connect(e,t,l)):(n.connectCount=0,n.flushConnectionCallbacks(new D("Websocket connection failed.",D.WEBSOCKET_CONNECTION_FAILED),null),n.sb.connecting=!1)},u.onClose=function(){W.debug("Connect: `WebSocketClient.ConnectionHandler.onClose` called."),n.connectCount=0,n.sb.connecting=!1},s.checkRouting((function(r,i){if(r)return n.sb.connecting=!1,void n.flushConnectionCallbacks(new D("Connection routing failed.",D.REQUEST_FAILED),null);l=i.wsHost,s.dummyCall((function(e){e&&W.error("API dummy call failed:",e)})),n.client.connect(e,t,l)}))}},{key:"reconnect",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=L.get(this.sb._iid),i=r.container,s=i.auth,a=i.apiClient,o=i.commandHandler,l=i.ackStateMap,u=i.sessionManager,c=this.cls.OpenChannel;if(this.sb.connecting=!1,this.sb.reconnecting=!0,this.sb.reconnectTimer)W.debug("Reconnect: still reconnecting.");else{if(this.reconnectCount+=1,this.reconnectCount<=1?(n&&(Object.keys(l).forEach((function(e){var t=l[e];t&&(clearTimeout(t.timer),(0,t.handler)(new D("Command received no ack.",D.ACK_TIMEOUT),null)),delete l[e]})),Object.keys(this.sb.connectionHandlers).forEach((function(e){t.sb.connectionHandlers[e].onReconnectStarted()}))),this.reconnectDelay=0):this.reconnectDelay=Math.min(1e3*this.reconnectParams.interval*Math.pow(this.reconnectParams.multiplier,this.reconnectCount-2),this.reconnectParams.maxInterval>0?1e3*this.reconnectParams.maxInterval:Number.MAX_SAFE_INTEGER),!e||!s.sessionKey||this.reconnectParams.retryCount>0&&this.reconnectCount>this.reconnectParams.retryCount)return this.disconnect({clearSession:!1,err:new D("Websocket connection failed.",D.WEBSOCKET_CONNECTION_FAILED)},null),this.reconnectCount=0,Object.keys(this.sb.connectionHandlers).forEach((function(e){t.sb.connectionHandlers[e].onReconnectFailed()})),this.sb.connecting=!1,this.sb.reconnecting=!1,this.sb.isReconnectingOnError=!1,void this.sb.ConnectionManager.errorAllReadyHandler();this.sb.onReconnectTimerCancel=function(){t.reconnectCount=0},this.sb.reconnectTimer=setTimeout((function(){t.sb.reconnectTimer=null,t.sb.onReconnectTimerCancel=null,t.client&&t.client.disconnect(!0);var n=new ie.ConnectionHandler;t.client=new ie(t.sb,n),t.sb.loginHandler=function(n,r){n?u.isSessionError(n)?u.refreshSessionIfExpiredError(n).then((function(){clearTimeout(t.sb.reconnectTimer),t.sb.reconnectTimer=null,t.reconnectCount=0,t.reconnect(e,!1)})).catch((function(){})):(clearTimeout(t.sb.reconnectTimer),t.sb.reconnectTimer=null,t.reconnect(e,!1)):(t.reconnectCount=0,t.sb.connecting=!1,t.sb.reconnecting=!1,t.sb.isReconnectingOnError=!1,Object.keys(t.sb.connectionHandlers).forEach((function(e){t.sb.connectionHandlers[e].onReconnectSucceeded()})),t.sb.ConnectionManager.processAllReadyHandler(null),t.sb.isReconnectingOnError&&Object.keys(t.sb.ConnectionManager.networkHandlers).forEach((function(e){t.sb.ConnectionManager.networkHandlers[e].onReconnected()})),Object.keys(c.enteredChannels).forEach((function(e){c.enteredChannels[e].enter((function(n,r){if(n){var i=t.cls.FileMessageQueue;delete c.enteredChannels[e],i.delete(e)}}))})))},n.onOpen=function(){W.debug("Reconnect: `WebSocketClient.ConnectionHandler.onOpen` called."),t.sb.loginTimer=setTimeout((function(){W.debug("Reconnect: `loginTimer` timeout."),t.sb.loginTimer=null,t.reconnect(e,!0)}),t.sb.Options.websocketResponseTimeout),t.sb.onLoginTimerCancel=null},n.onMessage=function(e){o.onRawCommandReceived(e)},n.onError=function(n){W.debug("Reconnect: `WebSocketClient.ConnectionHandler.onError` called.",n),t.sb.isReconnectingOnError=!0,t.sb.ConnectionManager.errorAllReadyHandler(),t.reconnect(e,!0)},n.onClose=function(){W.debug("Reconnect: `WebSocketClient.ConnectionHandler.onClose` called."),t.sb.reconnecting=!1},a.checkRouting((function(n,r){n?t.reconnect(e,!0):(t.sb.getCurrentApiHost()!==r.apiHost&&a.get("/",null,(function(){})),t.client.connect(e,null,r.wsHost))}))}),this.reconnectDelay)}}},{key:"disconnect",value:function(e,t){var n=L.get(this.sb._iid),r=n.container.ackStateMap,i=this.cls,s=i.GroupChannel,a=i.OpenChannel,o=e.clearSession,l=e.err;this.sb.loginTimer&&(clearTimeout(this.sb.loginTimer),this.sb.onLoginTimerCancel&&(this.sb.onLoginTimerCancel(),this.sb.onLoginTimerCancel=null),this.sb.loginTimer=null),this.sb.reconnectTimer&&(clearTimeout(this.sb.reconnectTimer),this.sb.onReconnectTimerCancel&&(this.sb.onReconnectTimerCancel(),this.sb.onReconnectTimerCancel=null),this.sb.reconnectTimer=null),this.client&&(this.reconnectCount=0,this.client.disconnect(!0),this.client=null),o&&(a.clearEnteredChannels(),a.clearCache(),s.clearCache(),this.sb.globalTimer&&(clearInterval(this.sb.globalTimer),this.sb.globalTimer=null),Object.keys(r).forEach((function(e){clearTimeout(r[e].timer)})),this.sb.currentUser=null,n.set("ackStateMap",{}),n.set("subscribedUnreadMessageCount",{all:0,custom_types:{},ts:0}),n.set("auth",new H)),l&&(this.flushConnectionCallbacks(l,null),this.sb.connecting=!1,this.sb.reconnecting=!1,this.sb.isReconnectingOnError=!1),t&&t(null,null)}},{key:"flushConnectionCallbacks",value:function(e,t){var n=this.sb.connectionCallbacks;this.sb.connectionCallbacks=[],n.forEach((function(n){return n(e,t)}))}}]),e}(),ae=function(){function e(t){var n=t.type,r=t.nullable,i=void 0!==r&&r,s=t.optional,a=void 0!==s&&s,o=t.optionalIf,l=void 0===o?null:o,u=t.ignoreIf,c=void 0===u?null:u,d=t.defaultValue,h=void 0===d?null:d,f=t.constraint,g=void 0===f?null:f;p(this,e),this.type=n,this.nullable=i,this.optional=a,this.optionalIf=l,this.ignoreIf=c,this.defaultValue=h,this.constraint=g}return g(e,[{key:"isMatchingType",value:function(e){var t=function(t,n){return"string"==typeof n?h(t)===n||"array"===n&&Array.isArray(t)||"file"===n&&ee.isFile(t)||"null"===n&&null===t||"date"===n&&t instanceof Date:"function"==typeof n?t instanceof n:"object"===h(n)&&Object.keys(n).map((function(e){return n[e]})).indexOf(e)>-1};return t(e,this.type)||Array.isArray(this.type)&&this.type.some((function(n){return t(e,n)}))||this.nullable&&null===e}}],[{key:"parse",value:function(t,n){for(t=e.toArray(t);t.length>0&&void 0===t[t.length-1];)t.pop();var r=!1,i=null;"callback"===n[n.length-1].type&&("function"==typeof t[t.length-1]&&(i=t.pop()),n.pop(),r=!0);var s=[],a=null,o=0;return n.forEach((function(n){"function"==typeof n.ignoreIf&&n.ignoreIf(t)?s.push(n.hasOwnProperty("defaultValue")?n.defaultValue:null):n.isMatchingType(t[o])?(n.nullable&&null===t[o]||!n.constraint||n.constraint(t[o])||(a=e.error),s.push(t[o]),o++):n.optional||"function"==typeof n.optionalIf&&n.optionalIf(t)?s.push(n.hasOwnProperty("defaultValue")?n.defaultValue:null):(a=e.error,s.push(t[o]),o++)})),r&&i&&s.push(i),t.length!==o&&(a=e.error),[a].concat(s)}},{key:"error",get:function(){return new D("Invalid parameter.",D.INVALID_PARAMETER)}},{key:"toArray",value:function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}}]),e}(),oe=function(){function e(t){p(this,e),this.sb=t,this.authCount=0,this.readyHandlers=[],this.networkHandlers={},this.authenticateTimer=1e4,this.authInfoRequester=null}return g(e,[{key:"addReadyHandler",value:function(e){e&&"function"==typeof e&&this.readyHandlers.push(e)}},{key:"ready",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=L.get(this.sb._iid),r=n.container,i=r.auth,s=r.isInBackground;t&&i.hasSession()?e&&(this.sb.currentUser?e(null,this.sb.currentUser):(this.addReadyHandler(e),this.errorAllReadyHandler()),this.sb.getConnectionState()!==this.sb.ConnectionState.CLOSED||s||this.sb.reconnect()):(this.addReadyHandler(e),this.sb.isReconnectingOnError?this.errorAllReadyHandler():this.sb.getConnectionState()===this.sb.ConnectionState.OPEN?this.processAllReadyHandler(null):this.sb.getConnectionState()===this.sb.ConnectionState.CONNECTING||this.errorAllReadyHandler())}},{key:"processAllReadyHandler",value:function(e){if(this.readyHandlers.length>0){var t=this.sb.currentUser,n=this.readyHandlers;this.readyHandlers=[],n.forEach((function(n){n&&"function"==typeof n&&n(e,t)}))}}},{key:"errorAllReadyHandler",value:function(){this.processAllReadyHandler(new D("Connection should be made first.",D.CONNECTION_REQUIRED))}},{key:"NetworkHandler",value:function(){this.onReconnected=function(){}}},{key:"addNetworkHandler",value:function(e,t){this.networkHandlers[e]=t}},{key:"removeNetworkHandler",value:function(e){delete this.networkHandlers[e]}},{key:"removeAllNetworkHandler",value:function(){this.networkHandlers={}}},{key:"authenticate",value:function(e){var t=this;if(this.sb.getConnectionState()===this.sb.ConnectionState.OPEN||this.sb.reconnecting)this.sb.connecting=!1,e(null,this.sb.currentUser);else if(this.authInfoRequester&&"function"==typeof this.authInfoRequester){this.sb.connecting=!0,this.authCount++;var n=setTimeout((function(){n=null,t.authCount--,0===t.authCount&&0===t.sb.connectionCallbacks.length&&(t.sb.connecting=!1),t.errorAllReadyHandler(),e(new D("Connection should be made first.",D.CONNECTION_REQUIRED),null)}),this.authenticateTimer);this.authInfoRequester((function(r){if(n){clearTimeout(n),n=null,t.authCount--;var i=function(n,r){t.sb.connecting=!1,e(n,null)};r&&r.hasOwnProperty("userId")?r.accessToken?r.apiHost&&r.wsHost?t.sb.connect(r.userId,r.accessToken,r.apiHost,r.wsHost,i):t.sb.connect(r.userId,r.accessToken,i):r.apiHost&&r.wsHost?t.sb.connect(r.userId,r.apiHost,r.wsHost,i):t.sb.connect(r.userId,i):e(ae.error,null)}}))}else e(ae.error,null)}}]),e}(),le=function e(){p(this,e),this.onSessionExpired=function(){},this.onSessionTokenRequired=function(e,t){return e(null)},this.onSessionError=function(e){},this.onSessionRefreshed=function(){},this.onSessionClosed=function(){}},ue=function(){function e(){p(this,e),this.handler=null,this.resolvers=[]}return g(e,[{key:"_refreshSessionToken",value:function(){var t=this;return new Promise((function(n,r){var i=null,s=function(){i&&(clearTimeout(i),i=null)},a=function(){i&&(s(),r(e.sessionTokenRequestFailedError))};i=setTimeout((function(){return a()}),3e4),t.handler.onSessionTokenRequired((function(e){i&&(s(),n(e))}),a)}))}},{key:"_refreshSessionKey",value:function(){var t=this;return new Promise((function(n,r){var i=L.get(t._iid).container,s=i.auth,a=i.wsAdapter;s.sessionToken?a.isConnected?t._refreshSessionKeyByCommand().then((function(){return n()})).catch((function(e){e.isSessionTokenExpiredError?r(e):t._refreshSessionKeyByApi().then((function(){return n()})).catch((function(e){return r(e)}))})):t._refreshSessionKeyByApi().then((function(){return n()})).catch((function(e){return r(e)})):r(e.sessionTokenNotFoundError)}))}},{key:"_refreshSessionKeyByCommand",value:function(){var t=this;return new Promise((function(n,r){var i=fn.getInstance(t._iid),s=L.get(t._iid).container.auth,a=G.get(t._iid).Command,o=a.bSessionRefresh({token:s.sessionToken,requestId:a.generateRequestId()});i.sendCommand(o,(function(t,a){if(!i.getErrorFirstCallback()){var o=[t,a];a=o[0],t=o[1]}t?r(t):a?a.hasOwnProperty("error")?r(e.sessionKeyRefreshFailedError):(a.hasOwnProperty("new_key")&&(s.sessionKey=a.new_key),n()):r(e.sessionKeyRefreshFailedError)}))}))}},{key:"_refreshSessionKeyByApi",value:function(){var t=this;return new Promise((function(n,r){!function i(s){if(s<3){var a=L.get(t._iid).container,o=a.auth,l=a.apiClient,u={};o.sessionToken&&(u.accessToken=o.sessionToken),l.refreshSessionKey(u,(function(e,t){if(e)e.isSessionTokenExpiredError||e.isSessionTokenRevokedError?r(e):i(s+1);else{var a=t.key;o.sessionKey=a,n()}}))}else r(e.sessionKeyRefreshFailedError)}(0)}))}},{key:"_handleSessionToken",value:function(t){var n=this;t?(L.get(this._iid).container.auth.sessionToken=t,this._refreshSessionKey().then((function(){return n._handleSessionRefreshSuccess()})).catch((function(){return n._handleSessionRefreshError(e.sessionTokenRequestFailedError)}))):this._handleSessionClosed(e.sessionTokenRequestFailedError)}},{key:"_handleSessionRefreshSuccess",value:function(){this.handler.onSessionRefreshed(),this._flushResolvers(null)}},{key:"_handleSessionRefreshError",value:function(e){this._cancelConnection(),this.handler.onSessionError(e),this._flushResolvers(e)}},{key:"_handleSessionClosed",value:function(e){this._cancelConnection(),this.handler.onSessionClosed(),this._flushResolvers(e)}},{key:"_cancelConnection",value:function(){var e=fn.getInstance(this._iid);e.reconnecting&&(Object.keys(e.connectionHandlers).forEach((function(t){e.connectionHandlers[t].onReconnectFailed()})),e.reconnecting=!1),e.disconnect()}},{key:"_flushResolvers",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=0;n<this.resolvers.length;n++)e?this.resolvers[n].reject(e):this.resolvers[n].resolve(t);this.resolvers=[]}},{key:"setHandler",value:function(e){e instanceof le&&(this.handler=e)}},{key:"isSessionError",value:function(e){return e.isSessionTokenExpiredError||e.isSessionTokenRevokedError||e.isSessionKeyExpiredError}},{key:"refreshSessionToken",value:function(){var t=this;return new Promise((function(n,r){t.handler?(t.resolvers.push({resolve:n,reject:r}),1===t.resolvers.length&&t._refreshSessionToken().then((function(e){return t._handleSessionToken(e)})).catch((function(){return t._handleSessionRefreshError(e.sessionTokenRequestFailedError)}))):n()}))}},{key:"refreshSessionKey",value:function(){var e=this;return new Promise((function(t,n){e.handler?(e.resolvers.push({resolve:t,reject:n}),1===e.resolvers.length&&e._refreshSessionKey().then((function(){return e._handleSessionRefreshSuccess()})).catch((function(t){t.isSessionTokenExpiredError?e._refreshSessionToken().then((function(t){return e._handleSessionToken(t)})).catch((function(t){return e._handleSessionRefreshError(t)})):t.isSessionTokenRevokedError?e._handleSessionClosed(t):e._handleSessionRefreshError(t)}))):t()}))}},{key:"refreshSessionIfExpiredError",value:function(e){var t=this;return e.isSessionTokenExpiredError?this.refreshSessionToken():e.isSessionKeyExpiredError?this.refreshSessionKey():e.isSessionTokenRevokedError?new Promise((function(e,n){return n(t.closeSession())})):Promise.reject(e)}},{key:"closeSession",value:function(){var t=e.sessionTokenRequestFailedError;return this._handleSessionClosed(t),t}}],[{key:"sessionTokenNotFoundError",get:function(){return new D("Session token is not found.",D.SESSION_TOKEN_EXPIRED)}},{key:"sessionTokenExpiredError",get:function(){return new D("Session token is expired.",D.SESSION_TOKEN_EXPIRED)}},{key:"sessionKeyRefreshFailedError",get:function(){return new D("Failed to refresh the session key.",D.SESSION_KEY_REFRESH_FAILED)}},{key:"sessionTokenRequestFailedError",get:function(){return new D("Failed to get the session token.",D.SESSION_TOKEN_REQUEST_FAILED)}}]),e}(),ce=function(){function e(t){p(this,e),this.sb=t}return g(e,[{key:"onlineWorker",value:function(){try{if("undefined"!=typeof navigator&&navigator.onLine){var e=L.get(this.sb._iid).container.auth;this.sb.reconnecting||this.sb.connecting||!e.sessionKey||this.sb.getConnectionState()===this.sb.ConnectionState.OPEN||this.sb.reconnect()}}catch(e){W.debug("There is no `window.addEventListener.ononline` or `navigator.onLine`")}}},{key:"offlineWorker",value:function(){try{if("undefined"!=typeof navigator&&!navigator.onLine){var e=L.get(this.sb._iid).container,t=e.auth,n=e.pinger;this.sb.reconnecting||this.sb.connecting||!t.sessionKey||(n&&n.stop(),this.sb.reconnect())}}catch(e){W.debug("There is no `window.addEventListener.ononline` or `navigator.onLine`")}}},{key:"start",value:function(){try{"undefined"!=typeof window&&window.addEventListener&&"ononline"in window&&"onoffline"in window&&"undefined"!=typeof navigator&&"boolean"==typeof navigator.onLine&&(window.addEventListener("online",this.onlineWorker),window.addEventListener("offline",this.offlineWorker))}catch(e){W.debug("There is no `window.addEventListener.ononline` or `navigator.onLine`")}}},{key:"stop",value:function(){try{window.removeEventListener("online",this.onlineWorker,!1),window.removeEventListener("offline",this.offlineWorker,!1)}catch(e){W.debug("There is no `window.addEventListener.ononline` or `navigator.onLine`")}}}]),e}(),de=(new Date).getTime(),he=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;switch(p(this,e),this.command=t,this.requestId=r,arguments.length){case 1:if(!t||t.length<=4)this.command="NOOP",this.payload="{}";else if(this.decode(t),this.isRequestIdCommand){var i=this.getJsonElement();i&&(this.requestId=i.req_id||"")}break;case 2:case 3:!this.requestId&&this.isRequestIdCommand&&(this.requestId=e.generateRequestId()),n.req_id=this.requestId||"",this.payload=JSON.stringify(n)}}return g(e,[{key:"isRequestIdCommand",get:function(){return this.isAckRequired||"EROR"===this.command}},{key:"isAckRequired",get:function(){return"LOGI"===this.command||"MESG"===this.command||"FILE"===this.command||"ENTR"===this.command||"EXIT"===this.command||"READ"===this.command||"MEDI"===this.command||"FEDI"===this.command}},{key:"encode",value:function(){return this.command+this.payload+"\n"}},{key:"decode",value:function(e){e=e.trim(),this.command=e.substring(0,4),this.payload=e.substring(4)}},{key:"getJsonElement",value:function(){return JSON.parse(this.payload)}}],[{key:"bSessionRefresh",value:function(e){return new this("LOGI",{token:e.token},e.requestId)}},{key:"bPing",value:function(){return new this("PING",{id:(new Date).getTime(),active:1})}},{key:"bMessage",value:function(e){var t=e.channelUrl,n=e.message,r=e.data,i=e.customType,s=e.metaArrays,a=e.mentionType,o=e.mentionedUserIds,l=e.translationTargetLanguages,u=e.pushNotificationDeliveryOption,c=e.appleCriticalAlertOptions,d=e.requestId,h=void 0===d?null:d,p=e.silent,f=void 0!==p&&p,g=e.rootMessageId,y=void 0===g?null:g,m=e.parentMessageId,_=void 0===m?null:m,v=e.pollId,E=e.isReplyToChannel,C=void 0!==E&&E,b=G.get(this._iid),S=b.UserMessageParams,A=b.BaseMessageParams,k={};return k.channel_url=t,k.message=n,k.data=r,s&&s.length>0&&(k.metaarray=s.map((function(e){return e.encode()}))),a&&(k.mention_type=a),k.mentioned_user_ids=[],a===A.MentionType.CHANNEL?k.mentioned_user_ids=[]:Array.isArray(o)&&o.length>0&&(k.mentioned_user_ids=o),i&&(k.custom_type=i),l&&l.length>0&&(k.target_langs=l),u&&u!==S.PushNotificationDeliveryOption.DEFAULT&&(k.push_option=u),c&&(k.apple_critical_alert_options=c.serialize()),f&&(k.silent=f),y&&(k.root_message_id=y),_&&(k.parent_message_id=_),"number"==typeof v?k.poll_id=v:null===v&&(k.poll_id=-1),C&&(k.reply_to_channel=C),new this("MESG",k,h)}},{key:"bFile",value:function(e){var t=e.channelUrl,n=e.url,r=e.name,i=e.type,s=e.size,a=e.data,o=e.customType,l=e.thumbnailSizes,u=e.requireAuth,c=e.metaArrays,d=e.mentionType,h=e.mentionedUserIds,p=e.pushNotificationDeliveryOption,f=e.appleCriticalAlertOptions,g=e.requestId,y=void 0===g?null:g,m=e.silent,_=void 0!==m&&m,v=e.rootMessageId,E=void 0===v?null:v,C=e.parentMessageId,b=void 0===C?null:C,S=e.isReplyToChannel,A=void 0!==S&&S,k=G.get(this._iid),I=k.BaseMessageParams,U=k.FileMessageParams,O={};return O.channel_url=t,O.url=n,O.name=r||"",O.type=i||"",O.size=s||0,O.custom=a,o&&(O.custom_type=o),l&&(O.thumbnails=l),u&&(O.require_auth=u),c&&c.length>0&&(O.metaarray=c.map((function(e){return e.encode()}))),d&&(O.mention_type=d),O.mentioned_user_ids=[],d===I.MentionType.CHANNEL?O.mentioned_user_ids=[]:Array.isArray(h)&&h.length>0&&(O.mentioned_user_ids=h),p&&p!==U.PushNotificationDeliveryOption.DEFAULT&&(O.push_option=p),f&&(O.apple_critical_alert_options=f.serialize()),_&&(O.silent=_),E&&(O.root_message_id=E),b&&(O.parent_message_id=b),A&&(O.reply_to_channel=A),new this("FILE",O,y)}},{key:"bUpdateUserMessage",value:function(e){var t=e.channelUrl,n=e.messageId,r=e.appleCriticalAlertOptions,i=e.message,s=void 0===i?null:i,a=e.data,o=void 0===a?null:a,l=e.customType,u=void 0===l?null:l,c=e.mentionType,d=void 0===c?null:c,h=e.mentionedUserIds,p=void 0===h?null:h,f=e.metaArrayParams,g=void 0===f?null:f,y=e.pollId,m=G.get(this._iid).BaseMessageParams,_={};return _.channel_url=t,_.msg_id=n,null!=s&&void 0!==s&&(_.message=s),null!=o&&void 0!==o&&(_.data=o),null!=u&&void 0!==u&&(_.custom_type=u),d&&(_.mention_type=d),d===m.MentionType.CHANNEL?_.mentioned_user_ids=[]:Array.isArray(p)&&p.length>0&&(_.mentioned_user_ids=p),g&&(_.metaarray=g),r&&(_.apple_critical_alert_options=r.serialize()),"number"==typeof y?_.poll_id=y:null===y&&(_.poll_id=-1),new this("MEDI",_)}},{key:"bUpdateFileMessage",value:function(e){var t=e.channelUrl,n=e.messageId,r=e.appleCriticalAlertOptions,i=e.data,s=void 0===i?null:i,a=e.customType,o=void 0===a?null:a,l=e.mentionType,u=void 0===l?null:l,c=e.mentionedUserIds,d=void 0===c?null:c,h=e.metaArrayParams,p=void 0===h?null:h,f=G.get(this._iid).BaseMessageParams,g={};return g.channel_url=t,g.msg_id=n,null!=s&&void 0!==s&&(g.data=s),null!=o&&void 0!==o&&(g.custom_type=o),u&&(g.mention_type=u),u===f.MentionType.CHANNEL?g.mentioned_user_ids=[]:Array.isArray(d)&&d.length>0&&(g.mentioned_user_ids=d),p&&(g.metaarray=p),r&&(g.apple_critical_alert_options=r.serialize()),new this("FEDI",g)}},{key:"bRead",value:function(e){var t=e.channelUrl,n={};return n.channel_url=t,new this("READ",n)}},{key:"bMessageAck",value:function(e){var t=e.channelUrl,n=e.messageId,r={};return r.channel_url=t,r.msg_id=n,new this("MACK",r)}},{key:"bTypeStart",value:function(e){var t=e.channelUrl,n=e.time,r={};return r.channel_url=t,r.time=n,new this("TPST",r)}},{key:"bTypeEnd",value:function(e){var t=e.channelUrl,n=e.time,r={};return r.channel_url=t,r.time=n,new this("TPEN",r)}},{key:"bEnter",value:function(e){var t=e.channelUrl,n={};return n.channel_url=t,new this("ENTR",n)}},{key:"bExit",value:function(e){var t=e.channelUrl,n={};return n.channel_url=t,new this("EXIT",n)}},{key:"generateRequestId",value:function(){return de++,String(de)}}]),e}(),pe=new WeakMap,fe=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};p(this,e);var n=[];if(t.hasOwnProperty("premium_feature_list")&&Array.isArray(t.premium_feature_list))try{var r=t.premium_feature_list;n.push.apply(n,O(r))}catch(e){}var i=[];if(t.hasOwnProperty("application_attributes")&&Array.isArray(t.application_attributes))try{var s=t.application_attributes;i.push.apply(i,O(s))}catch(e){}var a=!1;t.hasOwnProperty("disable_supergroup_mack")&&"boolean"==typeof t.disable_supergroup_mack&&(a=t.disable_supergroup_mack),pe.set(this,{emojiHash:t.hasOwnProperty("emoji_hash")?t.emoji_hash:"",uploadSizeLimit:t.hasOwnProperty("file_upload_size_limit")?1048576*t.file_upload_size_limit:Number.MAX_VALUE,useReaction:t.hasOwnProperty("use_reaction")&&t.use_reaction,disableSupergroupMack:a,applicationAttributes:i,premiumFeatureList:n})}return g(e,[{key:"emojiHash",get:function(){return pe.get(this).emojiHash}},{key:"uploadSizeLimit",get:function(){return pe.get(this).uploadSizeLimit}},{key:"premiumFeatureList",get:function(){return pe.get(this).premiumFeatureList}},{key:"applicationAttributes",get:function(){return pe.get(this).applicationAttributes}},{key:"isUsingReaction",get:function(){return pe.get(this).useReaction}},{key:"isSupergroupMackDisabled",get:function(){return pe.get(this).disableSupergroupMack}}]),e}(),ge=function(){function e(){p(this,e),this.messageId=null,this.userId=null,this.key=null,this.operation="",this.updatedAt=null}return g(e,null,[{key:"createFromJson",value:function(e){var t=parseInt(e.msg_id),n=e.user_id,r=e.operation,i=e.reaction,s=e.updated_at;if(t&&"string"==typeof n&&"string"==typeof r&&["add","delete"].indexOf(r.toLowerCase())>=0&&"string"==typeof i&&i&&"number"==typeof s){var a=new this;return a.messageId=t,a.userId=n,a.key=i,a.operation=r.toLowerCase(),a.updatedAt=s,a}return null}}]),e}();function ye(e){return Object.keys(e).forEach((function(t){e[t]&&"object"===h(e[t])&&ye(e[t])})),Object.freeze(e)}var me=function(){function e(){p(this,e)}return g(e,null,[{key:"serialize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=JSON.parse(JSON.stringify(e));return t&&t(n),ye(n)}},{key:"deserialize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=JSON.parse(JSON.stringify(e));return t&&t(n),n}}]),e}(),_e=function(e,t,n){return new Promise((function(r,i){t((function(t,s){n&&"function"==typeof n&&(L.get(e).container.isErrorFirstInCallback?n(t,s):n(s,t)),t?i(t):r(s)}))}))},ve={TIMESTAMP:"timestamp",MESSAGE_ID:"messageId"},Ee=new WeakMap,Ce=function(){function e(t){p(this,e),this.messageId=0,this.messageType=e.MESSAGE_TYPE_BASE,this.channelUrl="",this.data=null,this.customType=null,this.silent=!1,this.createdAt=0,this.updatedAt=0,this.channelType=null,this.metaArrays=[],this.reactions=[],this.mentionType=null,this.mentionedUsers=[],this.sendingStatus=null,Ee.set(this,0),this.parentMessageId=0,this.parentMessageText=null,this.threadInfo=null,this.isReplyToChannel=!1,this.parentMessage=null,this.ogMetaData=null,this.isOperatorMessage=!1,this.appleCriticalAlertOptions=null,t&&this.__update(t)}return g(e,[{key:"serialize",value:function(){return me.serialize(this,(function(e){e.hasOwnProperty("_sender")&&(e.sender=e._sender,delete e._sender)}))}},{key:"isIdentical",value:function(e){return!("object"!==h(e)||!e.hasOwnProperty("messageId"))&&(0!==this.messageId&&0!==e.messageId?this.messageId===e.messageId:this.reqId===e.reqId)}},{key:"isEqual",value:function(e){return ee.deepEqual(this,e)}},{key:"isOpenChannel",value:function(){var e=G.get(this._iid).BaseChannel;return this.channelType===e.CHANNEL_TYPE_OPEN}},{key:"isGroupChannel",value:function(){var e=G.get(this._iid).BaseChannel;return this.channelType===e.CHANNEL_TYPE_GROUP}},{key:"isUserMessage",value:function(){return this.messageType===e.MESSAGE_TYPE_USER}},{key:"isAdminMessage",value:function(){return this.messageType===e.MESSAGE_TYPE_ADMIN}},{key:"isFileMessage",value:function(){return this.messageType===e.MESSAGE_TYPE_FILE}},{key:"__update",value:function(e){var t=this,n=fn.getInstance(this._iid),r=G.get(this._iid),i=r.User,s=r.BaseChannel,a=r.BaseMessageParams,o=r.BaseMessage,l=r.Reaction,u=r.MessageMetaArray,c=r.ThreadInfo,h=r.OGMetaData,p=r.AppleCriticalAlertOptions;e.hasOwnProperty("msg_id")&&(this.messageId=parseInt(e.msg_id)),e.hasOwnProperty("message_id")&&(this.messageId=parseInt(e.message_id)),this.channelUrl=e.hasOwnProperty("channel_url")?String(e.channel_url):"",this.data=e.hasOwnProperty("data")?String(e.data):"",this.customType=e.hasOwnProperty("custom_type")?String(e.custom_type):"",this.silent=!!e.hasOwnProperty("silent")&&e.silent,this.createdAt=e.hasOwnProperty("ts")?parseInt(e.ts):0,e.hasOwnProperty("created_at")&&(this.createdAt=parseInt(e.created_at)),this.updatedAt=e.hasOwnProperty("updated_at")?parseInt(e.updated_at):0,this.channelType=e.hasOwnProperty("channel_type")?String(e.channel_type):s.CHANNEL_TYPE_GROUP;var f=e.hasOwnProperty("metaarray")?e.metaarray:{},g=e.hasOwnProperty("metaarray_key_order")?e.metaarray_key_order:Object.keys(f).sort((function(e,t){return e.localeCompare(t)}));this.metaArrays=[];for(var y=0;y<g.length;y++){var m=g[y];this.metaArrays.push(new u(m,f[m]||[]))}if(e.hasOwnProperty("sorted_metaarray")){var _=e.sorted_metaarray;Array.isArray(_)&&(this.metaArrays=_.map((function(e){return new u(e.key,e.value)})))}if(this.reactions=[],e.hasOwnProperty("reactions")&&Array.isArray(e.reactions))for(var v=0;v<e.reactions.length;v++){var E=l.createFromJson(e.reactions[v]);E&&this.reactions.push(E)}if(this.mentionType=e.hasOwnProperty("mention_type")?e.mention_type:a.MentionType.USERS,this.mentionedUsers=[],e.hasOwnProperty("mentioned_users")&&e.mentioned_users.forEach((function(e){var n=new i(e);t.mentionedUsers.push(n)})),this.sendingStatus=this.messageId>0?n.MessageSendingStatus.SUCCEEDED:n.MessageSendingStatus.FAILED,e.hasOwnProperty("sending_status")&&(this.sendingStatus=e.sending_status),e.hasOwnProperty("root_message_id")&&Ee.set(this,parseInt(e.root_message_id)),e.hasOwnProperty("parent_message_id")&&(this.parentMessageId=parseInt(e.parent_message_id)),this.threadInfo=new c(e.thread_info),this.isReplyToChannel=!!e.hasOwnProperty("is_reply_to_channel")&&e.is_reply_to_channel,e.hasOwnProperty("parent_message_info")){var C=d({},e.parent_message_info);e.parent_message_info.hasOwnProperty("file")&&(C.require_auth=!!e.parent_message_info.file.require_auth);var b={channelType:this.channelType,channelUrl:this.channelUrl};switch(this.parentMessage=s.buildMessage(C,b),this.parentMessage.messageType){case o.MESSAGE_TYPE_USER:this.parentMessageText=this.parentMessage.message;break;case o.MESSAGE_TYPE_FILE:this.parentMessageText=this.parentMessage.name}}e.hasOwnProperty("og_tag")&&(this.ogMetaData=new h(e.og_tag)),this.isOperatorMessage=!!e.hasOwnProperty("is_op_msg")&&e.is_op_msg,e.hasOwnProperty("apple_critical_alert_options")&&(this.appleCriticalAlertOptions=new p(e.apple_critical_alert_options))}},{key:"getMetaArraysByKeys",value:function(e){return Array.isArray(e)?this.metaArrays.filter((function(t){return e.indexOf(t.key)>-1})):[]}},{key:"metaArray",get:function(){var e={};return this.metaArrays.forEach((function(t){e[t.key]=t.value})),e},set:function(e){if("object"===h(e)&&e){var t=G.get(this._iid).MessageMetaArray,n=[];Object.keys(e).forEach((function(r){n.push(new t(r,e[r]))})),this.metaArrays=n}}},{key:"getMetaArrayByKeys",value:function(e){var t={};return this.getMetaArraysByKeys(e).forEach((function(e){t[e.key]=e.value})),t}},{key:"applyReactionEvent",value:function(e){var t=this,n=G.get(this._iid),r=n.Reaction,i=null,s=ae.parse(arguments,[new ae({type:ge,constraint:function(e){return parseInt(e.messageId)===parseInt(t.messageId)}})]),a=U(s,2);if(i=a[0],e=a[1],!i){for(var o=!1,l=0;l<this.reactions.length;l++)if(this.reactions[l].key===e.key){this.reactions[l]._applyEvent(e),this.reactions[l].isEmpty&&this.reactions.splice(l,1),o=!0;break}o||"add"!==e.operation||this.reactions.push(new r(e.key,[e.userId],e.updatedAt))}}},{key:"_getThreadedMessageList",value:function(t,n,r,i){var s=this,a=G.get(this._iid),o=a.ThreadedMessageListParams,l=null,u=ae.parse(arguments,[new ae({type:"number"}),new ae({type:"string",constraint:function(e){return Object.values(ve).includes(e)}}),new ae({type:o,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),c=U(u,5);return l=c[0],t=c[1],n=c[2],r=c[3],i=c[4],_e(this._iid,(function(i){if(l)i(l,null);else{var a=G.get(s._iid),o=a.GroupChannel,u=a.OpenChannel;s.isGroupChannel()?o.getChannel(s.channelUrl,w.INTERNAL_CALL,(function(a,o){if(fn.getInstance(s._iid).getErrorFirstCallback()){var l=[a,o];o=l[0],a=l[1]}o?i(o,null):L.get(s._iid).container.apiClient.getMessageList(d(d({channel:a,token:t,tokenType:n},r),{},{shouldReverse:r.reverse,parentMessageId:s.messageId,includeThreadInfo:!0,replyType:e.ReplyType.ALL}),(function(e,t){if(e)i(e,null);else{var n=G.get(s._iid).BaseChannel,r=t.messages.map((function(e){return n.buildMessage(e,a)})).filter((function(e){return null!==e})),o=r.filter((function(e){return e.messageId===s.messageId}))[0],l=r.filter((function(e){return e.parentMessageId===s.messageId}));i(null,{parentMessage:o,threadedReplies:l})}}))})):s.isOpenChannel()&&u.getChannel(s.channelUrl,w.INTERNAL_CALL,(function(a,o){if(fn.getInstance(s._iid).getErrorFirstCallback()){var l=[a,o];o=l[0],a=l[1]}o?i(o,null):L.get(s._iid).container.apiClient.getMessageList(d(d({channel:a,token:t,tokenType:n},r),{},{shouldReverse:r.reverse,parentMessageId:s.messageId,includeThreadInfo:!0,replyType:e.ReplyType.ALL}),(function(e,t){if(e)i(e,null);else{var n=G.get(s._iid).BaseChannel,r=t.messages.map((function(e){return n.buildMessage(e,a)})).filter((function(e){return null!==e})),o=r.filter((function(e){return e.messageId===s.messageId}))[0],l=r.filter((function(e){return e.parentMessageId===s.messageId}));i(null,{parentMessage:o,threadedReplies:l})}}))}))}}),i)}},{key:"getThreadedMessagesByTimestamp",value:function(e,t,n){return this._getThreadedMessageList(e,ve.TIMESTAMP,t,n)}},{key:"applyThreadInfoUpdateEvent",value:function(e){var t=this,n=G.get(this._iid),r=n.ThreadInfoUpdateEvent,i=null,s=ae.parse(arguments,[new ae({type:r,constraint:function(e){return parseInt(e.targetMessageId)===parseInt(t.messageId)}})]),a=U(s,2);return i=a[0],e=a[1],!i&&(this.threadInfo=e.threadInfo,!0)}}],[{key:"MESSAGE_TYPE_BASE",get:function(){return"base"}},{key:"MESSAGE_TYPE_ADMIN",get:function(){return"admin"}},{key:"MESSAGE_TYPE_USER",get:function(){return"user"}},{key:"MESSAGE_TYPE_FILE",get:function(){return"file"}},{key:"SendingStatus",get:function(){return{NONE:"none",PENDING:"pending",FAILED:"failed",CANCELED:"canceled",SUCCEEDED:"succeeded"}}},{key:"ReplyType",get:function(){return{ALL:"all",NONE:"none",ONLY_REPLY_TO_CHANNEL:"only_reply_to_channel"}}},{key:"getMessage",value:function(e,t){var n=this,r=G.get(this._iid),i=r.BaseChannel,s=r.MessageRetrievalParams,a=null,o=ae.parse(arguments,[new ae({type:s,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),l=U(o,3);return a=l[0],e=l[1],t=l[2],_e(this._iid,(function(t){if(a)t(a,null);else{var r=G.get(n._iid),s=r.GroupChannel,o=r.OpenChannel;switch(e.channelType){case i.CHANNEL_TYPE_GROUP:s.getChannel(e.channelUrl,w.INTERNAL_CALL,(function(r,s){if(fn.getInstance(n._iid).getErrorFirstCallback()){var a=[r,s];s=a[0],r=a[1]}s?t(s,null):L.get(n._iid).container.apiClient.getMessage(d({channel:r},e),(function(e,n){if(e)t(e,null);else{var s=i.buildMessage(n,r);t(null,s)}}))}));break;case i.CHANNEL_TYPE_OPEN:o.getChannel(e.channelUrl,w.INTERNAL_CALL,(function(r,s){if(fn.getInstance(n._iid).getErrorFirstCallback()){var a=[r,s];s=a[0],r=a[1]}s?t(s,null):L.get(n._iid).container.apiClient.getMessage(d({channel:r},e),(function(e,n){if(e)t(e,null);else{var s=i.buildMessage(n,r);t(null,s)}}))}))}}}),t)}}]),e}(),be=function(){function e(t){p(this,e),this.nickname="",this.plainProfileUrl="",this.userId="",this.connectionStatus="",this.lastSeenAt=null,this.metaData={},this.isActive=!0,this.friendDiscoveryKey=null,this.friendName=null,this._preferredLanguages=null,this.requireAuth=null,t&&this.__update(t)}return g(e,[{key:"preferredLanguages",get:function(){return this._preferredLanguages}},{key:"__update",value:function(t){var n=L.get(this._iid).container.auth;t.hasOwnProperty("guest_id")&&(this.userId=String(t.guest_id)),t.hasOwnProperty("user_id")&&(this.userId=String(t.user_id)),t.hasOwnProperty("name")&&(this.nickname=String(t.name)),t.hasOwnProperty("nickname")&&(this.nickname=String(t.nickname)),t.hasOwnProperty("require_auth_for_profile_image")?this.requireAuth=t.require_auth_for_profile_image:this.requireAuth=null,(t.hasOwnProperty("image")||t.hasOwnProperty("profile_url"))&&(this.plainProfileUrl=String(t.image||t.profile_url||""),Object.defineProperty(this,"profileUrl",{value:this.requireAuth?"".concat(this.plainProfileUrl,"?auth=").concat(n.eKey):this.plainProfileUrl,configurable:!0,writable:!1})),t.hasOwnProperty("is_online")?t.is_online===e.NON_AVAILABLE?this.connectionStatus=e.NON_AVAILABLE:this.connectionStatus=t.is_online?e.ONLINE:e.OFFLINE:this.connectionStatus=e.NON_AVAILABLE,t.hasOwnProperty("last_seen_at")?this.lastSeenAt=parseInt(t.last_seen_at):this.lastSeenAt=0,t.hasOwnProperty("metadata")?this.metaData=t.metadata:this.metaData={},t.hasOwnProperty("is_active")?this.isActive=void 0===t.is_active||t.is_active:this.isActive=!0,t.hasOwnProperty("friend_discovery_key")?this.friendDiscoveryKey=t.friend_discovery_key:this.friendDiscoveryKey=null,t.hasOwnProperty("friend_name")?this.friendName=t.friend_name:this.friendName=null,t.hasOwnProperty("preferred_languages")?this._preferredLanguages=t.preferred_languages||null:this._preferredLanguages=null}},{key:"_updateMetaData",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=G.get(this._iid),i=r.GroupChannel;Object.keys(e).forEach((function(r){n?delete t.metaData[r]:t.metaData[r]=e[r]})),Object.keys(i.cachedChannels).forEach((function(e){if(i.cachedChannels.hasOwnProperty(e)){var n=i.cachedChannels[e];n.memberMap.hasOwnProperty(t.userId)&&(n.memberMap[t.userId].metaData=t.metaData)}}))}},{key:"serialize",value:function(){return me.serialize(this,(function(e){e.hasOwnProperty("_preferredLanguages")&&(e.preferredLanguages=e._preferredLanguages,delete e._preferredLanguages)}))}},{key:"getOriginalProfileUrl",value:function(){var e="";if(((e=(e=this.plainProfileUrl.indexOf("://")>-1?this.plainProfileUrl.split("/")[2]:this.plainProfileUrl.split("/")[0]).split("?")[0]).indexOf("sendbird.com")>-1||e.indexOf("sendbirdtest.com")>-1||e.indexOf("intoz.com")>-1||e.indexOf("file-local")>-1)&&this.plainProfileUrl.indexOf(e+"/profile_images/")>-1){var t=this.plainProfileUrl.replace("profile_images/","");return t===this.plainProfileUrl?"":t}return""}},{key:"createMetaData",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return Object.keys(e).length>0&&!Array.isArray(e)}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.createUserMetaData({metaData:e},(function(e,r){e||n._updateMetaData(r),t(e,r)}))}),t)}},{key:"updateMetaData",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return!Array.isArray(e)&&Object.keys(e).length>0&&Object.keys(e).map((function(t){return e[t]})).every((function(e){return"string"==typeof e}))}}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.updateUserMetaData({metaData:e,upsert:t},(function(e,t){e||r._updateMetaData(t),n(e,t)}))}),n)}},{key:"deleteMetaData",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){if(r)t(r,null);else{var i={};i[e]="",L.get(n._iid).container.apiClient.deleteUserMetaData({metaDataKey:e},(function(e,r){e||n._updateMetaData(i,!0),t(e,r)}))}}),t)}},{key:"deleteAllMetaData",value:function(e){var t=this;return _e(this._iid,(function(e){var n=t.metaData;L.get(t._iid).container.apiClient.deleteAllUserMetaData({},(function(r,i){r||t._updateMetaData(n,!0),e(r,i)}))}),e)}}],[{key:"objectify",value:function(e){var t=e.userId,n=void 0===t?null:t,r=e.nickname,i=void 0===r?"":r,s=e.plainProfileUrl,a=void 0===s?"":s,o=e.connectionStatus,l=void 0===o?"":o,u=e.lastSeenAt,c=void 0===u?0:u,d=e.metaData,h=void 0===d?{}:d,p=e.isActive,f=void 0===p||p,g=e.friendDiscoveryKey,y=void 0===g?null:g,m=e.friendName,_=void 0===m?null:m,v=e.preferredLanguages,E=void 0===v?null:v,C=e.requireAuth;return{user_id:n,nickname:i,profile_url:a,is_online:l,last_seen_at:c,metadata:h,is_active:f,friend_discovery_key:y,friend_name:_,preferred_languages:E,require_auth_for_profile_image:void 0!==C&&C}}},{key:"build",value:function(e,t,n,r,i,s,a,o,l,u,c){return this.objectify({userId:e,nickname:t,plainProfileUrl:n,connectionStatus:r,lastSeenAt:i,metaData:s,isActive:a,friendDiscoveryKey:o,friendName:l,preferredLanguages:u,requireAuth:c})}},{key:"buildFromSerializedData",value:function(e){var t=G.get(this._iid).User,n=me.deserialize(e);return new t(t.objectify(n))}},{key:"NON_AVAILABLE",get:function(){return"nonavailable"}},{key:"ONLINE",get:function(){return"online"}},{key:"OFFLINE",get:function(){return"offline"}}]),e}(),Se={TIMESTAMP:"timestamp",MESSAGE_ID:"messageId"},Ae=new WeakMap,ke=function(){function e(t){p(this,e),this.url="",this.channelType=e.CHANNEL_TYPE_BASE,this.name="",this.coverUrl="",this.creator=null,this.createdAt=0,this.data=null,this.customType=null,this.isFrozen=!1,this.isEphemeral=!1,Ae.set(this,{}),t&&this.__update(t)}return g(e,[{key:"__update",value:function(e){this.url=e.hasOwnProperty("channel_url")?String(e.channel_url):"",this.name=e.hasOwnProperty("name")?String(e.name):"",this.coverUrl=e.hasOwnProperty("cover_url")?String(e.cover_url):"",this.createdAt=e.hasOwnProperty("created_at")?1e3*e.created_at:0,this.data=e.hasOwnProperty("data")?String(e.data):"",this.customType=e.hasOwnProperty("custom_type")?e.custom_type:"",this.isFrozen=!!e.hasOwnProperty("freeze")&&e.freeze,this.isEphemeral=!!e.hasOwnProperty("is_ephemeral")&&e.is_ephemeral,e.hasOwnProperty("created_by")&&null!==e.created_by&&"object"===h(e.created_by)&&Object.keys(e.created_by).length>0?this.creator=new be(e.created_by):this.creator=null,e.hasOwnProperty("metadata")&&null!==e.metadata&&e.hasOwnProperty("ts")&&"number"==typeof e.ts&&this._refreshMetaData(e.metadata,e.ts)}},{key:"_addOrUpdateCachedMetaData",value:function(e,t){var n=Ae.get(this);Object.keys(e).forEach((function(r){var i=n[r],s=e[r];i?t>i.updatedAt&&(i.value=s,i.updatedAt=t,i.isRemoved=!1):n[r]={value:s,updatedAt:t,isRemoved:!1}}))}},{key:"_markAsDeletedCachedMetaData",value:function(e,t){var n=Ae.get(this);e.forEach((function(e){var r=n[e];r?t>r.updatedAt&&(r.isRemoved=!0,r.updatedAt=t):n[e]={value:null,updatedAt:t,isRemoved:!0}}))}},{key:"_refreshMetaData",value:function(e,t){var n={};Object.keys(e).forEach((function(r){n[r]={value:e[r],updatedAt:t,isRemoved:!1}})),Ae.set(this,n)}},{key:"isGroupChannel",value:function(){var e=G.get(this._iid).BaseChannel;return this.channelType===e.CHANNEL_TYPE_GROUP}},{key:"isOpenChannel",value:function(){var e=G.get(this._iid).BaseChannel;return this.channelType===e.CHANNEL_TYPE_OPEN}},{key:"createOperatorListQuery",value:function(){return new(0,G.get(this._iid).OperatorListQuery)(this)}},{key:"createMessageListQuery",value:function(){return new(0,G.get(this._iid).MessageListQuery)(this)}},{key:"createPreviousMessageListQuery",value:function(){return new(0,G.get(this._iid).PreviousMessageListQuery)(this)}},{key:"createPollListQuery",value:function(){return new(0,G.get(this._iid).PollListQuery)({channelUrl:this.url})}},{key:"createPollVoterListQuery",value:function(e,t){return new(0,G.get(this._iid).PollVoterListQuery)({channelUrl:this.url,pollId:e,optionId:t})}},{key:"serialize",value:function(){return me.serialize(this,(function(e){if(null!==e.lastMessage&&"object"===h(e.lastMessage)){var t=e.lastMessage;t.hasOwnProperty("_sender")&&(t.sender=t._sender,delete t._sender,e.lastMessage=t)}e.hasOwnProperty("_messageOffsetTimestamp")&&(e.messageOffsetTimestamp=e._messageOffsetTimestamp,delete e._messageOffsetTimestamp)}))}},{key:"getMessageChangeLogsByTimestamp",value:function(e,t,n,r){var i=this,s=null,a=ae.parse(arguments,[new ae({type:"number",constraint:function(e){return e>=0}}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"callback"})]),o=U(a,5);return s=o[0],e=o[1],t=o[2],n=o[3],r=o[4],_e(this._iid,(function(r){s?r(s,null):L.get(i._iid).container.apiClient.getMessageChangeLogs({channelUrl:i.url,ts:e,token:null,isOpenChannel:i.isOpenChannel(),includeMetaArray:t,includeReactions:n},(function(e,t){var n=null;if(!e){var s=G.get(i._iid).BaseChannel;n={updatedMessages:t.updated.map((function(e){return s.buildMessage(e,i)})),deletedMessageIds:t.deleted.map((function(e){return parseInt(e.message_id)})),hasMore:t.has_more,token:t.next}}r(e,n)}))}),r)}},{key:"getMessageChangeLogsByToken",value:function(e,t,n,r){var i=this,s=null,a=ae.parse(arguments,[new ae({type:"string",nullable:!0}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"callback"})]),o=U(a,5);return s=o[0],e=o[1],t=o[2],n=o[3],r=o[4],_e(this._iid,(function(r){s?r(s,null):L.get(i._iid).container.apiClient.getMessageChangeLogs({channelUrl:i.url,ts:null,token:e,isOpenChannel:i.isOpenChannel(),includeMetaArray:t,includeReactions:n},(function(e,t){var n=null;if(!e){var s=G.get(i._iid).BaseChannel;n={updatedMessages:t.updated.map((function(e){return s.buildMessage(e,i)})),deletedMessageIds:t.deleted.map((function(e){return parseInt(e.message_id)})),hasMore:t.has_more,token:t.next}}r(e,n)}))}),r)}},{key:"getMessageChangeLogsSinceToken",value:function(e,t,n){var r=this,i=G.get(this._iid),s=i.BaseChannel,a=i.MessageChangeLogsParams,o=null,l=ae.parse(arguments,[new ae({type:"string",nullable:!0}),new ae({type:a,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),u=U(l,4);return o=u[0],e=u[1],t=u[2],n=u[3],_e(this._iid,(function(n){o?n(o,null):L.get(r._iid).container.apiClient.getMessageChangeLogs(d({channelUrl:r.url,ts:null,token:e,isOpenChannel:r.isOpenChannel()},t),(function(e,t){var i=null;e||(i={updatedMessages:t.updated.map((function(e){return s.buildMessage(e,r)})),deletedMessageIds:t.deleted.map((function(e){return parseInt(e.message_id)})),hasMore:t.has_more,token:t.next}),n(e,i)}))}),n)}},{key:"getMessageChangeLogsSinceTimestamp",value:function(e,t,n){var r=this,i=G.get(this._iid),s=i.BaseChannel,a=i.MessageChangeLogsParams,o=null,l=ae.parse(arguments,[new ae({type:"number",constraint:function(e){return e>=0}}),new ae({type:a,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),u=U(l,4);return o=u[0],e=u[1],t=u[2],n=u[3],_e(this._iid,(function(n){o?n(o,null):L.get(r._iid).container.apiClient.getMessageChangeLogs(d({channelUrl:r.url,timestamp:e,token:null,isOpenChannel:r.isOpenChannel()},t),(function(e,t){var i=null;e||(i={updatedMessages:t.updated.map((function(e){return s.buildMessage(e,r)})),deletedMessageIds:t.deleted.map((function(e){return parseInt(e.message_id)})),hasMore:t.has_more,token:t.next}),n(e,i)}))}),n)}},{key:"getMyMutedInfo",value:function(e){var t=this;return _e(this._iid,(function(e){var n=fn.getInstance(t._iid);L.get(t._iid).container.apiClient.getMyMutedInfo({channelUrl:t.url,userId:n.currentUser?n.currentUser.userId:null,isGroupChannel:t.isGroupChannel()},(function(t,n){var r=null;t||(r={isMuted:n.is_muted,startAt:n.start_at,endAt:n.end_at,remainingDuration:n.remaining_duration,description:n.description}),e(t,r)}))}),e)}},{key:"_parseMessageListParams",value:function(e){for(var t=G.get(this._iid),n=t.MessageListParams,r=new n,i=null,s=!1,a=0,o=0,l=!1,u="",c="",d=null,h=!1,p=!1,f=null,g=arguments.length,y=new Array(g>1?g-1:0),m=1;m<g;m++)y[m-1]=arguments[m];switch(e){case"prev":var _=ae.parse(y,[new ae({type:"number"}),new ae({type:"boolean"}),new ae({type:"number"}),new ae({type:"boolean"}),new ae({type:"string"}),new ae({type:"string"}),new ae({type:"array",optional:!0}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"callback"})]),v=U(_,11);i=v[0],s=v[2],a=v[3],l=v[4],u=v[5],c=v[6],d=v[7],h=v[8],p=v[9],f=v[10];break;case"next":var E=ae.parse(y,[new ae({type:"number"}),new ae({type:"boolean"}),new ae({type:"number"}),new ae({type:"boolean"}),new ae({type:"string"}),new ae({type:"string"}),new ae({type:"array",optional:!0}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"callback"})]),C=U(E,11);i=C[0],s=C[2],o=C[3],l=C[4],u=C[5],c=C[6],d=C[7],h=C[8],p=C[9],f=C[10];break;case"prevnext":var b=ae.parse(y,[new ae({type:"number"}),new ae({type:"number"}),new ae({type:"number"}),new ae({type:"boolean"}),new ae({type:"string"}),new ae({type:"string"}),new ae({type:"array",optional:!0}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"callback"})]),S=U(b,11);i=S[0],a=S[2],o=S[3],l=S[4],u=S[5],c=S[6],d=S[7],h=S[8],p=S[9],f=S[10],s=!0}return i?[null,f]:(r.isInclusive=s,r.prevResultSize=a,r.nextResultSize=o,r.reverse=l,r.messageType=u,r.customType=c,""===r.customType&&(r.customType="*"),r.senderUserIds=d,r.includeMetaArray=h,r.includeReactions=p,[r,f])}},{key:"_getMessageList",value:function(e,t,n,r){var i=this,s=G.get(this._iid),a=s.MessageListParams,o=null,l=ae.parse(arguments,[new ae({type:"number"}),new ae({type:"string",constraint:function(e){return Object.values(Se).includes(e)}}),new ae({type:a,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),u=U(l,5);return o=u[0],e=u[1],t=u[2],n=u[3],r=u[4],_e(this._iid,(function(r){o?r(o,null):L.get(i._iid).container.apiClient.getMessageList(d(d({channel:i,token:e,tokenType:t},n),{},{shouldReverse:n.reverse}),(function(e,t){if(e)r(e,null);else{var n=G.get(i._iid).BaseChannel,s=t.messages.map((function(e){return n.buildMessage(e,i)})).filter((function(e){return null!==e}));r(null,s)}}))}),r)}},{key:"getPreviousMessagesByTimestamp",value:function(e){var t=this._parseMessageListParams.apply(this,["prev"].concat(O(ae.toArray(arguments)))),n=U(t,2),r=n[0],i=n[1];return this._getMessageList(e,Se.TIMESTAMP,r,i)}},{key:"getNextMessagesByTimestamp",value:function(e){var t=this._parseMessageListParams.apply(this,["next"].concat(O(ae.toArray(arguments)))),n=U(t,2),r=n[0],i=n[1];return this._getMessageList(e,Se.TIMESTAMP,r,i)}},{key:"getPreviousAndNextMessagesByTimestamp",value:function(e){var t=this._parseMessageListParams.apply(this,["prevnext"].concat(O(ae.toArray(arguments)))),n=U(t,2),r=n[0],i=n[1];return this._getMessageList(e,Se.TIMESTAMP,r,i)}},{key:"getPreviousMessagesByID",value:function(e){var t=this._parseMessageListParams.apply(this,["prev"].concat(O(ae.toArray(arguments)))),n=U(t,2),r=n[0],i=n[1];return this._getMessageList(e,Se.MESSAGE_ID,r,i)}},{key:"getNextMessagesByID",value:function(e){var t=this._parseMessageListParams.apply(this,["next"].concat(O(ae.toArray(arguments)))),n=U(t,2),r=n[0],i=n[1];return this._getMessageList(e,Se.MESSAGE_ID,r,i)}},{key:"getPreviousAndNextMessagesByID",value:function(e){var t=this._parseMessageListParams.apply(this,["prevnext"].concat(O(ae.toArray(arguments)))),n=U(t,2),r=n[0],i=n[1];return this._getMessageList(e,Se.MESSAGE_ID,r,i)}},{key:"getMessagesByTimestamp",value:function(e,t,n){return this._getMessageList(e,Se.TIMESTAMP,t,n)}},{key:"getMessagesByMessageId",value:function(e,t,n){return this._getMessageList(e,Se.MESSAGE_ID,t,n)}},{key:"_sendUserMessage",value:function(e){var t=this,n=e.reqId,r=e.message,i=e.data,s=e.customType,a=e.metaArrays,o=e.mentionType,l=e.mentionedUserIds,u=e.pushNotificationDeliveryOption,c=e.rootMessageId,d=e.parentMessageId,h=e.translationTargetLanguages,p=e.appleCriticalAlertOptions,f=e.pollId,g=e.silent,y=void 0!==g&&g,m=e.isReplyToChannel,_=e.callback,v=G.get(this._iid),E=v.Command,C=v.UserMessage;n||(n=E.generateRequestId());var b=fn.getInstance(this._iid),S={};Array.isArray(h)&&h.forEach((function(e){return S[e]=""}));var A=C.objectify({messageId:0,reqId:n,user:b.currentUser||{},channel:this,message:r,data:i,customType:s,metaArrays:a,mentionType:o,mentionedUserIds:l,rootMessageId:c,parentMessageId:d,translations:S,silent:y,appleCriticalAlertOptions:p,isReplyToChannel:m,createdAt:(new Date).getTime()}),k=new C(A);if(k.requestState=b.MessageRequestState.PENDING,k.sendingStatus=b.MessageSendingStatus.PENDING,k.requestedMentionUserIds=l,!b.currentUser){var I=new D("Connection should be made first.",D.CONNECTION_REQUIRED),U=new C(A);return U.requestState=b.MessageRequestState.FAILED,U.sendingStatus=b.MessageSendingStatus.FAILED,U.requestedMentionUserIds=l,U.errorCode=I.code,_(I,U),k}var O=E.bMessage({channelUrl:this.url,message:r,data:i,customType:s,metaArrays:a,mentionType:o,mentionedUserIds:l,requestId:n,rootMessageId:c,parentMessageId:d,silent:y,translationTargetLanguages:h,pushNotificationDeliveryOption:u,appleCriticalAlertOptions:p,pollId:f,isReplyToChannel:m});return k.reqId=O.requestId,this.isGroupChannel()&&b.getConnectionState()!==b.ConnectionState.OPEN&&b.currentUser&&!b.connecting&&!b.reconnecting&&"string"==typeof s&&0===s.indexOf("SB_VIDEOCHAT")?L.get(b._iid).container.apiClient.sendUserMessage({channelUrl:this.url,isOpenChannel:this.isOpenChannel(),message:r,data:i,customType:s,translationTargetLanguages:h,metaArrays:a,mentionType:o,mentionedUserIds:l,pushNotificationDeliveryOption:u,rootMessageId:c,parentMessageId:d,appleCriticalAlertOptions:p,pollId:f,isReplyToChannel:m},(function(e,t){var n=null;e?((n=new C(A)).requestState=b.MessageRequestState.FAILED,n.sendingStatus=b.MessageSendingStatus.FAILED,e.code===D.REQUEST_CANCELED&&(n.sendingStatus=b.MessageSendingStatus.CANCELED),n.requestedMentionUserIds=l,n.errorCode=e.code):((n=new C(t)).requestState=b.MessageRequestState.SUCCEEDED,n.sendingStatus=b.MessageSendingStatus.SUCCEEDED),_(e,n)})):b.sendCommand(O,(function(e,n){if(b.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n){var i=new C(A);i.reqId=O.requestId,i.requestState=b.MessageRequestState.FAILED,i.sendingStatus=b.MessageSendingStatus.FAILED,n.code===D.REQUEST_CANCELED&&(i.sendingStatus=b.MessageSendingStatus.CANCELED),i.requestedMentionUserIds=l,i.errorCode=n.code,_(new D(n.message,n.code),i)}else{var s=new C(e.getJsonElement()),a=b.currentUser;a&&s._sender&&a.userId===s._sender.userId&&(a.nickname!==s._sender.nickname&&(a.nickname=s._sender.nickname),a.plainProfileUrl!==s._sender.plainProfileUrl&&(a.plainProfileUrl=s._sender.plainProfileUrl),ee.deepEqual(a.metaData,s._sender.metaData)||(a.metaData=s._sender.metaData)),t.isGroupChannel()&&(t.lastMessage=s,Object.keys(b.channelHandlers).forEach((function(e){b.channelHandlers[e].onChannelChanged(t)}))),s.requestState=b.MessageRequestState.SUCCEEDED,s.sendingStatus=b.MessageSendingStatus.SUCCEEDED,_(null,s)}})),k}},{key:"sendUserMessage",value:function(){var e=ae.toArray(arguments),t=e.pop(),n=null,r=null,i=G.get(this._iid),s=i.UserMessageParams;if("function"==typeof t)if(e[0]instanceof s)null===(r=e[0]).data&&(r.data=""),null===r.customType&&(r.customType="");else if("string"==typeof e[0])switch((r=new s).message=e[0],e.length){case 1:break;case 2:r.data=e[1]||"";break;case 3:r.data=e[1]||"",r.customType=e[2]||"";break;case 4:r.data=e[1]||"",r.customType=e[2]||"",r.translationTargetLanguages=Array.isArray(e[3])?e[3]:[e[3]];break;default:n=ae.error}else n=ae.error;else n=ae.error;var a=L.get(this._iid),o=a.container.isErrorFirstInCallback;return!n&&r._validate()&&r.message?this._sendUserMessage(d(d({},r),{},{metaArrays:r.metaArrays,mentionType:r.mentionType,mentionedUserIds:r._mentionedUserIds,rootMessageId:r.rootMessageId,parentMessageId:r.parentMessageId,translationTargetLanguages:r._translationTargetLanguages,callback:function(e,n){o?t(e,n):t(n,e)}})):(o?t(ae.error,null):t(null,ae.error),null)}},{key:"resendUserMessage",value:function(e,t){var n=this,r=G.get(this._iid),i=r.UserMessage,s=r.UserMessageParams,a=null,o=ae.parse(arguments,[new ae({type:i,constraint:function(e){return 0===e.messageId&&e.isResendable()&&e.reqId&&e.channelUrl===n.url&&"string"==typeof e.message&&"string"==typeof e.data&&"string"==typeof e.customType&&"object"===h(e.translations)&&!Array.isArray(e.translations)}}),new ae({type:"callback"})]),l=U(o,3);return a=l[0],e=l[1],t=l[2],_e(this._iid,(function(t){if(a)a.message+=" Please check if the failed message is resend-able with `message.isResendable().`",t(a,null);else{var r=Object.keys(e.translations),i=s.PushNotificationDeliveryOption.DEFAULT;n._sendUserMessage(d(d({},e),{},{mentionedUserIds:e.requestedMentionUserIds,translationTargetLanguages:r,pushNotificationDeliveryOption:i,reqId:e.reqId,callback:t}))}}),t)}},{key:"updateUserMessage",value:function(e,t,n,r,i){var s=this,a=G.get(this._iid),o=a.Command,l=a.UserMessage,u=a.UserMessageParams,c=arguments,h=null,p=null;if("number"==typeof e)switch(c.length){case 3:var f=ae.parse(c,[new ae({type:"number"}),new ae({type:u}),new ae({type:"callback"})]),g=U(f,4);h=g[0],e=g[1],p=g[2],i=g[3];break;case 5:p=new u;var y=ae.parse(c,[new ae({type:"number"}),new ae({type:"string",nullable:!0}),new ae({type:"string",nullable:!0}),new ae({type:"string",nullable:!0}),new ae({type:"callback"})]),m=U(y,6);h=m[0],e=m[1],t=m[2],n=m[3],r=m[4],i=m[5],p.message=t,p.data=n,p.customType=r}return _e(this._iid,(function(t){if(!h&&p&&p._validate()){var n=o.bUpdateUserMessage(d(d({channelUrl:s.url,messageId:e},p),{},{mentionType:p._mentionType,mentionedUserIds:p._mentionedUserIds})),r=fn.getInstance(s._iid);r.sendCommand(n,(function(e,n){if(r.getErrorFirstCallback()){var i=[e,n];n=i[0],e=i[1]}var s=null;n||(s=new l(e.getJsonElement())),t(n,s)}))}else t(ae.error,null)}),i)}},{key:"translateUserMessage",value:function(e,t,n){var r=this,i=fn.getInstance(this._iid),s=G.get(this._iid),a=s.UserMessage,o=null,l=ae.parse(arguments,[new ae({type:a,constraint:function(e){return e.channelUrl===r.url&&e.sendingStatus===i.MessageSendingStatus.SUCCEEDED}}),new ae({type:"array",constraint:function(e){return e.every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),u=U(l,4);return o=u[0],e=u[1],t=u[2],n=u[3],_e(this._iid,(function(n){o?n(o,null):L.get(r._iid).container.apiClient.translateUserMessage({channelUrl:r.url,isOpenChannel:r.isOpenChannel(),messageId:e.messageId,translationTargetLanguages:t},(function(e,t){var r=null;e||(r=new a(t)),n(e,r)}))}),n)}},{key:"_parseFileMessageArguments",value:function(e){var t=G.get(this._iid),n=t.BaseMessageParams,r=t.FileMessageParams,i={error:null,file:null,name:null,type:null,size:null,data:"",customType:"",thumbnailSizes:[],metaArrays:[],mentionType:n.MentionType.USERS,mentionedUserIds:[],pushNotificationDeliveryOption:r.PushNotificationDeliveryOption.DEFAULT,rootMessageId:null,parentMessageId:null,progressHandler:null,silent:!1,appleCriticalAlertOptions:null,isReplyToChannel:!1,callback:null};if("function"==typeof e[e.length-1]&&(i.callback=e.pop()),"function"==typeof e[e.length-1]&&(i.progressHandler=e.pop()),e[0]instanceof r)i.file=e[0].file||e[0].fileUrl,i.name=e[0].fileName,i.type=e[0].mimeType,i.size=e[0].fileSize,i.data=e[0].data,i.customType=e[0].customType,i.thumbnailSizes=e[0].thumbnailSizes,i.metaArrays=e[0].metaArrays,i.mentionType=e[0]._mentionType,i.mentionedUserIds=e[0]._mentionedUserIds,i.pushNotificationDeliveryOption=e[0].pushNotificationDeliveryOption?e[0].pushNotificationDeliveryOption:r.PushNotificationDeliveryOption.DEFAULT,i.rootMessageId=e[0].rootMessageId,i.parentMessageId=e[0].parentMessageId,i.silent=e[0].silent,e[0]._validate()||(i.error=ae.error),i.appleCriticalAlertOptions=e[0].appleCriticalAlertOptions,i.isReplyToChannel=e[0].isReplyToChannel;else if(ee.isFile(e[0])||"string"==typeof e[0]){switch(i.file=e[0],e.length){case 1:break;case 2:i.data=e[1];break;case 3:i.data=e[1],i.customType=e[2];break;case 4:i.data=e[1],i.customType=e[2],i.thumbnailSizes=e[3];break;case 5:i.name=e[1],i.type=e[2],i.size=e[3],i.data=e[4];break;case 6:i.name=e[1],i.type=e[2],i.size=e[3],i.data=e[4],i.customType=e[5];break;case 7:i.name=e[1],i.type=e[2],i.size=e[3],i.data=e[4],i.customType=e[5],i.thumbnailSizes=e[6]}var s=U(ae.parse([i.file,i.name,i.type,i.size,i.data,i.customType,i.thumbnailSizes],[new ae({type:["file","string"]}),new ae({type:"string",nullable:!0}),new ae({type:"string",nullable:!0}),new ae({type:"number",nullable:!0,constraint:function(e){return e>=0}}),new ae({type:"string",nullable:!0}),new ae({type:"string",nullable:!0}),new ae({type:"array"})]),8);i.error=s[0],i.file=s[1],i.name=s[2],i.type=s[3],i.size=s[4],i.data=s[5],i.customType=s[6],i.thumbnailSizes=s[7]}else i.error=ae.error;return ee.isFile(i.file)&&(i.name=i.name||i.file.name,i.type=i.type||i.file.type,i.size=i.size||i.file.size),i}},{key:"_createTempFileMessage",value:function(e){try{var t=fn.getInstance(this._iid),n=G.get(this._iid),r=n.Command,i=n.FileMessage,s=i.objectify(d(d({},e),{},{messageId:0,reqId:r.generateRequestId(),user:t.currentUser||{},channel:this,plainUrl:"string"==typeof e.file?e.file:"",thumbnails:e.thumbnailSizes.map((function(e){return{url:"",plainUrl:"",width:e.maxWidth,height:e.maxHeight,real_width:0,real_height:0}})),sendingStatus:t.MessageSendingStatus.PENDING,createdAt:(new Date).getTime()}));return new i(s)}catch(e){return null}}},{key:"sendFileMessage",value:function(){var e=this._parseFileMessageArguments(ae.toArray(arguments)),t=G.get(this._iid),n=t.Command,r=null,i=n.generateRequestId();e.error||((r=this._createTempFileMessage(e)).requestedMentionUserIds=e.mentionedUserIds,i=r.reqId);var s=fn.getInstance(this._iid);s&&s.currentUser||(e.error=new D("Connection should be made first.",D.CONNECTION_REQUIRED));var a=G.get(this._iid),o=a.FileMessageQueue,l=o.create(this);return l.addJob(new o.Job({fileInfo:e,pendingMessage:r,requestId:i,error:e.error,response:null})),r}},{key:"sendFileMessages",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.progress?n.progress:function(){},i=n.sent?n.sent:function(){},s=n.complete?n.complete:function(){};if(Array.isArray(e)&&e.length>0&&e.length<=20){var a=[];return e.forEach((function(n,o){a.push(t.sendFileMessage(n,r,(function(t,n){i(t,n),o===e.length-1&&s(null)})))})),a}return s(ae.error),null}},{key:"resendFileMessage",value:function(e,t,n){var r=this,i=G.get(this._iid),s=i.FileMessage,a=i.FileMessageParams,o=null,l=ae.parse(arguments,[new ae({type:s,constraint:function(e){return 0===e.messageId&&e.isResendable()&&e.reqId&&e.channelUrl===r.url&&"string"==typeof e.data&&"string"==typeof e.customType&&Array.isArray(e.thumbnails)}}),new ae({type:"file",optionalIf:function(e){return!!e[0].url},defaultValue:null}),new ae({type:"callback"})]),u=U(l,4);return o=u[0],e=u[1],t=u[2],n=u[3],_e(this._iid,(function(n){if(o)o.message+=" Please check if the failed message is resend-able with `message.isResendable().`",n(o,null);else{var i=new a;e.url?i.fileUrl=e.url:i.file=t,i.fileName=e.name,i.fileSize=e.size,i.mimeType=e.type,i.data=e.data,i.customType=e.customType,i.mentionType=e.mentionType,i.mentionedUserIds=e.requestedMentionUserIds,i.metaArrays=e.metaArrays,i.thumbnailSizes=e.thumbnails.map((function(e){return{maxWidth:e.width,maxHeight:e.height}})),i.appleCriticalAlertOptions=e.appleCriticalAlertOptions,r.sendFileMessage(i,n)}}),n)}},{key:"updateFileMessage",value:function(e,t,n,r){var i=this,s=G.get(this._iid),a=s.Command,o=s.FileMessage,l=s.FileMessageParams,u=arguments,c=null,h=null;if("number"==typeof e)switch(u.length){case 3:var p=ae.parse(u,[new ae({type:"number"}),new ae({type:l}),new ae({type:"callback"})]),f=U(p,4);c=f[0],e=f[1],h=f[2],r=f[3],h&&(h._isUpdate=!0);break;case 4:h=new l;var g=ae.parse(u,[new ae({type:"number"}),new ae({type:"string",nullable:!0}),new ae({type:"string",nullable:!0}),new ae({type:"callback"})]),y=U(g,5);c=y[0],e=y[1],t=y[2],n=y[3],r=y[4],h.data=t,h.customType=n,h._isUpdate=!0}return _e(this._iid,(function(t){if(!c&&h&&h._validate()){var n=a.bUpdateFileMessage(d(d({channelUrl:i.url,messageId:e},h),{},{mentionType:h._mentionType,mentionedUserIds:h._mentionedUserIds})),r=fn.getInstance(i._iid);r.sendCommand(n,(function(e,n){if(r.getErrorFirstCallback()){var i=[e,n];n=i[0],e=i[1]}var s=null;n||(s=new o(e.getJsonElement())),t(n,s)}))}else t(ae.error,null)}),r)}},{key:"cancelUploadingFileMessage",value:function(e,t){var n=null,r=ae.parse(arguments,[new ae({type:["number","string"]}),new ae({type:"callback"})]),i=U(r,3);n=i[0],e=i[1],t=i[2];var s=L.get(this._iid),a=s.container.isErrorFirstInCallback;if(n)return a?t(n,null):t(null,n),!1;var o=G.get(this._iid),l=o.FileMessageQueue,u=l.create(this);return u.cancelUploadItemByRequestId(e,(function(e,n){return a?t(e,n):t(n,e)}))}},{key:"addReaction",value:function(e,t,n){var r=this,i=fn.getInstance(this._iid),s=G.get(this._iid),a=s.ReactionEvent,o=null,l=ae.parse(arguments,[new ae({type:Ce}),new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"callback"})]),u=U(l,4);return o=u[0],e=u[1],t=u[2],n=u[3],_e(this._iid,(function(n){o?n(o,null):e.sendingStatus===i.MessageSendingStatus.SUCCEEDED?L.get(r._iid).container.apiClient.addReaction({isGroupChannel:e.isGroupChannel(),channelUrl:e.channelUrl,messageId:e.messageId,key:t},(function(t,r){var i=null;t||(i=a.createFromJson(d(d({},r),{},{msg_id:e.messageId}))),n(t,i)})):n(new D("Cannot add reaction to a non-succeeded message.",D.REQUEST_FAILED),null)}),n)}},{key:"deleteReaction",value:function(e,t,n){var r=this,i=fn.getInstance(this._iid),s=G.get(this._iid),a=s.ReactionEvent,o=null,l=ae.parse(arguments,[new ae({type:Ce}),new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"callback"})]),u=U(l,4);return o=u[0],e=u[1],t=u[2],n=u[3],_e(this._iid,(function(n){o?n(o,null):e.sendingStatus===i.MessageSendingStatus.SUCCEEDED?L.get(r._iid).container.apiClient.deleteReaction({isGroupChannel:e.isGroupChannel(),channelUrl:e.channelUrl,messageId:e.messageId,key:t},(function(t,r){var i=null;t||(i=a.createFromJson(d(d({},r),{},{msg_id:e.messageId}))),n(t,i)})):n(new D("Cannot remove reaction to a non-succeeded message.",D.REQUEST_FAILED),null)}),n)}},{key:"deleteMessage",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return!Array.isArray(e)&&null!==e&&e.hasOwnProperty("messageId")}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.deleteMessage({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),messageId:e.messageId},(function(e,n){return t(e,null)}))}),t)}},{key:"copyUserMessage",value:function(t,n,r){var i=G.get(this._iid);i.Command;var s=i.UserMessage,a=i.BaseMessageParams,o=null,l=ae.parse(arguments,[new ae({type:e}),new ae({type:s}),new ae({type:"callback"})]),u=U(l,4);o=u[0],t=u[1],n=u[2],r=u[3];var c=L.get(this._iid),h=c.container.isErrorFirstInCallback;if(o)return h?r(ae.error,null):r(null,ae.error),null;if(this.url!==n.channelUrl){var p=new D("The message does not belong to this channel",D.INVALID_PARAMETER);return h?r(p,null):r(null,p),null}var f={},g=Object.keys(n.translations);g.forEach((function(e){return f[e]=""}));var y=a.PushNotificationDeliveryOption.DEFAULT;return t._sendUserMessage(d(d({},n),{},{reqId:null,pushNotificationDeliveryOption:y,translationTargetLanguages:g,rootMessageId:null,parentMessageId:null,parentMessageText:null,callback:r}))}},{key:"copyFileMessage",value:function(t,n,r){var i=G.get(this._iid),s=i.Command;i.GroupChannel;var a=i.FileMessage,o=i.BaseMessageParams;i.FileMessageParams;var l=i.User,u=null,c=ae.parse(arguments,[new ae({type:e}),new ae({type:a}),new ae({type:"callback"})]),d=U(c,4);u=d[0],t=d[1],n=d[2],r=d[3];var h=L.get(this._iid),p=h.container.isErrorFirstInCallback;if(u)return p?r(ae.error,null):r(null,ae.error),null;if(this.url!==n.channelUrl){var f=new D("The message does not belong to this channel");return p?r(f,null):r(null,f),null}var g=fn.getInstance(this._iid),y=n,m=y.url,_=y.name,v=y.type,E=y.size,C=y.data,b=y.customType,S=y.mentionType,A=y.mentionedUserIds,k=y.mentionedUsers,I=y.metaArrays,O=y.thumbnails,T=y.requireAuth,R=y.messageSurvivalSeconds,N=y.silent,w=y.appleCriticalAlertOptions,M=s.generateRequestId(),P=g.currentUser||{},H=t.url,F=t.isOpenChannel(),x=k.filter((function(e){return new l(l.objectify(e))})),j=o.PushNotificationDeliveryOption.DEFAULT,B=a.objectify({messageId:0,reqId:M,user:P,channel:t,plainUrl:m,name:_,type:v,size:E,data:C,customType:b,mentionType:S,mentionedUserIds:A,mentionedUsers:x,requestedMentionUserIds:A,metaArrays:I,thumbnails:O,requireAuth:T,messageSurvivalSeconds:R,silent:N,createdAt:(new Date).getTime(),appleCriticalAlertOptions:w}),q=new a(B);if(q.requestState=g.MessageRequestState.PENDING,q.sendingStatus=g.MessageSendingStatus.PENDING,!g.currentUser){var z=new D("Connection should be made first.",D.CONNECTION_REQUIRED),Y=new a(B);return Y.requestState=g.MessageRequestState.FAILED,Y.sendingStatus=g.MessageSendingStatus.FAILED,Y.errorCode=z.code,p?r(z,Y):r(Y,z),q}var K=s.bFile({requestId:M,channelUrl:H,url:m,name:_,type:v,size:E,data:C,customType:b,metaArrays:I,mentionType:S,mentionedUserIds:A,thumbnailSizes:O,requireAuth:T,pushNotificationDeliveryOption:j,silent:N,appleCriticalAlertOptions:w});return g.getConnectionState()===g.ConnectionState.OPEN||g.connecting||g.reconnecting?g.sendCommand(K,(function(e,n){if(g.getErrorFirstCallback()){var i=[e,n];n=i[0],e=i[1]}if(n)if(n.code!==D.INVALID_PARAMETER){var s=new a(B);s.requestState=g.MessageRequestState.FAILED,s.sendingStatus=g.MessageSendingStatus.FAILED,n.code!==D.FILE_UPLOAD_CANCEL_FAILED&&n.code!==D.REQUEST_CANCELED||(s.sendingStatus=g.MessageSendingStatus.CANCELED),s.errorCode=n.code,p?r(n,s):r(s,n)}else p?r(n,null):r(null,n);else{var o=new a(e.getJsonElement()),l=o._sender;P&&l&&P.userId===l.userId&&(P.nickname!==l.nickname&&(P.nickname=l.nickname),P.plainProfileUrl!==l.plainProfileUrl&&(P.plainProfileUrl=l.plainProfileUrl)),t.isGroupChannel()&&(t.lastMessage=o,Object.keys(g.channelHandlers).forEach((function(e){g.channelHandlers[e].onChannelChanged(t)}))),p?r(null,o):r(o,null)}})):h.container.apiClient.sendFileMessage({channelUrl:H,isOpenChannel:F,fileUrl:m,fileName:_,fileType:v,fileSize:E,data:C,customType:b,metaArrays:I,mentionType:S,mentionedUserIds:A,thumbnailSizes:O,requireAuth:T,pushNotificationDeliveryOption:j,appleCriticalAlertOptions:w},(function(e,n){if(e)if(e.code!==D.INVALID_PARAMETER){var i=new a(commnad.getJsonElement());i.requestState=g.MessageRequestState.FAILED,i.sendingStatus=g.MessageSendingStatus.FAILED,e.code!==D.FILE_UPLOAD_CANCEL_FAILED&&e.code!==D.REQUEST_CANCELED||(i.sendingStatus=g.MessageSendingStatus.CANCELED),i.errorCode=e.code,p?r(e,i):r(i,e)}else p?r(e,null):r(null,e);else{var s=new a(n),o=s._sender;P&&o&&P.userId===o.userId&&(P.nickname!==o.nickname&&(P.nickname=o.nickname),P.plainProfileUrl!==o.plainProfileUrl&&(P.plainProfileUrl=o.plainProfileUrl)),t.isGroupChannel()&&(t.lastMessage=s,Object.keys(g.channelHandlers).forEach((function(e){g.channelHandlers[e].onChannelChanged(t)}))),p?r(null,s):r(s,null)}})),q}},{key:"addOperators",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return Object.keys(e).map((function(t){return e[t]})).every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.addOperators({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),operatorUserIds:e},(function(e,n){return t(e,n)}))}),t)}},{key:"removeOperators",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return Object.keys(e).map((function(t){return e[t]})).every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.removeOperators({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),operatorUserIds:e},(function(e,n){return t(e,n)}))}),t)}},{key:"getMetaCounters",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return Object.keys(e).map((function(t){return e[t]})).every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.getMetaCounters({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),keys:e},(function(e,n){return t(e,n)}))}),t)}},{key:"getAllMetaCounters",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getMetaCounters({channelUrl:t.url,isOpenChannel:t.isOpenChannel(),keys:[]},(function(t,n){return e(t,n)}))}),e)}},{key:"createMetaCounters",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return e&&!Array.isArray(e)&&Object.keys(e).length>0&&Object.keys(e).map((function(t){return e[t]})).every((function(e){return"number"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.createMetaCounters({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),metaCounter:e},(function(e,n){return t(e,n)}))}),t)}},{key:"updateMetaCounters",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return e&&!Array.isArray(e)&&Object.keys(e).length>0&&Object.keys(e).map((function(t){return e[t]})).every((function(e){return"number"==typeof e}))}}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.updateMetaCounters({channelUrl:r.url,isOpenChannel:r.isOpenChannel(),metaCounter:e,upsert:t,mode:"set"},(function(e,t){return n(e,t)}))}),n)}},{key:"increaseMetaCounters",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return e&&!Array.isArray(e)&&Object.keys(e).length>0&&Object.keys(e).map((function(t){return e[t]})).every((function(e){return"number"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.updateMetaCounters({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),metaCounter:e,upsert:!1,mode:"increase"},(function(e,n){return t(e,n)}))}),t)}},{key:"decreaseMetaCounters",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return e&&!Array.isArray(e)&&Object.keys(e).length>0&&Object.keys(e).map((function(t){return e[t]})).every((function(e){return"number"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.updateMetaCounters({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),metaCounter:e,upsert:!1,mode:"decrease"},(function(e,n){var r=null;e||(r={},Object.keys(n).forEach((function(e){r[e]=n[e]}))),t(e,r)}))}),t)}},{key:"deleteMetaCounter",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.deleteMetaCounter({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),key:e},(function(e,n){return t(e,n)}))}),t)}},{key:"deleteAllMetaCounters",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.deleteAllMetaCounters({channelUrl:t.url,isOpenChannel:t.isOpenChannel()},(function(t,n){return e(t,n)}))}),e)}},{key:"getCachedMetaData",value:function(){var e=Ae.get(this),t={};return Object.keys(e).forEach((function(n){var r=e[n];r.isRemoved||(t[n]=r.value)})),t}},{key:"getMetaData",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return Object.keys(e).map((function(t){return e[t]})).every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.getMetaData({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),keys:e},(function(e,n){t(e,n&&n.ts?n.metadata:n)}))}),t)}},{key:"getAllMetaData",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getMetaData({channelUrl:t.url,isOpenChannel:t.isOpenChannel(),keys:[]},(function(t,n){e(t,n&&n.ts?n.metadata:n)}))}),e)}},{key:"createMetaData",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return e&&!Array.isArray(e)&&Object.keys(e).length>0}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.createMetaData({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),metaData:e},(function(e,n){t(e,n&&n.ts?n.metadata:n)}))}),t)}},{key:"updateMetaData",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return e&&!Array.isArray(e)&&Object.keys(e).length>0}}),new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.updateMetaData({channelUrl:r.url,isOpenChannel:r.isOpenChannel(),metaData:e,upsert:t},(function(e,t){n(e,t&&t.ts?t.metadata:t)}))}),n)}},{key:"deleteMetaData",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.deleteMetaData({channelUrl:n.url,isOpenChannel:n.isOpenChannel(),key:e},(function(e,n){t(e,n&&n.ts?{}:n)}))}),t)}},{key:"deleteAllMetaData",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.deleteAllMetaData({channelUrl:t.url,isOpenChannel:t.isOpenChannel()},(function(t,n){return e(t,n&&n.ts?{}:n)}))}),e)}},{key:"_updateMessageMetaArray",value:function(e,t,n,r){var i=this;return _e(this._iid,(function(r){var s=G.get(i._iid),a=s.Command,o=s.UserMessage,l=s.FileMessage,u=s.AdminMessage,c=null;if(t.isUserMessage()?c=a.bUpdateUserMessage({channelUrl:e,messageId:t.messageId,metaArrayParams:n}):t.isFileMessage()&&(c=a.bUpdateFileMessage({channelUrl:e,messageId:t.messageId,metaArrayParams:n})),c){var d=fn.getInstance(i._iid);d.sendCommand(c,(function(e,n){if(d.getErrorFirstCallback()){var i=[e,n];n=i[0],e=i[1]}var s=null;n||(t.isUserMessage()?s=new o(e.getJsonElement()):t.isFileMessage()?s=new l(e.getJsonElement()):t.isAdminMessage()&&(s=new u(e.getJsonElement()))),r(n,s)}))}else r(ae.error,null)}),r)}},{key:"createMessageMetaArrayKeys",value:function(e,t,n){var r=G.get(this._iid),i=r.MessageMetaArray,s=null,a=ae.parse(arguments,[new ae({type:Ce}),new ae({type:"array",constraint:function(e){return e.every((function(e){return"string"==typeof e&&""!==e}))}}),new ae({type:"callback"})]),o=U(a,4);if(s=o[0],e=o[1],t=o[2],n=o[3],s)return _e(this._iid,(function(e){e(s,null)}),n);var l=[];if(Array.isArray(t))for(var u=0;u<t.length;u++){var c=t[u];l.push(new i(c,[]))}return this._updateMessageMetaArray(this.url,e,{array:l.map((function(e){return e.encode()})),mode:"add",upsert:!0},n)}},{key:"deleteMessageMetaArrayKeys",value:function(e,t,n){var r=G.get(this._iid),i=r.MessageMetaArray,s=null,a=ae.parse(arguments,[new ae({type:Ce}),new ae({type:"array",constraint:function(e){return e.every((function(e){return"string"==typeof e&&""!==e}))}}),new ae({type:"callback"})]),o=U(a,4);if(s=o[0],e=o[1],t=o[2],n=o[3],s)return _e(this._iid,(function(e){e(s,null)}),n);var l=[];if(Array.isArray(t))for(var u=0;u<t.length;u++){var c=t[u];l.push(new i(c,[]))}return this._updateMessageMetaArray(this.url,e,{array:l.map((function(e){return e.encode()})),mode:"remove",upsert:!0},n)}},{key:"addMessageMetaArrayValues",value:function(e,t,n){var r=G.get(this._iid),i=r.MessageMetaArray,s=null,a=ae.parse(arguments,[new ae({type:Ce}),new ae({type:"object",constraint:function(e){return e&&(Array.isArray(e)&&e.length>0&&e.every((function(e){return e instanceof i}))||Object.keys(e).length>0&&Object.keys(e).every((function(t){return Array.isArray(e[t])&&e[t].length>0&&e[t].every((function(e){return"string"==typeof e&&e.length>0}))})))}}),new ae({type:"callback"})]),o=U(a,4);if(s=o[0],e=o[1],t=o[2],n=o[3],s)return _e(this._iid,(function(e){e(s,null)}),n);var l=Array.isArray(t)?t.map((function(e){return e.encode()})):Object.keys(t).map((function(e){return{key:e,value:t[e]}}));return this._updateMessageMetaArray(this.url,e,{array:l,mode:"add",upsert:!0},n)}},{key:"removeMessageMetaArrayValues",value:function(e,t,n){var r=G.get(this._iid),i=r.MessageMetaArray,s=null,a=ae.parse(arguments,[new ae({type:Ce}),new ae({type:"object",constraint:function(e){return e&&(Array.isArray(e)&&e.length>0&&e.every((function(e){return e instanceof i}))||Object.keys(e).length>0&&Object.keys(e).every((function(t){return Array.isArray(e[t])&&e[t].length>0&&e[t].every((function(e){return"string"==typeof e&&e.length>0}))})))}}),new ae({type:"callback"})]),o=U(a,4);if(s=o[0],e=o[1],t=o[2],n=o[3],s)return _e(this._iid,(function(e){e(s,null)}),n);var l=Array.isArray(t)?t.map((function(e){return e.encode()})):Object.keys(t).map((function(e){return{key:e,value:t[e]}}));return this._updateMessageMetaArray(this.url,e,{array:l,mode:"remove",upsert:!0},n)}},{key:"report",value:function(e,t,n){var r=this,i=G.get(this._iid),s=i.BaseChannel,a=null,o=ae.parse(arguments,[new ae({type:s.ReportCategory}),new ae({type:"string"}),new ae({type:"callback"})]),l=U(o,4);return a=l[0],e=l[1],t=l[2],n=l[3],_e(this._iid,(function(n){if(a)n(a,null);else{var i=fn.getInstance(r._iid);L.get(r._iid).container.apiClient.report({channelUrl:r.url,isOpenChannel:r.isOpenChannel(),reportCategory:e,reportingUserId:i.currentUser?i.currentUser.userId:null,reportDescription:t},(function(e,t){n(e,null)}))}}),n)}},{key:"reportUser",value:function(e,t,n,r){var i=this,s=G.get(this._iid),a=s.BaseChannel,o=null,l=ae.parse(arguments,[new ae({type:be}),new ae({type:a.ReportCategory}),new ae({type:"string"}),new ae({type:"callback"})]),u=U(l,5);return o=u[0],e=u[1],t=u[2],n=u[3],r=u[4],_e(this._iid,(function(r){if(o)r(o,null);else{var s=fn.getInstance(i._iid);L.get(i._iid).container.apiClient.reportUser({channelUrl:i.url,isOpenChannel:i.isOpenChannel(),reportCategory:t,offendingUserId:e.userId,reportingUserId:s.currentUser?s.currentUser.userId:null,reportDescription:n},(function(e,t){r(e,null)}))}}),r)}},{key:"reportMessage",value:function(e,t,n,r){var i=this,s=G.get(this._iid),a=s.BaseChannel,o=null,l=ae.parse(arguments,[new ae({type:Ce}),new ae({type:a.ReportCategory}),new ae({type:"string"}),new ae({type:"callback"})]),u=U(l,5);return o=u[0],e=u[1],t=u[2],n=u[3],r=u[4],_e(this._iid,(function(r){if(o)r(o,null);else{var s=fn.getInstance(i._iid);L.get(i._iid).container.apiClient.reportMessage({messageId:e.messageId,channelUrl:i.url,isOpenChannel:i.isOpenChannel(),reportCategory:t,offendingUserId:e.sender.userId,reportingUserId:s.currentUser?s.currentUser.userId:null,reportDescription:n},(function(e,t){r(e,null)}))}}),r)}}],[{key:"CHANNEL_TYPE_OPEN",get:function(){return"open"}},{key:"CHANNEL_TYPE_GROUP",get:function(){return"group"}},{key:"CHANNEL_TYPE_BASE",get:function(){return"base"}},{key:"MessageTypeFilter",get:function(){return{ALL:"",USER:"MESG",FILE:"FILE",ADMIN:"ADMM"}}},{key:"ReportCategory",get:function(){return{SPAM:"spam",HARASSING:"harassing",SUSPICIOUS:"suspicious",INAPPROPRIATE:"inappropriate"}}},{key:"buildMessage",value:function(e,t){var n=G.get(this._iid),r=n.UserMessage,i=n.FileMessage,s=n.AdminMessage;if(e)switch(e.hasOwnProperty("channel_type")||(e.channel_type=t.channelType),e.type){case"MESG":return new r(e);case"FILE":var a=e.file;return new i(d(d({},e),{},{url:String(a.url),name:String(a.name),type:String(a.type),size:parseInt(a.size),data:String(a.data)}));case"BRDM":case"ADMM":return new s(e)}return null}}]),e}(),Ie=function(){function e(t){p(this,e),t&&(this.category=t.hasOwnProperty("cat")?parseInt(t.cat):0,this.data=t.hasOwnProperty("data")?t.data:null,this.channelUrl=t.hasOwnProperty("channel_url")?String(t.channel_url):"",this.channelType=t.hasOwnProperty("channel_type")?String(t.channel_type):ke.CHANNEL_TYPE_GROUP)}return g(e,[{key:"isGroupChannel",value:function(){return this.channelType===ke.CHANNEL_TYPE_GROUP}},{key:"isOpenChannel",value:function(){return this.channelType===ke.CHANNEL_TYPE_OPEN}}]),e}();Ie.CATEGORY_NONE=0,Ie.CATEGORY_CHANNEL_ENTER=10102,Ie.CATEGORY_CHANNEL_EXIT=10103,Ie.CATEGORY_USER_CHANNEL_MUTE=10201,Ie.CATEGORY_USER_CHANNEL_UNMUTE=10200,Ie.CATEGORY_USER_CHANNEL_BAN=10601,Ie.CATEGORY_USER_CHANNEL_UNBAN=10600,Ie.CATEGORY_CHANNEL_FREEZE=10701,Ie.CATEGORY_CHANNEL_UNFREEZE=10700,Ie.CATEGORY_TYPING_START=10900,Ie.CATEGORY_TYPING_END=10901,Ie.CATEGORY_CHANNEL_JOIN=1e4,Ie.CATEGORY_CHANNEL_LEAVE=10001,Ie.CATEGORY_CHANNEL_OPERATOR_UPDATE=10002,Ie.CATEGORY_CHANNEL_INVITE=10020,Ie.CATEGORY_CHANNEL_DECLINE_INVITE=10022,Ie.CATEGORY_CHANNEL_PROP_CHANGED=11e3,Ie.CATEGORY_CHANNEL_DELETED=12e3,Ie.CATEGORY_CHANNEL_META_DATA_CHANGED=11100,Ie.CATEGORY_CHANNEL_META_COUNTERS_CHANGED=11200,Ie.CATEGORY_CHANNEL_HIDE=13e3,Ie.CATEGORY_CHANNEL_UNHIDE=13001;var Ue=function e(t){p(this,e),t&&(this.category=t.hasOwnProperty("cat")?parseInt(t.cat):0)};Ue.CATEGORY_USER_BLOCK=20001,Ue.CATEGORY_USER_UNBLOCK=2e4,Ue.CATEGORY_FRIEND_DISCOVERED=20900;var Oe=function(){function e(t){p(this,e),this.sb=t,this.cls=G.get(this.sb._iid)}return g(e,[{key:"onRawCommandReceived",value:function(e){var t=this,n=this.cls,r=n.Command,i=n.User,s=n.Member,a=n.RestrictedUser,o=n.BaseChannel,l=n.GroupChannel,u=n.OpenChannel,c=n.UserMessage,p=n.FileMessage,f=n.AdminMessage,g=n.BaseMessageParams,y=n.ReactionEvent,m=n.ReadStatus,_=n.ThreadInfoUpdateEvent,v=n.PollUpdateEvent,E=n.PollVoteEvent,C=n.RestrictionInfo,b=L.get(this.sb._iid),S=b.container,A=S.pinger,k=S.auth,I=S.subscribedUnreadMessageCount,U=S.sessionManager,O=S.ackStateMap,T=new r(e),R=T.getJsonElement();if(R.hasOwnProperty("unread_cnt")&&"object"===h(R.unread_cnt)){var M=!1,P=R.unread_cnt.ts;"number"==typeof P&&P>I.ts&&(I.all!==R.unread_cnt.all&&(M=!0),I.all=R.unread_cnt.all>=0?R.unread_cnt.all:0,R.unread_cnt.custom_types&&Object.keys(R.unread_cnt.custom_types).forEach((function(e){I.custom_types[e]!==R.unread_cnt.custom_types[e]&&(M=!0),I.custom_types[e]=R.unread_cnt.custom_types[e]})),M=M&&I.ts>0,I.ts=P),M&&Object.keys(this.sb.userEventHandlers).forEach((function(e){t.sb.userEventHandlers[e].onTotalUnreadMessageCountUpdated(I.all,I.custom_types)}))}var H=T.requestId;if(H){var F=O[H];if(F){clearTimeout(F.timer);var G=F.handler;G&&("EROR"===T.command?G(new D(R.message,R.code),null):G(null,T)),O.hasOwnProperty(H)&&delete O[H]}}else switch(A&&"LOGI"!==T.command&&A.refreshTimer(),T.command){case"LOGI":this.sb.loginTimer&&(clearTimeout(this.sb.loginTimer),this.sb.loginTimer=null,this.sb.onLoginTimerCancel=null,R.hasOwnProperty("error")?(this.sb.isSessionOpened=!1,this.sb.loginHandler(new D(R.message,R.code),null)):(this.sb.isSessionOpened=!0,R.hasOwnProperty("key")&&(k.sessionKey=R.key),R.hasOwnProperty("ekey")&&(k.eKey=R.ekey),R.hasOwnProperty("user_id")&&(this.sb.currentUser=new i(R)),"number"==typeof R.ping_interval&&R.ping_interval>0&&b.set("pingInterval",1e3*R.ping_interval),"number"==typeof R.pong_timeout&&R.pong_timeout>0&&b.set("pongTimeout",1e3*R.pong_timeout),"number"==typeof R.login_ts&&b.set("connectedAt",1e3*R.login_ts),"number"==typeof R.max_unread_cnt_on_super_group?b.set("maxUnreadCountOfSuperGroupChannel",R.max_unread_cnt_on_super_group):b.set("maxUnreadCountOfSuperGroupChannel",w.DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL),R.profile_image_encryption&&b.set("profileImageEncryption",!0),A&&A.start(),R.hasOwnProperty("file_upload_size_limit")&&R.hasOwnProperty("premium_feature_list")&&R.hasOwnProperty("emoji_hash")&&b.set("appInfo",new fe(R)),this.sb.loginHandler(null,this.sb.currentUser)));break;case"EXPR":var x=new D("The session would be expired.",R.reason||D.SESSION_KEY_EXPIRED);U.refreshSessionIfExpiredError(x).then((function(){})).catch((function(){}));break;case"MESG":case"FILE":case"BRDM":case"ADMM":var j=null;if("MESG"===T.command?j=new c(R):"FILE"===T.command?j=new p(R):"BRDM"!==T.command&&"ADMM"!==T.command||(j=new f(R)),j){var B=this.sb.currentUser?this.sb.currentUser.userId:null,q=j.silent,z=!!R.force_update_last_message,Y=j._sender&&j._sender.userId===B;if(j.isGroupChannel()){var K=l.cachedChannels.hasOwnProperty(j.channelUrl);l.getChannel(j.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var i=[e,n];n=i[0],e=i[1]}if(!n){if(!b.container.appInfo.isSupergroupMackDisabled||!e.isSuper||e.isBroadcast){var s=r.bMessageAck({channelUrl:j.channelUrl,messageId:j.messageId});t.sb.sendCommand(s)}if(e.isHidden=!1,e.hiddenState=l.HiddenState.UNHIDDEN,l.cachedChannels[e.url]=e,j._sender&&e.memberMap.hasOwnProperty(j._sender.userId)){var a=e.memberMap[j._sender.userId];a.nickname!==j._sender.nickname&&(a.nickname=j._sender.nickname),a.plainProfileUrl!==j._sender.plainProfileUrl&&(a.plainProfileUrl=j._sender.plainProfileUrl),ee.deepEqual(a.metaData,j._sender.metaData)||(a.metaData=j._sender.metaData),a.isBlockedByMe!==j._sender.isBlockedByMe&&(a.isBlockedByMe=j._sender.isBlockedByMe)}var o=t.sb.currentUser;o&&Y&&(o.nickname!==j._sender.nickname&&(o.nickname=j._sender.nickname),o.plainProfileUrl!==j._sender.plainProfileUrl&&(o.plainProfileUrl=j._sender.plainProfileUrl),ee.deepEqual(o.metaData,j._sender.metaData)||(o.metaData=j._sender.metaData));var u=!1;if(j.mentionType===g.MentionType.CHANNEL)Y||(u=!0);else if(j.mentionType===g.MentionType.USERS)for(var c=0;c<j.mentionedUsers.length;c++)if(!Y&&j.mentionedUsers[c].userId===B){u=!0;break}q&&!Y||(e.isEphemeral||K)&&((!e.lastMessage||e.lastMessage.createdAt<j.createdAt)&&(e.lastMessage=j),Y||e._setGroupChannelUnreadCount(e.unreadMessageCount+1,e.unreadMentionCount+(u?1:0))),z&&(!e.lastMessage||e.lastMessage.createdAt<j.createdAt)&&(e.lastMessage=j),q&&!Y||Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelChanged(e)})),Object.keys(t.sb.channelHandlers).forEach((function(n){var r=t.sb.channelHandlers[n];r.onMessageReceived(e,j),u&&r.onMentionReceived(e,j)}))}}))}else j.isOpenChannel()&&u.getChannel(j.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(!n){var i=!1;if(j.mentionType===g.MentionType.CHANNEL)i=!0;else if(j.mentionType===g.MentionType.USERS)for(var s=0;s<j.mentionedUsers.length;s++)if(j.mentionedUsers[s].userId===B){i=!0;break}Object.keys(t.sb.channelHandlers).forEach((function(n){var r=t.sb.channelHandlers[n];u.enteredChannels[e.url]&&r.onMessageReceived(e,j),i&&r.onMentionReceived(e,j)}))}}))}break;case"MEDI":case"FEDI":case"AEDI":var V=null;if("MEDI"===T.command?V=new c(R):"FEDI"===T.command?V=new p(R):"AEDI"===T.command&&(V=new f(R)),V){var Q=this.sb.currentUser?this.sb.currentUser.userId:null,J=V.silent,X=V.sender&&V.sender.userId===Q;if(V.isGroupChannel()){var $=l.cachedChannels.hasOwnProperty(V.channelUrl);l.getChannel(V.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(!n){var i=e.cachedReadReceiptStatus[Q],s=i&&i>=V.createAt,a=t.sb.currentUser;a&&X&&(a.nickname!==V._sender.nickname&&(a.nickname=V._sender.nickname),a.plainProfileUrl!==V._sender.plainProfileUrl&&(a.plainProfileUrl=V._sender.plainProfileUrl),ee.deepEqual(a.metaData,V._sender.metaData)||(a.metaData=V._sender.metaData));var o=!1,l=!1;if(!X&&!s&&R&&R.hasOwnProperty("old_values")){var u=R.old_values.mention_type||V.mentionType,c=R.old_values.mentioned_user_ids||V.mentionedUsers.map((function(e){return e.userId}));if(u===g.MentionType.USERS&&V.mentionType===g.MentionType.USERS){for(var d=!1,h=!1,p=0;p<c.length;p++)if(c[p]===Q){d=!0;break}for(var f=0;f<V.mentionedUsers.length;f++)if(V.mentionedUsers[f].userId===Q){h=!0;break}!d&&h&&(l=!0,!J&&$&&(e._setGroupChannelUnreadCount(e.unreadMessageCount,e.unreadMentionCount+1),o=!0))}else if(u===g.MentionType.USERS&&V.mentionType===g.MentionType.CHANNEL){for(var y=!1,m=0;m<c.length;m++)if(c[m]===Q){y=!0;break}y||(l=!0,!J&&$&&(e._setGroupChannelUnreadCount(e.unreadMessageCount,e.unreadMentionCount+1),o=!0))}}e.lastMessage?e.lastMessage.createdAt<V.createdAt?(e.lastMessage=V,o=!0):e.lastMessage.createdAt===V.createdAt&&e.lastMessage.messageId===V.messageId&&($?e.lastMessage.updatedAt<V.updatedAt&&(e.lastMessage=V,o=!0):o=!0):(e.lastMessage=V,o=!0),J&&!X||!o||Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelChanged(e)})),Object.keys(t.sb.channelHandlers).forEach((function(n){var r=t.sb.channelHandlers[n];r.onMessageUpdated(e,V),l&&r.onMentionReceived(e,V)}))}}))}else V.isOpenChannel()&&u.getChannel(V.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n||Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onMessageUpdated(e,V)}))}))}break;case"DELM":var Z=String(R.channel_type),te=String(R.channel_url),ne=parseInt(R.msg_id);switch(Z){case o.CHANNEL_TYPE_GROUP:l.getChannel(te,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`")):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onMessageDeleted(e,ne)}))}));break;case o.CHANNEL_TYPE_OPEN:u.getChannel(te,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`")):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onMessageDeleted(e,ne)}))}))}break;case"READ":var re=new m(R),ie=l.cachedChannels.hasOwnProperty(re.channelUrl);l.getChannel(re.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n||(ie&&e.updateReadReceipt(re.reader.userId,re.timestamp),t.sb.currentUser&&(re.reader.userId===t.sb.currentUser.userId?ie?(e.unreadMessageCount>0||e.unreadMentionCount>0)&&(e._setGroupChannelUnreadCount(0,0),Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelChanged(e)}))):0!==e.unreadMessageCount&&0!==e.unreadMentionCount||Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelChanged(e)})):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onReadReceiptUpdated(e)}))))}));break;case"MRCT":var se=String(R.channel_type),ae=String(R.channel_url),oe=y.createFromJson(R);switch(se){case o.CHANNEL_TYPE_GROUP:l.getChannel(ae,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`")):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onReactionUpdated(e,oe)}))}));break;case o.CHANNEL_TYPE_OPEN:u.getChannel(ae,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`")):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onReactionUpdated(e,oe)}))}))}break;case"DLVR":var le=String(R.channel_url),ue=R.hasOwnProperty("updated")?R.updated:null,ce=l.cachedChannels.hasOwnProperty(le);l.getChannel(le,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(!n){var i=!1;Object.keys(ue).forEach((function(n){t.sb.currentUser&&n===t.sb.currentUser.userId&&(i=!0),ce&&e.updateDeliveryReceipt(n,parseInt(ue[n]))})),l.cachedChannels[e.url]=e,i&&1===Object.keys(ue).length||Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onDeliveryReceiptUpdated(e)}))}}));break;case"MTHD":var de=String(R.channel_url),he=String(R.channel_type),pe=_.createFromJson(R);switch(he){case o.CHANNEL_TYPE_GROUP:l.getChannel(de,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n||Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onThreadInfoUpdated(e,pe)}))}));break;case o.CHANNEL_TYPE_OPEN:u.getChannel(de,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n||Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onThreadInfoUpdated(e,pe)}))}))}break;case"MCNT":if(R.hasOwnProperty("group_channels")&&Array.isArray(R.group_channels)){var ge,ye=[],me=N(R.group_channels);try{for(me.s();!(ge=me.n()).done;){var _e=ge.value;if(_e){_e.hasOwnProperty("joined_member_count")&&_e.joined_member_count,_e.hasOwnProperty("member_count")&&_e.member_count;var ve=l.cachedChannels[_e.channel_url];ve&&ve.isBroadcast&&ve.setLatestMemberCount(_e.member_count,_e.joined_member_count,_e.ts)&&ye.push(ve)}}}catch(e){me.e(e)}finally{me.f()}ye.length>0&&Object.keys(this.sb.channelHandlers).forEach((function(e){t.sb.channelHandlers[e].onChannelMemberCountChanged(ye)}))}if(R.hasOwnProperty("open_channels")&&Array.isArray(R.open_channels)){var Ee,Ce=[],be=N(R.open_channels);try{for(be.s();!(Ee=be.n()).done;){var Se=Ee.value;if(Se){Se.hasOwnProperty("participant_count")&&Se.participant_count;var Ae=u.cachedChannels[Se.channel_url];Ae&&Ae.setLatestParticipantCount(Se.participant_count,Se.ts)&&Ce.push(Ae)}}}catch(e){be.e(e)}finally{be.f()}Ce.length>0&&Object.keys(this.sb.channelHandlers).forEach((function(e){t.sb.channelHandlers[e].onChannelParticipantCountChanged(Ce)}))}break;case"PEDI":var ke=v.createFromJson(R);Object.keys(this.sb.channelHandlers).forEach((function(e){t.sb.channelHandlers[e].onPollUpdated(ke)}));break;case"VOTE":var Oe=E.createFromJson(R);Object.keys(this.sb.channelHandlers).forEach((function(e){t.sb.channelHandlers[e].onPollVoted(Oe)}));break;case"SYEV":var Te=new Ie(R),Re=R.ts;switch(Te.category){case Ie.CATEGORY_CHANNEL_JOIN:case Ie.CATEGORY_CHANNEL_LEAVE:l.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n)W.debug("Discard command:","`".concat(T.command,"`"),Te.category);else{var a=Te.data.hasOwnProperty("member_count")?Te.data.member_count:null,o=Te.data.hasOwnProperty("joined_member_count")?Te.data.joined_member_count:null,u=!1;if(Te.category===Ie.CATEGORY_CHANNEL_JOIN)(Te.data.hasOwnProperty("users")?Te.data.users:[Te.data]).forEach((function(n){e.isSuper||e.isBroadcast?u=e.setLatestMemberCount(a,o,R.ts):(n.state=s.JOINED,e.addMember(new s(n),Re),e.updateJoinedMemberCount());var r=new i(n);t.sb.currentUser&&r.userId===t.sb.currentUser.userId&&(e.myMemberState="joined",l.cachedChannels[e.url]=e),Object.keys(t.sb.channelHandlers).forEach((function(n){var i=t.sb.channelHandlers[n];i.onUserJoined(e,r),e.isBroadcast&&u&&i.onChannelMemberCountChanged([e])}))}));else{var c=new i(Te.data);t.sb.currentUser&&c.userId===t.sb.currentUser.userId?(e.isPublic||l.removeCachedChannel(Te.channelUrl),e.myMemberState="none",e.invitedAt=0,e.joinedAt=0,e._setGroupChannelUnreadCount(0,0)):l.cachedChannels[e.url]=e,e.isSuper||e.isBroadcast?u=e.setLatestMemberCount(a,o,R.ts):(e.removeMember(c),e.updateJoinedMemberCount()),Object.keys(t.sb.channelHandlers).forEach((function(n){var r=t.sb.channelHandlers[n];r.onUserLeft(e,c),e.isBroadcast&&u&&r.onChannelMemberCountChanged([e])}))}}}));break;case Ie.CATEGORY_CHANNEL_OPERATOR_UPDATE:Te.isGroupChannel()?l.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n)W.debug("Discard command:","`".concat(T.command,"`"),Te.category);else{for(var s=Te.data.operators.map((function(e){return new i(e)})),a=s.map((function(e){return e.userId})),o=0;o<e.members.length;o++)e.members[o].role=a.indexOf(e.members[o].userId)>=0?l.Role.OPERATOR:l.Role.NONE;e.myRole=t.sb.currentUser&&a.indexOf(t.sb.currentUser.userId)>=0?l.Role.OPERATOR:l.Role.NONE,Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onOperatorUpdated(e,s)}))}})):Te.isOpenChannel()&&u.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`"),Te.category):(e.operators=Te.data.operators.map((function(e){return new i(e)})),Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onOperatorUpdated(e,e.operators)})))}));break;case Ie.CATEGORY_CHANNEL_INVITE:l.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n)W.debug("Discard command:","`".concat(T.command,"`"),Te.category);else{var a=null;Te.data&&Te.data.inviter&&Object.keys(Te.data.inviter).length>0&&(a=new i(Te.data.inviter));for(var o=[],u=0;u<Te.data.invitees.length;u++){var c=new i(Te.data.invitees[u]);o.push(c),Te.data.invitees[u].state=s.INVITED;var d=new s(Te.data.invitees[u]);if(e.isSuper||e.isBroadcast){var h=Te.data.hasOwnProperty("member_count")?Te.data.member_count:null,p=Te.data.hasOwnProperty("joined_member_count")?Te.data.joined_member_count:null;e.setLatestMemberCount(h,p,R.ts)}else e.addMember(d,Re);t.sb.currentUser&&d.userId===t.sb.currentUser.userId&&(e.isHidden=!1,"joined"!==e.myMemberState&&(e.myMemberState="invited"),e.invitedAt=R.ts,l.cachedChannels[e.url]=e)}Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserReceivedInvitation(e,a,o)}))}}));break;case Ie.CATEGORY_CHANNEL_DECLINE_INVITE:l.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n)W.debug("Discard command:","`".concat(T.command,"`"),Te.category);else{var s=null;Te.data&&Te.data.inviter&&Object.keys(Te.data.inviter).length>0&&(s=new i(Te.data.inviter));var a=new i(Te.data.invitee);if(t.sb.currentUser&&a.userId===t.sb.currentUser.userId&&(e.invitedAt=0,e.myMemberState="none",e.isPublic||l.removeCachedChannel(Te.channelUrl)),e.isSuper||e.isBroadcast){var o=Te.data.hasOwnProperty("member_count")?Te.data.member_count:null,u=Te.data.hasOwnProperty("joined_member_count")?Te.data.joined_member_count:null;e.setLatestMemberCount(o,u,R.ts)}else e.removeMember(a);t.sb.currentUser&&a.userId!==t.sb.currentUser.userId&&(l.cachedChannels[e.url]=e),Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserDeclinedInvitation(e,s,a)}))}}));break;case Ie.CATEGORY_TYPING_START:case Ie.CATEGORY_TYPING_END:l.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n)W.debug("Discard command:","`".concat(T.command,"`"),Te.category);else{var s=new i(Te.data);Te.category===Ie.CATEGORY_TYPING_START?e.updateTypingStatus(s,!0):e.updateTypingStatus(s,!1),Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onTypingStatusUpdated(e)}))}}));break;case Ie.CATEGORY_CHANNEL_ENTER:case Ie.CATEGORY_CHANNEL_EXIT:u.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n)W.debug("Discard command:","`".concat(T.command,"`"),Te.category);else{var s=Te.data.hasOwnProperty("participant_count")?Te.data.participant_count:null,a=e.setLatestParticipantCount(s,R.ts),o=new i(Te.data);Te.category===Ie.CATEGORY_CHANNEL_ENTER?Object.keys(t.sb.channelHandlers).forEach((function(n){var r=t.sb.channelHandlers[n];r.onUserEntered(e,o),a&&r.onChannelParticipantCountChanged([e])})):Object.keys(t.sb.channelHandlers).forEach((function(n){var r=t.sb.channelHandlers[n];r.onUserExited(e,o),a&&r.onChannelParticipantCountChanged([e])}))}}));break;case Ie.CATEGORY_USER_CHANNEL_MUTE:case Ie.CATEGORY_USER_CHANNEL_UNMUTE:var Ne=Te.category===Ie.CATEGORY_USER_CHANNEL_MUTE,we=d({},Te.data);Ne&&(we.restriction_type=a.RestrictionType.MUTED);var Me=Ne?new a(we):new i(Te.data),Pe=Ne?"muted":"unmuted";Te.isOpenChannel()?u.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`"),Te.category):Ne?Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserMuted(e,Me)})):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserUnmuted(e,Me)}))})):l.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`"),Te.category):(t.sb.currentUser&&Me.userId===t.sb.currentUser.userId&&(e.myMutedState=Pe),Array.isArray(e.members)&&e.members.filter((function(e){return e&&e.userId===Me.userId})).forEach((function(e){e.isMuted=Ne,e.restrictionInfo=new C(we)})),Ne?Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserMuted(e,Me)})):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserUnmuted(e,Me)})))}));break;case Ie.CATEGORY_USER_CHANNEL_BAN:case Ie.CATEGORY_USER_CHANNEL_UNBAN:var Le=Te.category===Ie.CATEGORY_USER_CHANNEL_BAN,De=d({},Te.data);Le&&(De.restriction_type=a.RestrictionType.BANNED);var He=Le?new a(De):new i(Te.data);Te.isOpenChannel()?u.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`"),Te.category):Le?(t.sb.currentUser&&He.userId===t.sb.currentUser.userId&&(delete u.enteredChannels[Te.channelUrl],t.cls.FileMessageQueue.delete(Te.channelUrl)),Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserBanned(e,He)}))):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserUnbanned(e,He)}))})):l.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n)W.debug("Discard command:","`".concat(T.command,"`"),Te.category);else if(Le){if(t.sb.currentUser&&He.userId===t.sb.currentUser.userId&&(e.isPublic||l.removeCachedChannel(Te.channelUrl),e.myMemberState="none",e.invitedAt=0,e.joinedAt=0,e._setGroupChannelUnreadCount(0,0)),e.isSuper||e.isBroadcast){var i=Te.data.hasOwnProperty("member_count")?Te.data.member_count:null,s=Te.data.hasOwnProperty("joined_member_count")?Te.data.joined_member_count:null;e.setLatestMemberCount(i,s,R.ts)}else e.removeMember(He),e.updateJoinedMemberCount();Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserBanned(e,He)}))}else Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onUserUnbanned(e,He)}))}));break;case Ie.CATEGORY_CHANNEL_FREEZE:case Ie.CATEGORY_CHANNEL_UNFREEZE:Te.isOpenChannel()?u.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`"),Te.category):(e.isFrozen=Te.data.freeze,u.cachedChannels[e.url]=e,Te.category===Ie.CATEGORY_CHANNEL_FREEZE?Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelFrozen(e)})):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelUnfrozen(e)})))})):l.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`"),Te.category):(e.isFrozen=Te.data.freeze,l.cachedChannels[e.url]=e,Te.category===Ie.CATEGORY_CHANNEL_FREEZE?Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelFrozen(e)})):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelUnfrozen(e)})))}));break;case Ie.CATEGORY_CHANNEL_DELETED:Te.isGroupChannel()?l.removeCachedChannel(Te.channelUrl):u.removeCachedChannel(Te.channelUrl),Object.keys(this.sb.channelHandlers).forEach((function(e){t.sb.channelHandlers[e].onChannelDeleted(Te.channelUrl,Te.isGroupChannel()?"group":"open")}));break;case Ie.CATEGORY_CHANNEL_PROP_CHANGED:Te.isOpenChannel()?u.getChannelWithoutCache(Te.channelUrl,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`"),Te.category):Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelChanged(e)}))})):l.getChannelWithoutCache(Te.channelUrl,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n)W.debug("Discard command:","`".concat(T.command,"`"),Te.category);else{var i=e.unreadMessageCount,s=e.unreadMentionCount;e.myCountPreference!==l.CountPreference.ALL&&(e.myCountPreference===l.CountPreference.UNREAD_MESSAGE_COUNT_ONLY?s=0:e.myCountPreference===l.CountPreference.UNREAD_MENTION_COUNT_ONLY?i=0:(i=0,s=0)),e._setGroupChannelUnreadCount(i,s),Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelChanged(e)}))}}));break;case Ie.CATEGORY_CHANNEL_META_DATA_CHANGED:case Ie.CATEGORY_CHANNEL_META_COUNTERS_CHANGED:var Fe=Te.data.hasOwnProperty("created"),Ge=Te.data.hasOwnProperty("updated"),xe=Te.data.hasOwnProperty("deleted");(Te.isOpenChannel()?u.getChannel(Te.channelUrl,w.INTERNAL_CALL):l.getChannel(Te.channelUrl,w.INTERNAL_CALL)).then((function(e){var n=Te.data.created,r=Te.data.updated,i=Te.data.deleted,s=R.ts;Fe&&e._addOrUpdateCachedMetaData(n,s),Ge&&e._addOrUpdateCachedMetaData(r,s),xe&&e._markAsDeletedCachedMetaData(i,s),Object.keys(t.sb.channelHandlers).forEach((function(s){var a=t.sb.channelHandlers[s];Te.category===Ie.CATEGORY_CHANNEL_META_DATA_CHANGED?(Fe&&a.onMetaDataCreated(e,n),Ge&&a.onMetaDataUpdated(e,r),xe&&a.onMetaDataDeleted(e,i)):(Fe&&a.onMetaCountersCreated(e,n),Ge&&a.onMetaCountersUpdated(e,r),xe&&a.onMetaCountersDeleted(e,i))}))})).catch((function(e){return W.debug("Discard command:","`".concat(T.command,"`"),Te.category)}));break;case Ie.CATEGORY_CHANNEL_HIDE:case Ie.CATEGORY_CHANNEL_UNHIDE:l.getChannel(Te.channelUrl,w.INTERNAL_CALL,(function(e,n){if(t.sb.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}n?W.debug("Discard command:","`".concat(T.command,"`"),Te.category):Te.category===Ie.CATEGORY_CHANNEL_HIDE?(e.isHidden=!0,Te.data&&(Te.data.hasOwnProperty("allow_auto_unhide")&&(e.hiddenState=Te.data.allow_auto_unhide?l.HiddenState.HIDDEN_ALLOW_AUTO_UNHIDE:l.HiddenState.HIDDEN_PREVENT_AUTO_UNHIDE),Te.data.hasOwnProperty("hide_previous_messages")&&Te.data.hide_previous_messages&&e._setGroupChannelUnreadCount(0,0)),R.hasOwnProperty("ts_message_offset")&&(e._messageOffsetTimestamp=R.ts_message_offset),l.cachedChannels[e.url]=e,Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelHidden(e)}))):(e.isHidden=!1,e.hiddenState=l.HiddenState.UNHIDDEN,l.cachedChannels[e.url]=e,Object.keys(t.sb.channelHandlers).forEach((function(n){t.sb.channelHandlers[n].onChannelChanged(e)})))}))}break;case"USEV":var je=new Ie(R);switch(je.category){case Ue.CATEGORY_USER_BLOCK:case Ue.CATEGORY_USER_UNBLOCK:var Be=je.data.blocker.user_id,qe=je.data.blockee.user_id;Object.keys(l.cachedChannels).forEach((function(e){var n=l.cachedChannels[e];try{t.sb.currentUser&&(t.sb.currentUser.userId===Be?n.memberMap[qe].isBlockedByMe=je.category===Ue.CATEGORY_USER_BLOCK:t.sb.currentUser.userId===qe&&(n.memberMap[Be].isBlockingMe=je.category===Ue.CATEGORY_USER_BLOCK))}catch(e){}}));break;case Ue.CATEGORY_FRIEND_DISCOVERED:var ze=je.data.friend_discoveries.map((function(e){return new i(e)}));Object.keys(this.sb.userEventHandlers).forEach((function(e){t.sb.userEventHandlers[e].onFriendsDiscovered(ze)}))}break;case"LEAV":case"JOIN":case"PONG":case"MTIO":case"TPST":case"TPEN":break;default:W.debug("Discard command:","`".concat(T.command,"`"))}}}]),e}(),Te={},Re={},Ne=function(){function e(t){p(this,e),this.channel=t,this.uploadQueue=[],this.messageQueue=[],this.latestTimestampToSendMessage=0,G.get(this._iid).FileMessageQueue.queueMap[t.url]=this}return g(e,[{key:"_handleMessageQueueUpdated",value:function(e){var t=this;switch(W.debug("`fileMessageQueue` message queue updated:",this.messageQueue),e){case"add":this.uploadQueue.length<6&&this._moveFirstPendingMessageToUploadQueue();break;case"update":case"remove":if(this.messageQueue.length>0){var n=G.get(this._iid).FileMessageQueue,r=this.messageQueue[0];if(r)if(r.state===n.State.UPLOADED){if(r&&r.state===n.State.UPLOADED){for(r.state=n.State.SENDING,0===this.latestTimestampToSendMessage&&(this.latestTimestampToSendMessage=(new Date).getTime()-200);(new Date).getTime()-this.latestTimestampToSendMessage<200;);this.latestTimestampToSendMessage=(new Date).getTime(),this._sendUploadedMessage(r,(function(e,i){r.state=n.State.SENT,r.error=e||null,r.response=i||null,t._handleMessageQueueUpdated("update")}))}}else r.state===n.State.SENT&&this._finalizeMessage()}}}},{key:"_handleUploadQueueUpdated",value:function(e,t){var n=this;switch(W.debug("`fileMessageQueue` upload queue updated:",this.uploadQueue),e){case"add":var r=G.get(this._iid).FileMessageQueue;t.state=r.State.UPLOADING,t.error?(this.messageQueue.map((function(e){return e.requestId})).indexOf(t.requestId)>-1&&(t.state=r.State.SENT,this._handleMessageQueueUpdated("update")),this._finalizeUpload(t.requestId)):this._uploadFile(t,(function(e){t.error&&t.state===r.State.SENT||(t.state=r.State.UPLOADED),t.fileInfo=e,n._handleMessageQueueUpdated("update"),n._finalizeUpload(t.requestId)}));break;case"update":break;case"remove":this.uploadQueue.length<6&&this._moveFirstPendingMessageToUploadQueue()}}},{key:"_moveFirstPendingMessageToUploadQueue",value:function(){var e=G.get(this._iid).FileMessageQueue,t=this.messageQueue.filter((function(t){return t.state===e.State.PENDING}));if(t.length>0){var n=t[0];this.uploadQueue.push(n),this._handleUploadQueueUpdated("add",n)}}},{key:"_sendUploadedMessage",value:function(e,t){var n=G.get(this._iid),r=n.Command,i=n.FileMessage,s=e.fileInfo,a=r.bFile(d(d({},s),{},{requestId:e.requestId,channelUrl:this.channel.url,url:s.file,metaArrays:s.metaArrays})),o=fn.getInstance(this._iid),l=L.get(this._iid);o.getConnectionState()===o.ConnectionState.OPEN||!o.currentUser||o.connecting||o.reconnecting?o.sendCommand(a,(function(e,n){if(o.getErrorFirstCallback()){var r=[e,n];n=r[0],e=r[1]}if(n){var l=new i(a.getJsonElement());l.requestedMentionUserIds=s.mentionedUserIds,t(n,l)}else{var u=new i(e.getJsonElement());t(null,u)}})):l.container.apiClient.sendFileMessage(d(d({channelUrl:this.channel.url,isOpenChannel:this.channel.isOpenChannel()},s),{},{fileUrl:s.file,fileName:s.name,fileSize:s.size,fileType:s.type,metaArrays:s.metaArrays}),(function(e,n){var r=new i(e?a.getJsonElement():n);e&&(r.requestedMentionUserIds=s.mentionedUserIds),t(e,r)}))}},{key:"_uploadFile",value:function(e,t){var n=e.fileInfo,r=e.pendingMessage;if("string"!=typeof n.file&&n.file){var i=G.get(this._iid).FileMessageQueue;L.get(this._iid).container.apiClient.uploadFile(d(d({},n),{},{fileType:n.type,channelUrl:this.channel.url,reqId:r?r.reqId:null}),(function(r,s){if(r)e.state=i.State.SENT,e.error=r,e.response=null,t(n);else{var a="object"===h(s)?s:JSON.parse(s);n.file=a.url,n.thumbnailSizes=a.hasOwnProperty("thumbnails")?a.thumbnails:[],n.requireAuth=!!a.hasOwnProperty("require_auth")&&a.require_auth,n.size=a.hasOwnProperty("file_size")?a.file_size:n.size,t(n)}}))}else n.thumbnailSizes=[],n.requireAuth=!1,t(n)}},{key:"_finalizeUpload",value:function(e){var t=this.uploadQueue.map((function(e){return e.requestId})).indexOf(e);if(t>-1){var n=this.uploadQueue.splice(t,1);n.length>0&&this._handleUploadQueueUpdated("remove",n[0])}}},{key:"_finalizeMessage",value:function(){var e=this,t=L.get(this._iid).container.isErrorFirstInCallback,n=fn.getInstance(this._iid),r=G.get(this._iid).FileMessageQueue,i=this.messageQueue[0];if(i&&i.state===r.State.SENT){i.state=r.State.DONE;var s=i.response,a=i.error,o=i.fileInfo.callback;if(s&&!a){var l=n.currentUser;return l&&s._sender&&l.userId===s._sender.userId&&(l.nickname!==s._sender.nickname&&(l.nickname=s._sender.nickname),l.plainProfileUrl!==s._sender.plainProfileUrl&&(l.plainProfileUrl=s._sender.plainProfileUrl)),this.channel.isGroupChannel()&&(this.channel.lastMessage=s,Object.keys(n.channelHandlers).forEach((function(t){n.channelHandlers[t].onChannelChanged(e.channel)}))),t?o(null,s):o(s,null),this.messageQueue.shift(),void this._handleMessageQueueUpdated("remove")}a&&(s=i.pendingMessage)&&(a.code!==D.INVALID_PARAMETER?(s.requestState=n.MessageRequestState.FAILED,s.sendingStatus=n.MessageSendingStatus.FAILED,a.code!==D.FILE_UPLOAD_CANCEL_FAILED&&a.code!==D.REQUEST_CANCELED||(s.sendingStatus=n.MessageSendingStatus.CANCELED),s.requestedMentionUserIds=i.fileInfo.mentionedUserIds,s.errorCode=a.code):s=null),t?o(a,s):o(s,a),this.messageQueue.shift(),this._handleMessageQueueUpdated("remove")}}},{key:"addJob",value:function(e){this.messageQueue.push(e),this._handleMessageQueueUpdated("add")}},{key:"cancelUploadItemByRequestId",value:function(e,t){this._finalizeUpload(e);var n=this.messageQueue.map((function(e){return e.requestId})).indexOf(e);if(n>-1){var r=G.get(this._iid).FileMessageQueue,i=this.messageQueue[n];!i||i.state!==r.State.UPLOADING&&i.state!==r.State.PENDING||(i.state=r.State.SENT,i.response=null,i.error=new D("Uploading has been completed or canceled.",D.FILE_UPLOAD_CANCEL_FAILED),this._handleMessageQueueUpdated("update"));var s=r.uploadRequest[e];if(s)return"function"==typeof s.abort?s.abort():"function"==typeof s.cancel&&s.cancel("Upload has been canceled."),t(null,!0),!0;t(new D("Uploading has been completed or canceled.",D.FILE_UPLOAD_CANCEL_FAILED),!1)}else t(new D("Uploading has been completed or canceled.",D.FILE_UPLOAD_CANCEL_FAILED),!1);return!1}}],[{key:"State",get:function(){return{PENDING:"pending",UPLOADING:"uploading",UPLOADED:"uploaded",SENDING:"sending",SENT:"sent",DONE:"done"}}},{key:"getByChannelUrl",value:function(e){return G.get(this._iid).FileMessageQueue.queueMap[e]}},{key:"create",value:function(e){var t=G.get(this._iid).FileMessageQueue;return t.queueMap.hasOwnProperty(e.url)||(t.queueMap[e.url]=new t(e)),t.queueMap[e.url]}},{key:"delete",value:function(e){var t=G.get(this._iid).FileMessageQueue;t.queueMap.hasOwnProperty(e)&&delete t.queueMap[e]}},{key:"clear",value:function(){Re[this._iid]={}}},{key:"queueMap",get:function(){return Re[this._iid]||(Re[this._iid]={}),Re[this._iid]}},{key:"uploadRequest",get:function(){return Te[this._iid]||(Te[this._iid]={}),Te[this._iid]}}]),e}();Ne.Job=function e(t){var n=t.fileInfo,r=t.requestId,i=t.pendingMessage,s=t.state,a=t.error,o=void 0===a?null:a,l=t.response,u=void 0===l?null:l;p(this,e),this.fileInfo=n,this.requestId=r,this.pendingMessage=i,this.state=s||Ne.State.PENDING,this.error=o,this.response=u};var we=function(){function e(){p(this,e)}return g(e,null,[{key:"create",value:function(){return"".concat(parseInt(1e5*Math.random()),"-").concat((new Date).getTime())}}]),e}(),Me={},Pe={},Le=new WeakMap,De=new WeakMap,He=new WeakMap,Fe=function(e){m(n,e);var t=k(n);function n(e){var r;return p(this,n),(r=t.call(this,e)).channelType=ke.CHANNEL_TYPE_GROUP,r.isDistinct=!1,r.isSuper=!1,r.isBroadcast=!1,r.isPublic=!1,r.unreadMessageCount=0,r.inviter=null,r.members=[],r.memberMap={},r.lastMessage=null,r.memberCount=0,r.joinedMemberCount=0,r.cachedReadReceiptStatus={},r.cachedDeliveryReceiptStatus=null,r.myPushTriggerOption=n.PushTriggerOption.DEFAULT,r.isPushEnabled,r.isHidden=!1,r.hiddenState=n.HiddenState.UNHIDDEN,r.isDiscoverable=!0,r.myLastRead=0,r.messageSurvivalSeconds=-1,r.invitedAt=0,r.joinedAt=0,r._messageOffsetTimestamp=0,r._cachedLastDeliveredReceipt={sentAt:0,timeout:null},Le.set(S(r),{}),De.set(S(r),{start:0,end:0}),He.set(S(r),0),e&&r._update(e),r}return g(n,[{key:"messageOffsetTimestamp",get:function(){return this._messageOffsetTimestamp}},{key:"_setGroupChannelUnreadCount",value:function(e,t){try{if("number"==typeof e&&e>=0)if("all"===this.myCountPreference||"unread_message_count_only"===this.myCountPreference)if(this.isSuper||this.isBroadcast){var n=L.get(this._iid).container.maxUnreadCountOfSuperGroupChannel;this.unreadMessageCount=e>=n?n:e}else this.unreadMessageCount=e;else this.unreadMessageCount=0;"number"==typeof t&&t>=0&&("all"===this.myCountPreference||"unread_mention_count_only"===this.myCountPreference?this.unreadMentionCount=t:this.unreadMentionCount=0)}catch(e){}}},{key:"_update",value:function(e){var t=this,n=G.get(this._iid),r=n.BaseChannel,i=n.GroupChannel,s=n.User,a=n.Member;if(this.isAccessCodeRequired=!!e.is_access_code_required&&e.is_access_code_required,this.isDistinct=!!e.is_distinct&&e.is_distinct,this.isPushEnabled=!!e.is_push_enabled&&e.is_push_enabled,this.isHidden=!!e.hasOwnProperty("is_hidden")&&e.is_hidden,this.myPushTriggerOption=e.push_trigger_option?e.push_trigger_option:i.PushTriggerOption.DEFAULT,this.myCountPreference=e.hasOwnProperty("count_preference")?e.count_preference:i.CountPreference.ALL,this.unreadMessageCount=0,this.unreadMentionCount=0,this._setGroupChannelUnreadCount(parseInt(e.unread_message_count),parseInt(e.unread_mention_count)),e.hasOwnProperty("read_receipt")&&(this.cachedReadReceiptStatus={},Object.keys(e.read_receipt).forEach((function(n){var r=e.read_receipt[n];t.updateReadReceipt(n,parseInt(r))}))),e.hasOwnProperty("delivery_receipt")&&"object"===h(e.delivery_receipt)&&null!==e.delivery_receipt&&(this.cachedDeliveryReceiptStatus||(this.cachedDeliveryReceiptStatus={}),Object.keys(e.delivery_receipt).forEach((function(n){var r=e.delivery_receipt[n];t.updateDeliveryReceipt(n,parseInt(r))}))),e.hasOwnProperty("user_last_read")&&"number"==typeof e.user_last_read?this.myLastRead=e.user_last_read:this.myLastRead=0,e.hasOwnProperty("members")){this.members=[],this.memberMap={};for(var o=0;o<e.members.length;o++){var l=new a(e.members[o]);this.members.push(l),this.memberMap[l.userId]=l}}this.myMemberState=e.member_state||"none",this.myRole=e.my_role||i.Role.NONE,e.hasOwnProperty("is_muted")?"string"==typeof e.is_muted?this.myMutedState=e.is_muted:"boolean"==typeof e.is_muted?this.myMutedState=e.is_muted?"muted":"unmuted":this.myMutedState="unmuted":this.myMutedState="unmuted",e.hasOwnProperty("member_count")&&(this.memberCount=parseInt(e.member_count)),e.hasOwnProperty("joined_member_count")&&(this.joinedMemberCount=parseInt(e.joined_member_count)),e.hasOwnProperty("last_message")&&"object"===h(e.last_message)&&e.last_message?e.last_message instanceof Ce?this.lastMessage=e.last_message:this.lastMessage=r.buildMessage(e.last_message,this):this.lastMessage=null,e.hasOwnProperty("inviter")&&null!==e.inviter&&"object"===h(e.inviter)&&Object.keys(e.inviter).length>0?this.inviter=new s(e.inviter):this.inviter=null,this.invitedAt=e.invited_at||0,this.joinedAt=e.joined_ts||0,e.hasOwnProperty("is_super")&&"boolean"==typeof e.is_super?this.isSuper=e.is_super:this.isSuper=!1,e.hasOwnProperty("is_broadcast")&&"boolean"==typeof e.is_broadcast?this.isBroadcast=e.is_broadcast:this.isBroadcast=!1,e.hasOwnProperty("is_public")&&"boolean"==typeof e.is_public?this.isPublic=e.is_public:this.isPublic=!1,e.hasOwnProperty("hidden_state")?this.hiddenState=e.hidden_state:this.hiddenState=i.HiddenState.UNHIDDEN,e.hasOwnProperty("is_discoverable")&&"boolean"==typeof e.is_discoverable?this.isDiscoverable=e.is_discoverable:this.isDiscoverable=this.isPublic,e.hasOwnProperty("ts_message_offset")&&(this._messageOffsetTimestamp=e.ts_message_offset),e.hasOwnProperty("message_survival_seconds")&&"number"==typeof e.message_survival_seconds&&(this.messageSurvivalSeconds=e.message_survival_seconds)}},{key:"addMember",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!this.isSuper&&!this.isBroadcast){var n=G.get(this._iid),r=n.Member,i=this.removeMember(e);i&&i.state===r.JOINED&&(e.state=r.JOINED),this.memberMap[e.userId]=e,this.members.push(e),this.memberCount++,this.updateReadReceipt(e.userId,t),this.updateDeliveryReceipt(e.userId,t)}}},{key:"removeMember",value:function(e){var t=null;if(!this.isSuper&&!this.isBroadcast&&this.memberMap.hasOwnProperty(e.userId)){delete this.memberMap[e.userId];for(var n=0;n<this.members.length;n++){var r=this.members[n];if(r.userId===e.userId){t=r,this.members.splice(n,1);break}}this.memberCount--}return t}},{key:"parse",value:function(e){this._update(e)}},{key:"update",value:function(e){this.__update(e),this._update(e)}},{key:"isIdentical",value:function(e){return e&&this.url===e.url}},{key:"isEqual",value:function(e){return ee.deepEqual(this,e)}},{key:"createMemberListQuery",value:function(){return new(0,G.get(this._iid).MemberListQuery)(this.url)}},{key:"createBannedUserListQuery",value:function(){return new(0,G.get(this._iid).BannedUserListQuery)({channelUrl:this.url,isOpenChannel:this.isOpenChannel()})}},{key:"refresh",value:function(e){return G.get(this._iid).GroupChannel.getChannelWithoutCache(this.url,e)}},{key:"updateChannel",value:function(){var e=this,t=ae.toArray(arguments),n=void 0;"function"==typeof t[t.length-1]&&(n=t.pop());var r=G.get(this._iid),i=r.GroupChannel,s=r.GroupChannelParams;if(t[0]instanceof s&&1===t.length)return _e(this._iid,(function(n){var r=t[0];r.channelUrl=e.url,r._validate()?L.get(e._iid).container.apiClient.updateGroupChannel(d(d({},r),{},{operatorUserIds:r.operatorUserIds}),(function(e,t){var r=null;e||(r=i.upsert(t)),n(e,r)})):n(ae.error,null)}),n);if(3===t.length){var a=new s;return a.channelUrl=this.url,a.name=t[0],"string"==typeof t[1]?a.coverUrl=t[1]:a.coverImage=t[1],a.data=t[2],this.updateChannel(a,n)}if(4===t.length){var o=new s;return o.channelUrl=this.url,o.isDistinct=t[0],o.name=t[1],"string"==typeof t[1]?o.coverUrl=t[2]:o.coverImage=t[2],o.data=t[3],this.updateChannel(o,n)}if(5===t.length){var l=new s;return l.channelUrl=this.url,l.isDistinct=t[0],l.name=t[1],"string"==typeof t[2]?l.coverUrl=t[2]:l.coverImage=t[2],l.data=t[3],l.customType=t[4],this.updateChannel(l,n)}return _e(this._iid,(function(e){return e(ae.error,null)}),n)}},{key:"invite",value:function(e,t){var n=null,r=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return e.length>0&&e.every((function(e){return!!e.userId&&"string"==typeof e.userId}))}}),new ae({type:"callback"})]),i=U(r,3);return n=i[0],e=i[1],t=i[2],n?_e(this._iid,(function(e){return e(ae.error,null)}),t):this.inviteWithUserIds(e.map((function(e){return e.userId})),t)}},{key:"inviteWithUserIds",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return e.every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.inviteToGroupChannel({channelUrl:n.url,userIds:e},(function(e,r){var i=null;e||(i=G.get(n._iid).GroupChannel.upsert(r)),t(e,i)}))}),t)}},{key:"acceptInvitation",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",optional:!0,defaultValue:null}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.acceptInvitation({channelUrl:n.url,accessCode:e},(function(e,r){var i=null;e||((i=G.get(n._iid).GroupChannel.upsert(r)).myMemberState="joined"),t(e,i)}))}),t)}},{key:"declineInvitation",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.declineInvitation({channelUrl:t.url},(function(n,r){var i=null;if(!n){var s=G.get(t._iid).GroupChannel;(i=s.upsert(r)).myMemberState="none",t.isPublic||s.removeCachedChannel(t.url)}e(n,i)}))}),e)}},{key:"join",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",optional:!0,defaultValue:null}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.joinGroupChannel({channelUrl:n.url,accessCode:e},(function(e,r){var i=null;e||((i=G.get(n._iid).GroupChannel.upsert(r)).myMemberState="joined"),t(e,i)}))}),t)}},{key:"leave",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.leaveGroupChannel({channelUrl:t.url},(function(t,n){return e(t,null)}))}),e)}},{key:"muteUser",value:function(e,t,n,r){return this.muteUserWithUserId(e?e.userId:null,t,n,r)}},{key:"muteUserWithUserId",value:function(e,t,n,r){var i=this,s=null,a=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"number",optional:!0,defaultValue:-1,constraint:function(e){return e>=-1}}),new ae({type:"string",optional:!0,defaultValue:""}),new ae({type:"callback"})]),o=U(a,5);return s=o[0],e=o[1],t=o[2],n=o[3],r=o[4],_e(this._iid,(function(r){s?r(s,null):L.get(i._iid).container.apiClient.muteUser({channelUrl:i.url,userId:e,description:n,seconds:t,isGroupChannel:!0},(function(e,t){r(e,null)}))}),r)}},{key:"unmuteUser",value:function(e,t){return this.unmuteUserWithUserId(e?e.userId:null,t)}},{key:"unmuteUserWithUserId",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.unmuteUser({channelUrl:n.url,userId:e,isGroupChannel:!0},(function(e,n){t(e,null)}))}),t)}},{key:"banUser",value:function(e,t,n,r){return this.banUserWithUserId(e?e.userId:null,t,n,r)}},{key:"banUserWithUserId",value:function(e,t,n,r){var i=this,s=null,a=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"number",optional:!0,defaultValue:-1,constraint:function(e){return e>=-1}}),new ae({type:"string"}),new ae({type:"callback"})]),o=U(a,5);return s=o[0],e=o[1],t=o[2],n=o[3],r=o[4],_e(this._iid,(function(r){s?r(s,null):L.get(i._iid).container.apiClient.banUser({channelUrl:i.url,userId:e,description:n,seconds:t,isGroupChannel:!0},(function(e,t){r(e,null)}))}),r)}},{key:"unbanUser",value:function(e,t){return this.unbanUserWithUserId(e?e.userId:null,t)}},{key:"unbanUserWithUserId",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.unbanUser({channelUrl:n.url,userId:e,isGroupChannel:!0},(function(e,n){t(e,null)}))}),t)}},{key:"updateJoinedMemberCount",value:function(){if(!this.isSuper&&!this.isBroadcast){var e=G.get(this._iid).Member;this.joinedMemberCount=this.members.filter((function(t){return t.state===e.JOINED})).length}}},{key:"setLatestMemberCount",value:function(e,t,n){var r=!1;return"number"==typeof e&&"number"==typeof t&&"number"==typeof n&&n>=He.get(this)&&(He.set(this,n),r=t!==this.joinedMemberCount||e!==this.memberCount,this.memberCount=e,this.joinedMemberCount=t),r}},{key:"hide",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"boolean",optional:!0,defaultValue:!1}),new ae({type:"boolean",optional:!0,defaultValue:!0}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.hideGroupChannel({channelUrl:r.url,hidePreviousMessages:e,allowAutoUnhide:t},(function(i,s){if(!i){var a=G.get(r._iid).GroupChannel;r.isHidden=!0,r.hiddenState=t?a.HiddenState.HIDDEN_ALLOW_AUTO_UNHIDE:a.HiddenState.HIDDEN_PREVENT_AUTO_UNHIDE,e&&r._setGroupChannelUnreadCount(0,0),s.hasOwnProperty("ts_message_offset")&&(r._messageOffsetTimestamp=s.ts_message_offset),a.cachedChannels[r.url]=r}n(i,s)}))}),n)}},{key:"unhide",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.unhideGroupChannel({channelUrl:t.url},(function(n,r){if(!n){var i=G.get(t._iid).GroupChannel;t.isHidden=!1,t.hiddenState=i.HiddenState.UNHIDDEN,i.cachedChannels[t.url]=t}e(n,r)}))}),e)}},{key:"freeze",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.freeze({channelUrl:t.url,isGroupChannel:!0,freezing:!0},(function(n,r){if(!n){var i=G.get(t._iid).GroupChannel;t.isFrozen=!0,i.cachedChannels[t.url]=t}e(n,null)}))}),e)}},{key:"unfreeze",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.freeze({channelUrl:t.url,isGroupChannel:!0,freezing:!1},(function(n,r){if(!n){var i=G.get(t._iid).GroupChannel;t.isFrozen=!1,i.cachedChannels[t.url]=t}e(n,null)}))}),e)}},{key:"delete",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.deleteGroupChannel({channelUrl:t.url},(function(n,r){n||G.get(t._iid).GroupChannel.removeCachedChannel(t.url),e(n,r)}))}),e)}},{key:"markAsRead",value:function(e){var t=this;return _e(this._iid,(function(e){var n=G.get(t._iid).Command,r=fn.getInstance(t._iid),i=n.bRead({channelUrl:t.url});r.sendCommand(i,(function(n,i){if(r.getErrorFirstCallback()){var s=[n,i];i=s[0],n=s[1]}if(i)e(i,null);else if(r.currentUser)t.updateReadReceipt(r.currentUser.userId,n.getJsonElement().ts),(t.unreadMessageCount>0||t.unreadMentionCount>0)&&(t._setGroupChannelUnreadCount(0,0),Object.keys(r.channelHandlers).forEach((function(e){r.channelHandlers[e].onChannelChanged(t)}))),e(null,null);else{var a=new SendBirdException("Connection should be made first.",SendBirdException.CONNECTION_REQUIRED);e(a,null)}}))}),e)}},{key:"getUnreadMemberCount",value:function(e){var t=fn.getInstance(this._iid),n=G.get(this._iid).Member;if(e instanceof Ce&&!e.isAdminMessage()&&t.currentUser&&!this.isSuper&&!this.isBroadcast){for(var r=0,i=e.createdAt,s=this.members,a=0;a<s.length;a++){var o=s[a];t.currentUser.userId===o.userId||o.state!==n.JOINED||e.sender&&e.sender.userId===o.userId||(this.cachedReadReceiptStatus[o.userId]||0)<i&&r++}return r}return 0}},{key:"getReadReceipt",value:function(e){return this.getUnreadMemberCount(e)}},{key:"markAsDelivered",value:function(){var e=this,t=fn.getInstance(this._iid),n=t.currentUser?t.currentUser.userId:null;L.get(this._iid).container.apiClient.markAsDelivered({channelUrl:this.url,userId:n},(function(t,r){if(t)W.debug(t);else{var i=r.hasOwnProperty("ts")?r.ts:0;e.updateDeliveryReceipt(n,i)}}))}},{key:"getUndeliveredMemberCount",value:function(e){var t=fn.getInstance(this._iid),n=G.get(this._iid).Member;if(this.cachedDeliveryReceiptStatus&&e instanceof Ce&&!e.isAdminMessage()&&t.currentUser&&!this.isSuper&&!this.isBroadcast){var r,i=e.createdAt,s=0,a=N(this.members);try{for(a.s();!(r=a.n()).done;){var o=r.value;t.currentUser.userId===o.userId||o.state!==n.JOINED||e.sender&&e.sender.userId===o.userId||this.cachedDeliveryReceiptStatus[o.userId]<i&&s++}}catch(e){a.e(e)}finally{a.f()}return s}return 0}},{key:"getDeliveryReceipt",value:function(e){return this.getUndeliveredMemberCount(e)}},{key:"getReadMembers",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=fn.getInstance(this._iid);if(n.currentUser&&!this.isSuper&&!this.isBroadcast&&e instanceof Ce&&!e.isAdminMessage()){for(var r=[],i=0;i<this.members.length;i++){var s=this.members[i];if(t||s.userId!==n.currentUser.userId&&s.userId!==e.sender.userId){var a=this.cachedReadReceiptStatus[s.userId]||0;a>=e.createdAt&&r.push(s)}}return r}return[]}},{key:"getUnreadMembers",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=fn.getInstance(this._iid);if(n.currentUser&&!this.isSuper&&!this.isBroadcast&&e instanceof Ce&&!e.isAdminMessage()){for(var r=[],i=0;i<this.members.length;i++){var s=this.members[i];if(t||s.userId!==n.currentUser.userId&&s.userId!==e.sender.userId){var a=this.cachedReadReceiptStatus[s.userId]||0;a<e.createdAt&&r.push(s)}}return r}return[]}},{key:"getReadStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=fn.getInstance(this._iid);if(n.currentUser&&!this.isSuper&&!this.isBroadcast){for(var r={},i=Object.keys(this.cachedReadReceiptStatus),s=function(s){var a=i[s];if(!t&&a===n.currentUser.userId)return"continue";var o=e.cachedReadReceiptStatus[a],l=e.members.filter((function(e){return e.userId===a}));r[a]={user:l.length>0?l[0]:null,last_seen_at:parseInt(o)}},a=0;a<i.length;a++)s(a);return r}return{}}},{key:"updateReadReceipt",value:function(e,t){var n=this.cachedReadReceiptStatus[e];if(!n||n<t){this.cachedReadReceiptStatus[e]=t;var r=fn.getInstance(this._iid);r.currentUser&&e===r.currentUser.userId&&(this.myLastRead=t)}}},{key:"updateDeliveryReceipt",value:function(e,t){if(this.cachedDeliveryReceiptStatus)if(this.cachedDeliveryReceiptStatus.hasOwnProperty(e)){var n=this.cachedDeliveryReceiptStatus[e];(!n||n<t)&&(this.cachedDeliveryReceiptStatus[e]=t)}else this.cachedDeliveryReceiptStatus[e]=t}},{key:"startTyping",value:function(){var e=fn.getInstance(this._iid),t=(new Date).getTime(),n=e.Options.typingIndicatorThrottle;("number"!=typeof n||n<1e3||n>9e3)&&(n=1e3);var r=De.get(this);if(t-r.start>=n){r.end=0,r.start=t;var i=G.get(this._iid).Command.bTypeStart({channelUrl:this.url,time:r.start});e.sendCommand(i,null)}}},{key:"endTyping",value:function(){var e=fn.getInstance(this._iid),t=(new Date).getTime(),n=e.Options.typingIndicatorThrottle;("number"!=typeof n||n<1e3||n>9e3)&&(n=1e3);var r=De.get(this);if(t-r.end>=n){r.start=0,r.end=t;var i=G.get(this._iid).Command.bTypeEnd({channelUrl:this.url,time:r.end});e.sendCommand(i,null)}}},{key:"invalidateTypingStatus",value:function(){var e=Le.get(this),t=(new Date).getTime(),n=!1;return Object.keys(e).forEach((function(r){var i=e[r].ts;t-i>=1e4&&(delete e[r],n=!0)})),n}},{key:"getTypingMembers",value:function(){var e=this,t=Le.get(this),n=[];return Object.keys(t).forEach((function(t){var r=e.memberMap[t];r&&n.push(r)})),n}},{key:"getTypingUsers",value:function(){var e=Le.get(this),t=[];return Object.keys(e).forEach((function(n){var r=e[n].user;t.push(r)})),t}},{key:"updateTypingStatus",value:function(e,t){var n=Le.get(this);t?n[e.userId]={user:e,ts:(new Date).getTime()}:delete n[e.userId]}},{key:"isTyping",value:function(){var e=Le.get(this);return 0!==Object.keys(e).length}},{key:"registerScheduledUserMessage",value:function(e,t){var n=this,r=G.get(this._iid),i=r.ScheduledUserMessage,s=r.ScheduledUserMessageParams,a=null,o=ae.parse(arguments,[new ae({type:s,constraint:function(e){return"string"==typeof e.message&&"string"==typeof e._getScheduleString()}}),new ae({type:"callback"})]),l=U(o,3);return a=l[0],e=l[1],t=l[2],_e(this._iid,(function(t){a?t(a,null):L.get(n._iid).container.apiClient.registerScheduledUserMessage({groupChannelParams:e,channelUrl:n.url,isOpenChannel:!1},(function(e,r){var s=null;if(!e){s=new i(r);var a=fn.getInstance(n._iid).currentUser;a&&s._sender&&a.userId===s._sender.userId&&(a.nickname=s._sender.nickname,a.plainProfileUrl=s._sender.plainProfileUrl,a.metaData=s._sender.metaData)}t(e,s)}))}),t)}},{key:"getPushPreference",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getMyPushTriggerOption({channelUrl:t.url},(function(n,r){var i=null;if(!n){try{i=r.enable}catch(e){i=!1}t.isPushEnabled=i}e&&e(n,i)}))}),e)}},{key:"setPushPreference",value:function(e,t){var n=this;return _e(this._iid,(function(t){var r=G.get(n._iid).GroupChannel;L.get(n._iid).container.apiClient.setMyPushTriggerOption({channelUrl:n.url,enable:e},(function(e,i){e||(n.isPushEnabled=i.enable,n.isPushEnabled||(n.myPushTriggerOption=r.PushTriggerOption.OFF)),t(e,i)}))}),t)}},{key:"getMyPushTriggerOption",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getMyPushTriggerOption({channelUrl:t.url},(function(r,i){var s=null;if(!r){try{s=i.push_trigger_option||n.PushTriggerOption.DEFAULT}catch(e){W.debug(e)}t.myPushTriggerOption=s}e(r,s)}))}),e)}},{key:"setMyPushTriggerOption",value:function(e,t){var n=this,r=G.get(this._iid),i=r.GroupChannel,s=null,a=ae.parse(arguments,[new ae({type:i.PushTriggerOption}),new ae({type:"callback"})]),o=U(a,3);return s=o[0],e=o[1],t=o[2],_e(this._iid,(function(t){s?t(s,null):L.get(n._iid).container.apiClient.setMyPushTriggerOption({channelUrl:n.url,pushTriggerOption:e},(function(e,r){var i=null;if(!e){try{i=r.push_trigger_option}catch(e){W.debug(e)}n.myPushTriggerOption=i}t(e,i)}))}),t)}},{key:"setMyCountPreference",value:function(e,t){var n=this,r=G.get(this._iid),i=r.GroupChannel,s=null,a=ae.parse(arguments,[new ae({type:i.CountPreference}),new ae({type:"callback"})]),o=U(a,3);return s=o[0],e=o[1],t=o[2],_e(this._iid,(function(t){s?t(s,null):L.get(n._iid).container.apiClient.setMyCountPreference({channelUrl:n.url,countPreference:e},(function(e,r){var s=null;e||(s=n.myCountPreference=r.count_preference,n._setGroupChannelUnreadCount(n.unreadMessageCount,n.unreadMentionCount),i.cachedChannels[n.url]=n),t(e,s)}))}),t)}},{key:"resetMyHistory",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.resetMyHistory({channelUrl:t.url},(function(n,r){if(!n&&r.hasOwnProperty("ts_message_offset")){var i=G.get(t._iid).GroupChannel;t._messageOffsetTimestamp=r.ts_message_offset,i.cachedChannels[t.url]=t}e(n,r)}))}),e)}}],[{key:"MemberStateFilter",get:function(){return{ALL:"all",JOINED:"joined_only",INVITED:"invited_only",INVITED_BY_FRIEND:"invited_by_friend",INVITED_BY_NON_FRIEND:"invited_by_non_friend"}}},{key:"PushTriggerOption",get:function(){return{DEFAULT:"default",ALL:"all",MENTION_ONLY:"mention_only",OFF:"off"}}},{key:"CountPreference",get:function(){return{ALL:"all",UNREAD_MESSAGE_COUNT_ONLY:"unread_message_count_only",UNREAD_MENTION_COUNT_ONLY:"unread_mention_count_only",OFF:"off"}}},{key:"HiddenState",get:function(){return{UNHIDDEN:"unhidden",HIDDEN_ALLOW_AUTO_UNHIDE:"hidden_allow_auto_unhide",HIDDEN_PREVENT_AUTO_UNHIDE:"hidden_prevent_auto_unhide"}}},{key:"PublicChannelFilter",get:function(){return{ALL:"all",PUBLIC:"public",PRIVATE:"private"}}},{key:"SuperChannelFilter",get:function(){return{ALL:"all",SUPER:"super",NON_SUPER:"nonsuper",BROADCAST_ONLY:"broadcast_only"}}},{key:"UnreadChannelFilter",get:function(){return{ALL:"all",UNREAD_MESSAGE:"unread_message"}}},{key:"HiddenChannelFilter",get:function(){return{UNHIDDEN:"unhidden_only",HIDDEN:"hidden_only",HIDDEN_ALLOW_AUTO_UNHIDE:"hidden_allow_auto_unhide",HIDDEN_PREVENT_AUTO_UNHIDE:"hidden_prevent_auto_unhide"}}},{key:"Role",get:function(){return{OPERATOR:"operator",NONE:"none"}}},{key:"UnreadItemKey",get:function(){return{GROUP_CHANNEL_UNREAD_MENTION_COUNT:"group_channel_unread_mention_count",NONSUPER_UNREAD_MENTION_COUNT:"non_super_group_channel_unread_mention_count",SUPER_UNREAD_MENTION_COUNT:"super_group_channel_unread_mention_count",GROUP_CHANNEL_UNREAD_MESSAGE_COUNT:"group_channel_unread_message_count",NONSUPER_UNREAD_MESSAGE_COUNT:"non_super_group_channel_unread_message_count",SUPER_UNREAD_MESSAGE_COUNT:"super_group_channel_unread_message_count",GROUP_CHANNEL_INVITATION_COUNT:"group_channel_invitation_count",NONSUPER_INVITATION_COUNT:"non_super_group_channel_invitation_count",SUPER_INVITATION_COUNT:"super_group_channel_invitation_count"}}},{key:"cachedChannels",get:function(){return Me[this._iid]||(Me[this._iid]={}),Me[this._iid]}},{key:"buildFromSerializedData",value:function(e){var t=G.get(this._iid),n=t.User,r=t.Member,i=t.GroupChannel,s=t.BaseMessage,a=t.UserMessage,o=t.FileMessage,l=t.AdminMessage,u=me.deserialize(e),c=function(e){return null!=e&&"object"===h(e)?e.messageType===s.MESSAGE_TYPE_USER?new a(a.objectify(d(d({},e),{},{channel:{url:e.channelUrl,channelType:e.channelType},user:e.sender,mentionedUsers:e.mentionedUsers}))):e.messageType===s.MESSAGE_TYPE_FILE?new o(o.objectify(d(d({},e),{},{channel:{url:e.channelUrl,channelType:e.channelType},user:e.sender,mentionedUsers:e.mentionedUsers}))):new l(l.objectify(d(d({},e),{},{channel:{url:e.channelUrl,channelType:e.channelType},mentionedUsers:e.mentionedUsers}))):null}(u.lastMessage);return new i({channel_url:u.url,name:u.name,cover_url:u.coverUrl,data:u.data,custom_type:u.customType,invited_at:u.invitedAt,created_at:u.createdAt/1e3,joined_ts:u.joinedAt,is_access_code_required:u.isAccessCodeRequired,is_distinct:u.isDistinct,is_super:u.isSuper,is_broadcast:u.isBroadcast,is_public:u.isPublic,is_discoverable:u.isDiscoverable,is_hidden:u.isHidden,is_ephemeral:u.isEphemeral,is_muted:u.myMutedState,is_push_enabled:u.isPushEnabled,freeze:u.isFrozen,unread_message_count:u.unreadMessageCount,unread_mention_count:u.unreadMentionCount,push_trigger_option:u.myPushTriggerOption,count_preference:u.myCountPreference,hidden_state:u.hiddenState,member_count:u.memberCount,joined_member_count:u.joinedMemberCount,member_state:u.myMemberState,my_role:u.myRole,user_last_read:u.myLastRead,ts_message_offset:u.messageOffsetTimestamp,message_survival_seconds:u.messageSurvivalSeconds,read_receipt:u.cachedReadReceiptStatus,delivery_receipt:u.cachedDeliveryReceiptStatus,members:u.members.map((function(e){return r.objectify(d({user:e},e))})),last_message:c,created_by:null!==u.creator&&void 0!==u.creator&&"object"===h(u.creator)?n.objectify(u.creator):null,inviter:null!==u.inviter&&void 0!==u.inviter&&"object"===h(u.inviter)?n.objectify(u.inviter):null})}},{key:"upsert",value:function(e){var t=G.get(this._iid).GroupChannel,n=new t(e);if(t.cachedChannels.hasOwnProperty(n.url)){if(n.isEphemeral){var r=t.cachedChannels[n.url];e.last_message=r.lastMessage,e.unread_message_count=r.unreadMessageCount}t.cachedChannels[n.url].update(e)}else t.cachedChannels[n.url]=n;return t.cachedChannels[n.url]}},{key:"removeCachedChannel",value:function(e){var t=G.get(this._iid),n=t.GroupChannel,r=t.FileMessageQueue;n.cachedChannels[e]&&delete n.cachedChannels[e],r.delete(e)}},{key:"clearCache",value:function(){Me[this._iid]={},G.get(this._iid).FileMessageQueue.clear()}},{key:"getChannel",value:function(e,t){var n=null,r=null,i=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"string",optional:!0,nullable:!0,defaultValue:null}),new ae({type:"callback"})]),s=U(i,4);if(n=s[0],e=s[1],r=s[2],t=s[3],n)return _e(this._iid,(function(e){e(n,null)}),t);var a=G.get(this._iid),o=a.GroupChannel;return o.cachedChannels[e]?_e(this._iid,(function(t){t(null,o.cachedChannels[e])}),t):o.getChannelWithoutCache(e,r,t)}},{key:"getChannelWithoutCache",value:function(e,t){var n=this,r=null,i=null,s=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"string",optional:!0,nullable:!0,defaultValue:null}),new ae({type:"callback"})]),a=U(s,4);return r=a[0],e=a[1],i=a[2],t=a[3],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.getGroupChannel({channelUrl:e,internalCall:i,showMember:!0},(function(e,r){var i=null;e||(i=n.upsert(r)),t(e,i)}))}),t)}},{key:"createDistinctChannelIfNotExist",value:function(e,t){var n=this,r=G.get(this._iid),i=r.GroupChannelParams,s=null,a=ae.parse(arguments,[new ae({type:i,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),o=U(a,3);return s=o[0],e=o[1],t=o[2],_e(this._iid,(function(t){s?t(s,null):(e.isPublic||(e.accessCode=null),L.get(n._iid).container.apiClient.createGroupChannel(d(d({},e),{},{isDistinct:!0}),(function(e,r){var i=null;if(!e){var s=G.get(n._iid).GroupChannel;i={channel:new s(r),isCreated:r.is_created},s.cachedChannels[i.channel.url]=i.channel}t(e,i)})))}),t)}},{key:"createChannel",value:function(){var e=this,t=ae.toArray(arguments),n=void 0;"function"==typeof t[t.length-1]&&(n=t.pop());var r=G.get(this._iid),i=r.GroupChannel,s=r.GroupChannelParams;if(t[0]instanceof s&&1===t.length)return _e(this._iid,(function(n){var r=t[0];r.isPublic||(r.accessCode=null),r._validate()?L.get(e._iid).container.apiClient.createGroupChannel(r,(function(e,t){var r=null;e||(r=new i(t),i.cachedChannels[r.url]=r),n(e,r)})):n(ae.error,null)}),n);if(Array.isArray(t[0])){var a=new s;switch(t.length){case 1:a.addUsers(t[0]);break;case 2:a.addUsers(t[0]),a.isDistinct=t[1];break;case 3:a.addUsers(t[0]),a.isDistinct=t[1],a.customType=t[2];break;case 5:a.addUsers(t[0]),a.isDistinct=t[1],a.name=t[2],"string"==typeof t[3]?a.coverUrl=t[3]:a.coverImage=t[3],a.data=t[4];break;case 6:a.addUsers(t[0]),a.isDistinct=t[1],a.name=t[2],"string"==typeof t[3]?a.coverUrl=t[3]:a.coverImage=t[3],a.data=t[4],a.customType=t[5];break;default:return _e(this._iid,(function(e){return e(ae.error,null)}),n)}return n?i.createChannel(a,n):i.createChannel(a)}return _e(this._iid,(function(e){return e(ae.error,null)}),n)}},{key:"createChannelWithUserIds",value:function(){var e=ae.toArray(arguments),t=void 0;"function"==typeof e[e.length-1]&&(t=e.pop());var n=G.get(this._iid),r=n.GroupChannel,i=n.GroupChannelParams,s=new i;switch(e.length){case 1:s.addUserIds(e[0]);break;case 2:s.addUserIds(e[0]),s.isDistinct=e[1];break;case 3:s.addUserIds(e[0]),s.isDistinct=e[1],s.customType=e[2];break;case 5:s.addUserIds(e[0]),s.isDistinct=e[1],s.name=e[2],"string"==typeof e[3]?s.coverUrl=e[3]:s.coverImage=e[3],s.data=e[4];break;case 6:s.addUserIds(e[0]),s.isDistinct=e[1],s.name=e[2],"string"==typeof e[3]?s.coverUrl=e[3]:s.coverImage=e[3],s.data=e[4],s.customType=e[5];break;default:return _e(this._iid,(function(e){return e(ae.error,null)}),t)}return r.createChannel(s,t)}},{key:"createMyGroupChannelListQuery",value:function(){return new(0,G.get(this._iid).GroupChannelListQuery)}},{key:"createPublicGroupChannelListQuery",value:function(){return new(0,G.get(this._iid).PublicGroupChannelListQuery)}},{key:"markAsReadAllLastSentAt",get:function(){return Pe[this._iid]||0},set:function(e){Pe[this._iid]=e}},{key:"getChannelCount",value:function(e,t){return fn.getInstance(this._iid).getGroupChannelCount(e,t)}},{key:"getUnreadItemCount",value:function(e,t){return fn.getInstance(this._iid).getUnreadItemCount(e,t)}},{key:"getTotalUnreadMessageCount",value:function(){var e=ae.toArray(arguments),t="function"==typeof e[e.length-1]?e.pop():null,n=fn.getInstance(this._iid);return n.getTotalUnreadMessageCount.apply(n,O(e).concat([t]))}},{key:"getTotalUnreadChannelCount",value:function(e){return fn.getInstance(this._iid).getTotalUnreadChannelCount(e)}}]),n}(ke),Ge=function(e){m(n,e);var t=k(n);function n(e){var r;return p(this,n),(r=t.call(this,e)).state="",r.role="",r.isMuted=!1,r.isBlockedByMe=!1,r.isBlockingMe=!1,r.restrictionInfo=null,e&&r._update(e),r}return g(n,[{key:"_update",value:function(e){var t=G.get(this._iid),n=t.RestrictedUser,r=t.RestrictionInfo;this.state=e.state,this.role=e.role||Fe.Role.NONE,e.hasOwnProperty("is_muted")&&(this.isMuted=e.is_muted),e.hasOwnProperty("is_blocked_by_me")&&(this.isBlockedByMe=e.is_blocked_by_me),e.hasOwnProperty("is_blocking_me")&&(this.isBlockingMe=e.is_blocking_me),this.isMuted&&(this.restrictionInfo=new r(e),this.restrictionInfo.restrictionType=n.RestrictionType.MUTED)}},{key:"parse",value:function(e){this._update(e)}}],[{key:"objectify",value:function(e){var t=G.get(this._iid),n=t.User,r=t.RestrictedUser,i=t.RestrictionInfo,s=e.user,a=e.state,o=e.role,l=void 0===o?"":o,u=e.isMuted,c=void 0!==u&&u,d=e.isBlockedByMe,h=void 0!==d&&d,p=e.isBlockingMe,f=void 0!==p&&p,g=e.restrictionInfo,y=void 0===g?null:g,m=c?r.objectify(s):n.objectify(s);if(m.state=a,m.role=l,m.is_muted=c,m.is_blocked_by_me=h,m.is_blocking_me=f,y){var _=i.objectify(y);m.restriction_type=_.restriction_type,m.muted_description=_.description,m.muted_end_at=_.end_at}return m}},{key:"build",value:function(e,t,n,r,i,s){var a=G.get(this._iid).User;return this.objectify({user:new a(e),state:t,role:n,isMuted:r,isBlockedByMe:i,isBlockingMe:s})}},{key:"buildFromSerializedData",value:function(e){var t=G.get(this._iid).Member,n=me.deserialize(e);return new t(t.objectify(d({user:n},n)))}},{key:"JOINED",get:function(){return"joined"}},{key:"INVITED",get:function(){return"invited"}}]),n}(be),xe=function(e){m(n,e);var t=k(n);function n(e){var r;return p(this,n),(r=t.call(this,e)).role="",r.isBlockedByMe=!1,e&&r._update(e),r}return g(n,[{key:"parse",value:function(e){this._update(e)}},{key:"_update",value:function(e){this.role=e.role||Fe.Role.NONE,e.hasOwnProperty("is_blocked_by_me")&&(this.isBlockedByMe=e.is_blocked_by_me)}}],[{key:"objectify",value:function(e){var t=G.get(this._iid).User,n=e.user,r=e.role,i=void 0===r?"":r,s=e.isBlockedByMe,a=void 0!==s&&s,o=t.objectify(n);return o.role=i,o.is_blocked_by_me=a,o}},{key:"build",value:function(e,t){var n=G.get(this._iid).User;return this.objectify({user:new n(e),isBlockedByMe:t})}},{key:"buildFromSerializedData",value:function(e){var t=G.get(this._iid).Sender,n=me.deserialize(e);return new t(t.objectify(d({user:n},n)))}}]),n}(be),je=function(e){m(n,e);var t=k(n);function n(e){var r;return p(this,n),(r=t.call(this,e)).restrictionInfo=null,e&&r._update(e),r}return g(n,[{key:"_update",value:function(e){var t=G.get(this._iid).RestrictionInfo;this.restrictionInfo=new t(e)}}],[{key:"RestrictionType",get:function(){return{MUTED:"muted",BANNED:"banned"}}},{key:"objectify",value:function(e){var t=G.get(this._iid),n=t.User,r=t.RestrictionInfo,i=e.restrictionInfo,s=void 0===i?{}:i;return d(d({},n.objectify(e)),r.objectify(s))}}]),n}(be),Be=function(){function e(t){p(this,e),this.emojiHash=null,this.emojiCategories=null,t&&this._update(t)}return g(e,[{key:"_update",value:function(e){var t=G.get(this._iid).EmojiCategory;this.emojiHash=e.emoji_hash||"",this.emojiCategories=e.emoji_categories?e.emoji_categories.map((function(e){return new t(e)})):[]}}]),e}(),qe=function(){function e(t){p(this,e),this.id=null,this.name=null,this.url=null,this.emojis=null,t&&this._update(t)}return g(e,[{key:"_update",value:function(e){var t=G.get(this._iid).Emoji;this.id=e.id||0,this.name=e.name||"",this.url=e.url||"",this.emojis=e.emojis?e.emojis.map((function(e){return new t(e)})):[]}}]),e}(),ze=function(){function e(t){p(this,e),this.key=null,this.url=null,t&&this._update(t)}return g(e,[{key:"_update",value:function(e){this.key=e.key,this.url=e.url}}]),e}(),Ye={},Ke={},Ve=new WeakMap,Qe=function(e){m(n,e);var t=k(n);function n(e){var r;return p(this,n),(r=t.call(this,e)).channelType=ke.CHANNEL_TYPE_OPEN,r.participantCount=0,Ve.set(S(r),0),r.operators=[],e&&r._update(e),r}return g(n,[{key:"_update",value:function(e){var t=G.get(this._iid).User;e.hasOwnProperty("participant_count")&&(this.participantCount=parseInt(e.participant_count)),e.hasOwnProperty("operators")&&Array.isArray(e.operators)&&(this.operators=e.operators.map((function(e){return new t(e)})))}},{key:"parse",value:function(e){this._update(e)}},{key:"update",value:function(e){this.__update(e),this._update(e)}},{key:"createParticipantListQuery",value:function(){return new(0,G.get(this._iid).ParticipantListQuery)({channelUrl:this.url})}},{key:"createMutedUserListQuery",value:function(){return new(0,G.get(this._iid).MutedUserListQuery)({channelUrl:this.url,isOpenChannel:!0})}},{key:"createBannedUserListQuery",value:function(){return new(0,G.get(this._iid).BannedUserListQuery)({channelUrl:this.url,isOpenChannel:!0})}},{key:"isOperator",value:function(e){return!!e&&this.isOperatorWithUserId(e.userId)}},{key:"isOperatorWithUserId",value:function(e){return this.operators.map((function(e){return e.userId})).indexOf(e)>-1}},{key:"refresh",value:function(e){return G.get(this._iid).OpenChannel.getChannelWithoutCache(this.url,e)}},{key:"enter",value:function(e){var t=this;return _e(this._iid,(function(e){var n=G.get(t._iid).Command.bEnter({channelUrl:t.url}),r=fn.getInstance(t._iid);r.sendCommand(n,(function(n,i){if(r.getErrorFirstCallback()){var s=[n,i];i=s[0],n=s[1]}i?(i=i?new D(i.message,i.code):null,e(i,null)):(G.get(t._iid).OpenChannel.enteredChannels[t.url]=t,t.refresh((function(){return e(null,null)})))}))}),e)}},{key:"exit",value:function(e){var t=this;return _e(this._iid,(function(e){var n=G.get(t._iid),r=n.Command,i=n.FileMessageQueue,s=r.bExit({channelUrl:t.url}),a=fn.getInstance(t._iid);a.sendCommand(s,(function(n,r){if(a.getErrorFirstCallback()){var s=[n,r];r=s[0],n=s[1]}r?(r=r?new D(r.message,r.code):null,e(r,null)):(delete G.get(t._iid).OpenChannel.enteredChannels[t.url],i.delete(t.url),e(null,null))}))}),e)}},{key:"updateChannel",value:function(){var e=this,t=ae.toArray(arguments),n=null;"function"==typeof t[t.length-1]&&(n=t.pop());var r=G.get(this._iid),i=r.OpenChannel,s=r.OpenChannelParams;if(t[0]instanceof s&&1===t.length)return _e(this._iid,(function(n){var r=t[0];r.channelUrl=e.url,r._validate()?L.get(e._iid).container.apiClient.updateOpenChannel(r,(function(e,t){var r=null;e||(r=i.upsert(t)),n(e,r)})):n(ae.error,null)}),n);if(3===t.length){var a=new s;return a.channelUrl=this.url,a.name=t[0],a.coverUrlOrImage=t[1],a.data=t[2],a.operatorUserIds=this.operators.map((function(e){return e.userId})),this.updateChannel(a,n)}if(4===t.length){var o=new s;return o.channelUrl=this.url,o.name=t[0],o.coverUrlOrImage=t[1],o.data=t[2],Array.isArray(t[3])&&(o.operatorUserIds=t[3]),this.updateChannel(o,n)}if(5===t.length){var l=new s;return l.channelUrl=this.url,l.name=t[0],l.coverUrlOrImage=t[1],l.data=t[2],Array.isArray(t[3])&&(l.operatorUserIds=t[3]),l.customType=t[4],this.updateChannel(l,n)}return _e(this._iid,(function(e){return e(ae.error,null)}),n)}},{key:"updateChannelWithOperatorUserIds",value:function(){var e=ae.toArray(arguments),t=void 0;switch("function"==typeof e[e.length-1]&&(t=e.pop()),e.length){case 4:case 5:return this.updateChannel.apply(this,O(e).concat([t]));default:return _e(this._iid,(function(e){return e(ae.error,null)}),t)}}},{key:"muteUser",value:function(e,t,n,r){return this.muteUserWithUserId(e?e.userId:null,t,n,r)}},{key:"muteUserWithUserId",value:function(e,t,n,r){var i=this,s=null,a=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"number",optional:!0,defaultValue:-1,constraint:function(e){return e>=-1}}),new ae({type:"string",optional:!0,defaultValue:""}),new ae({type:"callback"})]),o=U(a,5);return s=o[0],e=o[1],t=o[2],n=o[3],r=o[4],_e(this._iid,(function(r){s?r(s,null):L.get(i._iid).container.apiClient.muteUser({channelUrl:i.url,userId:e,description:n,seconds:t,isGroupChannel:!1},(function(e,t){r(e,null)}))}),r)}},{key:"unmuteUser",value:function(e,t){return this.unmuteUserWithUserId(e?e.userId:null,t)}},{key:"unmuteUserWithUserId",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.unmuteUser({channelUrl:n.url,userId:e,isGroupChannel:!1},(function(e,n){t(e,null)}))}),t)}},{key:"banUser",value:function(e,t,n){return this.banUserWithUserId(e?e.userId:null,t,n)}},{key:"banUserWithUserId",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"number",optional:!0,defaultValue:-1,constraint:function(e){return e>=-1}}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.banUser({channelUrl:r.url,userId:e,description:null,seconds:t,isGroupChannel:!1},(function(e,t){n(e,null)}))}),n)}},{key:"unbanUser",value:function(e,t){return this.unbanUserWithUserId(e?e.userId:null,t)}},{key:"unbanUserWithUserId",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.unbanUser({channelUrl:n.url,userId:e,isGroupChannel:!1},(function(e,n){t(e,null)}))}),t)}},{key:"setLatestParticipantCount",value:function(e,t){var n=!1;return"number"==typeof e&&"number"==typeof t&&t>=Ve.get(this)&&(Ve.set(this,t),n=e!==this.participantCount,this.participantCount=e),n}},{key:"delete",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.deleteOpenChannel({channelUrl:t.url},(function(n,r){n||(delete G.get(t._iid).OpenChannel.cachedChannels[t.url],G.get(t._iid).FileMessageQueue.delete(t.url)),e(n,r)}))}),e)}}],[{key:"cachedChannels",get:function(){return Ye[this._iid]||(Ye[this._iid]={}),Ye[this._iid]}},{key:"enteredChannels",get:function(){return Ke[this._iid]||(Ke[this._iid]={}),Ke[this._iid]}},{key:"buildFromSerializedData",value:function(e){var t=G.get(this._iid),n=t.User,r=t.OpenChannel,i=me.deserialize(e);return new r({channel_url:i.url,name:i.name,cover_url:i.coverUrl,data:i.data,custom_type:i.customType,created_at:i.createdAt/1e3,freeze:i.isFrozen,is_ephemeral:i.isEphemeral,participant_count:i.participantCount,operators:i.operators.map((function(e){return n.objectify(e)}))})}},{key:"getChannel",value:function(e,t){var n=null,r=null,i=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"string",optional:!0,nullable:!0,defaultValue:null}),new ae({type:"callback"})]),s=U(i,4);if(n=s[0],e=s[1],r=s[2],t=s[3],n)return _e(this._iid,(function(e){e(n,null)}),t);var a=G.get(this._iid),o=a.OpenChannel;return o.cachedChannels[e]?_e(this._iid,(function(t){t(null,o.cachedChannels[e])}),t):o.getChannelWithoutCache(e,r,t)}},{key:"getChannelWithoutCache",value:function(e,t){var n=this,r=null,i=null,s=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"string",optional:!0,nullable:!0,defaultValue:null}),new ae({type:"callback"})]),a=U(s,4);return r=a[0],e=a[1],i=a[2],t=a[3],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.getOpenChannel({channelUrl:e,internalCall:i},(function(e,r){var i=null;e||(i=G.get(n._iid).OpenChannel.upsert(r)),t(e,i)}))}),t)}},{key:"createChannel",value:function(){var e=this,t=ae.toArray(arguments),n=null;"function"==typeof t[t.length-1]&&(n=t.pop());var r=G.get(this._iid),i=r.OpenChannel,s=r.OpenChannelParams;if(t[0]instanceof s&&1===t.length)return _e(this._iid,(function(n){var r=t[0];r._validate()?L.get(e._iid).container.apiClient.createOpenChannel(r,(function(t,r){var i=null;t||(i=G.get(e._iid).OpenChannel.upsert(r)),n(t,i)})):n(ae.error,null)}),n);var a=new s;switch(t.length){case 0:break;case 1:a.name=t[0];break;case 2:a.name=t[0],a.coverUrlOrImage=t[1];break;case 3:a.name=t[0],a.coverUrlOrImage=t[1],a.data=t[2];break;case 4:a.name=t[0],a.coverUrlOrImage=t[1],a.data=t[2],a.operatorUserIds=t[3];break;case 5:a.name=t[0],a.coverUrlOrImage=t[1],a.data=t[2],a.operatorUserIds=t[3],a.customType=t[4];break;default:return _e(this._iid,(function(e){return e(ae.error,null)}),n)}return n?i.createChannel(a,n):i.createChannel(a)}},{key:"createChannelWithOperatorUserIds",value:function(){var e=ae.toArray(arguments),t=void 0;switch("function"==typeof e[e.length-1]&&(t=e.pop()),e.length){case 4:case 5:return this.createChannel.apply(this,O(e).concat([t]));default:return _e(this._iid,(function(e){return e(ae.error,null)}),t)}}},{key:"upsert",value:function(e){var t=new(0,G.get(this._iid).OpenChannel)(e);return this.cachedChannels.hasOwnProperty(t.url)?this.cachedChannels[t.url].update(e):this.cachedChannels[t.url]=t,this.cachedChannels[t.url]}},{key:"removeCachedChannel",value:function(e){this.cachedChannels[e]&&delete this.cachedChannels[e],G.get(this._iid).FileMessageQueue.delete(e)}},{key:"clearCache",value:function(){Ye[this._iid]={},G.get(this._iid).FileMessageQueue.clear()}},{key:"clearEnteredChannels",value:function(){Ke[this._iid]={}}},{key:"createOpenChannelListQuery",value:function(){return new(0,G.get(this._iid).OpenChannelListQuery)}}]),n}(ke),We=function(e){m(n,e);var t=k(n);function n(e){var r;return p(this,n),(r=t.call(this,e)).messageType=Ce.MESSAGE_TYPE_USER,r.message=null,r._sender=null,r.reqId="",r.translations={},r.requestState=null,r.requestedMentionUserIds=[],r.errorCode=0,r.messageSurvivalSeconds=-1,r.plugins=[],r.poll=null,e&&r._update(e),r}return g(n,[{key:"applyPollUpdateEvent",value:function(e){var t=G.get(this._iid),n=t.Poll,r=t.PollUpdateEvent,i=null,s=ae.parse(arguments,[new ae({type:r,constraint:function(e){return Object.values(n.Status).includes(e.status)}})]),a=U(s,2);if(i=a[0],e=a[1],!i&&this.poll&&this.poll.id===e.poll.id){if(e.status===n.Status.REMOVED)return this.poll=new n(n.objectify(this.poll)),this.poll.details.status=e.status,!0;if(this.poll.details.updatedAt<e.poll.details.updatedAt)return this.poll=e.poll,!0}return!1}},{key:"applyPollVoteEvent",value:function(e){var t=G.get(this._iid),n=t.PollVoteEvent,r=null,i=ae.parse(arguments,[new ae({type:n})]),s=U(i,2);if(r=s[0],e=s[1],!r&&this.poll&&this.poll.id===e.pollId){var a,o=N(this.poll.details.options);try{for(o.s();!(a=o.n()).done;){var l=a.value;if(l._applyEvent(e))return!0}}catch(r){o.e(r)}finally{o.f()}}return!1}},{key:"_update",value:function(e){var t=fn.getInstance(this._iid),n=G.get(this._iid),r=n.Sender,i=n.Plugin,s=n.Poll;this.message=String(e.message),this._sender=new r(e.user),this.reqId=e.hasOwnProperty("req_id")?String(e.req_id):"",this.translations=e.hasOwnProperty("translations")?e.translations:{},this.requestState=this.messageId>0?t.MessageRequestState.SUCCEEDED:t.MessageRequestState.FAILED,e.hasOwnProperty("sending_status")&&(this.requestState=e.sending_status,this.requestState===t.MessageSendingStatus.CANCELED&&(this.requestState=t.MessageRequestState.FAILED)),this.requestedMentionUserIds=[],e.hasOwnProperty("requested_mention_user_ids")&&(this.requestedMentionUserIds=e.requested_mention_user_ids),this.errorCode=0,e.hasOwnProperty("error_code")&&(this.errorCode=e.error_code),this.messageSurvivalSeconds=-1,e.hasOwnProperty("message_survival_seconds")&&(this.messageSurvivalSeconds=e.message_survival_seconds),this.plugins=[],e.hasOwnProperty("plugins")&&Array.isArray(e.plugins)&&(this.plugins=e.plugins.map((function(e){return new i(e)}))),this.poll=null,e.hasOwnProperty("poll")&&(this.poll=new s(e.poll))}},{key:"sender",get:function(){var e=fn.getInstance(this._iid),t=G.get(this._iid).GroupChannel;if(e.Options.useMemberAsMessageSender&&this.isGroupChannel()){var n=t.cachedChannels[this.channelUrl];if(n){var r=n.memberMap[this._sender.userId];r&&(this._sender.nickname!==r.nickname&&(this._sender.nickname=r.nickname),this._sender.plainProfileUrl!==r.plainProfileUrl&&(this._sender.plainProfileUrl=r.plainProfileUrl),ee.deepEqual(this._sender.metaData,r.metaData)||(this._sender.metaData=r.metaData))}}return this._sender},set:function(e){this._sender=e}},{key:"isResendable",value:function(){var e=fn.getInstance(this._iid);return this.sendingStatus===e.MessageSendingStatus.FAILED&&ee.isResendableError(this.errorCode)}}],[{key:"objectify",value:function(e){var t=fn.getInstance(this._iid),n=G.get(this._iid),r=n.BaseChannel,i=n.BaseMessageParams,s=n.Sender,a=n.User,o=n.UserMessage,l=n.FileMessage,u=n.AdminMessage,c=n.ThreadInfo,d=n.OGMetaData,h=n.Plugin,p=n.AppleCriticalAlertOptions,f=n.Poll,g=e.messageId,y=e.reqId,m=void 0===y?"":y,_=e.user,v=e.channel,E=e.message,C=e.data,b=void 0===C?"":C,S=e.customType,A=void 0===S?"":S,k=e.mentionType,I=void 0===k?i.MentionType.USERS:k,U=e.mentionedUsers,O=void 0===U?[]:U,T=e.mentionedUserIds,R=void 0===T?[]:T,N=e.requestedMentionUserIds,w=void 0===N?[]:N,M=e.reactions,P=void 0===M?[]:M,L=e.metaArrays,D=void 0===L?[]:L,H=e.rootMessageId,F=void 0===H?0:H,x=e.parentMessageId,j=void 0===x?0:x,B=e.parentMessageText,q=void 0===B?"":B,z=e.threadInfo,Y=void 0===z?null:z,K=e.isReplyToChannel,V=void 0!==K&&K,Q=e.parentMessage,W=void 0===Q?null:Q,J=e.translations,X=void 0===J?{}:J,$=e.sendingStatus,Z=e.errorCode,ee=void 0===Z?0:Z,te=e.silent,ne=void 0!==te&&te,re=e.isGlobalBlocked,ie=void 0!==re&&re,se=e.messageSurvivalSeconds,ae=void 0===se?-1:se,oe=e.ogMetaData,le=void 0===oe?null:oe,ue=e.isOperatorMessage,ce=void 0!==ue&&ue,de=e.plugins,he=void 0===de?[]:de,pe=e.appleCriticalAlertOptions,fe=e.poll,ge=void 0===fe?null:fe,ye=e.createdAt,me=e.updatedAt,_e=void 0===me?0:me,ve={};if(ve.req_id=m,ve.msg_id=g,ve.user=s.objectify({user:_,role:t.currentUser&&t.currentUser.userId===_.userId?v.myRole:_.role,isBlockedByMe:_.isBlockedByMe}),ve.channel_url=v.url,ve.channel_type=v.channelType===r.CHANNEL_TYPE_OPEN?r.CHANNEL_TYPE_OPEN:r.CHANNEL_TYPE_GROUP,ve.message=E,ve.data=b,ve.custom_type=A,ve.translations=X,ve.is_global_block=!!ie,ve.ts=ye,ve.updated_at=_e,ve.mention_type=I,ve.mentioned_users=O.map((function(e){return a.objectify(e)})),ve.mentioned_user_ids=R,ve.requested_mention_user_ids=w,ve.reactions=P.map((function(e){return e.serialize()})),ve.metaarray={},D.forEach((function(e){var t=e.key;ve.metaarray[t]=e.value})),ve.metaarray_key_order=D.map((function(e){return e.key})),ve.root_message_id=F,ve.parent_message_id=j,ve.parent_message_text=q,Y&&(ve.thread_info=c.objectify(Y)),ve.is_reply_to_channel=V,W)switch(W.messageType){case r.MESSAGE_TYPE_USER:ve.parent_message_info=o.objectify(W);break;case r.MESSAGE_TYPE_FILE:ve.parent_message_info=l.objectify(W);break;case r.MESSAGE_TYPE_ADMIN:ve.parent_message_info=u.objectify(W)}return ve.sending_status=g>0?t.MessageSendingStatus.SUCCEEDED:t.MessageSendingStatus.FAILED,$&&(ve.sending_status=$),ve.silent=!!ne,ve.error_code=ee,ve.message_survival_seconds=ae,le&&(ve.og_tag=d.objectify(le)),ve.is_op_msg=!!ce,ve.plugins=he.map((function(e){return h.objectify(e)})),ge&&(ve.poll=f.objectify(ge)),pe&&(ve.apple_critical_alert_options=p.objectify(pe)),ve}},{key:"build",value:function(e,t,n,r,i,s,a,o,l,u,c,d,h,p,f,g,y,m,_,v,E,C,b,S,A,k,I,U,O){return this.objectify({messageId:t,reqId:e,user:n,channel:r,message:i,data:s,customType:a,mentionType:p,mentionedUsers:f,mentionedUserIds:v,requestedMentionUserIds:C,reactions:h,metaArrays:d,rootMessageId:g,parentMessageId:y,parentMessageText:m,threadInfo:_,translations:o,sendingStatus:E,errorCode:b,isGlobalBlocked:l,messageSurvivalSeconds:S,ogMetaData:A,isOperatorMessage:k,plugins:I,appleCriticalAlertOptions:U,poll:O,createdAt:u,updatedAt:c})}},{key:"buildFromSerializedData",value:function(e){var t=G.get(this._iid).UserMessage,n=me.deserialize(e);return new t(t.objectify(d(d({},n),{},{channel:{url:n.channelUrl,channelType:n.channelType},user:n.sender})))}}]),n}(Ce),Je=function(e){m(n,e);var t=k(n);function n(e){var r;return p(this,n),(r=t.call(this,e)).messageType=Ce.MESSAGE_TYPE_FILE,r.plainUrl=null,r.name="File",r.size=0,r.type=null,r.thumbnails=[],r._sender=null,r.reqId="",r.requireAuth=null,r.requestState=null,r.requestedMentionUserIds=[],r.errorCode=0,r.messageSurvivalSeconds=-1,e&&r._update(e),r}return g(n,[{key:"_update",value:function(e){var t=fn.getInstance(this._iid),n=L.get(this._iid).container.auth,r=G.get(this._iid).Sender;if(this._sender=new r(e.user),this.requireAuth=!!e.hasOwnProperty("require_auth")&&e.require_auth,this.plainUrl=String(e.url).split("?auth=")[0],Object.defineProperty(this,"url",{value:this.requireAuth?"".concat(this.plainUrl,"?auth=").concat(n.eKey):this.plainUrl,configurable:!0,writable:!1}),this.name=e.hasOwnProperty("name")?e.name:"File",this.size=parseInt(e.size)||0,this.type=String(e.type),e.hasOwnProperty("custom")&&(this.data=String(e.custom)),this.reqId=e.hasOwnProperty("req_id")?String(e.req_id):"",this.thumbnails=e.hasOwnProperty("thumbnails")?e.thumbnails:[],this.requireAuth)for(var i=0;i<this.thumbnails.length;i++)this.thumbnails[i].plainUrl=String(this.thumbnails[i].url).split("?auth=")[0],this.thumbnails[i].url=this.requireAuth?"".concat(this.thumbnails[i].plainUrl,"?auth=").concat(n.eKey):this.thumbnails[i].plainUrl;this.requestState=this.messageId>0?t.MessageRequestState.SUCCEEDED:t.MessageRequestState.FAILED,e.hasOwnProperty("sending_status")&&(this.requestState=e.sending_status,this.requestState===t.MessageSendingStatus.CANCELED&&(this.requestState=t.MessageRequestState.FAILED)),this.requestedMentionUserIds=[],e.hasOwnProperty("requested_mention_user_ids")&&(this.requestedMentionUserIds=e.requested_mention_user_ids),this.errorCode=0,e.hasOwnProperty("error_code")&&(this.errorCode=e.error_code),this.messageSurvivalSeconds=-1,e.hasOwnProperty("message_survival_seconds")&&(this.messageSurvivalSeconds=e.message_survival_seconds)}},{key:"sender",get:function(){var e=fn.getInstance(this._iid),t=G.get(this._iid).GroupChannel;if(e.Options.useMemberAsMessageSender&&this.isGroupChannel()){var n=t.cachedChannels[this.channelUrl];if(n){var r=n.memberMap[this._sender.userId];r&&(this._sender.nickname!==r.nickname&&(this._sender.nickname=r.nickname),this._sender.plainProfileUrl!==r.plainProfileUrl&&(this._sender.plainProfileUrl=r.plainProfileUrl),ee.deepEqual(this._sender.metaData,r.metaData)||(this._sender.metaData=r.metaData))}}return this._sender},set:function(e){this._sender=e}},{key:"isResendable",value:function(){var e=fn.getInstance(this._iid);return this.sendingStatus===e.MessageSendingStatus.FAILED&&ee.isResendableError(this.errorCode)}}],[{key:"objectify",value:function(e){var t=fn.getInstance(this._iid),n=G.get(this._iid),r=n.BaseChannel,i=n.BaseMessageParams,s=n.Sender,a=n.User,o=n.UserMessage,l=n.FileMessage,u=n.AdminMessage,c=n.ThreadInfo,d=n.OGMetaData,h=n.AppleCriticalAlertOptions,p=e.messageId,f=e.reqId,g=void 0===f?"":f,y=e.user,m=void 0===y?{}:y,_=e.channel,v=e.plainUrl,E=e.name,C=e.type,b=e.size,S=void 0===b?0:b,A=e.data,k=void 0===A?"":A,I=e.customType,U=void 0===I?"":I,O=e.mentionType,T=void 0===O?i.MentionType.USERS:O,R=e.mentionedUsers,N=void 0===R?[]:R,w=e.mentionedUserIds,M=void 0===w?[]:w,P=e.requestedMentionUserIds,L=void 0===P?[]:P,D=e.reactions,H=void 0===D?[]:D,F=e.metaArrays,x=void 0===F?[]:F,j=e.rootMessageId,B=void 0===j?0:j,q=e.parentMessageId,z=void 0===q?0:q,Y=e.parentMessageText,K=void 0===Y?"":Y,V=e.threadInfo,Q=void 0===V?null:V,W=e.isReplyToChannel,J=void 0!==W&&W,X=e.parentMessage,$=void 0===X?null:X,Z=e.thumbnails,ee=void 0===Z?[]:Z,te=e.requireAuth,ne=void 0!==te&&te,re=e.sendingStatus,ie=e.errorCode,se=void 0===ie?0:ie,ae=e.silent,oe=void 0!==ae&&ae,le=e.isGlobalBlocked,ue=void 0!==le&&le,ce=e.messageSurvivalSeconds,de=void 0===ce?-1:ce,he=e.ogMetaData,pe=void 0===he?null:he,fe=e.isOperatorMessage,ge=void 0!==fe&&fe,ye=e.appleCriticalAlertOptions,me=e.createdAt,_e=e.updatedAt,ve=void 0===_e?0:_e,Ee={};Ee.req_id=g,Ee.msg_id=p,Ee.user=s.objectify({user:m,role:t.currentUser&&t.currentUser.userId===m.userId?_.myRole:m.role,isBlockedByMe:m.isBlockedByMe}),Ee.channel_url=_.url,Ee.channel_type=_.channelType===r.CHANNEL_TYPE_OPEN?r.CHANNEL_TYPE_OPEN:r.CHANNEL_TYPE_GROUP,Ee.url=v,Ee.name=E,Ee.type=C,Ee.size=S,Ee.custom=k,Ee.custom_type=U,Ee.thumbnails=ee,Ee.require_auth=ne,Ee.is_global_block=!!ue,Ee.ts=me,Ee.updated_at=ve,Ee.mention_type=T,Ee.mentioned_users=N.map((function(e){return a.objectify(e)})),Ee.mentioned_user_ids=M,Ee.requested_mention_user_ids=L,Ee.reactions=H.map((function(e){return e.serialize()})),Ee.metaarray={};for(var Ce=0;Ce<x.length;Ce++){var be=x[Ce].key;Ee.metaarray[be]=x[Ce].value}if(Ee.metaarray_key_order=x.map((function(e){return e.key})),Ee.root_message_id=B,Ee.parent_message_id=z,Ee.parent_message_text=K,Q&&(Ee.thread_info=c.objectify(Q)),Ee.is_reply_to_channel=J,$)switch($.messageType){case r.MESSAGE_TYPE_USER:Ee.parent_message_info=o.objectify($);break;case r.MESSAGE_TYPE_FILE:Ee.parent_message_info=l.objectify($);break;case r.MESSAGE_TYPE_ADMIN:Ee.parent_message_info=u.objectify($)}return Ee.sending_status=p>0?t.MessageSendingStatus.SUCCEEDED:t.MessageSendingStatus.FAILED,re&&(Ee.sending_status=re),Ee.silent=!!oe,Ee.error_code=se,Ee.message_survival_seconds=de,pe&&(Ee.og_tag=d.objectify(pe)),Ee.is_op_msg=!!ge,ye&&(Ee.apple_critical_alert_options=h.objectify(ye)),Ee}},{key:"build",value:function(e,t,n,r,i,s,a,o,l,u,c,d,h,p,f,g,y,m,_,v,E,C,b,S,A,k,I,U,O,T,R){return this.objectify({messageId:t,reqId:e,user:n,channel:r,plainUrl:i,name:s,type:a,size:o,data:l,customType:u,mentionType:m,mentionedUsers:_,mentionedUserIds:S,requestedMentionUserIds:k,reactions:y,metaArrays:g,rootMessageId:v,parentMessageId:E,parentMessageText:C,threadInfo:b,thumbnails:h,requireAuth:p,sendingStatus:A,errorCode:I,isGlobalBlocked:c,messageSurvivalSeconds:U,ogMetaData:O,isOperatorMessage:T,appleCriticalAlertOptions:R,createdAt:d,updatedAt:f})}},{key:"buildFromSerializedData",value:function(e){var t=G.get(this._iid).FileMessage,n=me.deserialize(e);return new t(t.objectify(d(d({},n),{},{channel:{url:n.channelUrl,channelType:n.channelType},user:n.sender})))}}]),n}(Ce),Xe=function(e){m(n,e);var t=k(n);function n(e){var r;return p(this,n),(r=t.call(this,e)).messageType=Ce.MESSAGE_TYPE_ADMIN,r.message="",r.translations={},e&&r._update(e),r}return g(n,[{key:"_update",value:function(e){this.message=String(e.message),this.translations=e.hasOwnProperty("translations")?e.translations:{}}}],[{key:"objectify",value:function(e){var t=G.get(this._iid),n=t.BaseChannel,r=t.BaseMessageParams,i=t.UserMessage,s=t.FileMessage,a=t.AdminMessage,o=t.User,l=t.ThreadInfo,u=t.OGMetaData,c=e.messageId,d=e.channel,h=e.message,p=e.data,f=void 0===p?"":p,g=e.customType,y=void 0===g?"":g,m=e.mentionType,_=void 0===m?r.MentionType.USERS:m,v=e.mentionedUsers,E=void 0===v?[]:v,C=e.reactions,b=void 0===C?[]:C,S=e.metaArrays,A=void 0===S?[]:S,k=e.rootMessageId,I=void 0===k?0:k,U=e.parentMessageId,O=void 0===U?0:U,T=e.parentMessageText,R=void 0===T?"":T,N=e.threadInfo,w=void 0===N?null:N,M=e.isReplyToChannel,P=void 0!==M&&M,L=e.parentMessage,D=void 0===L?null:L,H=e.translations,F=void 0===H?{}:H,x=e.silent,j=void 0!==x&&x,B=e.ogMetaData,q=void 0===B?null:B,z=e.createdAt,Y=e.updatedAt,K=void 0===Y?0:Y,V={msg_id:c,channel_url:d.url,channel_type:d.channelType===n.CHANNEL_TYPE_OPEN?n.CHANNEL_TYPE_OPEN:n.CHANNEL_TYPE_GROUP,message:h,data:f,custom_type:y,silent:j,ts:z,updated_at:K};V.translations=F,V.mention_type=_,V.mentioned_users=E.map((function(e){return o.objectify(e)})),V.reactions=b.map((function(e){return e.serialize()})),V.metaarray={};for(var Q=0;Q<A.length;Q++){var W=A[Q].key;V.metaarray[W]=A[Q].value}if(V.metaarray_key_order=A.map((function(e){return e.key})),V.root_message_id=I,V.parent_message_id=O,V.parent_message_text=R,w&&(V.thread_info=l.objectify(w)),V.is_reply_to_channel=P,D)switch(D.messageType){case n.MESSAGE_TYPE_USER:V.parent_message_info=i.objectify(D);break;case n.MESSAGE_TYPE_FILE:V.parent_message_info=s.objectify(D);break;case n.MESSAGE_TYPE_ADMIN:V.parent_message_info=a.objectify(D)}return q&&(V.og_tag=u.objectify(q)),V}},{key:"build",value:function(e,t,n,r,i,s,a,o,l,u,c,d,h,p,f,g,y){return this.objectify({messageId:e,channel:t,message:n,data:r,customType:i,mentionType:c,mentionedUsers:d,reactions:u,metaArrays:l,rootMessageId:h,parentMessageId:p,parentMessageText:f,threadInfo:g,translations:s,ogMetaData:y,createdAt:a,updatedAt:o})}},{key:"buildFromSerializedData",value:function(e){var t=G.get(this._iid).AdminMessage,n=me.deserialize(e);return new t(t.objectify(d(d({},n),{},{channel:{url:n.channelUrl,channelType:n.channelType}})))}}]),n}(Ce),$e=function(){function e(t){p(this,e);var n=G.get(this._iid),r=n.BaseMessage,i=n.BaseMessageParams;this.scheduledId=0,this.scheduledDateTimeString="",this.scheduledTimezone="",this.status=e.Status.SCHEDULED,this.createdAt=0,this.updatedAt=0,this._messageType=r.MESSAGE_TYPE_BASE,this._sender=null,this._channelType="",this.channelUrl="",this.message="",this.customType="",this.data="",this.metaArrays=[],this.mentionType=i.MentionType.USERS,this.mentionedUsers=[],this.pushNotificationDeliveryOption=i.PushNotificationDeliveryOption.DEFAULT,this.translationTargetLanguages=[],this.errorMessage="",this.errorCode=0,this.appleCriticalAlertOptions=null,t&&this._update(t)}return g(e,[{key:"sender",get:function(){var e=fn.getInstance(this._iid),t=G.get(this._iid).GroupChannel;if(e.Options.useMemberAsMessageSender&&this.isGroupChannel()){var n=t.cachedChannels[this.channelUrl];if(n){var r=n.memberMap[this._sender.userId];r&&(this._sender.nickname!==r.nickname&&(this._sender.nickname=r.nickname),this._sender.plainProfileUrl!==r.plainProfileUrl&&(this._sender.plainProfileUrl=r.plainProfileUrl),ee.deepEqual(this._sender.metaData,r.metaData)||(this._sender.metaData=r.metaData))}}return this._sender},set:function(e){this._sender=e}},{key:"_update",value:function(t){var n=this,r=G.get(this._iid),i=r.User,s=r.Sender,a=r.BaseMessageParams,o=r.MessageMetaArray,l=r.AppleCriticalAlertOptions;this.scheduledId=t.hasOwnProperty("scheduled_id")?parseInt(t.scheduled_id):0,this.scheduledDateTimeString=t.hasOwnProperty("scheduled_dt")?String(t.scheduled_dt):"",this.scheduledTimezone=t.hasOwnProperty("scheduled_timezone")?String(t.scheduled_timezone):"",this.status=t.hasOwnProperty("status")?String(t.status):"",this.createdAt=t.hasOwnProperty("created_at")?parseInt(t.created_at):0,this.updatedAt=t.hasOwnProperty("updated_at")?parseInt(t.updated_at):0,this.channelUrl=t.hasOwnProperty("channel_url")?String(t.channel_url):"",this._channelType=t.hasOwnProperty("channel_type")?String(t.channel_type):"",this._messageType=t.hasOwnProperty("type")?String(t.type):"",this._sender=t.hasOwnProperty("user")?new s(t.user):null,this.message=t.hasOwnProperty("message")?String(t.message):"",this.customType=t.hasOwnProperty("custom_type")?String(t.custom_type):"",this.data=t.hasOwnProperty("data")?String(t.data):"";var u=t.hasOwnProperty("metaarray")?t.metaarray:{},c=t.hasOwnProperty("metaarray_key_order")?t.metaarray_key_order:Object.keys(u).sort((function(e,t){return e.localeCompare(t)}));this.metaArrays=[];for(var d=0;d<c.length;d++){var h=c[d];this.metaArrays.push(new o(h,u[h]||[]))}this.mentionType=t.hasOwnProperty("mention_type")?t.mention_type:a.MentionType.USERS,this.mentionedUsers=[],t.hasOwnProperty("mentioned_users")&&t.mentioned_users.forEach((function(e){var t=new i(e);n.mentionedUsers.push(t)})),this.pushNotificationDeliveryOption=t.hasOwnProperty("push_option")?t.push_option:a.PushNotificationDeliveryOption.DEFAULT,this.translationTargetLanguages=t.hasOwnProperty("translation_target_langs")?t.translation_target_langs:[],this.status===e.Status.FAILED&&(t.hasOwnProperty("error")&&t.error.hasOwnProperty("message")&&(this.errorMessage=String(t.error.message)),t.hasOwnProperty("error")&&t.error.hasOwnProperty("code")&&(this.errorCode=parseInt(t.error.code))),t.hasOwnProperty("apple_critical_alert_options")&&(this.appleCriticalAlertOptions=new l(t.apple_critical_alert_options))}},{key:"isOpenChannel",value:function(){var e=G.get(this._iid).BaseChannel;return this._channelType===e.CHANNEL_TYPE_OPEN}},{key:"isGroupChannel",value:function(){var e=G.get(this._iid).BaseChannel;return this._channelType===e.CHANNEL_TYPE_GROUP}},{key:"metaArray",get:function(){var e={};return this.metaArrays.forEach((function(t){e[t.key]=t.value})),e},set:function(e){if("object"===h(e)&&e){var t=G.get(this._iid).MessageMetaArray,n=[];Object.keys(e).forEach((function(r){n.push(new t(r,e[r]))})),this.metaArrays=n}}}],[{key:"Status",get:function(){return{SCHEDULED:"scheduled",SENT:"sent",CANCELED:"canceled",FAILED:"failed"}}}]),e}(),Ze=function(){function e(){p(this,e),this.threadInfo=null,this.targetMessageId=0,this.channelUrl=null,this.channelType=null}return g(e,null,[{key:"createFromJson",value:function(e){var t=G.get(this._iid),n=t.BaseChannel,r=t.ThreadInfo,i=e.thread_info,s=e.root_message_id,a=e.channel_url,o=e.channel_type;if(i&&"object"===h(i)&&("string"==typeof s||"number"==typeof s)&&"string"==typeof a&&"string"==typeof o&&[n.CHANNEL_TYPE_GROUP,n.CHANNEL_TYPE_OPEN].includes(o)){var l=new this;return l.threadInfo=new r(i),l.targetMessageId=parseInt(s),l.channelUrl=a,l.channelType=o,l}return null}}]),e}(),et=function(){function e(){p(this,e),this.poll=null,this.status=null}return g(e,null,[{key:"createFromJson",value:function(e){var t=G.get(this._iid).Poll,n=e.poll;if("object"===h(n)){var r=new this;return r.poll=new t(n),r.status=n.status,r}return null}}]),e}(),tt=function(){function e(){p(this,e),this.pollId=null,this.updatedVoteCounts=null,this.votedAt=null}return g(e,null,[{key:"createFromJson",value:function(e){var t=e.poll_id,n=e.updated_vote_counts,r=e.ts;if("number"==typeof t&&Array.isArray(e.updated_vote_counts)&&"number"==typeof r){var i=new this;return i.pollId=t,i.updatedVoteCounts=n.map((function(e){return{optionId:e.option_id,voteCount:e.vote_count}})),i.votedAt=r,i}return null}}]),e}(),nt=function(){function e(){p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this.userIdsFilter=[],this.metaDataKeyFilter="",this.metaDataValuesFilter=[],this.nicknameStartsWithFilter=null,this._token=""}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){"number"==typeof t.limit&&t.limit>0&&Array.isArray(t.userIdsFilter)&&"string"==typeof t.metaDataKeyFilter&&Array.isArray(t.metaDataValuesFilter)&&!!t.metaDataKeyFilter==t.metaDataValuesFilter.length>0&&("string"==typeof t.nicknameStartsWithFilter||null===t.nicknameStartsWithFilter)?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadUserList(d(d({},t),{},{token:t._token}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).User,a=String(r.next);t._token=a,t.hasNext=!!a,i=r.users.map((function(e){return new s(e)}))}t.isLoading=!1,e(n,i)}))):e(null,[]):e(ae.error,null)}),e)}}]),e}(),rt=function(){function e(t){p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this._isOpenChannel=!1,this._channelUrl=null,this._token="",t.channelUrl&&(this._channelUrl=t.channelUrl),t.isOpenChannel&&(this._isOpenChannel=t.isOpenChannel)}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){"number"==typeof t.limit&&t.limit>0?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadBannedUserList(d(d({},t),{},{channelUrl:t._channelUrl,isOpenChannel:t._isOpenChannel,token:t._token}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).RestrictedUser,a=String(r.next);t._token=a,t.hasNext=!!a,i=r.banned_list.map((function(e){var t=new s(e);return t.restrictionInfo.restrictionType=s.RestrictionType.BANNED,t}))}t.isLoading=!1,e(n,i)}))):e(null,[]):e(ae.error,null)}),e)}}]),e}(),it=function(){function e(){p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this.userIdsFilter=[],this._token=""}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){"number"==typeof t.limit&&t.limit>0&&Array.isArray(t.userIdsFilter)?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadBlockedUserList(d(d({},t),{},{token:t._token}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).User,a=String(r.next);t._token=a,t.hasNext=!!a,i=r.users.map((function(e){return new s(e)}))}t.isLoading=!1,e(n,i)}))):e(null,[]):e(ae.error,null)}),e)}}]),e}(),st=function(){function e(){p(this,e),this.isLoading=!1,this.hasMore=!0,this.limit=20,this._token=""}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){"number"==typeof t.limit&&t.limit>0?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasMore?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadFriendList(d(d({},t),{},{token:t._token}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).User,a=String(r.next);t._token=a,t.hasMore=!!a,i=r.users.map((function(e){return new s(e)}))}t.isLoading=!1,e(n,i)}))):e(null,[]):e(ae.error,null)}),e)}}]),e}(),at=function(){function e(){p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this.includeEmpty=!1,this.order=e.ORDER_LATEST_LAST_MESSAGE,this._token="",this._searchFilter={},this._userIdsFilter={userIds:[],includeMode:!0,queryType:e.QueryType.AND},this._userIdsExactFilter=[],this._userIdsIncludeFilter=[],this._userIdsIncludeFilterQueryType=e.QueryType.AND,this.nicknameContainsFilter="",this.channelNameContainsFilter="",this.memberStateFilter=Fe.MemberStateFilter.ALL,this.customTypesFilter=[],this.channelUrlsFilter=[],this.superChannelFilter=Fe.SuperChannelFilter.ALL,this.publicChannelFilter=Fe.PublicChannelFilter.ALL,this.customTypeStartsWithFilter=null,this.unreadChannelFilter=Fe.UnreadChannelFilter.ALL,this.metadataOrderKeyFilter=null,this.metadataKey=null,this.metadataValues=[],this.metadataValueStartsWith=null,this.hiddenChannelFilter=Fe.HiddenChannelFilter.UNHIDDEN,this.includeFrozen=!0,this.includeMetaData=!0}return g(e,[{key:"userIdsExactFilter",get:function(){return this._userIdsExactFilter},set:function(e){Array.isArray(e)&&(this._userIdsExactFilter=e,this._userIdsIncludeFilter=[],this._userIdsFilter.userIds=this._userIdsExactFilter,this._userIdsFilter.includeMode=!1)}},{key:"userIdsIncludeFilter",get:function(){return this._userIdsIncludeFilter},set:function(e){Array.isArray(e)&&(this._userIdsIncludeFilter=e,this._userIdsExactFilter=[],this._userIdsFilter.userIds=this._userIdsIncludeFilter,this._userIdsFilter.includeMode=!0)}},{key:"userIdsIncludeFilterQueryType",get:function(){return this._userIdsIncludeFilterQueryType},set:function(t){Object.keys(e.QueryType).map((function(t){return e.QueryType[t]})).indexOf(t)>-1&&(this._userIdsIncludeFilterQueryType=t.toUpperCase(),this._userIdsFilter.queryType=this._userIdsIncludeFilterQueryType)}},{key:"setSearchFilter",value:function(e,t){Array.isArray(e)&&0!==e.length&&"string"==typeof t&&t&&(this._searchFilter={search_query:t,search_fields:e.join(",").toLocaleLowerCase()})}},{key:"serialize",value:function(){return me.serialize(this,(function(e){e.isLoading=!1}))}},{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){var n=G.get(t._iid),r=n.GroupChannel,i=n.GroupChannelListQuery;!("number"==typeof t.limit&&t.limit>0&&"boolean"==typeof t.includeEmpty&&"string"==typeof t.order&&[i.ORDER_CHRONOLOGICAL,i.ORDER_LATEST_LAST_MESSAGE,i.CHANNEL_NAME_ALPHABETICAL,i.METADATA_VALUE_ALPHABETICAL].indexOf(t.order.toLowerCase())>-1&&Array.isArray(t._userIdsExactFilter)&&Array.isArray(t._userIdsIncludeFilter)&&Array.isArray(t.customTypesFilter)&&Array.isArray(t.channelUrlsFilter)&&Object.keys(i.QueryType).map((function(e){return i.QueryType[e]})).indexOf(t._userIdsIncludeFilterQueryType.toUpperCase())>-1&&Object.keys(r.MemberStateFilter).map((function(e){return r.MemberStateFilter[e]})).indexOf(t.memberStateFilter)>-1&&Object.keys(r.SuperChannelFilter).map((function(e){return r.SuperChannelFilter[e]})).indexOf(t.superChannelFilter)>-1&&Object.keys(r.PublicChannelFilter).map((function(e){return r.PublicChannelFilter[e]})).indexOf(t.publicChannelFilter)>-1&&Object.keys(r.UnreadChannelFilter).map((function(e){return r.UnreadChannelFilter[e]})).indexOf(t.unreadChannelFilter)>-1&&Object.keys(r.HiddenChannelFilter).map((function(e){return r.HiddenChannelFilter[e]})).indexOf(t.hiddenChannelFilter)>-1)||"string"!=typeof t.customTypeStartsWithFilter&&null!==t.customTypeStartsWithFilter||"string"!=typeof t.nicknameContainsFilter||"string"!=typeof t.channelNameContainsFilter||"string"!=typeof t.metadataOrderKeyFilter&&null!==t.metadataOrderKeyFilter||"string"!=typeof t.metadataKey&&null!==t.metadataKey||!Array.isArray(t.metadataValues)||!t.metadataValues.every((function(e){return"string"==typeof e}))||"string"!=typeof t.metadataValueStartsWith&&null!==t.metadataValueStartsWith||"boolean"!=typeof t.includeFrozen||"boolean"!=typeof t.includeMetaData?e(ae.error,null):t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadGroupChannelList(d(d({},t),{},{token:t._token,userIdsFilter:t._userIdsFilter,searchFilter:t._searchFilter}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).GroupChannel,a=String(r.next);t._token=a,t.hasNext=!!a;var o=r.channels;o&&Array.isArray(o)?i=o.map((function(e){return"number"==typeof r.ts&&(e.ts=r.ts),s.upsert(e)})):n=new D("Failed at loading group channels.",D.MALFORMED_DATA)}t.isLoading=!1,e(n,i)}))):e(null,[])}),e)}}],[{key:"ORDER_LATEST_LAST_MESSAGE",get:function(){return"latest_last_message"}},{key:"ORDER_CHRONOLOGICAL",get:function(){return"chronological"}},{key:"CHANNEL_NAME_ALPHABETICAL",get:function(){return"channel_name_alphabetical"}},{key:"METADATA_VALUE_ALPHABETICAL",get:function(){return"metadata_value_alphabetical"}},{key:"QueryType",get:function(){return{AND:"AND",OR:"OR"}}},{key:"SearchField",get:function(){return{MEMBER_NICKNAME:"member_nickname",CHANNEL_NAME:"channel_name"}}},{key:"buildFromSerializedData",value:function(e){var t=G.get(this._iid).GroupChannel,n=me.deserialize(e),r=t.createMyGroupChannelListQuery();return Object.keys(n).forEach((function(e){r.hasOwnProperty(e)&&(r[e]=n[e])})),r}}]),e}(),ot=function(){function e(t){p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this.mutedMemberFilter=e.MutedMemberFilter.ALL,this.memberStateFilter=Fe.MemberStateFilter.ALL,this.nicknameStartsWithFilter=null,this.order=e.Order.MEMBER_NICKNAME_ALPHABETICAL,this._token="",this._channelUrl=t}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){var n=G.get(t._iid),r=n.GroupChannel,i=n.Member,s=n.MemberListQuery;"number"==typeof t.limit&&t.limit>0&&Object.keys(s.MutedMemberFilter).map((function(e){return s.MutedMemberFilter[e]})).indexOf(t.mutedMemberFilter)>-1&&Object.keys(r.MemberStateFilter).map((function(e){return r.MemberStateFilter[e]})).indexOf(t.memberStateFilter)>-1&&Object.keys(s.Order).map((function(e){return s.Order[e]})).indexOf(t.order)>-1&&("string"==typeof t.nicknameStartsWithFilter||null===t.nicknameStartsWithFilter)?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadMemberList(d(d({},t),{},{channelUrl:t._channelUrl,token:t._token}),(function(n,r){var s=null;if(!n){var a=String(r.next);t._token=a,t.hasNext=!!a,s=r.members.map((function(e){return new i(e)}))}t.isLoading=!1,e(n,s)}))):e(null,[]):e(ae.error,null)}),e)}}],[{key:"MutedMemberFilter",get:function(){return{ALL:"all",MUTED:"muted",UNMUTED:"unmuted"}}},{key:"Order",get:function(){return{MEMBER_NICKNAME_ALPHABETICAL:"member_nickname_alphabetical",OPERATOR_THEN_MEMBER_ALPHABETICAL:"operator_then_member_alphabetical"}}}]),e}(),lt=function(){function e(t){p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this._token="",t.channelUrl&&(this._channelUrl=t.channelUrl),t.isOpenChannel&&(this._isOpenChannel=t.isOpenChannel)}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){"number"==typeof t.limit&&t.limit>0?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadMutedUserList(d(d({},t),{},{channelUrl:t._channelUrl,isOpenChannel:t._isOpenChannel,token:t._token}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).RestrictedUser,a=String(r.next);t._token=a,t.hasNext=!!a,i=r.muted_list.map((function(e){var t=new s(e);return t.restrictionInfo.restrictionType=s.RestrictionType.MUTED,t}))}t.isLoading=!1,e(n,i)}))):e(null,[]):e(ae.error,null)}),e)}}]),e}(),ut=function(){function e(){p(this,e),this.limit=20,this.isLoading=!1,this.hasNext=!0,this.nameKeyword=null,this.urlKeyword=null,this.customTypes=[],this.includeFrozen=!0,this.includeMetaData=!0}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){!("number"==typeof t.limit&&t.limit>0&&Array.isArray(t.customTypes))||"string"!=typeof t.nameKeyword&&null!==t.nameKeyword||"string"!=typeof t.urlKeyword&&null!==t.urlKeyword||"boolean"!=typeof t.includeFrozen||"boolean"!=typeof t.includeMetaData?e(ae.error,null):t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadOpenChannelList(d(d({},t),{},{token:t._token}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).OpenChannel,a=String(r.next);t._token=a,t.hasNext=!!a;var o=r.channels;o&&Array.isArray(o)?i=o.map((function(e){return"number"==typeof r.ts&&(e.ts=r.ts),s.upsert(e)})):n=new D("Failed at loading open channels.",D.MALFORMED_DATA)}t.isLoading=!1,e(n,i)}))):e(null,[])}),e)}}]),e}(),ct=new WeakMap,dt=function(){function e(t){p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this._token="",ct.set(this,t)}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){if("number"==typeof t.limit&&t.limit>0)if(t.isLoading)e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null);else if(t.hasNext){t.isLoading=!0;var n=ct.get(t);L.get(t._iid).container.apiClient.loadOperatorList(d(d({},t),{},{token:t._token,channelUrl:n.url,isOpenChannel:n.isOpenChannel()}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).User,a=String(r.next);t._token=a,t.hasNext=!!a,i=r.operators.map((function(e){return new s(e)}))}t.isLoading=!1,e(n,i)}))}else e(null,[]);else e(ae.error,null)}),e)}}]),e}(),ht=new WeakMap,pt=function(){function e(t){p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this._token="",t&&ht.set(this,t.channelUrl)}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){"number"==typeof t.limit&&t.limit>0?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadParticipantList(d(d({},t),{},{channelUrl:ht.get(t),token:t._token}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).User,a=String(r.next);t._token=a,t.hasNext=!!a,i=r.participants.map((function(e){return new s(e)}))}t.isLoading=!1,e(n,i)}))):e(null,[]):e(ae.error,null)}),e)}}]),e}(),ft=new WeakMap,gt=function(){function e(t,n){var r=n.limit,i=void 0===r?20:r,s=n.reverse,a=void 0!==s&&s,o=n.exactMatch,l=void 0!==o&&o,u=n.channelUrl,c=void 0===u?"":u,d=n.channelCustomType,h=void 0===d?"":d,f=n.messageTimestampFrom,g=void 0===f?null:f,y=n.messageTimestampTo,m=void 0===y?null:y,_=n.order,v=void 0===_?"score":_,E=n.advancedQuery,C=void 0!==E&&E,b=n.targetFields,S=void 0===b?null:b;p(this,e),this.isLoading=!1,this.hasNext=!0,ft.set(this,{keyword:t,limit:i,reverse:a,exactMatch:l,channelUrl:c,channelCustomType:h,messageTimestampFrom:g,messageTimestampTo:m,order:v,advancedQuery:C,targetFields:S,previousToken:"",nextToken:""})}return g(e,[{key:"key",get:function(){return ft.get(this).keyword}},{key:"limit",get:function(){return ft.get(this).limit}},{key:"reverse",get:function(){return ft.get(this).reverse}},{key:"exactMatch",get:function(){return ft.get(this).exactMatch}},{key:"channelUrl",get:function(){return ft.get(this).channelUrl}},{key:"channelCustomType",get:function(){return ft.get(this).channelCustomType}},{key:"messageTimestampFrom",get:function(){return ft.get(this).messageTimestampFrom}},{key:"messageTimestampTo",get:function(){return ft.get(this).messageTimestampTo}},{key:"order",get:function(){return ft.get(this).order}},{key:"next",value:function(e){var t=this,n=G.get(this._iid),r=n.BaseChannel,i=n.GroupChannel,s=n.OpenChannel;return _e(this._iid,(function(e){var n=ft.get(t),a=n.keyword,o=n.limit,l=n.reverse,u=n.exactMatch,c=n.channelUrl,d=n.channelCustomType,h=n.messageTimestampFrom,p=n.messageTimestampTo,f=n.order,g=n.advancedQuery,y=n.targetFields,m=n.nextToken;!("number"==typeof o&&o>0&&o<=1e3&&"boolean"==typeof l&&"boolean"==typeof u)||"string"!=typeof c&&null!==c||"string"!=typeof d&&null!==d||"number"!=typeof h&&null!==h||"number"!=typeof p&&null!==p||!(["score","ts"].indexOf(f)>=0)||"boolean"!=typeof g&&null!==g||!Array.isArray(y)&&null!==y?e(ae.error,null):t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.searchMessages({keyword:a,limit:o,reverse:l,exactMatch:u,channelUrl:c,channelCustomType:d,messageTimestampFrom:h,messageTimestampTo:p,order:f,advancedQuery:g,targetFields:y,nextToken:m},(function(n,a){var o=null;n||(o=[],a.results.forEach((function(e){if(e.channel.hasOwnProperty("members")){var t=new i(e.channel);i.cachedChannels[t.url]=t,o.push(r.buildMessage(e,t))}else{var n=new s(e.channel);s.cachedChannels[n.url]=n,o.push(r.buildMessage(e,n))}})),t.hasNext=a.has_next,ft.get(t).nextToken=a.end_cursor),t.isLoading=!1,e(n,o)}))):e(null,[])}),e)}}]),e}(),yt=new WeakMap,mt=new WeakMap,_t=function(){function e(t){p(this,e),this.isLoading=!1,this.hasMore=!0,this.limit=20,mt.set(this,Number.MAX_SAFE_INTEGER),yt.set(this,t),this.reverse=!1,this.messageTypeFilter=null,this.customTypeFilter=null,this.customTypesFilter=[],this.senderUserIdsFilter=[],this.includeMetaArray=!1,this.includeReaction=null,this.includeReactions=null,this.includeReplies=null,this.includeParentMessageText=null,this.includeThreadInfo=!1,this.replyType=null,this.includeParentMessageInfo=null,this.showSubchannelMessagesOnly=!1,this.includePollDetails=!1}return g(e,[{key:"load",value:function(e,t,n,r){var i=this,s=G.get(this._iid),a=s.BaseChannel,o=s.BaseMessage,l=null,u=ae.parse(arguments,[new ae({type:"number",optional:!0,defaultValue:this.limit}),new ae({type:"boolean",optional:!0,defaultValue:this.reverse}),new ae({type:["string","number"],optional:!0,defaultValue:this.messageTypeFilter,constraint:function(e){return Object.keys(a.MessageTypeFilter).map((function(e){return a.MessageTypeFilter[e]})).indexOf(e)>-1||[0,1,2,3].indexOf(e)>-1}}),new ae({type:"callback"})]),c=U(u,5);return l=c[0],e=c[1],t=c[2],n=c[3],r=c[4],_e(this._iid,(function(r){if(("string"!=typeof i.customTypeFilter&&null!==i.customTypeFilter||!Array.isArray(i.customTypesFilter)||!i.customTypesFilter.every((function(e){return"string"==typeof e||null===e}))||!Array.isArray(i.senderUserIdsFilter)||!i.senderUserIdsFilter.every((function(e){return"string"==typeof e}))||"boolean"!=typeof i.includeMetaArray||null!==i.includeReaction&&"boolean"!=typeof i.includeReaction||null!==i.includeReactions&&"boolean"!=typeof i.includeReactions||"boolean"!=typeof i.includeThreadInfo||null!==i.includeReplies&&"boolean"!=typeof i.includeReplies||!(null===i.replyType||"string"==typeof i.replyType&&Object.values(o.ReplyType).includes(i.replyType))||null!==i.includeParentMessageText&&"boolean"!=typeof i.includeParentMessageText||null!==i.includeParentMessageInfo&&"boolean"!=typeof i.includeParentMessageInfo||"boolean"!=typeof i.showSubchannelMessagesOnly)&&(l=ae.error),l)r(l,null);else{if(i.limit=e,i.reverse=t,i.messageTypeFilter=n,"number"==typeof i.messageTypeFilter)switch(i.messageTypeFilter){case 0:i.messageTypeFilter=a.MessageTypeFilter.ALL;break;case 1:i.messageTypeFilter=a.MessageTypeFilter.USER;break;case 2:i.messageTypeFilter=a.MessageTypeFilter.FILE;break;case 3:i.messageTypeFilter=a.MessageTypeFilter.ADMIN}if(i.isLoading)r(new D("Query in progress.",D.QUERY_IN_PROGRESS),null);else if(i.hasMore){i.isLoading=!0;var s=yt.get(i);L.get(i._iid).container.apiClient.getMessageList({channel:s,token:mt.get(i)||(new Date).getTime()+1e4,tokenType:"timestamp",isInclusive:!1,prevResultSize:e,nextResultSize:0,shouldReverse:t,messageType:i.messageTypeFilter,customType:i.customTypeFilter,customTypes:i.customTypesFilter,senderUserIds:i.senderUserIdsFilter,includeMetaArray:i.includeMetaArray,includeReaction:i.includeReaction,includeReactions:i.includeReactions,includeReplies:i.includeReplies,includeParentMessageText:i.includeParentMessageText,includeThreadInfo:i.includeThreadInfo,replyType:i.replyType,includeParentMessageInfo:i.includeParentMessageInfo,showSubchannelMessagesOnly:i.showSubchannelMessagesOnly,includePollDetails:i.includePollDetails},(function(t,n){var o=null;if(!t){(0===(o=n.messages.map((function(e){return a.buildMessage(e,s)}))).length||o.length<e)&&(i.hasMore=!1);var l=mt.get(i);mt.set(i,Math.min.apply(Math,O(o.map((function(e){return e.createdAt}))).concat([l])))}i.isLoading=!1,r(t,o)}))}else r(null,[])}}),r)}}]),e}(),vt=function(){function e(){p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this.includeEmpty=!1,this.order=at.ORDER_LATEST_LAST_MESSAGE,this._token="",this.channelNameContainsFilter="",this.channelUrlsFilter=[],this.customTypesFilter=[],this.customTypeStartsWithFilter=null,this.superChannelFilter=Fe.SuperChannelFilter.ALL,this.membershipFilter=e.MembershipType.JOINED,this.metadataOrderKeyFilter=null,this.metadataKey=null,this.metadataValues=[],this.metadataValueStartsWith=null,this.includeFrozen=!0,this.includeMetaData=!0}return g(e,[{key:"next",value:function(t){var n=this;return _e(this._iid,(function(t){var r=G.get(n._iid).GroupChannel;!("number"==typeof n.limit&&n.limit>0&&"boolean"==typeof n.includeEmpty&&"string"==typeof n.order&&[e.ORDER_CHRONOLOGICAL,e.CHANNEL_NAME_ALPHABETICAL,e.METADATA_VALUE_ALPHABETICAL,e.ORDER_LATEST_LAST_MESSAGE].indexOf(n.order.toLowerCase())>-1&&Array.isArray(n.customTypesFilter)&&Array.isArray(n.channelUrlsFilter)&&Object.keys(e.MembershipType).map((function(t){return e.MembershipType[t]})).indexOf(n.membershipFilter)>-1&&Object.keys(r.SuperChannelFilter).map((function(e){return r.SuperChannelFilter[e]})).indexOf(n.superChannelFilter)>-1)||"string"!=typeof n.customTypeStartsWithFilter&&null!==n.customTypeStartsWithFilter||"string"!=typeof n.channelNameContainsFilter||"string"!=typeof n.metadataOrderKeyFilter&&null!==n.metadataOrderKeyFilter||"string"!=typeof n.metadataKey&&null!==n.metadataKey||!Array.isArray(n.metadataValues)||!n.metadataValues.every((function(e){return"string"==typeof e}))||"string"!=typeof n.metadataValueStartsWith&&null!==n.metadataValueStartsWith||"boolean"!=typeof n.includeFrozen||"boolean"!=typeof n.includeMetaData?t(ae.error,null):n.isLoading?t(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):n.hasNext?(n.isLoading=!0,L.get(n._iid).container.apiClient.loadPublicGroupChannelList(d(d({},n),{},{token:n._token}),(function(e,i){var s=null;if(!e){var a=String(i.next);n._token=a,n.hasNext=!!a;var o=i.channels;o&&Array.isArray(o)?s=o.map((function(e){return"number"==typeof i.ts&&(e.ts=i.ts),r.upsert(e)})):e=new D("Failed at loading group channels.",D.MALFORMED_DATA)}n.isLoading=!1,t(e,s)}))):t(null,[])}),t)}}],[{key:"MembershipType",get:function(){return{ALL:"all",JOINED:"joined"}}},{key:"ORDER_LATEST_LAST_MESSAGE",get:function(){return"latest_last_message"}},{key:"ORDER_CHRONOLOGICAL",get:function(){return"chronological"}},{key:"CHANNEL_NAME_ALPHABETICAL",get:function(){return"channel_name_alphabetical"}},{key:"METADATA_VALUE_ALPHABETICAL",get:function(){return"metadata_value_alphabetical"}}]),e}(),Et=new WeakMap,Ct=new WeakMap,bt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.channelUrl,r=void 0===n?null:n,i=t.token,s=void 0===i?"":i,a=t.limit,o=void 0===a?20:a;p(this,e),this.channelUrl=r,this.token=s,this.limit=o,Et.set(this,!1),Ct.set(this,!0)}return g(e,[{key:"isLoading",get:function(){return!!Et.get(this)}},{key:"hasNext",get:function(){return!!Ct.get(this)}},{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){"string"==typeof t.channelUrl&&"number"==typeof t.limit&&t.limit>0&&t.limit<=100?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(Et.set(t,!0),L.get(t._iid).container.apiClient.getPollList(d({},t),(function(n,r){if(n)Et.set(t,!1),e(n,null);else{var i=G.get(t._iid).Poll,s=r.hasOwnProperty("polls")&&Array.isArray(r.polls)?r.polls.map((function(e){return new i(e)})):[],a=r.hasOwnProperty("next")&&r.next?String(r.next):"";t.token=a,Et.set(t,!1),Ct.set(t,!!a),e(null,s)}}))):e(null,[]):e(ae.error,null)}),e)}}]),e}(),St=new WeakMap,At=new WeakMap,kt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.channelUrl,r=void 0===n?null:n,i=t.pollId,s=void 0===i?null:i,a=t.optionId,o=void 0===a?null:a,l=t.token,u=void 0===l?"":l,c=t.limit,d=void 0===c?100:c;p(this,e),this.channelUrl=r,this.pollId=s,this.optionId=o,this.token=u,this.limit=d,St.set(this,!1),At.set(this,!0)}return g(e,[{key:"isLoading",get:function(){return!!St.get(this)}},{key:"hasNext",get:function(){return!!At.get(this)}},{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){"string"==typeof t.channelUrl&&"number"==typeof t.pollId&&"number"==typeof t.optionId&&"number"==typeof t.limit&&t.limit>0&&t.limit<=100?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(St.set(t,!0),L.get(t._iid).container.apiClient.getPollOptionVoterList(d({},t),(function(n,r){if(n)St.set(t,!1),e(n,null);else{var i=G.get(t._iid).User,s=r.hasOwnProperty("voters")&&Array.isArray(r.voters)?r.voters.map((function(e){return new i(e)})):[],a=r.hasOwnProperty("next")&&r.next?String(r.next):"";t.token=a,St.set(t,!1),At.set(t,!!a),e(null,s)}}))):e(null,[]):e(ae.error,null)}),e)}}]),e}(),It=function(){function e(){p(this,e),this.isDistinct=null,this.isSuper=null,this.isBroadcast=null,this.isPublic=null,this.channelUrl=null,this.isEphemeral=null,this.isDiscoverable=null,this.isStrict=null,this.name=null,this.data=null,this.customType=null,this.channelCover=null,this.coverUrl=null,this.coverImage=null,this.accessCode=null,this.messageSurvivalSeconds=null,this._invitedUserIds=[];var t=null;Object.defineProperty(this,"operators",{set:function(e){Array.isArray(e)&&e.filter((function(e){return e.hasOwnProperty("userId")})).length===e.length&&(t=e.map((function(e){return e.userId})))}}),Object.defineProperty(this,"operatorUserIds",{get:function(){return t},set:function(e){Array.isArray(e)&&e.filter((function(e){return"string"==typeof e})).length===e.length&&(t=e)}})}return g(e,[{key:"_validate",value:function(){return Array.isArray(this._invitedUserIds)&&this._invitedUserIds.every((function(e){return"string"==typeof e}))&&("string"==typeof this.channelUrl||null===this.channelUrl)&&("string"==typeof this.coverUrl||null===this.coverUrl)&&(ee.isFile(this.coverImage)||null===this.coverImage)&&("string"==typeof this.name||null===this.name)&&("string"==typeof this.data||null===this.data)&&("string"==typeof this.customType||null===this.customType)&&("boolean"==typeof this.isDistinct||null===this.isDistinct)&&("boolean"==typeof this.isSuper||null===this.isSuper)&&("boolean"==typeof this.isBroadcast||null===this.isBroadcast)&&("boolean"==typeof this.isPublic||null===this.isPublic)&&("boolean"==typeof this.isEphemeral||null===this.isEphemeral)&&("boolean"==typeof this.isDiscoverable||null===this.isDiscoverable)&&("boolean"==typeof this.isStrict||null===this.isStrict)&&(Array.isArray(this.operatorUserIds)&&this.operatorUserIds.every((function(e){return"string"==typeof e}))||null===this.operatorUserIds)&&("string"==typeof this.accessCode||null===this.accessCode)&&("number"==typeof this.messageSurvivalSeconds||null===this.messageSurvivalSeconds)}},{key:"addUsers",value:function(e){if(Array.isArray(e)){var t,n=e.filter((function(e){return e.hasOwnProperty("userId")&&"string"==typeof e.userId})).map((function(e){return e.userId}));(t=this._invitedUserIds).push.apply(t,O(n))}}},{key:"addUser",value:function(e){e.hasOwnProperty("userId")&&"string"==typeof e.userId&&this._invitedUserIds.push(e.userId)}},{key:"addUserIds",value:function(e){if(Array.isArray(e)){var t,n=e.filter((function(e){return"string"==typeof e}));(t=this._invitedUserIds).push.apply(t,O(n))}}},{key:"addUserId",value:function(e){"string"==typeof e&&this._invitedUserIds.push(e)}}]),e}(),Ut=function(){function e(){p(this,e),this.channelUrl=null,this.name=null,this.coverUrlOrImage=null,this.data=null,this.customType=null,this._operatorUserIds=[]}return g(e,[{key:"operatorUserIds",get:function(){return this._operatorUserIds},set:function(e){Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))&&(this._operatorUserIds=e)}},{key:"operators",set:function(e){Array.isArray(e)&&e.every((function(e){return e.hasOwnProperty("userId")}))&&(this._operatorUserIds=e.map((function(e){return e.userId})))}},{key:"_validate",value:function(){return(Array.isArray(this.operatorUserIds)&&this.operatorUserIds.every((function(e){return"string"==typeof e}))||null===this.operatorUserIds)&&("string"==typeof this.coverUrlOrImage||ee.isFile(this.coverUrlOrImage)||null===this.coverUrlOrImage)&&("string"==typeof this.name||null===this.name)&&("string"==typeof this.data||null===this.data)&&("string"==typeof this.customType||null===this.customType)&&("string"==typeof this.channelUrl&&/^\w+$/.test(this.channelUrl)||null===this.channelUrl)}}]),e}(),Ot=new WeakMap,Tt=function(){function e(){p(this,e),this._mentionType=e.MentionType.USERS,this._mentionedUserIds=[],this._cachedMentionedUsers=[],this._cachedMentionedUserIds=[],this._metaArrays=[],Ot.set(this,null),this._parentMessageId=null,this.isReplyToChannel=!1}return g(e,[{key:"mentionType",get:function(){return this._mentionType},set:function(e){var t=G.get(this._iid).BaseMessageParams;Object.keys(t.MentionType).map((function(e){return t.MentionType[e]})).indexOf(e)>-1&&(this._mentionType=e)}},{key:"mentionedUserIds",get:function(){return this._cachedMentionedUserIds},set:function(e){if(Array.isArray(e))for(var t=fn.getInstance(this._iid),n=0;n<e.length;n++){var r=e[n];if("string"!=typeof r){this._cachedMentionedUserIds=[],this._mentionedUserIds=[];break}this._mentionedUserIds.indexOf(r)<0&&t.currentUser&&t.currentUser.userId!==r&&(this._cachedMentionedUserIds.push(r),this._mentionedUserIds.push(r))}}},{key:"mentionedUsers",get:function(){return this._cachedMentionedUsers},set:function(e){if(Array.isArray(e))for(var t=fn.getInstance(this._iid),n=0;n<e.length;n++){var r=e[n];if(!r.hasOwnProperty("userId")){this._cachedMentionedUsers=[],this._mentionedUserIds=[];break}this._mentionedUserIds.indexOf(r.userId)<0&&t.currentUser&&t.currentUser.userId!==r.userId&&(this._cachedMentionedUsers.push(r),this._mentionedUserIds.push(r.userId))}}},{key:"metaArrayKeys",get:function(){return this._metaArrays.map((function(e){return e.key}))},set:function(e){var t=G.get(this._iid).MessageMetaArray,n={};if(Array.isArray(e)){this._metaArrays=[];for(var r=0;r<e.length;r++)"string"!=typeof e[r]||n[e[r]]||(n[e[r]]=!0,this._metaArrays.push(new t(e[r])))}}},{key:"metaArrays",get:function(){return this._metaArrays},set:function(e){var t=G.get(this._iid).MessageMetaArray;if(Array.isArray(e)){this._metaArrays=[];for(var n=0;n<e.length;n++){var r=e[n];if(r instanceof t){var i,s=this._metaArrays.map((function(e){return e.key})).indexOf(r.key);s<0?this._metaArrays.push(r):(i=this._metaArrays[s].value).push.apply(i,O(r.value))}}}}},{key:"rootMessageId",get:function(){return Ot.get(this)}},{key:"parentMessageId",get:function(){return this._parentMessageId},set:function(e){Ot.set(this,e),this._parentMessageId=e}},{key:"_validate",value:function(){var e=G.get(this._iid),t=e.BaseMessageParams,n=e.MessageMetaArray,r=Ot.get(this);return Object.keys(t.MentionType).map((function(e){return t.MentionType[e]})).indexOf(this.mentionType)>-1&&this._mentionedUserIds.every((function(e){return"string"==typeof e}))&&Array.isArray(this._metaArrays)&&this._metaArrays.every((function(e){return e instanceof n}))&&("number"==typeof r||null===r)&&("number"==typeof this._parentMessageId||null===this._parentMessageId)&&"boolean"==typeof this.isReplyToChannel}}],[{key:"MentionType",get:function(){return{USERS:"users",CHANNEL:"channel"}}},{key:"PushNotificationDeliveryOption",get:function(){return{DEFAULT:"default",SUPPRESS:"suppress"}}}]),e}(),Rt=function(e){m(n,e);var t=k(n);function n(){var e;return p(this,n),(e=t.call(this)).message=null,e.data=null,e.customType=null,e.pushNotificationDeliveryOption=null,e.appleCriticalAlertOptions=null,e.pollId=void 0,e._translationTargetLanguages=[],e}return g(n,[{key:"targetLanguages",get:function(){return this.translationTargetLanguages},set:function(e){this.translationTargetLanguages=e}},{key:"translationTargetLanguages",get:function(){return this._translationTargetLanguages},set:function(e){if(Array.isArray(e)){for(var t=0;t<e.length;t++)if("string"!=typeof e[t])return void(this._translationTargetLanguages=[]);this._translationTargetLanguages=e}}},{key:"_validate",value:function(){var e=G.get(this._iid),t=e.BaseMessageParams,r=e.AppleCriticalAlertOptions;return I(_(n.prototype),"_validate",this).call(this)&&("string"==typeof this.message||null===this.message)&&("string"==typeof this.data||null===this.data)&&("string"==typeof this.customType||null===this.customType)&&Array.isArray(this.translationTargetLanguages)&&this.translationTargetLanguages.every((function(e){return"string"==typeof e}))&&(null===this.pushNotificationDeliveryOption||Object.keys(t.PushNotificationDeliveryOption).map((function(e){return t.PushNotificationDeliveryOption[e]})).indexOf(this.pushNotificationDeliveryOption)>-1)&&(null===this.appleCriticalAlertOptions||this.appleCriticalAlertOptions instanceof r)&&("number"==typeof this.pollId||null===this.pollId||void 0===this.pollId)}}]),n}(Tt),Nt=function(e){m(n,e);var t=k(n);function n(){var e;return p(this,n),(e=t.call(this)).fileName=null,e.mimeType=null,e.fileSize=null,e.data=null,e.customType=null,e.pushNotificationDeliveryOption=null,e.appleCriticalAlertOptions=null,e._isUpdate=!1,e._file=null,e._fileUrl=null,e._thumbnailSizes=[],e}return g(n,[{key:"file",get:function(){return this._file},set:function(e){ee.isFile(e)&&(this._fileUrl=null,this._file=e)}},{key:"fileUrl",get:function(){return this._fileUrl},set:function(e){"string"==typeof e&&(this._fileUrl=e,this._file=null)}},{key:"thumbnailSizes",get:function(){return this._thumbnailSizes},set:function(e){if(Array.isArray(e)){for(var t=0;t<e.length;t++)if("object"!==h(e[t])||"number"!=typeof e[t].maxWidth||"number"!=typeof e[t].maxHeight)return void(this._thumbnailSizes=[]);this._thumbnailSizes=e}}},{key:"_validate",value:function(){var e=G.get(this._iid),t=e.BaseMessageParams,r=e.AppleCriticalAlertOptions;return I(_(n.prototype),"_validate",this).call(this)&&(this._isUpdate||ee.isFile(this.file)||"string"==typeof this.fileUrl)&&("string"==typeof this.fileName||null===this.fileName)&&("string"==typeof this.mimeType||null===this.mimeType)&&("number"==typeof this.fileSize||null===this.fileSize)&&("string"==typeof this.data||null===this.data)&&("string"==typeof this.customType||null===this.customType)&&(null===this._thumbnailSizes||this._thumbnailSizes.every((function(e){return"object"===h(e)&&e.maxWidth>0&&e.maxHeight>0})))&&(null===this.pushNotificationDeliveryOption||Object.keys(t.PushNotificationDeliveryOption).map((function(e){return t.PushNotificationDeliveryOption[e]})).indexOf(this.pushNotificationDeliveryOption)>-1)&&(null===this.appleCriticalAlertOptions||this.appleCriticalAlertOptions instanceof r)}}]),n}(Tt),wt=function(e){m(n,e);var t=k(n);function n(e){var r;return p(this,n),(r=t.call(this)).year=null,r.month=null,r.day=null,r.hour=null,r.min=null,r.timezone=null,r._scheduledDateTimeString=null,e&&r._update(e),r}return g(n,[{key:"scheduledDateTimeString",get:function(){return this._scheduledDateTimeString?this._scheduledDateTimeString:"number"==typeof this.year&&4===this.year.toString().length&&"number"==typeof this.month&&this.month>=1&&this.month<=12&&"number"==typeof this.day&&this.day>=1&&this.day<=31&&"number"==typeof this.hour&&this.hour>=0&&this.hour<=24&&"number"==typeof this.min&&this.min>=0&&this.min<=60&&"string"==typeof this.timezone&&this.timezone.length>0?this.year.toString()+"-"+("0"+this.month.toString()).substr(-2)+"-"+("0"+this.day.toString()).substr(-2)+" "+("0"+this.hour.toString()).substr(-2)+":"+("0"+this.min.toString()).substr(-2):null},set:function(e){e&&"string"==typeof e&&(this._scheduledDateTimeString=e)}},{key:"_update",value:function(e){e.hasOwnProperty("message")&&(this.message=e.message),e.hasOwnProperty("year")&&(this.year=e.year),e.hasOwnProperty("month")&&(this.month=e.month),e.hasOwnProperty("day")&&(this.day=e.day),e.hasOwnProperty("hour")&&(this.hour=e.hour),e.hasOwnProperty("min")&&(this.min=e.min),e.hasOwnProperty("timezone")&&(this.timezone=e.timezone)}},{key:"_getScheduleString",value:function(){return this.scheduledDateTimeString?this.scheduledDateTimeString+" "+this.timezone:"number"==typeof this.year&&4===this.year.toString().length&&"number"==typeof this.month&&this.month>=1&&this.month<=12&&"number"==typeof this.day&&this.day>=1&&this.day<=31&&"number"==typeof this.hour&&this.hour>=0&&this.hour<=24&&"number"==typeof this.min&&this.min>=0&&this.min<=60&&"string"==typeof this.timezone&&this.timezone.length>0?this.year.toString()+"-"+("0"+this.month.toString()).substr(-2)+"-"+("0"+this.day.toString()).substr(-2)+" "+("0"+this.hour.toString()).substr(-2)+":"+("0"+this.min.toString()).substr(-2)+" "+this.timezone:null}},{key:"setSchedule",value:function(e,t,n,r,i,s){"number"==typeof e&&4===e.toString().length&&"number"==typeof t&&t>=1&&t<=12&&"number"==typeof n&&n>=1&&n<=31&&"number"==typeof r&&r>=0&&r<=24&&"number"==typeof i&&i>=0&&i<=60&&"string"==typeof s&&s.length>0&&(this.scheduledDateTimeString=e.toString()+"-"+("0"+t.toString()).substr(-2)+"-"+("0"+n.toString()).substr(-2)+" "+("0"+r.toString()).substr(-2)+":"+("0"+i.toString()).substr(-2),this.timezone=s)}}]),n}(Rt),Mt=function e(){p(this,e),this.channelCustomTypesFilter=[],this.superChannelFilter=Fe.SuperChannelFilter.ALL},Pt=function(){function e(){p(this,e),this.channelUrl=null,this.channelType=null,this.messageId=0,this.includeMetaArray=!1,this.includeReactions=!1,this.includeParentMessageText=null,this.includeThreadInfo=!1,this.includeParentMessageInfo=null,this.includePollDetails=!1}return g(e,[{key:"_validate",value:function(){var e=G.get(this._iid).BaseChannel;return"string"==typeof this.channelUrl&&"string"==typeof this.channelType&&[e.CHANNEL_TYPE_BASE,e.CHANNEL_TYPE_OPEN,e.CHANNEL_TYPE_GROUP].includes(this.channelType)&&"number"==typeof this.messageId&&"boolean"==typeof this.includeMetaArray&&"boolean"==typeof this.includeReactions&&"boolean"==typeof this.includeThreadInfo&&(null===this.includeParentMessageText||"boolean"==typeof this.includeParentMessageText)&&(null===this.includeParentMessageInfo||"boolean"==typeof this.includeParentMessageInfo)&&"boolean"==typeof this.includePollDetails}}]),e}(),Lt=function(){function e(){p(this,e);var t=G.get(this._iid).BaseChannel;this.prevResultSize=0,this.nextResultSize=0,this.isInclusive=!1,this.reverse=!1,this.messageType=t.MessageTypeFilter.ALL,this.customType=null,this.customTypes=[],this.senderUserIds=null,this.includeMetaArray=!1,this.includeReaction=null,this.includeReactions=null,this.includeReplies=null,this.includeParentMessageText=null,this.includeThreadInfo=!1,this.replyType=null,this.includeParentMessageInfo=null,this.showSubchannelMessagesOnly=!1,this.includePollDetails=!1}return g(e,[{key:"_validate",value:function(){var e=G.get(this._iid),t=e.BaseChannel,n=e.BaseMessage;return"number"==typeof this.prevResultSize&&"number"==typeof this.nextResultSize&&"boolean"==typeof this.isInclusive&&"boolean"==typeof this.reverse&&"string"==typeof this.messageType&&Object.values(t.MessageTypeFilter).includes(this.messageType)&&("string"==typeof this.customType||null===this.customType)&&Array.isArray(this.customTypes)&&this.customTypes.every((function(e){return"string"==typeof e||null===e}))&&(Array.isArray(this.senderUserIds)&&this.senderUserIds.every((function(e){return"string"==typeof e}))||null===this.senderUserIds)&&"boolean"==typeof this.includeMetaArray&&(null===this.includeReaction||"boolean"==typeof this.includeReaction)&&(null===this.includeReactions||"boolean"==typeof this.includeReactions)&&"boolean"==typeof this.includeThreadInfo&&(null===this.includeReplies||"boolean"==typeof this.includeReplies)&&(null===this.replyType||"string"==typeof this.replyType&&Object.values(n.ReplyType).includes(this.replyType))&&(null===this.includeParentMessageText||"boolean"==typeof this.includeParentMessageText)&&(null===this.includeParentMessageInfo||"boolean"==typeof this.includeParentMessageInfo)&&"boolean"==typeof this.showSubchannelMessagesOnly&&"boolean"==typeof this.includePollDetails}},{key:"belongsTo",value:function(e){var t=G.get(this._iid),n=t.BaseChannel,r=t.UserMessageParams,i=t.FileMessageParams,s=t.BaseMessage;if(this.messageType!==n.MessageTypeFilter.ALL){if(e instanceof r&&this.messageType!==n.MessageTypeFilter.USER)return!1;if(e instanceof i&&this.messageType!==n.MessageTypeFilter.FILE)return!1}if(Array.isArray(this.customTypes)&&this.customTypes.length>0&&!this.customTypes.includes(e.customType))return!1;if("string"==typeof this.customType&&this.customType!==e.customType)return!1;if(Array.isArray(this.senderUserIds)&&this.senderUserIds.length>0){var a=fn.getInstance(e._iid);if(!a||!a.currentUser||!this.senderUserIds.includes(a.currentUser.userId))return!1}if("string"==typeof this.replyType&&e.parentMessageId){if(this.replyType===s.ReplyType.NONE)return!1;if(this.replyType===s.ReplyType.ONLY_REPLY_TO_CHANNEL&&!e.isReplyToChannel)return!1}else if(!1===this.includeReplies&&e.parentMessageId)return!1;return!0}}]),e}(),Dt=function(){function e(){p(this,e);var t=G.get(this._iid).BaseChannel;this.prevResultSize=0,this.nextResultSize=0,this.isInclusive=!1,this.reverse=!1,this.messageType=t.MessageTypeFilter.ALL,this.customType=null,this.customTypes=[],this.senderUserIds=null,this.includeMetaArray=!1,this.includeReaction=null,this.includeReactions=null,this.includeParentMessageText=null,this.includeParentMessageInfo=null,this.includePollDetails=!1}return g(e,[{key:"_validate",value:function(){var e=G.get(this._iid).BaseChannel;return"number"==typeof this.prevResultSize&&"number"==typeof this.nextResultSize&&"boolean"==typeof this.isInclusive&&"boolean"==typeof this.reverse&&"string"==typeof this.messageType&&Object.values(e.MessageTypeFilter).includes(this.messageType)&&("string"==typeof this.customType||null===this.customType)&&Array.isArray(this.customTypes)&&this.customTypes.every((function(e){return"string"==typeof e||null===e}))&&(Array.isArray(this.senderUserIds)&&this.senderUserIds.every((function(e){return"string"==typeof e}))||null===this.senderUserIds)&&"boolean"==typeof this.includeMetaArray&&(null===this.includeReaction||"boolean"==typeof this.includeReaction)&&(null===this.includeReactions||"boolean"==typeof this.includeReactions)&&(null===this.includeParentMessageText||"boolean"==typeof this.includeParentMessageText)&&(null===this.includeParentMessageInfo||"boolean"==typeof this.includeParentMessageInfo)&&"boolean"==typeof this.includePollDetails}}]),e}(),Ht=function(){function e(){p(this,e),this.includeMetaArray=!1,this.includeReaction=null,this.includeReactions=null,this.includeReplies=null,this.includeParentMessageText=null,this.includeThreadInfo=!1,this.replyType=null,this.includeParentMessageInfo=null,this.includePollDetails=!1}return g(e,[{key:"_validate",value:function(){return"boolean"==typeof this.includeMetaArray&&(null===this.includeReaction||"boolean"==typeof this.includeReaction)&&(null===this.includeReactions||"boolean"==typeof this.includeReactions)&&"boolean"==typeof this.includeThreadInfo&&(null===this.includeReplies||"boolean"==typeof this.includeReplies)&&(null===this.replyType||"string"==typeof this.replyType&&Object.values(BaseMessage.ReplyType).includes(this.replyType))&&(null===this.includeParentMessageText||"boolean"==typeof this.includeParentMessageText)&&(null===this.includeParentMessageInfo||"boolean"==typeof this.includeParentMessageInfo)&&"boolean"==typeof this.includePollDetails}}]),e}(),Ft=function(){function e(){p(this,e),this.customTypes=[],this.includeEmpty=!1,this.includeFrozen=!0}return g(e,[{key:"_validate",value:function(){return(Array.isArray(this.customTypes)&&this.customTypes.every((function(e){return"string"==typeof e}))||null===this.customTypes)&&("boolean"==typeof this.includeEmpty||null===this.includeEmpty)&&"boolean"==typeof this.includeFrozen}}]),e}(),Gt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.title,r=void 0===n?null:n,i=t.options,s=void 0===i?null:i,a=t.data,o=void 0===a?null:a,l=t.isAnonymous,u=void 0===l?null:l,c=t.allowUserSuggestion,d=void 0===c?null:c,h=t.allowMultipleVotes,f=void 0===h?null:h,g=t.closeAt,y=void 0===g?null:g;p(this,e),this.title=r,this.options=s,this.data=o,this.isAnonymous=u,this.allowUserSuggestion=d,this.allowMultipleVotes=f,this.closeAt=y}return g(e,[{key:"_validate",value:function(){return"string"==typeof this.title&&(Array.isArray(this.options)&&this.options.length>0&&this.options.every((function(e){return"string"==typeof e}))||null===this.options)&&("string"==typeof this.data||null==this.data)&&("boolean"==typeof this.isAnonymous||null===this.isAnonymous)&&("boolean"==typeof this.allowUserSuggestion||null===this.allowUserSuggestion)&&("boolean"==typeof this.allowMultipleVotes||null===this.allowMultipleVotes)&&("number"==typeof this.closeAt||null===this.closeAt)}}]),e}(),xt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.channelUrl,r=void 0===n?null:n,i=t.pollId,s=void 0===i?null:i,a=t.showPartialVoters,o=void 0!==a&&a;p(this,e),this.channelUrl=r,this.pollId=s,this.showPartialVoters=o}return g(e,[{key:"_validate",value:function(){return"string"==typeof this.channelUrl&&"number"==typeof this.pollId&&"boolean"==typeof this.showPartialVoters}}]),e}(),jt=function e(){p(this,e),this.onReconnectStarted=function(){},this.onReconnectSucceeded=function(){},this.onReconnectFailed=function(){}},Bt=function e(){p(this,e),this.onFriendsDiscovered=function(e){},this.onTotalUnreadMessageCountUpdated=function(e,t){}},qt=function e(){p(this,e),this.onMessageReceived=function(e,t){},this.onMessageUpdated=function(e,t){},this.onMessageDeleted=function(e,t){},this.onReadReceiptUpdated=function(e){},this.onReactionUpdated=function(e,t){},this.onDeliveryReceiptUpdated=function(e){},this.onTypingStatusUpdated=function(e){},this.onUserJoined=function(e,t){},this.onUserLeft=function(e,t){},this.onOperatorUpdated=function(e,t){},this.onUserEntered=function(e,t){},this.onUserExited=function(e,t){},this.onUserMuted=function(e,t){},this.onUserUnmuted=function(e,t){},this.onUserBanned=function(e,t){},this.onUserUnbanned=function(e,t){},this.onChannelFrozen=function(e){},this.onChannelUnfrozen=function(e){},this.onChannelChanged=function(e){},this.onChannelDeleted=function(e,t){},this.onUserReceivedInvitation=function(e,t,n){},this.onUserDeclinedInvitation=function(e,t,n){},this.onMetaDataCreated=function(e,t){},this.onMetaDataUpdated=function(e,t){},this.onMetaDataDeleted=function(e,t){},this.onMetaCountersCreated=function(e,t){},this.onMetaCountersUpdated=function(e,t){},this.onMetaCountersDeleted=function(e,t){},this.onChannelHidden=function(e){},this.onMentionReceived=function(e,t){},this.onThreadInfoUpdated=function(e,t){},this.onChannelMemberCountChanged=function(e){},this.onChannelParticipantCountChanged=function(e){},this.onPollUpdated=function(e){},this.onPollVoted=function(e){}},zt=function e(t){if(p(this,e),t){var n=G.get(this._iid),r=n.User,i=n.BaseChannel;this.reader=new r(t.user),this.timestamp=parseInt(t.ts),this.channelUrl=t.hasOwnProperty("channel_url")?String(t.channel_url):"",this.channelType=t.hasOwnProperty("channel_type")?String(t.channel_type):i.CHANNEL_TYPE_GROUP}},Yt=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];p(this,e),this.key=t,this.value=Array.isArray(n)&&n.every((function(e){return"string"==typeof e}))?n:[]}return g(e,[{key:"encode",value:function(){return{key:this.key,value:this.value||[]}}}]),e}(),Kt=new WeakMap,Vt=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;p(this,e),this.key=t,this.userIds=r,this.updatedAt=i;var s={};this.userIds.forEach((function(e){s[e]=n.updatedAt})),Kt.set(this,s)}return g(e,[{key:"isEmpty",get:function(){return 0===this.userIds.length}},{key:"serialize",value:function(){return{key:this.key,user_ids:this.userIds,updated_at:this.updatedAt}}},{key:"_applyEvent",value:function(e){if(e instanceof ge){var t=Kt.get(this);if(e.key===this.key&&(!t[e.userId]||t[e.userId]<e.updatedAt)){var n=this.userIds.indexOf(e.userId);switch(e.operation){case"add":n<0&&this.userIds.push(e.userId);break;case"delete":n>=0&&this.userIds.splice(n,1)}t[e.userId]=e.updatedAt}}}}],[{key:"createFromJson",value:function(e){var t=e.key,n=e.user_ids,r=e.updated_at;return"string"==typeof t&&t&&Array.isArray(n)&&n.length>0&&"number"==typeof r?new this(t,n,r):null}}]),e}(),Qt=function(){function e(t){p(this,e),this.replyCount=0,this.mostRepliedUsers=[],this.lastRepliedAt=0,this.updatedAt=0,t&&this._update(t)}return g(e,[{key:"_update",value:function(e){var t=G.get(this._iid).User;e.hasOwnProperty("reply_count")&&(this.replyCount=parseInt(e.reply_count)),e.hasOwnProperty("most_replies")&&Array.isArray(e.most_replies)&&e.most_replies.every((function(e){return"object"===h(e)}))&&(this.mostRepliedUsers=e.most_replies.map((function(e){return new t(e)}))),e.hasOwnProperty("last_replied_at")&&(this.lastRepliedAt=parseInt(e.last_replied_at)),e.hasOwnProperty("updated_at")&&(this.updatedAt=parseInt(e.updated_at))}}],[{key:"objectify",value:function(e){var t=G.get(this._iid).User,n=e.replyCount,r=e.mostRepliedUsers,i=e.lastRepliedAt,s=e.updatedAt,a={};return a.reply_count=n,Array.isArray(r)&&r.every((function(e){return e instanceof t}))&&(a.most_replies=r.map((function(e){return t.objectify(e)}))),a.last_replied_at=i,a.updated_at=s,a}},{key:"build",value:function(e,t,n,r){return this.objectify({replyCount:e,mostRepliedUsers:t,lastRepliedAt:n,updatedAt:r})}}]),e}(),Wt=function(){function e(t){p(this,e),this.title=null,this.url=null,this.description=null,this.defaultImage=null,t&&this._update(t)}return g(e,[{key:"_update",value:function(e){var t=G.get(this._iid).OGImage;e.hasOwnProperty("og:title")&&(this.title=e["og:title"]),e.hasOwnProperty("og:url")&&(this.url=e["og:url"]),e.hasOwnProperty("og:description")&&(this.description=e["og:description"]),e.hasOwnProperty("og:image")&&(this.defaultImage=new t(e["og:image"]))}}],[{key:"objectify",value:function(e){var t=G.get(this._iid).OGImage,n=e.title,r=void 0===n?null:n,i=e.url,s=void 0===i?null:i,a=e.description,o=void 0===a?null:a,l=e.defaultImage,u=void 0===l?null:l,c={};return c["og:title"]=r,c["og:url"]=s,c["og:description"]=o,u&&(c["og:image"]=t.objectify(u)),c}}]),e}(),Jt=function(){function e(t){p(this,e),this.url=null,this.secureUrl=null,this.type=null,this.width=0,this.height=0,this.alt=null,t&&this._update(t)}return g(e,[{key:"_update",value:function(e){e.hasOwnProperty("url")&&(this.url=e.url),e.hasOwnProperty("secure_url")&&(this.secureUrl=e.secure_url),e.hasOwnProperty("type")&&(this.type=e.type),e.hasOwnProperty("width")&&(this.width=parseInt(e.width)),e.hasOwnProperty("height")&&(this.height=parseInt(e.height)),e.hasOwnProperty("alt")&&(this.alt=e.alt)}}],[{key:"objectify",value:function(e){var t=e.url,n=void 0===t?null:t,r=e.secureUrl,i=void 0===r?null:r,s=e.type,a=void 0===s?null:s,o=e.width,l=void 0===o?0:o,u=e.height,c=void 0===u?0:u,d=e.alt,h=void 0===d?null:d,p={};return p.url=n,p.secure_url=i,p.type=a,p.width=l,p.height=c,p.alt=h,p}}]),e}(),Xt=function(){function e(t){p(this,e),this.type=null,this.vendor=null,this.detail={},t&&this._update(t)}return g(e,[{key:"_update",value:function(e){this.type=e.hasOwnProperty("type")?e.type:"",this.vendor=e.hasOwnProperty("vendor")?e.vendor:"",e.hasOwnProperty("detail")&&"object"===h(e.detail)&&!Array.isArray(e.detail)&&(this.detail=e.detail)}}],[{key:"objectify",value:function(e){var t=e.type,n=void 0===t?"":t,r=e.vendor,i=void 0===r?"":r,s=e.detail,a=void 0===s?{}:s,o={};return o.type=n,o.vendor=i,o.detail=a,o}}]),e}(),$t=function(){function e(t){p(this,e),this.id=0,this.title="",this.details=null,this._update(t)}return g(e,[{key:"update",value:function(e,t){var n=this,r=G.get(this._iid),i=r.PollParams,s=null,a=ae.parse(arguments,[new ae({type:i,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),o=U(a,3);return s=o[0],e=o[1],t=o[2],_e(this._iid,(function(t){if(s)t(s,null);else{var r={text:e.data};L.get(n._iid).container.apiClient.updatePoll(d(d({pollId:n.id},e),{},{data:r}),(function(e,r){if(e)t(e,null);else{var i=new(0,G.get(n._iid).Poll)(r);t(null,i)}}))}}),t)}},{key:"delete",value:function(e){var t=this,n=null,r=ae.parse(arguments,[new ae({type:"callback"})]),i=U(r,2);return n=i[0],e=i[1],_e(this._iid,(function(e){n?e(n,null):L.get(t._iid).container.apiClient.deletePoll({pollId:t.id},(function(t,n){e(t||null,null)}))}),e)}},{key:"addOption",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"string"}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.addPollOption({channelUrl:e,pollId:r.id,text:t},(function(e,t){if(e)n(e,null);else{var i=new(0,G.get(r._iid).Poll)(t);n(null,i)}}))}),n)}},{key:"vote",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"array",constraint:function(e){return e.every((function(e){return"number"==typeof e}))}}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.votePoll({channelUrl:e,pollId:r.id,optionIds:t},(function(e,t){if(e)n(e,null);else{var i=new(0,G.get(r._iid).Poll)(t);n(null,i)}}))}),n)}},{key:"close",value:function(e){var t=this,n=null,r=ae.parse(arguments,[new ae({type:"callback"})]),i=U(r,2);return n=i[0],e=i[1],_e(this._iid,(function(e){n?e(n,null):L.get(t._iid).container.apiClient.closePoll({pollId:t.id},(function(n,r){if(n)e(n,null);else{var i=new(0,G.get(t._iid).Poll)(r);e(null,i)}}))}),e)}},{key:"_update",value:function(e){var t=G.get(this._iid).PollDetails;this.id=parseInt(e.id),this.title=e.title,e.hasOwnProperty("options")&&e.hasOwnProperty("is_anonymous")&&e.hasOwnProperty("allow_user_suggestion")&&e.hasOwnProperty("allow_multiple_votes")&&e.hasOwnProperty("close_at")&&e.hasOwnProperty("voter_count")&&e.hasOwnProperty("status")&&e.hasOwnProperty("created_by")&&e.hasOwnProperty("created_at")&&e.hasOwnProperty("updated_at")&&(this.details=new t(e))}}],[{key:"Status",get:function(){return{OPEN:"open",CLOSED:"closed",REMOVED:"removed"}}},{key:"objectify",value:function(e){var t=G.get(this._iid).PollDetails,n=e.id,r=void 0===n?0:n,i=e.title,s=void 0===i?"":i,a=e.details,o=void 0===a?null:a,l=d({},o?t.objectify(o):{});return l.id=r,l.title=s,l}},{key:"get",value:function(e,t){var n=this,r=G.get(this._iid),i=r.PollRetrievalParams,s=null,a=ae.parse(arguments,[new ae({type:i,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),o=U(a,3);return s=o[0],e=o[1],t=o[2],_e(this._iid,(function(t){s?t(s,null):L.get(n._iid).container.apiClient.getPoll(d({},e),(function(e,r){if(e)t(e,null);else{var i=new(0,G.get(n._iid).Poll)(r);t(null,i)}}))}),t)}},{key:"create",value:function(e,t){var n=this,r=G.get(this._iid),i=r.PollParams,s=null,a=ae.parse(arguments,[new ae({type:i,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),o=U(a,3);return s=o[0],e=o[1],t=o[2],_e(this._iid,(function(t){if(s)t(s,null);else{var r={text:e.data};L.get(n._iid).container.apiClient.createPoll(d(d({},e),{},{data:r}),(function(e,r){if(e)t(e,null);else{var i=new(0,G.get(n._iid).Poll)(r);t(null,i)}}))}}),t)}}]),e}(),Zt=function(){function e(t){p(this,e),this.options=[],this.data=null,this.isAnonymous=!1,this.allowUserSuggestion=!1,this.allowMultipleVotes=!1,this.closeAt=-1,this.voterCount=0,this.votedOptionIds=[],this.status="",this.createdBy=null,this.createdAt=0,this.updatedAt=0,this._update(t)}return g(e,[{key:"_update",value:function(e){var t=G.get(this._iid).PollOption;e.hasOwnProperty("options")&&Array.isArray(e.options)&&(this.options=e.options.map((function(e){return new t(e)})));try{this.data=JSON.parse(e.data)}catch(t){this.data=e.data}this.isAnonymous=!!e.hasOwnProperty("is_anonymous")&&e.is_anonymous,this.allowUserSuggestion=!!e.hasOwnProperty("allow_user_suggestion")&&e.allow_user_suggestion,this.allowMultipleVotes=!!e.hasOwnProperty("allow_multiple_votes")&&e.allow_multiple_votes,this.closeAt=parseInt(e.close_at),this.voterCount=parseInt(e.voter_count),e.hasOwnProperty("voted_option_ids")&&Array.isArray(e.voted_option_ids)&&(this.votedOptionIds=e.voted_option_ids.map((function(e){return parseInt(e)}))),this.status=e.status,this.createdBy=e.created_by,this.createdAt=parseInt(e.created_at),this.updatedAt=parseInt(e.updated_at)}}],[{key:"objectify",value:function(e){var t=G.get(this._iid).PollOption,n=e.options,r=void 0===n?[]:n,i=e.data,s=void 0===i?null:i,a=e.isAnonymous,o=void 0!==a&&a,l=e.allowUserSuggestion,u=void 0!==l&&l,c=e.allowMultipleVotes,d=void 0!==c&&c,h=e.closeAt,p=void 0===h?-1:h,f=e.voterCount,g=void 0===f?0:f,y=e.votedOptionIds,m=void 0===y?[]:y,_=e.status,v=void 0===_?"":_,E=e.createdBy,C=void 0===E?"":E,b=e.createdAt,S=void 0===b?0:b,A=e.updatedAt,k=void 0===A?0:A,I={};return I.options=r.map((function(e){return t.objectify(e)})),I.data=JSON.stringify(s),I.is_anonymous=o,I.allow_user_suggestion=u,I.allow_multiple_votes=d,I.close_at=p,I.voter_count=g,I.voted_option_ids=m,I.status=v,I.created_by=C,I.created_at=S,I.updated_at=k,I}}]),e}(),en=new WeakMap,tn=function(){function e(t){p(this,e),this.pollId=0,this.id=0,this.text="",this.voteCount=0,this.partialVoters=[],this.createdBy="",this.createdAt=0,this.updatedAt=0,en.set(this,null),this._update(t)}return g(e,[{key:"lastVotedAt",get:function(){return en.get(this)}},{key:"update",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.updatePollOption({pollId:n.pollId,optionId:n.id,text:e},(function(e,r){if(e)t(e,null);else{var i=new(0,G.get(n._iid).Poll)(r);t(null,i)}}))}),t)}},{key:"delete",value:function(e){var t=this,n=null,r=ae.parse(arguments,[new ae({type:"callback"})]),i=U(r,2);return n=i[0],e=i[1],_e(this._iid,(function(e){n?e(n,null):L.get(t._iid).container.apiClient.deletePollOption({pollId:t.pollId,optionId:t.id},(function(t,n){e(t||null,null)}))}),e)}},{key:"_applyEvent",value:function(e){return this.id===e.optionId&&this.lastVotedAt<e.votedAt&&(this.voteCount=e.voteCount,en.set(this,e.votedAt),!0)}},{key:"_update",value:function(e){var t=G.get(this._iid).User;this.pollId=parseInt(e.poll_id),this.id=parseInt(e.id),this.text=e.text,this.voteCount=parseInt(e.vote_count),e.hasOwnProperty("partial_voter_list")&&Array.isArray(e.partial_voter_list)&&(this.partialVoters=e.partial_voter_list.map((function(e){return new t(e)}))),this.createdBy=e.created_by,this.createdAt=parseInt(e.created_at),this.updatedAt=parseInt(e.updated_at)}}],[{key:"VoteAction",get:function(){return{CAST:"cast",CANCEL:"cancel"}}},{key:"objectify",value:function(e){var t=G.get(this._iid).User,n=e.pollId,r=void 0===n?0:n,i=e.id,s=void 0===i?0:i,a=e.text,o=void 0===a?"":a,l=e.voteCount,u=void 0===l?0:l,c=e.partialVoters,d=void 0===c?[]:c,h=e.createdBy,p=void 0===h?"":h,f=e.createdAt,g=void 0===f?0:f,y=e.updatedAt,m=void 0===y?0:y,_={};return _.poll_id=r,_.id=s,_.text=o,_.vote_count=u,Array.isArray(d)&&(_.partial_voter_list=d.filter((function(e){return e instanceof t})).map((function(e){return t.objectify(e)}))),_.created_by=p,_.created_at=g,_.updated_at=m,_}},{key:"get",value:function(e,t,n,r){var i=this,s=null,a=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"number"}),new ae({type:"number"}),new ae({type:"callback"})]),o=U(a,5);return s=o[0],e=o[1],t=o[2],n=o[3],r=o[4],_e(this._iid,(function(r){s?r(s,null):L.get(i._iid).container.apiClient.getPollOption({channelUrl:e,pollId:t,optionId:n},(function(e,t){if(e)r(e,null);else{var n=new(0,G.get(i._iid).PollOption)(t);r(null,n)}}))}),r)}}]),e}(),nn=function(){function e(t){p(this,e),this.restrictionType=null,this.description=null,this.endAt=-1,t&&this._update(t)}return g(e,[{key:"_update",value:function(e){e.hasOwnProperty("restriction_type")&&(this.restrictionType=e.restriction_type),e.hasOwnProperty("description")?this.description=e.description:e.hasOwnProperty("muted_description")&&(this.description=e.muted_description),e.hasOwnProperty("end_at")?this.endAt=parseInt(e.end_at):e.hasOwnProperty("muted_end_at")&&(this.endAt=parseInt(e.muted_end_at))}}],[{key:"objectify",value:function(e){var t=e.restrictionType,n=void 0===t?null:t,r=e.description,i=void 0===r?null:r,s=e.endAt,a=void 0===s?-1:s,o={};return o.restriction_type=n,o.description=i,o.end_at=a,o}}]),e}(),rn="default",sn=function(){function e(t){p(this,e),this.name=rn,this.volume=1,t&&this._update(t)}return g(e,[{key:"_update",value:function(e){e.hasOwnProperty("name")&&(this.name=e.name),e.hasOwnProperty("volume")&&(this.volume=e.volume)}},{key:"serialize",value:function(){return me.serialize(this)}}],[{key:"objectify",value:function(e){var t=e.name,n=void 0===t?rn:t,r=e.volume;return{name:n,volume:void 0===r?1:r}}}]),e}(),an=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];p(this,e),this.isLoading=!1,this.hasNext=!0,this.limit=20,this.userIds=t,this.metaDataKey="",this.metaDataValues=[],this._token=""}return g(e,[{key:"next",value:function(e){var t=this;return _e(this._iid,(function(e){"number"==typeof t.limit&&t.limit>0&&Array.isArray(t.userIds)&&"string"==typeof t.metaDataKey&&Array.isArray(t.metaDataValues)&&!!t.metaDataKey==t.metaDataValues.length>0?t.isLoading?e(new D("Query in progress.",D.QUERY_IN_PROGRESS),null):t.hasNext?(t.isLoading=!0,L.get(t._iid).container.apiClient.loadUserList(d(d({},t),{},{userIdsFilter:t.userIds,metaDataKeyFilter:t.metaDataKey,metaDataValuesFilter:t.metaDataValues,token:t._token}),(function(n,r){var i=null;if(!n){var s=G.get(t._iid).User,a=String(r.next);t._token=a,t.hasNext=!!a,i=r.users.map((function(e){return new s(e)}))}t.isLoading=!1,e(n,i)}))):e(null,[]):e(ae.error,null)}),e)}}]),e}(),on=new WeakMap,ln=function(){function e(t){p(this,e),this.isLoading=!1,on.set(this,t)}return g(e,[{key:"prev",value:function(e,t,n,r){var i=arguments,s=this;return _e(this._iid,(function(r){var a,o=G.get(s._iid).BaseChannel,l=U(ae.parse(i,[new ae({type:"number"}),new ae({type:"number"}),new ae({type:"boolean"}),new ae({type:"function"})]),5);if(a=l[0],e=l[1],t=l[2],n=l[3],r=l[4],a)r(a,null);else if(s.isLoading)r(new D("Query in progress.",D.QUERY_IN_PROGRESS),null);else{s.isLoading=!0;var u=on.get(s);L.get(s._iid).container.apiClient.getMessageList({channelUrl:u.url,channelType:u.channelType,token:e,tokenType:"timestamp",isInclusive:!1,prevResultSize:t,nextResultSize:0,shouldReverse:n,messageType:"",customType:""},(function(e,t){var n=null;e||(n=t.messages.map((function(e){return o.buildMessage(e,u)}))),s.isLoading=!1,r(e,n)}))}}),r)}},{key:"next",value:function(e,t,n,r){var i=arguments,s=this;return _e(this._iid,(function(r){var a,o=G.get(s._iid).BaseChannel,l=U(ae.parse(i,[new ae({type:"number"}),new ae({type:"number"}),new ae({type:"boolean"}),new ae({type:"function"})]),5);if(a=l[0],e=l[1],t=l[2],n=l[3],r=l[4],a)r(a,null);else if(s.isLoading)r(new D("Query in progress.",D.QUERY_IN_PROGRESS),null);else{s.isLoading=!0;var u=on.get(s);L.get(s._iid).container.apiClient.getMessageList({channelUrl:u.url,channelType:u.channelType,token:e,tokenType:"timestamp",isInclusive:!1,prevResultSize:0,nextResultSize:t,shouldReverse:n,messageType:"",customType:""},(function(e,t){var n=null;e||(n=t.messages.map((function(e){return o.buildMessage(e,u)}))),s.isLoading=!1,r(e,n)}))}}),r)}},{key:"load",value:function(e,t,n,r,i){var s=arguments,a=this;return _e(this._iid,(function(i){var o,l=G.get(a._iid).BaseChannel,u=U(ae.parse(s,[new ae({type:"number"}),new ae({type:"number"}),new ae({type:"number"}),new ae({type:"boolean"}),new ae({type:"callback"})]),6);if(o=u[0],e=u[1],t=u[2],n=u[3],r=u[4],i=u[5],o)i(o,null);else if(a.isLoading)i(new D("Query in progress.",D.QUERY_IN_PROGRESS),null);else{a.isLoading=!0;var c=on.get(a);L.get(a._iid).container.apiClient.getMessageList({channelUrl:c.url,channelType:c.channelType,token:e,tokenType:"timestamp",isInclusive:!1,prevResultSize:t,nextResultSize:n,shouldReverse:r,messageType:"",customType:""},(function(e,t){var n=null;e||(n=t.messages.map((function(e){return l.buildMessage(e,c)}))),a.isLoading=!1,i(e,n)}))}}),i)}}]),e}(),un=function(){function e(t){var n=this;if(p(this,e),this.state=0,this._value=null,this._reason=null,"function"!=typeof t)throw"Promise resolver ".concat(t," is not a function");t((function(e){0===n.state&&(n.state=1,n._value=e)}),(function(e){0===n.state&&(n.state=2,n._reason=e)}))}return g(e,[{key:"length",get:function(){return 1}},{key:"then",value:function(t,n){var r=this,i=this;switch(this.state){case 0:setTimeout((function(){return r.then(t,n)}),100);break;case 1:t&&"function"==typeof t&&(i=t(this._value));break;case 2:n&&"function"==typeof n&&(i=n(this._reason))}return i instanceof e?i:this}},{key:"catch",value:function(t){var n=this,r=this;switch(this.state){case 0:setTimeout((function(){return n.catch(t)}),100);break;case 1:break;case 2:r=t(this._reason)}return r instanceof e?r:this}},{key:"finally",value:function(t){var n=this,r=this;switch(this.state){case 0:setTimeout((function(){return n.finally(t)}),100);break;case 1:case 2:r=t()}return r instanceof e?r:this}}],[{key:"all",value:function(t){return new e((function(n,r){if(Array.isArray(t)||"string"==typeof t)if(t.length>0){for(var i=[],s=0;s<t.length;s++)t[s]instanceof e?i.push(t[s]):i.push(e.resolve(t[s]));var a=new Array(i.length).fill(null),o=i.length,l=function(e,t,i){t?r(t):(o--,a[e]=i,o<=0&&n(a))};i.forEach((function(e,t){e.then((function(e){l(t,null,e)})).catch((function(e){l(t,e,null)}))}))}else n([]);else r(new Error("Uncaught (in promise) TypeError: ".concat(h(t)," ").concat(t," is not iterable")))}))}},{key:"resolve",value:function(t){return new e((function(e){e(t)}))}},{key:"reject",value:function(t){return new e((function(e,n){n(t)}))}}]),e}(),cn=function(){"undefined"==typeof Promise&&("undefined"!=typeof window?window.Promise=un:void 0!==i?i.Promise=un:"undefined"!=typeof self?self.Promise=un:"undefined"!=typeof globalThis&&(globalThis.Promise=un)),Object.values||(Object.values=function(e){return Object.keys(e).map((function(t){return e[t]}))}),Number.MAX_SAFE_INTEGER||Object.defineProperty(Number,"MAX_SAFE_INTEGER",{value:Math.pow(2,53)-1})},dn=null,hn={},pn=!1,fn=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};p(this,e),cn();var r=!1;if((n.newInstance||!dn||dn&&n.appId!==dn.getApplicationId()&&dn.getConnectionState()===dn.ConnectionState.CLOSED)&&(r=!0,dn=this),r){try{if(!n.hasOwnProperty("appId"))return W.warn("Must be set appId."),dn=null,null}catch(e){return W.warn("Must be set appId."),dn=null,null}var i=we.create();Object.defineProperty(this,"_iid",{get:function(){return i}}),hn[i]=this,this.customApiHost=null,this.customWsHost=null,this.connecting=!1,this.reconnecting=!1,this.isReconnectingOnError=!1,this.connectionCallbacks=[],this.ConnectionManager=new oe(this),this.GCMPushToken="",this.APNSPushToken="",this.PUSH_TEMPLATE_DEFAULT="default",this.PUSH_TEMPLATE_ALTERNATIVE="alternative",this.currentUser=null,this.isSessionOpened=!1,this.globalTimer,this.loginTimer,this.reconnectTimer,this.loginHandler=null,this.onLoginTimerCancel,this.onReconnectTimerCancel,this.BaseChannel={MessageTypeFilter:ke.MessageTypeFilter};var s={User:be,Member:Ge,RestrictedUser:je,GroupChannel:Fe,OpenChannel:Qe,UserMessage:We,FileMessage:Je,AdminMessage:Xe,GroupChannelListQuery:at,MemberListQuery:ot,GroupChannelParams:It,OpenChannelParams:Ut,BaseMessageParams:Tt,UserMessageParams:Rt,FileMessageParams:Nt,ScheduledUserMessageParams:wt,GroupChannelTotalUnreadMessageCountParams:Mt,MessageRetrievalParams:Pt,MessageListParams:Lt,ThreadedMessageListParams:Dt,MessageChangeLogsParams:Ht,GroupChannelChangeLogsParams:Ft,PollParams:Gt,PollRetrievalParams:xt,MessageMetaArray:Yt,UserEventHandler:Bt,SessionHandler:le,ChannelHandler:qt,ConnectionHandler:jt,AppleCriticalAlertOptions:sn,Poll:$t,PollOption:tn},a={SessionManager:ue,BaseChannel:ke,BaseMessage:Ce,UserListQuery:an,ApplicationUserListQuery:nt,BannedUserListQuery:rt,BlockedUserListQuery:it,FriendListQuery:st,MutedUserListQuery:lt,OpenChannelListQuery:ut,OperatorListQuery:dt,ParticipantListQuery:pt,MessageListQuery:ln,PreviousMessageListQuery:_t,MessageSearchQuery:gt,PublicGroupChannelListQuery:vt,PollListQuery:bt,PollVoterListQuery:kt,ScheduledUserMessage:$e,ThreadInfo:Qt,ThreadInfoUpdateEvent:Ze,OGMetaData:Wt,OGImage:Jt,Plugin:Xt,Command:he,Sender:xe,ReadStatus:zt,Reaction:Vt,ReactionEvent:ge,Emoji:ze,EmojiCategory:qe,EmojiContainer:Be,PollDetails:Zt,PollUpdateEvent:et,PollVoteEvent:tt,RestrictionInfo:nn,FileMessageQueue:Ne},o=new G(this._iid,d(d({},s),a));this.BaseMessage={ReplyType:Ce.ReplyType,getMessage:o.BaseMessage.getMessage.bind(o.BaseMessage)},Object.keys(o).forEach((function(e){s[e]&&(t[e]=o[e])})),L.create(i,{appId:n.appId,pinger:new X(this),apiClient:new re(this),wsAdapter:new se(this),commandHandler:new Oe(this),onlineDetector:new ce(this),ackStateMap:{},subscribedUnreadMessageCount:{all:0,custom_types:{},ts:0},maxUnreadCountOfSuperGroupChannel:w.DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL,auth:new H,appInfo:null,pingInterval:15e3,pongTimeout:5e3,connectedAt:0,extensions:{},supportedExtensionKeys:["sb_uikit","sb_syncmanager"],getUserAgentWithExtensions:function(e){var t=e.sb_syncmanager?"s".concat(e.sb_syncmanager):"",n=e.sb_uikit?"u".concat(e.sb_uikit):"";return"JS/c".concat(w.SDK_VERSION,"/").concat(t,"/").concat(n)},sessionManager:new o.SessionManager(this),stateChangeEnabled:!0,isInBackground:!1,closedByGoingBackground:!1,isErrorFirstInCallback:!1}),this.userEventHandlers={},this.channelHandlers={},this.connectionHandlers={},this.Options={_useMemberAsMessageSender:!0,get UseMemberAsMessageSender(){return this._useMemberAsMessageSender},set UseMemberAsMessageSender(e){"boolean"==typeof e&&(this._useMemberAsMessageSender=e)},get useMemberAsMessageSender(){return this._useMemberAsMessageSender},set useMemberAsMessageSender(e){"boolean"==typeof e&&(this._useMemberAsMessageSender=e)},_typingIndicatorThrottle:1e3,get typingIndicatorThrottle(){return this._typingIndicatorThrottle},set typingIndicatorThrottle(e){"number"==typeof e&&e>=1e3&&e<=9e3&&(this._typingIndicatorThrottle=e)},_websocketResponseTimeout:1e4,get websocketResponseTimeout(){return this._websocketResponseTimeout},set websocketResponseTimeout(e){"number"==typeof e&&e>=5e3&&e<=3e5&&(this._websocketResponseTimeout=e)},includePollDetails:!1}}return dn}return g(e,[{key:"ConnectionState",get:function(){return{CONNECTING:"CONNECTING",OPEN:"OPEN",CLOSED:"CLOSED"}}},{key:"MessageRequestState",get:function(){return{NONE:"none",PENDING:"pending",FAILED:"failed",SUCCEEDED:"succeeded"}}},{key:"MessageSendingStatus",get:function(){return{NONE:"none",PENDING:"pending",FAILED:"failed",CANCELED:"canceled",SUCCEEDED:"succeeded"}}},{key:"pushTokenRegistrationState",get:function(){return{SUCCESS:"success",PENDING:"pending",ERROR:"error"}}},{key:"PushTriggerOption",get:function(){return{ALL:"all",MENTION_ONLY:"mention_only",OFF:"off"}}},{key:"appInfo",get:function(){return L.get(this._iid).container.appInfo}},{key:"ekey",get:function(){var e=L.get(this._iid).container.auth;return e?e.eKey:""}},{key:"getApplicationId",value:function(){return L.get(this._iid).get("appId")}},{key:"getCurrentUserId",value:function(){return this.currentUser?this.currentUser.userId:null}},{key:"getDebugMode",value:function(){return pn}},{key:"setDebugMode",value:function(e){pn=e,W.mode=e?W.Mode.DEBUG:W.Mode.PRODUCTION}},{key:"getErrorFirstCallback",value:function(){return L.get(this._iid).container.isErrorFirstInCallback}},{key:"setErrorFirstCallback",value:function(e){"boolean"==typeof e&&L.get(this._iid).set("isErrorFirstInCallback",e)}},{key:"getCurrentApiHost",value:function(){return this.customApiHost?this.customApiHost:"https://api.sendbird.com"}},{key:"clearCurrentApiHost",value:function(){this.customApiHost=null}},{key:"getCurrentWsHost",value:function(){return this.customWsHost?this.customWsHost:"wss://ws.sendbird.com"}},{key:"clearCurrentWsHost",value:function(){this.customWsHost=null}},{key:"getConnectionState",value:function(){try{var e=L.get(this._iid).container.wsAdapter;return this.connecting||this.reconnecting?this.ConnectionState.CONNECTING:e.client?this.connecting||this.reconnecting?this.ConnectionState.CONNECTING:this.isSessionOpened?e.client.getConnectionState():this.ConnectionState.CLOSED:this.ConnectionState.CLOSED}catch(e){return this.ConnectionState.CLOSED}}},{key:"getPendingGCMToken",value:function(){return this.GCMPushToken}},{key:"getPendingAPNSToken",value:function(){return this.APNSPushToken}},{key:"hasLoggedIn",value:function(){var e=L.get(this._iid);return this.currentUser&&e.get("auth").hasSession()}},{key:"getLastConnectedAt",value:function(){var e=L.get(this._iid);return this.getConnectionState()===this.ConnectionState.OPEN&&this.currentUser?e.get("connectedAt"):0}},{key:"connect",value:function(e,t,n,r,i){var s=this,a=L.get(this._iid),o=a.container,l=o.wsAdapter,u=o.onlineDetector;u&&u.start();var c=null,d=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"string",nullable:!0,ignoreIf:function(e){return 1===e.length||3===e.length}}),new ae({type:"string",nullable:!0,ignoreIf:function(e){return 1===e.length||2===e.length}}),new ae({type:"string",nullable:!0,ignoreIf:function(e){return 1===e.length||2===e.length}}),new ae({type:"callback"})]),h=U(d,6);return c=h[0],e=h[1],t=h[2],n=h[3],r=h[4],i=h[5],_e(this._iid,(function(i){c?i(c,null):(s.customApiHost=n,s.customWsHost=r,s.connecting=!0,s.reconnecting=!1,s.isReconnectingOnError=!1,s.reconnectTimer&&(clearTimeout(s.reconnectTimer),s.reconnectTimer=null,s.onReconnectTimerCancel=null),s.getConnectionState()===s.ConnectionState.OPEN&&s.currentUser&&s.currentUser.userId===e?(s.connecting=!1,i(null,s.currentUser)):(s.connectionCallbacks.push(i),1===s.connectionCallbacks.length&&(l.disconnect({clearSession:!0,err:null},null),l.connect(e,t))))}),i)}},{key:"reconnect",value:function(){var e=L.get(this._iid).container,t=e.wsAdapter;if(e.auth.sessionKey&&this.currentUser){var n=!0;return t.reconnectCount>0&&(n=!1),t.disconnect({clearSession:!1,err:new D("Connection has been canceled.",D.CONNECTION_CANCELED)},null),t.reconnectCount=0,t.reconnect(this.currentUser.userId,n),!0}return!1}},{key:"disconnect",value:function(e){var t=this;return _e(this._iid,(function(e){var n=L.get(t._iid).container,r=n.wsAdapter,i=n.onlineDetector;i&&i.stop(),r.disconnect({clearSession:!0,err:new D("Connection has been canceled.",D.CONNECTION_CANCELED)},e)}),e)}},{key:"setBackgroundState",value:function(){var e=L.get(this._iid),t=e.container,n=t.wsAdapter,r=t.stateChangeEnabled;!t.isInBackground&&r&&(e.set("isInBackground",!0),this.getConnectionState()!==this.ConnectionState.CLOSED?(e.set("closedByGoingBackground",!0),n.disconnect({clearSession:!1,err:new D("Websocket connection failed.",D.WEBSOCKET_CONNECTION_FAILED)},null)):e.set("closedByGoingBackground",!1))}},{key:"setForegroundState",value:function(){var e=L.get(this._iid),t=e.container,n=t.wsAdapter,r=t.stateChangeEnabled,i=t.isInBackground,s=t.closedByGoingBackground;i&&r&&(e.set("isInBackground",!1),s&&this.currentUser&&n.reconnect(this.currentUser.userId,!0))}},{key:"enableStateChange",value:function(){L.get(this._iid).set("enableStateChange",!0)}},{key:"disableStateChange",value:function(){L.get(this._iid).set("enableStateChange",!1)}},{key:"addExtension",value:function(e,t){var n=L.get(this._iid).container,r=n.extensions;n.supportedExtensionKeys.indexOf(e)>-1&&(r[e]=t)}},{key:"createUserListQuery",value:function(e){return new(0,G.get(this._iid).UserListQuery)(e)}},{key:"createApplicationUserListQuery",value:function(){return new(0,G.get(this._iid).ApplicationUserListQuery)}},{key:"createBlockedUserListQuery",value:function(){return new(0,G.get(this._iid).BlockedUserListQuery)}},{key:"createFriendListQuery",value:function(){return new(0,G.get(this._iid).FriendListQuery)}},{key:"createMessageSearchQuery",value:function(e,t){return new(0,G.get(this._iid).MessageSearchQuery)(e,t)}},{key:"sendCommand",value:function(e,t){var n=this;return _e(this._iid,(function(t){n.ConnectionManager.ready((function(r,i){if(r)t(r,null);else{var s=L.get(n._iid).container,a=s.wsAdapter,o=s.ackStateMap;if(null==a||null==a.client||a.client.getConnectionState()!==n.ConnectionState.OPEN||n.getConnectionState()!==n.ConnectionState.OPEN)return void t(new D("Connection is not valid. Please reconnect.",D.WEBSOCKET_CONNECTION_CLOSED),null);if(e.isAckRequired){var l=e.requestId,u={handler:t,timer:setTimeout((function(){t(new D("Command received no ack.",D.ACK_TIMEOUT),null),delete o[l]}),n.Options.websocketResponseTimeout)};o[l]=u,a.client.send(e,(function(e){e&&(clearTimeout(u.timer),t(e,null))}))}else a.client.send(e,t)}}),!1)}),t)}},{key:"setSessionHandler",value:function(e){L.get(this._iid).container.sessionManager.setHandler(e)}},{key:"addUserEventHandler",value:function(e,t){t instanceof G.get(this._iid).UserEventHandler&&(this.userEventHandlers[e]=t)}},{key:"removeUserEventHandler",value:function(e){delete this.userEventHandlers[e]}},{key:"removeAllUserEventHandler",value:function(){this.userEventHandlers={}}},{key:"addChannelHandler",value:function(e,t){t instanceof G.get(this._iid).ChannelHandler&&(this.channelHandlers[e]=t)}},{key:"removeChannelHandler",value:function(e){delete this.channelHandlers[e]}},{key:"removeAllChannelHandlers",value:function(){this.channelHandlers={}}},{key:"addConnectionHandler",value:function(e,t){t instanceof G.get(this._iid).ConnectionHandler&&(this.connectionHandlers[e]=t)}},{key:"removeConnectionHandler",value:function(e){delete this.connectionHandlers[e]}},{key:"removeAllConnectionHandlers",value:function(){this.connectionHandlers={}}},{key:"updateCurrentUserInfo",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"string",nullable:!0}),new ae({type:"string",nullable:!0}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.updateCurrentUserInfo({nickname:e,profileUrl:t},(function(i,s){var a=null;i||(r.currentUser&&(e&&(r.currentUser.nickname=e),t&&(r.currentUser.plainProfileUrl=t)),a=r.currentUser),n(i,a)}))}),n)}},{key:"updateCurrentUserInfoWithProfileImage",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"string",nullable:!0}),new ae({type:"file",nullable:!0}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.updateCurrentUserInfo({nickname:e,profileImage:t},(function(t,i){var s=null;t||(r.currentUser&&(e&&(r.currentUser.nickname=e),i.profile_url&&(r.currentUser.plainProfileUrl=i.profile_url)),s=r.currentUser),n(t,s)}))}),n)}},{key:"updateCurrentUserInfoWithPreferredLanguages",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return e.every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.updateCurrentUserInfo({preferredLanguages:e},(function(r,i){var s=null;r||(n.currentUser&&e&&(n.currentUser._preferredLanguages=e),s=n.currentUser),t(r,s)}))}),t)}},{key:"registerGCMPushTokenForCurrentUser",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,n.pushTokenRegistrationState.ERROR):n.currentUser?L.get(n._iid).container.apiClient.registerGCMPushToken({token:e},(function(e,r){var i=n.pushTokenRegistrationState.ERROR;e||(n.GCMPushToken="",i=n.pushTokenRegistrationState.SUCCESS),t(e,i)})):(n.GCMPushToken=e,t(null,n.pushTokenRegistrationState.PENDING))}),t)}},{key:"unregisterGCMPushTokenForCurrentUser",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):n.currentUser?L.get(n._iid).container.apiClient.unregisterGCMPushToken({token:e},(function(e,n){t(e,null)})):(n.GCMPushToken=e,t(null,n.pushTokenRegistrationState.PENDING))}),t)}},{key:"unregisterGCMPushTokenAllForCurrentUser",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.unregisterAllGCMPushTokens({},(function(t,n){e(t,null)}))}),e)}},{key:"registerAPNSPushTokenForCurrentUser",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,n.pushTokenRegistrationState.ERROR):n.currentUser?L.get(n._iid).container.apiClient.registerAPNSPushToken({token:e},(function(e,r){var i=n.pushTokenRegistrationState.ERROR;e||(n.APNSPushToken="",i=n.pushTokenRegistrationState.SUCCESS),t(e,i)})):(n.APNSPushToken=e,t(null,n.pushTokenRegistrationState.PENDING))}),t)}},{key:"unregisterAPNSPushTokenForCurrentUser",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e.length>0}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):n.currentUser?L.get(n._iid).container.apiClient.unregisterAPNSPushToken({token:e},(function(e,n){t(e,null)})):(n.APNSPushToken=e,t(null,n.pushTokenRegistrationState.PENDING))}),t)}},{key:"unregisterAPNSPushTokenAllForCurrentUser",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.unregisterAllAPNSPushTokens({},(function(t,n){e(t,null)}))}),e)}},{key:"unregisterPushTokenAllForCurrentUser",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.unregisterAllPushTokens({},(function(t,n){e(t,null)}))}),e)}},{key:"getMyGroupChannelChangeLogsByToken",value:function(e,t,n,r){var i=this,s=null,a=ae.parse(arguments,[new ae({type:"string",nullable:!0}),new ae({type:"array",optional:!0,nullable:!0,defaultValue:null}),new ae({type:"boolean",nullable:!0,optional:!0,defaultValue:null}),new ae({type:"callback"})]),o=U(a,5);s=o[0],e=o[1],t=o[2],n=o[3],r=o[4];var l=G.get(this._iid),u=l.GroupChannelChangeLogsParams,c=null;if(s){var h=ae.parse(arguments,[new ae({type:"string",nullable:!0}),new ae({type:u,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),p=U(h,4);s=p[0],e=p[1],c=p[2],r=p[3]}else(c=new u).customTypes=t,c.includeEmpty=n,c.includeFrozen=!0;return _e(this._iid,(function(t){s?t(s,null):L.get(i._iid).container.apiClient.getMyGroupChannelChangeLogs(d({ts:null,token:e},c),(function(e,n){if(e)t(e,null);else{var r=G.get(i._iid).GroupChannel,s=n.updated.map((function(e){return new r(e)})),a=n.deleted,o=n.has_more,l=n.next;t(null,{updatedChannels:s,deletedChannelUrls:a,hasMore:o,token:l})}}))}),r)}},{key:"getMyGroupChannelChangeLogsByTimestamp",value:function(e,t,n,r){var i=this,s=null,a=ae.parse(arguments,[new ae({type:"number",constraint:function(e){return e>=0}}),new ae({type:"array",optional:!0,nullable:!0,defaultValue:null}),new ae({type:"boolean",nullable:!0,optional:!0,defaultValue:null}),new ae({type:"callback"})]),o=U(a,5);s=o[0],e=o[1],t=o[2],n=o[3],r=o[4];var l=G.get(this._iid),u=l.GroupChannelChangeLogsParams,c=null;if(s){var h=ae.parse(arguments,[new ae({type:"number",constraint:function(e){return e>=0}}),new ae({type:u,constraint:function(e){return e._validate()}}),new ae({type:"callback"})]),p=U(h,4);s=p[0],e=p[1],c=p[2],r=p[3]}else(c=new u).customTypes=t,c.includeEmpty=n,c.includeFrozen=!0;return _e(this._iid,(function(t){s?t(s,null):L.get(i._iid).container.apiClient.getMyGroupChannelChangeLogs(d({ts:e,token:null},c),(function(e,n){if(e)t(e,null);else{var r=G.get(i._iid).GroupChannel,s=n.updated.map((function(e){return new r(e)})),a=n.deleted,o=n.has_more,l=n.next;t(null,{updatedChannels:s,deletedChannelUrls:a,hasMore:o,token:l})}}))}),r)}},{key:"getChannelInvitationPreference",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getChannelInvitationPreference({},(function(t,n){var r=null;t||(r={autoAccept:n.auto_accept}),e(t,r)}))}),e)}},{key:"setChannelInvitationPreference",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"boolean"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.setChannelInvitationPreference({isAutoAccept:e},(function(e,n){var r=null;e||(r={autoAccept:n.auto_accept}),t(e,r)}))}),t)}},{key:"getDoNotDisturb",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getDoNotDisturb({},(function(t,n){var r=null;t||(r={doNotDisturbOn:n.do_not_disturb,startHour:n.start_hour,startMin:n.start_min,endHour:n.end_hour,endMin:n.end_min,timezone:n.timezone}),e(t,r)}))}),e)}},{key:"setDoNotDisturb",value:function(e,t,n,r,i,s,a){var o=this,l=null,u=ae.parse(arguments,[new ae({type:"boolean"}),new ae({type:"number",constraint:function(e){return 0<=e&&e<=23}}),new ae({type:"number",constraint:function(e){return 0<=e&&e<=59}}),new ae({type:"number",constraint:function(e){return 0<=e&&e<=23}}),new ae({type:"number",constraint:function(e){return 0<=e&&e<=59}}),new ae({type:"string"}),new ae({type:"callback"})]),c=U(u,8);return l=c[0],e=c[1],t=c[2],n=c[3],r=c[4],i=c[5],s=c[6],a=c[7],_e(this._iid,(function(a){l?a(l,null):L.get(o._iid).container.apiClient.setDoNotDisturb({doNotDisturbOn:e,startHour:t,startMin:n,endHour:r,endMin:i,timezone:s},(function(e,t){var n=null;e||(n={doNotDisturbOn:t.do_not_disturb,startHour:t.start_hour,startMin:t.start_min,endHour:t.end_hour,endMin:t.end_min,timezone:t.timezone}),a(e,n)}))}),a)}},{key:"getSnoozePeriod",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getSnoozePeriod({},(function(t,n){var r=null;t||(r={isSnoozeOn:n.snooze_enabled,startTs:n.snooze_start_ts,endTs:n.snooze_end_ts}),e(t,r)}))}),e)}},{key:"setSnoozePeriod",value:function(e,t,n,r){var i=this,s=null,a=ae.parse(arguments,[new ae({type:"boolean"}),new ae({type:"number",constraint:function(e){return e>0}}),new ae({type:"number",constraint:function(e){return e>0}}),new ae({type:"callback"})]),o=U(a,5);return s=o[0],e=o[1],t=o[2],n=o[3],r=o[4],_e(this._iid,(function(r){s?r(s,null):L.get(i._iid).container.apiClient.setSnoozePeriod({snoozeOn:e,startTs:t,endTs:n},(function(e,t){var n=null;e||(n={isSnoozeOn:t.snooze_enabled,startTs:t.snooze_start_ts,endTs:t.snooze_end_ts}),r(e,n)}))}),r)}},{key:"blockUser",value:function(e,t){var n=null,r=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return e&&e.hasOwnProperty("userId")}}),new ae({type:"callback"})]),i=U(r,3);return n=i[0],e=i[1],t=i[2],n?_e(this._iid,(function(e){e(n,null)}),t):this.blockUserWithUserId(e.userId,t)}},{key:"blockUserWithUserId",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e&&(!n.currentUser||e!==n.currentUser.userId)}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.blockUser({blockedUserId:e},(function(e,n){var r=null;e||(r=new be(n)),t(e,r)}))}),t)}},{key:"unblockUser",value:function(e,t){var n=null,r=ae.parse(arguments,[new ae({type:"object",constraint:function(e){return e&&e.hasOwnProperty("userId")}}),new ae({type:"callback"})]),i=U(r,3);return n=i[0],e=i[1],t=i[2],n?_e(this._iid,(function(e){e(n,null)}),t):this.unblockUserWithUserId(e.userId,t)}},{key:"unblockUserWithUserId",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",constraint:function(e){return e&&(!n.currentUser||e!==n.currentUser.userId)}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.unblockUser({unblockedUserId:e},(function(e,n){t(e,null)}))}),t)}},{key:"getPushTriggerOption",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getPushTriggerOption({},(function(t,n){e(t,n?n.push_trigger_option:null)}))}),e)}},{key:"setPushTriggerOption",value:function(e,t){var n=this;return _e(this._iid,(function(t){Object.keys(n.PushTriggerOption).map((function(e){return n.PushTriggerOption[e]})).indexOf(e)>-1?L.get(n._iid).container.apiClient.setPushTriggerOption({pushTriggerOption:e},(function(e,n){t(e,n?n.push_trigger_option:null)})):t(ae.error,null)}),t)}},{key:"getGroupChannelCount",value:function(e,t){var n=this,r=G.get(this._iid),i=r.GroupChannel,s=null,a=ae.parse(arguments,[new ae({type:i.MemberStateFilter,optional:!0,defaultValue:i.MemberStateFilter.ALL}),new ae({type:"callback"})]),o=U(a,3);return s=o[0],e=o[1],t=o[2],_e(this._iid,(function(t){s?t(s,null):L.get(n._iid).container.apiClient.getGroupChannelCount({memberStateFilter:e},(function(e,n){var r=null;e||(r=parseInt(n.group_channel_count)),t(e,r)}))}),t)}},{key:"getTotalUnreadChannelCount",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getTotalUnreadChannelCount({},(function(t,n){var r=null;t||(r=parseInt(n.unread_count)),e(t,r)}))}),e)}},{key:"getTotalUnreadMessageCount",value:function(e,t){var n=this,r=G.get(this._iid),i=r.GroupChannel,s=r.GroupChannelTotalUnreadMessageCountParams,a=null,o=ae.parse(arguments,[new ae({type:"object",optional:!0,defaultValue:null,constraint:function(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))||e instanceof s}}),new ae({type:"callback"})]),l=U(o,3);return a=l[0],e=l[1],t=l[2],_e(this._iid,(function(t){if(a)t(a,null);else{var r=i.SuperChannelFilter.ALL;if(e instanceof s){var o=e;e=o.channelCustomTypesFilter,r=o.superChannelFilter}L.get(n._iid).container.apiClient.getTotalUnreadMessageCount({customTypesFilter:e,superChannelFilter:r},(function(e,n){var r=null;e||(r=parseInt(n.unread_count)),t(e,r)}))}}),t)}},{key:"getUnreadItemCount",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return e.length>0&&e.every((function(e){return Object.keys(Fe.UnreadItemKey).map((function(e){return Fe.UnreadItemKey[e]})).indexOf(e)>-1}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){if(r)t(r,null);else{var i=e.filter((function(t,n){return e.indexOf(t)===n}));L.get(n._iid).container.apiClient.getUnreadItemCount({keys:i},(function(e,n){t(e,n)}))}}),t)}},{key:"getSubscribedTotalUnreadMessageCount",value:function(){var e=L.get(this._iid).container.subscribedUnreadMessageCount;return e.all>=0?e.all:0}},{key:"getSubscribedCustomTypeTotalUnreadMessageCount",value:function(){var e=L.get(this._iid).container.subscribedUnreadMessageCount;if(Object.keys(e.custom_types).length>0){var t=0;return Object.keys(e.custom_types).forEach((function(n){t+=e.custom_types[n]})),t}return 0}},{key:"getSubscribedCustomTypeUnreadMessageCount",value:function(e){if(e&&"string"==typeof e){var t=L.get(this._iid).container.subscribedUnreadMessageCount;return t.custom_types.hasOwnProperty(e)?t.custom_types[e]:0}return 0}},{key:"getMyPushTokensByToken",value:function(e,t,n){var r=this,i=null,s=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"string",constraint:function(e){return["gcm","apns","apns_voip"].indexOf(e)>-1}}),new ae({type:"callback"})]),a=U(s,4);return i=a[0],e=a[1],t=a[2],n=a[3],_e(this._iid,(function(n){i?n(i,null):L.get(r._iid).container.apiClient.getPushTokens({ts:null,token:e,type:t},(function(e,t){if(e)n(e,null);else{var r=t.type;n(null,{deviceTokens:t.device_tokens,type:r?r.toLowerCase():"unknown",hasMore:t.has_more,token:t.token})}}))}),n)}},{key:"getPushTemplate",value:function(e){var t=this;return _e(this._iid,(function(e){L.get(t._iid).container.apiClient.getPushTemplate({},(function(t,n){var r=null;t||(r=n.name.toString()),e(t,r)}))}),e)}},{key:"setPushTemplate",value:function(e,t){var n=this;return _e(this._iid,(function(t){[n.PUSH_TEMPLATE_DEFAULT,n.PUSH_TEMPLATE_ALTERNATIVE].indexOf(e)>-1?L.get(n._iid).container.apiClient.setPushTemplate({templateName:e},(function(e,n){var r=null;e||(r=n.name.toString()),t(e,r)})):t(ae.error,null)}),t)}},{key:"markAsReadAll",value:function(e){var t=this;return _e(this._iid,(function(e){var n=G.get(t._iid).GroupChannel,r=(new Date).getTime();r-n.markAsReadAllLastSentAt<1e3?e(new D("MarkAsRead rate limit exceeded.",D.MARK_AS_READ_RATE_LIMIT_EXCEEDED),null):(n.markAsReadAllLastSentAt=r,L.get(t._iid).container.apiClient.markAsReadAll({channelUrls:null},(function(i,s){i||Object.keys(n.cachedChannels).forEach((function(e){t.currentUser&&n.cachedChannels[e].updateReadReceipt(t.currentUser.userId,r),n.cachedChannels[e]._setGroupChannelUnreadCount(0,0)})),e(i,null)})))}),e)}},{key:"markAsReadWithChannelUrls",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return e.every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){if(r)t(r,null);else{var i=(new Date).getTime();L.get(n._iid).container.apiClient.markAsReadAll({channelUrls:e},(function(r,s){r||e.forEach((function(e){Fe.cachedChannels[e]&&(n.currentUser&&Fe.cachedChannels[e].updateReadReceipt(n.currentUser.userId,i),Fe.cachedChannels[e]._setGroupChannelUnreadCount(0,0))})),t(r,null)}))}}),t)}},{key:"markAsDelivered",value:function(e){"string"==typeof e&&G.get(this._iid).GroupChannel.getChannel(e,w.INTERNAL_CALL,(function(e,t){e||t.markAsDelivered()}))}},{key:"getFriendChangeLogsByToken",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string",optional:!0,defaultValue:null}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.getFriendChangeLogsByToken({token:e},(function(e,r){var i=null;if(!e){var s=G.get(n._iid).User;i={updatedUsers:r.updated.map((function(e){return new s(e)})),deletedUserIds:r.deleted,hasMore:r.has_more,token:r.next}}t(e,i)}))}),t)}},{key:"uploadFriendDiscoveries",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return e.every((function(e){return e.hasOwnProperty("friendDiscoveryKey")}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.uploadFriendDiscoveries({discoveries:e},(function(e,n){t(e,n)}))}),t)}},{key:"deleteFriendDiscovery",value:function(e,t){var n=null,r=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),i=U(r,3);return n=i[0],e=i[1],t=i[2],n?_e(this._iid,(function(e){e(n,null)}),t):this.deleteFriendDiscoveries([e],t)}},{key:"deleteFriendDiscoveries",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return e.every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.deleteFriendDiscoveries({discoveryKeys:e},(function(e,n){t(e,n)}))}),t)}},{key:"addFriends",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return e.every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.addFriends({userIds:e},(function(e,r){var i=null;if(!e){var s=G.get(n._iid).User;i=r.users.map((function(e){return new s(e)}))}t(e,i)}))}),t)}},{key:"deleteFriend",value:function(e,t){var n=null,r=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),i=U(r,3);return n=i[0],e=i[1],t=i[2],n?_e(this._iid,(function(e){e(n,null)}),t):this.deleteFriends([e],t)}},{key:"deleteFriends",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"array",constraint:function(e){return e.every((function(e){return"string"==typeof e}))}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.deleteFriends({userIds:e},(function(e,n){t(e,n)}))}),t)}},{key:"getAllEmoji",value:function(e){var t=this,n=null,r=ae.parse(arguments,[new ae({type:"callback"})]),i=U(r,2);return n=i[0],e=i[1],_e(this._iid,(function(e){n?e(n,null):L.get(t._iid).container.apiClient.getAllEmoji((function(n,r){if(n)e(n,null);else{var i=new(0,G.get(t._iid).EmojiContainer)(r);e(null,i)}}))}),e)}},{key:"getEmojiCategory",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"number",constraint:function(e){return e>=0}}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.getEmojiCategory({categoryId:e},(function(e,r){if(e)t(e,null);else{var i=new(0,G.get(n._iid).EmojiCategory)(r);t(null,i)}}))}),t)}},{key:"getEmoji",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"string"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.getEmoji({emojiKey:e},(function(e,r){if(e)t(e,null);else{var i=new(0,G.get(n._iid).Emoji)(r);t(null,i)}}))}),t)}},{key:"getAllowFriendDiscovery",value:function(e){var t=this,n=null,r=ae.parse(arguments,[new ae({type:"callback"})]),i=U(r,2);return n=i[0],e=i[1],_e(this._iid,(function(e){n?e(n,null):L.get(t._iid).container.apiClient.getAllowFriendDiscovery((function(t,n){var r=n.allow_friend_discovery;t?e(t,null):e(null,r)}))}),e)}},{key:"setAllowFriendDiscovery",value:function(e,t){var n=this,r=null,i=ae.parse(arguments,[new ae({type:"boolean"}),new ae({type:"callback"})]),s=U(i,3);return r=s[0],e=s[1],t=s[2],_e(this._iid,(function(t){r?t(r,null):L.get(n._iid).container.apiClient.setAllowFriendDiscovery({allowFriendDiscovery:e},(function(n,r){n?t(n,null):t(null,e)}))}),t)}}],[{key:"version",get:function(){return w.SDK_VERSION}},{key:"LogLevel",get:function(){return W.supportedLogLevels}},{key:"getInstance",value:function(e){return e?hn[e]:dn}},{key:"getLogLevel",value:function(){return W.logLevel}},{key:"setLogLevel",value:function(e){var t=Object.values(W.supportedLogLevels);if(t.includes(e))W.logLevel=e;else{W.logLevel=W.defaultLogLevel;var n=t.map((function(e){return"'".concat(e,"'")})).join(", ");W.warn("`logLevel` parameter should be one of","".concat(n,","),"not `'".concat(e,"'`."),"Set to default log level","`".concat(W.defaultLogLevel,"`."))}}}]),e}();return fn}(n(19),n(38),n(39))}).call(this,n(3),n(15).Buffer,n(4))},function(e,t){var n,r,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var l,u=[],c=!1,d=-1;function h(){c&&l&&(c=!1,l.length?u=l.concat(u):d=-1,u.length&&p())}function p(){if(!c){var e=o(h);c=!0;for(var t=u.length;t;){for(l=u,u=[];++d<t;)l&&l[d].run();d=-1,t=u.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function g(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new f(e,t)),1!==u.length||c||o(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(t){var r=n(1),i=n(25),s=n(8),a={"Content-Type":"application/x-www-form-urlencoded"};function o(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(l=n(9)),l),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(o(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(o(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,n=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,a=!n&&"json"===this.responseType;if(a||i&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(a){if("SyntaxError"===e.name)throw s(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){u.headers[e]=r.merge(a)})),e.exports=u}).call(this,n(3))},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(1);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var s;if(n)s=n(t);else if(r.isURLSearchParams(t))s=t.toString();else{var a=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),a.push(i(t)+"="+i(e))})))})),s=a.join("&")}if(s){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(1),i=n(26),s=n(27),a=n(7),o=n(28),l=n(31),u=n(32),c=n(10);e.exports=function(e){return new Promise((function(t,n){var d=e.data,h=e.headers,p=e.responseType;r.isFormData(d)&&delete h["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var g=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";h.Authorization="Basic "+btoa(g+":"+y)}var m=o(e.baseURL,e.url);function _(){if(f){var r="getAllResponseHeaders"in f?l(f.getAllResponseHeaders()):null,s={data:p&&"text"!==p&&"json"!==p?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:r,config:e,request:f};i(t,n,s),f=null}}if(f.open(e.method.toUpperCase(),a(m,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=_:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(_)},f.onabort=function(){f&&(n(c("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){n(c("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(c(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},r.isStandardBrowserEnv()){var v=(e.withCredentials||u(m))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;v&&(h[e.xsrfHeaderName]=v)}"setRequestHeader"in f&&r.forEach(h,(function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete h[t]:f.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),p&&"json"!==p&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),n(e),f=null)})),d||(d=null),f.send(d)}))}},function(e,t,n){"use strict";var r=n(8);e.exports=function(e,t,n,i,s){var a=new Error(e);return r(a,t,n,i,s)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e,t){t=t||{};var n={},i=["url","method","data"],s=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function l(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function u(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=l(void 0,e[i])):n[i]=l(e[i],t[i])}r.forEach(i,(function(e){r.isUndefined(t[e])||(n[e]=l(void 0,t[e]))})),r.forEach(s,u),r.forEach(a,(function(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=l(void 0,e[i])):n[i]=l(void 0,t[i])})),r.forEach(o,(function(r){r in t?n[r]=l(e[r],t[r]):r in e&&(n[r]=l(void 0,e[r]))}));var c=i.concat(s).concat(a).concat(o),d=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return r.forEach(d,u),n}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){n(41),e.exports=n(40)},function(e,t,n){"use strict";(function(e){
  /*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <http://feross.org>
   * @license  MIT
   */
  var r=n(16),i=n(17),s=n(18);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=l.prototype:(null===e&&(e=new l(t)),e.length=t),e}function l(e,t,n){if(!(l.TYPED_ARRAY_SUPPORT||this instanceof l))return new l(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return d(this,e)}return u(this,e,t,n)}function u(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);l.TYPED_ARRAY_SUPPORT?(e=t).__proto__=l.prototype:e=h(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!l.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|f(t,n),i=(e=o(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(l.isBuffer(t)){var n=0|p(t.length);return 0===(e=o(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?o(e,0):h(e,t);if("Buffer"===t.type&&s(t.data))return h(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function d(e,t){if(c(t),e=o(e,t<0?0:0|p(t)),!l.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function h(e,t){var n=t.length<0?0:0|p(t.length);e=o(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function p(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function f(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return x(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(r)return x(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return U(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:_(e,t,n,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):_(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function _(e,t,n,r,i){var s,a=1,o=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,o/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(s=n;s<o;s++)if(u(e,s)===u(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===l)return c*a}else-1!==c&&(s-=s-c),c=-1}else for(n+l>o&&(n=o-l),s=n;s>=0;s--){for(var d=!0,h=0;h<l;h++)if(u(e,s+h)!==u(t,h)){d=!1;break}if(d)return s}return-1}function v(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var a=0;a<r;++a){var o=parseInt(t.substr(2*a,2),16);if(isNaN(o))return a;e[n+a]=o}return a}function E(e,t,n,r){return B(x(t,e.length-n),e,n,r)}function C(e,t,n,r){return B(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function b(e,t,n,r){return C(e,t,n,r)}function S(e,t,n,r){return B(j(t),e,n,r)}function A(e,t,n,r){return B(function(e,t){for(var n,r,i,s=[],a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var s,a,o,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(s=e[i+1]))&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[i+1],a=e[i+2],128==(192&s)&&128==(192&a)&&(l=(15&u)<<12|(63&s)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[i+1],a=e[i+2],o=e[i+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(l=(15&u)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return u(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?o(e,t):void 0!==n?"string"==typeof r?o(e,t).fill(n,r):o(e,t).fill(n):o(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,s=Math.min(n,r);i<s;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=l.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!l.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):g.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},l.prototype.compare=function(e,t,n,r,i){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),o=Math.min(s,a),u=this.slice(r,i),c=e.slice(t,n),d=0;d<o;++d)if(u[d]!==c[d]){s=u[d],a=c[d];break}return s<a?-1:a<s?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return m(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return m(this,e,t,n,!1)},l.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":return C(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function U(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function O(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function T(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",s=t;s<n;++s)i+=G(e[s]);return i}function R(e,t,n){for(var r=e.slice(t,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}function N(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function w(e,t,n,r,i,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i<s;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function P(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i<s;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function L(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,s){return s||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function H(e,t,n,r,s){return s||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),l.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=l.prototype;else{var i=t-e;n=new l(i,void 0);for(var s=0;s<i;++s)n[s]=this[s+e]}return n},l.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||N(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r},l.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||N(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUInt8=function(e,t){return t||N(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||N(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||N(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||N(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||N(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||N(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||N(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||N(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||N(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||N(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||N(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||w(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[t]=255&e;++s<n&&(i*=256);)this[t+s]=e/i&255;return t+n},l.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||w(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):P(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);w(this,e,t,n,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s<n&&(a*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);w(this,e,t,n,i-1,-i)}var s=n-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):P(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||w(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,s=r-n;if(this===e&&n<t&&t<r)for(i=s-1;i>=0;--i)e[i+t]=this[i+n];else if(s<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s},l.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!l.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{var a=l.isBuffer(e)?e:x(new l(e,r).toString()),o=a.length;for(s=0;s<n-t;++s)this[s+t]=a[s%o]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function G(e){return e<16?"0"+e.toString(16):e.toString(16)}function x(e,t){var n;t=t||1/0;for(var r=e.length,i=null,s=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function j(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(4))},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],o=r[1],l=new s(function(e,t,n){return 3*(t+n)/4-n}(0,a,o)),c=0,d=o>0?a-4:a;for(n=0;n<d;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;2===o&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,l[c++]=255&t);1===o&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t);return l},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],a=0,o=n-i;a<o;a+=16383)s.push(c(e,a,a+16383>o?o:a+16383));1===i?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return s.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=a.length;o<l;++o)r[o]=a[o],i[a.charCodeAt(o)]=o;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var i,s,a=[],o=t;o<n;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  t.read=function(e,t,n,r,i){var s,a,o=8*i-r-1,l=(1<<o)-1,u=l>>1,c=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,s=p&(1<<-c)-1,p>>=-c,c+=o;c>0;s=256*s+e[t+d],d+=h,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=h,c-=8);if(0===s)s=1-u;else{if(s===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),s-=u}return(p?-1:1)*a*Math.pow(2,s-r)},t.write=function(e,t,n,r,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,d=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,f=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(o=0,a=c):a+d>=1?(o=(t*l-1)*Math.pow(2,i),a+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&o,p+=f,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;e[n+p]=255&a,p+=f,a/=256,u-=8);e[n+p-f]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){e.exports=n(20)},function(e,t,n){"use strict";var r=n(1),i=n(6),s=n(21),a=n(12);function o(e){var t=new s(e),n=i(s.prototype.request,t);return r.extend(n,s.prototype,t),r.extend(n,t),n}var l=o(n(5));l.Axios=s,l.create=function(e){return o(a(l.defaults,e))},l.Cancel=n(13),l.CancelToken=n(35),l.isCancel=n(11),l.all=function(e){return Promise.all(e)},l.spread=n(36),l.isAxiosError=n(37),e.exports=l,e.exports.default=l},function(e,t,n){"use strict";var r=n(1),i=n(7),s=n(22),a=n(23),o=n(12),l=n(33),u=l.validators;function c(e){this.defaults=e,this.interceptors={request:new s,response:new s}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=o(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&l.assertOptions(t,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var i,s=[];if(this.interceptors.response.forEach((function(e){s.push(e.fulfilled,e.rejected)})),!r){var c=[a,void 0];for(Array.prototype.unshift.apply(c,n),c=c.concat(s),i=Promise.resolve(e);c.length;)i=i.then(c.shift(),c.shift());return i}for(var d=e;n.length;){var h=n.shift(),p=n.shift();try{d=h(d)}catch(e){p(e);break}}try{i=a(d)}catch(e){return Promise.reject(e)}for(;s.length;)i=i.then(s.shift(),s.shift());return i},c.prototype.getUri=function(e){return e=o(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,n){return this.request(o(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,n,r){return this.request(o(r||{},{method:e,url:t,data:n}))}})),e.exports=c},function(e,t,n){"use strict";var r=n(1);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var r=n(1),i=n(24),s=n(11),a=n(5);function o(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return o(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return o(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(o(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(1),i=n(5);e.exports=function(e,t,n){var s=this||i;return r.forEach(n,(function(n){e=n.call(s,e,t)})),e}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(10);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(1);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,s,a){var o=[];o.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),r.isString(i)&&o.push("path="+i),r.isString(s)&&o.push("domain="+s),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(29),i=n(30);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(1),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,s,a={};return e?(r.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=r.trim(e.substr(0,s)).toLowerCase(),n=r.trim(e.substr(s+1)),t){if(a[t]&&i.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},function(e,t,n){"use strict";var r=n(1);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(34),i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var s={},a=r.version.split(".");function o(e,t){for(var n=t?t.split("."):a,r=e.split("."),i=0;i<3;i++){if(n[i]>r[i])return!0;if(n[i]<r[i])return!1}return!1}i.transitional=function(e,t,n){var i=t&&o(t);function a(e,t){return"[Axios v"+r.version+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,o){if(!1===e)throw new Error(a(r," has been removed in "+t));return i&&!s[r]&&(s[r]=!0,console.warn(a(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,o)}},e.exports={isOlderVersion:o,assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var s=r[i],a=t[s];if(a){var o=e[s],l=void 0===o||a(o,s,e);if(!0!==l)throw new TypeError("option "+s+" must be "+l)}else if(!0!==n)throw Error("Unknown option "+s)}},validators:i}},function(e){e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},function(e,t,n){"use strict";var r=n(13);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t){e.exports="object"==typeof self?self.FormData:window.FormData},function(e,t,n){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(e,t,n){},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return _}));const r=e=>{let t=e=>{e.html=t=>(void 0!==t&&(e.innerHTML=t),e.innerHTML),e.attr=(t,n)=>(void 0!==n&&(n?e.setAttribute(t,n):e.removeAttribute(t)),e.getAttribute(t)),e.val=t=>(void 0!==t&&(e.value=t),e.value),e.simplifiedChildren=()=>{let t=[];for(let n=0;n<e.children.length;n++)t.push(r(e.children[n]));return t},e.removeAll=t=>{if(t){let n=[],r=e.simplifiedChildren();for(let e in r)r[e].hasClass(t)&&n.push(r[e]);for(let t in n)e.removeChild(n[t])}else e.innerHTML=""},e.show=t=>(e.style.display=t||"",e),e.hide=()=>(e.style.display="none",e),e.fadeIn=(t=300,n)=>{e.style.opacity=0,e.style.display="inline-block";let r=0;const i=setInterval(()=>{e.style.opacity=Math.min(r/t,1),r+=10,r>t&&(clearInterval(i),n&&n())},10)},e.fadeOut=(t=300,n)=>{e.style.opacity=1;let r=0;const i=setInterval(()=>{e.style.opacity=1-Math.min(r/t,1),r+=10,r>t&&(clearInterval(i),n&&n())},10)},e.hasClass=t=>e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className),e.addClass=t=>(Array.isArray(t)||(t=t?[t]:[]),t.forEach(t=>{e.classList?t in e.classList||e.classList.add(t):e.className.indexOf(t)<0&&(e.className+=" "+t)}),e),e.removeClass=t=>(e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi"),""),e),e.toggleClass=t=>{e.hasClass(t)?e.removeClass(t):e.addClass(t)},e.on=(t,n)=>{e.addEventListener(t,n)},e.off=(t,n)=>{e.removeEventListener(t,n)}};if(e instanceof NodeList&&(e=Array.from(e)),Array.isArray(e))for(let n in e)t(e[n]);else e instanceof HTMLElement&&t(e);return e},i=e=>{var t=document.createElement("div");return t.innerHTML=e.trim(),(t=r(t.firstChild)).parentNode&&t.parentNode.removeChild(t),t},s={};let a=0;class o{constructor(e,t){this._sid=a++,this.event=e,this.callback=t}static send(e,t){if(e instanceof Array)for(let n in e)o.send(e[n],t);else if(s[e])for(let n in s[e])s[e][n].callback(t)}static subscribe(e,t){const n=new o(e,t);return s[e]||(s[e]=[]),s[e].push(n),n}static unsubscribe(e){const t=e.event;if(s[t])for(let n in s[t])if(s[t][n]._sid===e._sid){s[t].splice(n,1);break}}}var l=n(2),u=n.n(l),c=n(0),d=n.n(c);class h{constructor(){this.attachCount=0,this.element=i("<div class='-sbd-spinner'>\n            <div class='-sbd-spinner-wrapper'>\n                <div></div>\n                <div></div>\n                <div></div>\n            </div>\n        </div>")}isAttached(){return!!this.element.parentNode}attachTo(e){this.attachCount++,this.isAttached()||e.appendChild(this.element)}detach(){this.attachCount--,this.isAttached()&&0===this.attachCount&&this.element.parentNode.removeChild(this.element)}}class p{constructor(e,t){this.message=e,this.streak=!!t,this.element=i("<div class='-sbd-message-item'>\n            <div class='profile'>\n                <img src='' alt='Profile' class='image'></img>\n            </div>\n            <div class='content'>\n                <div class='media'>\n                    <img src='' alt='Image' class='image'></img>\n                    <video src='' controls='controls' width='240' height='200' class='video'></video>\n                </div>\n                <div class='preview'>\n                    <img src='' alt='Image' class='image'></img>\n                    <div class='title'></div>\n                    <div class='description'></div>\n                </div>\n                <div class='message'>\n                  <div class='file'></div>\n                  <div class='text'></div>\n                </div>\n                <div class='chatbot-card'></div>\n                <div class='rating'>\n                  <div class='rating-message'></div>\n                  <div class='rating-score'>\n                    <div class='rating-item'></div>\n                    <div class='rating-item'></div>\n                    <div class='rating-item'></div>\n                    <div class='rating-item'></div>\n                    <div class='rating-item'></div>\n                  </div>\n                  <div class='rating-form'>\n                    <textarea class='rating-comment' placeholder='(Optional)'></textarea>\n                    <button class='rating-submit'>Submit</button>\n                  </div>\n                </div>\n                <div class='rating-result'>\n                  <div class='rating-message'>Thank you!</div>\n                  <div class='rating-description'>Your submission has been received</div>\n                  <div class='line'></div>\n                  <div class='rating-result-score'>\n                    <div class='rating-result-item'></div>\n                    <div class='rating-result-item'></div>\n                    <div class='rating-result-item'></div>\n                    <div class='rating-result-item'></div>\n                    <div class='rating-result-item'></div>\n                    <div class='rating-result-number'></div>\n                  </div>\n                  <div class='rating-result-comment'></div>\n                </div>\n                <div class='created-at'></div>\n            </div>\n            <div class='confirm-end-of-chat'>\n              <div class='message'></div>\n              <div class='confirm'>\n                <div class='yes button'>Yes</div>\n                <div class='no button'>No</div>\n              </div>\n            </div>\n        </div>"),this.isSatisfactionForm=!1,this.satisfaction={score:null,comment:null,sent:!1},this.content=r(this.element.querySelector(".content")),this.media=r(this.content.querySelector(".media")),this.image=r(this.media.querySelector(".image")),this.video=r(this.media.querySelector(".video")),this.preview=r(this.element.querySelector(".preview")),this.previewImage=r(this.preview.querySelector(".image")),this.previewTitle=r(this.preview.querySelector(".title")),this.previewDescription=r(this.preview.querySelector(".description")),this.profile=r(this.element.querySelector(".profile")),this.profileImage=r(this.profile.querySelector(".image")),this.messageBox=r(this.element.querySelector(".content .message")),this.messageFile=r(this.messageBox.querySelector(".file")),this.messageText=r(this.messageBox.querySelector(".text")),this.createdAt=r(this.element.querySelector(".created-at")),this.chatbotCard=r(this.element.querySelector(".chatbot-card")),this.confirmEndOfChat=r(this.element.querySelector(".confirm-end-of-chat")),this.confirmMessage=r(this.confirmEndOfChat.querySelector(".message")),this.confirm=r(this.confirmEndOfChat.querySelector(".confirm")),this.yes=r(this.confirm.querySelector(".yes")),this.no=r(this.confirm.querySelector(".no")),this.yes.on("click",()=>{d.a.Ticket.confirmEndOfChat(this.message,"yes")}),this.no.on("click",()=>{d.a.Ticket.confirmEndOfChat(this.message,"no")}),this.rating=r(this.element.querySelector(".rating")),this.ratingMessage=r(this.rating.querySelector(".rating-message")),this.ratingItems=r(this.rating.querySelectorAll(".rating-item")),this.ratingForm=r(this.rating.querySelector(".rating-form")),this.ratingComment=r(this.rating.querySelector(".rating-comment")),this.ratingSubmit=r(this.rating.querySelector(".rating-submit")),this.ratingItems.forEach((e,t)=>{e.on("click",()=>{if(!this.satisfaction.sent){for(let e=0;e<this.ratingItems.length;e++)e<=t?this.ratingItems[e].addClass("selected"):this.ratingItems[e].removeClass("selected");this.satisfaction.score=t+1,this.ratingForm.show()}})}),this.ratingSubmit.on("click",()=>{if(!this.satisfaction.sent){const e=this.ratingComment.val();d.a.Ticket.submitFeedback(this.message,this.satisfaction.score,e,(t,n)=>{n||(this.satisfaction.comment=e,this.satisfaction.sent=!0)})}}),this.ratingResult=r(this.element.querySelector(".rating-result")),this.ratingResultItems=r(this.ratingResult.querySelectorAll(".rating-result-item")),this.ratingResultNumber=r(this.ratingResult.querySelector(".rating-result-number")),this.ratingResultComment=r(this.ratingResult.querySelector(".rating-result-comment")),this.render()}render(){const e=u.a.getInstance(),t=this.message.sender||{};e.getCurrentUserId()===t.userId&&(this.messageFile.removeClass("file"),this.messageFile.addClass("my-file"),this.element.addClass("-sbd-my-message")),this.message.isAdminMessage()&&this.element.addClass("-sbd-admin-message");try{const e=JSON.parse(this.message.data);"SENDBIRD_DESK_CUSTOMER_SATISFACTION"===e.type&&(this.isSatisfactionForm=!0,this.satisfaction.ticketId=e.body.ticketId,"WAITING"!==e.body.status&&(this.satisfaction.score=e.body.customerSatisfactionScore,this.satisfaction.comment=e.body.customerSatisfactionComment,this.satisfaction.sent=!0)),"SENDBIRD_DESK_BOT_MESSAGE_FAQ_ANSWERS"===e.type&&(this.chatbotFaqResults=e.results&&e.results||[])}catch(e){}if(t.profileUrl?(this.profileImage.attr("src",t.profileUrl),this.profileImage.show()):this.message.isAdminMessage()?this.profileImage.attr("src",""):this.profileImage.hide(),this.isSatisfactionForm)this.preview.hide(),this.media.hide(),this.messageBox.hide(),this.confirmEndOfChat.hide(),this.chatbotCard.hide(),this.satisfaction.sent?(this.rating.hide(),this.ratingResult.show(),this.ratingResultItems.forEach((e,t)=>{t+1<=this.satisfaction.score&&e.addClass("selected")}),this.ratingResultNumber.html(this.satisfaction.score),this.satisfaction.comment?this.ratingResultComment.html(this.satisfaction.comment):this.ratingResultComment.hide()):(this.rating.show(),this.ratingResult.hide(),this.ratingMessage.html(this.message.message)),this.ratingForm.hide();else{if(this.preview.hide(),this.message.data)try{const e=JSON.parse(this.message.data);switch(e.type){case d.a.Message.DataType.URL_PREVIEW:this.message.message=this.message.message.replace(d.a.Message.UrlRegExp,e=>`<a href='${e}' target='_blank'>${e}</a>`),e.body.url&&e.body.title&&(this.preview.attr("href",e.body.url),this.previewTitle.html(e.body.title),e.body.image?(this.previewImage.attr("src",e.body.image),this.previewImage.show()):this.previewImage.hide(),e.body.description&&this.previewDescription.html(e.body.description),this.preview.on("click",()=>window.open(e.body.url,"_blank")),this.preview.show());break;case d.a.Message.DataType.TICKET_FEEDBACK:}}catch(e){}this.message.isAdminMessage()?(this.messageFile.hide(),this.media.hide(),this.messageBox.show(),this.messageText.html(this.message.message),this.chatbotCard.hide()):this.message.isFileMessage()?(this.chatbotCard.hide(),this.message.type.indexOf("image")>=0?(this.messageBox.hide(),this.video.hide(),this.image.attr("src",this.message.url)):this.message.type.indexOf("video")>=0?(this.messageBox.hide(),this.image.hide(),this.video.attr("src",this.message.url)):(this.messageFile.show("inline-block"),this.media.hide(),this.messageBox.show(),this.messageText.html(this.message.name),this.messageText.addClass("file-name"),this.messageText.on("click",()=>{window.open(this.message.url,"_blank")}))):(this.messageFile.hide(),this.media.hide(),this.messageBox.show(),this.messageText.html(this.message.message),this.chatbotFaqResults&&this.chatbotFaqResults.length>0?(this.chatbotCard.show("flex"),this.chatbotFaqResults.forEach(e=>{const{question:t="",answer:n="",url:r="",url_label:s="",image_url:a=""}=e,o=i(`\n              <div class="faq-card">\n                <img\n                  class="faq-card__profile-image"\n                  src="${a||"img/login-logo.png"}"\n                  alt="${s}"\n                ></img>\n                <div class="faq-card__title-question">${t}</div>\n                <p class="faq-card__description">${n}</p>\n              </div>\n            `);o.onclick=()=>{window.open(r)},this.chatbotCard.appendChild(o,this.chatbotCard)})):this.chatbotCard.hide()),this.streak&&this.createdAt.hide(),this.createdAt.html(moment(this.message.createdAt).fromNow());let e=null;try{e=this.message.data?JSON.parse(this.message.data):null}catch(e){throw e}if(e&&e.type===d.a.Message.DataType.TICKET_INQUIRE_CLOSURE){switch(e.body.state){case d.a.Message.ClosureState.WAITING:this.profile.hide(),this.content.hide(),this.confirmMessage.html(this.message.message),this.confirmEndOfChat.show();break;default:this.confirmEndOfChat.hide()}}else this.confirmEndOfChat.hide();this.rating.hide(),this.ratingResult.hide()}}static get Script(){return{TICKET_ASSIGNED:"Ticket assigned.",TICKET_CLOSED:"Ticket closed.",TICKET_START:"Hi, what can I help you?"}}static isVisible(e){let t=null;try{t=e.data?JSON.parse(e.data):null}catch(e){throw e}return e.isSystemMessage="SENDBIRD_DESK_ADMIN_MESSAGE_CUSTOM_TYPE"===e.customType,e.isAssigned=t&&t.type===d.a.Message.DataType.TICKET_ASSIGN,e.isTransferred=t&&t.type===d.a.Message.DataType.TICKET_TRANSFER,e.isClosed=t&&t.type===d.a.Message.DataType.TICKET_CLOSE,!(e.isSystemMessage||e.isAssigned||e.isTransferred||e.isClosed)}}class f{constructor(e){this.ticket=e,this.element=i(`<div class='-sbd-dialog'>\n            <div class='-sbd-dialog-header'>\n                <div class='close'></div>\n                <div class='agent'>\n                    <div class='profile'>\n                        <img src='' alt='Profile' class='image'></img>\n                    </div>\n                    <div class='name'>${this.ticket.agent?this.ticket.agent.name:"Agent"}</div>\n                </div>\n            </div>\n            <div class='-sbd-message-list'>\n            </div>\n            <div class='-sbd-message-form'>\n                <input type='text' class='message' placeholder='Write a message...'></input>\n                <div class='attach'><input type='file' class='file'></input></div>\n            </div>\n        </div>`),this.updateAgent(e.agent),this.isOpened=!1;r(this.element.querySelector(".close")).on("click",()=>{this.close()}),this.messageList=r(this.element.querySelector(".-sbd-message-list")),this.messageElementList=[],this.collisionSet=new Set,this.spinner=new h,this.messageRevision=0,this.isLoading=!1,this.noMoreMessage=!1,this.messageList.on("scroll",e=>{if(!this.isLoading&&!this.noMoreMessage&&this.isTop()){this.isLoading=!0;const t=this.messageRevision;this.loadMessage(!0,(e,n)=>{if(!n&&this.messageRevision===t){const t=e;for(let e in t){const n=t[e];p.isVisible(n)&&this.prependMessage(n)}}this.isLoading=!1}),e.preventDefault(),e.stopPropagation()}}),this.form=r(this.element.querySelector(".-sbd-message-form")),this.input=r(this.form.querySelector(".message")),this.attach=r(this.form.querySelector(".attach")),this.file=r(this.form.querySelector(".file")),this.editable=!0,e.status===d.a.Ticket.Status.CLOSED&&this.disableForm(),this.input.on("keypress",e=>{if(13===e.keyCode&&!e.shiftKey){e.preventDefault();const t=this.input.val();this.input.val(""),t&&this.editable&&(this.ticket.status===d.a.Ticket.Status.INITIALIZED&&(this.ticket.status=d.a.Ticket.Status.UNASSIGNED),this.ticket.channel.sendUserMessage(t,(e,t)=>{if(t)this.ticket.status=d.a.Ticket.Status.INITIALIZED;else{const t=e;d.a.Message.UrlRegExp.test(t.message)&&(t.url=d.a.Message.UrlRegExp.exec(t.message)[0],d.a.Ticket.getUrlPreview(t.url,(e,n)=>{if(n)throw n;this.ticket.channel.updateUserMessage(t.messageId,t.message,JSON.stringify({type:d.a.Message.DataType.URL_PREVIEW,body:{url:t.url,site_name:e.data.siteName,title:e.data.title,description:e.data.description,image:e.data.image}}),t.customType,(e,t)=>{if(t)throw t;this.updateMessage(e)})})),this.appendMessage(e),this.scrollToBottom()}}))}}),this.attach.on("click",()=>{this.editable&&this.file.click()}),this.file.on("change",()=>{if(this.editable){let e=this.file.files[0];this.ticket.channel.sendFileMessage(e,e.name,e.type,e.size,"","",[{maxWidth:220,maxHeight:220}],(e,t)=>{t||p.isVisible(e)&&this.appendMessage(e)})}}),this.file.on("click",e=>e.stopPropagation())}loadMessage(e,t){this.query&&e||(this.query=this.ticket.channel.createPreviousMessageListQuery(),this.clearMessage()),this.query.load(20,!0,(e,n)=>{if(n)throw n;this.noMoreMessage=e.length<20,t(e,n)})}open(e){if(e){this.isOpened=!0,this.widget=e,this.widget.panel.appendChild(this.element),this.element.addClass("opened"),this.ticket.channel.markAsRead(),this.spinner.attachTo(this.messageList),this.messageRevision++;const t=this.messageRevision;this.loadMessage(!1,(e,n)=>{if(!n&&this.messageRevision===t){const t=e;for(let e in t){const n=t[e];p.isVisible(n)&&this.prependMessage(n)}this.scrollToBottom()}this.spinner.detach()})}}close(e){e?(this.element.hide(),this.element.parentNode&&this.widget.panel.removeChild(this.element)):(this.element.removeClass("opened"),setTimeout(()=>{this.element.parentNode&&this.widget.panel.removeChild(this.element)},1e3)),this.isOpened=!1}enableForm(){this.editable=!0,this.form.removeClass("disabled"),this.input.attr("readonly",""),this.input.attr("placeholder","Write a message..."),this.attach.show()}disableForm(){this.editable=!1,this.form.addClass("disabled"),this.input.attr("readonly","readonly"),this.input.attr("placeholder",""),this.attach.hide()}updateAgent(e){this.ticket&&(this.ticket.agent=e);let t=r(this.element.querySelector(".agent .profile .image")),n=r(this.element.querySelector(".agent .name"));e?(e.profileUrl?(t.attr("src",e.profileUrl),t.show()):t.hide(),n.html(e.name||"Agent")):(t.hide(),n.html("Agent"))}isMessageStreak(e,t){return(!e.sender&&!t.sender||e.sender&&t.sender&&e.sender.userId===t.sender.userId)&&Math.round((e.createdAt-t.createdAt)/1e3)<60}prependMessage(e){if(!this.collisionSet.has(e.messageId)){this.collisionSet.add(e.messageId);let t=!1;if(this.messageElementList.length>0){let n=null;for(let e in this.messageElementList){const t=this.messageElementList[e];if(!t.streak){n=t;break}}n&&(t=this.isMessageStreak(n.message,e))}const n=new p(e,t);this.messageElementList.unshift(n),this.messageList.firstChild?this.messageList.insertBefore(n.element,this.messageList.firstChild):this.messageList.appendChild(n.element)}}appendMessage(e){if(!this.collisionSet.has(e.messageId)){if(this.collisionSet.add(e.messageId),this.messageElementList.length>0){const t=this.messageElementList[this.messageElementList.length-1];this.isMessageStreak(e,t.message)&&(t.streak=!0,t.render())}const t=this.isBottom(),n=new p(e);this.messageElementList.push(n),this.messageList.appendChild(n.element),!this.spinner.isAttached()&&t&&this.scrollToBottom()}}updateMessage(e){for(let t in this.messageElementList){const n=this.messageElementList[t];if(n.message.messageId===e.messageId){n.message=e,n.render();break}}}clearMessage(){this.collisionSet=new Set,this.messageList.removeAll("-sbd-message-item"),this.messageElementList=[]}isTop(){return 0===this.messageList.scrollTop}isBottom(){return this.messageList.scrollHeight-this.messageList.scrollTop===this.messageList.clientHeight}scrollToBottom(){this.messageList.scrollTo(0,this.messageList.scrollHeight)}}class g{constructor(e,t){this.ticket=t,this.element=i(`<div class='-sbd-ticket-item'>\n            <div class='profile'>\n                <img src='${t.agent?t.agent.profileUrl:""}' alt='Profile' class='image'></img>\n                <div class='badge'></div>\n            </div>\n            <div class='content'>\n                <div class='name'>${t.agent?t.agent.name:t.title}</div>\n                <div class='last'>${t.channel.lastMessage.message||"No message"}</div>\n            </div>\n            <div class='updated-at'></div>\n        </div>`),this.profileImage=r(this.element.querySelector(".profile .image")),this.badge=r(this.element.querySelector(".profile .badge")),this.name=r(this.element.querySelector(".content .name")),this.last=r(this.element.querySelector(".content .last")),this.updatedAt=r(this.element.querySelector(".updated-at")),this.render(),this.element.on("click",()=>{e.startNewDialog(this.ticket)})}render(){const e=this.ticket.agent;e&&e.profileUrl?(this.profileImage.attr("src",e.profileUrl),this.profileImage.show()):this.profileImage.hide();let t=this.ticket.channel.unreadMessageCount;t>0?(t>=99&&(t+="+"),this.badge.html(t),this.badge.show()):this.badge.hide(),this.name.html(e?e.name:this.ticket.title),this.ticket.channel.lastMessage&&(this.ticket.channel.lastMessage.isFileMessage()?this.last.html(this.ticket.channel.lastMessage.name):this.last.html(this.ticket.channel.lastMessage.message)),this.updatedAt.html(moment(this.ticket.channel.lastMessage?this.ticket.channel.lastMessage.createdAt:null).fromNow())}}class y{constructor(e,t){this.ticket=e,this.message=t,this.element=i("<div class='-sbd-notification'>\n            <div class='profile'>\n              <img src='' alt='Profile' class='image'></img>\n            </div>\n            <div class='content'>\n              <div class='name'>Agent</div>\n              <div class='close'></div>\n              <div class='text'></div>\n            </div>\n        </div>"),this.onClickHandler=null,this.element.on("click",()=>{this.onClickHandler&&this.onClickHandler(this.ticket,this.message)});r(this.element.querySelector(".close")).on("click",e=>{e.stopPropagation(),e.preventDefault(),this.close()}),this.profile=r(this.element.querySelector(".profile")),this.profileImage=r(this.profile.querySelector(".image")),this.messageBox=r(this.element.querySelector(".content")),this.name=r(this.element.querySelector(".name")),this.messageText=r(this.messageBox.querySelector(".text")),this.render()}render(){const e=this.message.sender||{};e.profileUrl?(this.profileImage.attr("src",e.profileUrl),this.profileImage.show()):this.profileImage.hide(),e.name&&this.name.html(e.name),this.message.isAdminMessage()?this.messageText.html(this.message.message):this.message.isFileMessage()?this.messageText.html(this.message.name):this.messageText.html(this.message.message)}open(e,t=5e3){this.widget=e,this.element.addClass("fade-in"),this.widget.element.appendChild(this.element),setTimeout(()=>{this.close()},t)}close(){this.element.removeClass("fade-in"),setTimeout(()=>{this.element.parentNode&&this.widget.element.removeChild(this.element)},2e3)}onClick(e){this.onClickHandler=e}}class m{constructor(e,t){this.element=document.getElementById("sb-desk"),this.element.className="-sbd-widget",t||(t={}),m.panel=this.panel=i(`<div class='-sbd-panel'>\n            <div class='-sbd-header'>\n                <div class='-sbd-title'>Inbox</div>\n                <div class='-sbd-tabs'>\n                    <div class='-sbd-tab-item' data-status='${d.a.Ticket.Status.OPEN}'>OPEN</div>\n                    <div class='-sbd-tab-item' data-status='${d.a.Ticket.Status.CLOSED}'>CLOSED</div>\n                    <div class='-sbd-tab-bar'></div>\n                </div>\n                <div class='-sbd-menu'><div class='icon'></div></div>\n                <div class='-sbd-menu-list'>\n                  <div class='-sbd-menu-item' data-cmd='signout'>Sign out</div>\n                </div>\n            </div>\n            <div class='-sbd-ticket-list'>\n                <div class='-sbd-ticket-new'>\n                    <div class='icon'></div>\n                    <div class='label'>Start a new conversation.</div>\n                </div>\n            </div>\n            <div class='-sbd-error'>Cannot connect to internet.</div>\n        </div>`),this.element.appendChild(this.panel),this.error=r(this.element.querySelector(".-sbd-error"));let n=r(document.querySelectorAll(".-sbd-tabs > .-sbd-tab-item")),s=r(document.querySelector(".-sbd-tabs > .-sbd-tab-bar"));for(let e=0;e<n.length;e++)n[e].on("click",e=>{let t=e.target.getAttribute("data-status");f(t)});let a=r(document.querySelector(".-sbd-menu")),o=r(document.querySelector(".-sbd-menu-list"));a.on("click",()=>o.toggleClass("fade-in"));let l=r(document.querySelectorAll(".-sbd-menu-list > .-sbd-menu-item"));for(let e=0;e<l.length;e++)l[e].on("click",e=>{switch(e.target.getAttribute("data-cmd")){case"signout":this.signout()}o.toggleClass("fade-in")});this.ticketList=r(document.querySelector(".-sbd-panel > .-sbd-ticket-list")),this.ticketElementList=[],this.ticketRevision=0,this.isLoading=!1,this.noMoreTicket=!1,this.ticketList.on("scroll",()=>{if(!this.isLoading&&!this.noMoreTicket&&this.isBottom()){this.isLoading=!0,this.currentPage++;const e=this.ticketRevision;this.loadTicket(this.currentTab,this.currentPage,(t,n)=>{if(!n&&this.ticketRevision===e)for(let e in t)this.appendTicket(t[e]);this.isLoading=!1})}});let c=r(document.querySelector(".-sbd-ticket-list > .-sbd-ticket-new"));c.on("click",()=>{const t="Issue #"+("000"+(new Date).getTime()%1e3).slice(-3);this.spinner.attachTo(this.ticketList),d.a.Ticket.create(t,e.nickname,(e,t)=>{if(t)throw t;this.spinner.detach(),this.startNewDialog(e)})}),this.spinner=new h,this.currentTab="",this.currentPage=0,this.payloadTicket=null;let f=e=>{if(e!=this.currentTab){for(let t=0;t<n.length;t++){n[t].attr("data-status")===e&&(s.style.left=n[t].offsetLeft+"px")}e===d.a.Ticket.Status.OPEN?c.show():c.hide(),this.currentTab=e,this.currentPage=0,this.ticketRevision++,this.clearTicket();const t=this.ticketRevision;this.spinner.attachTo(this.ticketList),this.loadTicket(e,this.currentPage,(e,n)=>{if(this.spinner.detach(),!n&&this.ticketRevision===t){for(let t in e)this.appendTicket(e[t]);this.payloadTicket&&(this.startNewDialog(this.payloadTicket),this.payloadTicket=null)}})}};const _=r(document.querySelector(".guide-balloon"));this.active=!1,this.action=i("<div class='-sbd-action-button'></div>"),this.action.on("click",()=>{this.active=!this.active,this.action.toggleClass("is-active"),this.panel.toggleClass("fade-in"),this.active?f(d.a.Ticket.Status.OPEN):this.dialog&&setTimeout(()=>{this.currentTab="",this.dialog.close(!0)},500),this.active?_.hide():_.show()}),this.action.hide(),this.element.appendChild(this.action),this.sendbird=new u.a({appId:e.appId}),this.sendbird.connect(e.userId,t.apiHost,t.wsHost,(n,r)=>{if(r)throw r;this.sendbird.updateCurrentUserInfo(e.nickname,null,(n,r)=>{if(r)throw r;d.a.init(u.a),t.deskApiHost&&d.a.setApiHost(t.deskApiHost),d.a.authenticate(e.userId,(e,t)=>{if(t)throw t;_.fadeIn(300),this.action.show();const n=new this.sendbird.ConnectionHandler;n.onReconnectStarted=()=>{this.active&&this.spinner.attachTo(this.ticketList)},n.onReconnectSucceeded=()=>{if(this.active){const e=this.currentTab;if(this.currentTab="",this.error.hide(),this.dialog&&this.dialog.isOpened){this.dialog.ticket.channel.markAsRead(),this.dialog.ticket.refresh((e,t)=>{t||(this.dialog.ticket=e,this.dialog.updateAgent(e.agent))});const t=this.dialog.messageRevision;this.dialog.loadMessage(!1,(n,r)=>{if(!r){if(this.dialog.messageRevision===t){const e=n;for(let t in e){const n=e[t];p.isVisible(n)&&this.dialog.prependMessage(n)}this.dialog.scrollToBottom()}this.spinner.detach()}f(e)})}else this.spinner.detach(),f(e)}},n.onReconnectFailed=()=>{this.active&&(this.spinner.detach(),this.error.show())},this.sendbird.addConnectionHandler("widget",n);const r=new this.sendbird.ChannelHandler;r.onChannelChanged=e=>{d.a.Ticket.getByChannelUrl(e.url,(t,n)=>{if(n)throw n;const r=t;r.channel=e;let i=this.ticketElementList.findIndex(e=>e.ticket.id===r.id),s=i>=0?this.ticketElementList[i]:null;s&&(s.ticket=r,s.render());const a=r.status===d.a.Ticket.Status.INITIALIZED,o=r.status===d.a.Ticket.Status.CLOSED,l=0===i;this.currentTab===d.a.Ticket.Status.CLOSED||l||o||(s?(this.ticketElementList.splice(i,1),this.ticketList.removeChild(s.element)):a||(s=new g(this,r)),s&&(this.ticketElementList.length>0?(this.ticketList.insertBefore(s.element,this.ticketElementList[0].element),this.ticketElementList.unshift(s)):(this.ticketElementList.push(s),this.ticketList.appendChild(s.element))))})},r.onMessageReceived=(e,t)=>{if(!this.currentTab||this.currentTab===d.a.Ticket.Status.OPEN){let n=null;try{n=t.data?JSON.parse(t.data):null}catch(e){throw e}d.a.Ticket.getByChannelUrl(e.url,(r,i)=>{if(i)throw i;const s=r;n&&n.ticket&&(s.status=n.ticket.status),t.isAssigned=n&&n.type===d.a.Message.DataType.TICKET_ASSIGN,t.isTransferred=n&&n.type===d.a.Message.DataType.TICKET_TRANSFER,t.isClosed=n&&n.type===d.a.Message.DataType.TICKET_CLOSE,(t.isAssigned||t.isTransferred)&&(s.agent=n.ticket.agent);const a=this.ticketElementList.findIndex(e=>e.ticket.id===s.id),o=a>=0?this.ticketElementList[a]:null;if(o&&(o.ticket=s,o.render(),t.isClosed&&(this.ticketElementList.splice(a,1),this.ticketList.removeChild(o.element))),!this.active&&d.a.isDeskChannel(e)&&p.isVisible(t)){const e=new y(s,t);e.render(),e.onClick(t=>{e.close(),this.payloadTicket=t,this.action.click()}),e.open(this)}}),this.dialog&&this.dialog.isOpened&&this.dialog.ticket.channel.url===e.url&&(p.isVisible(t)&&this.dialog.appendMessage(t),this.dialog.ticket.channel.markAsRead(()=>{}))}},r.onMessageUpdated=(e,t)=>{this.currentTab===d.a.Ticket.Status.OPEN&&d.a.Ticket.getByChannelUrl(e.url,(n,r)=>{if(r)throw r;const i=n;let s=null;try{s=t.data?JSON.parse(t.data):null}catch(e){throw e}s&&s.ticket&&(i.status=s.ticket.status);let a=this.ticketElementList.findIndex(e=>e.ticket.id===i.id),o=a>=0?this.ticketElementList[a]:null;if(t.isClosureInquired=s&&s.type===d.a.Message.DataType.TICKET_INQUIRE_CLOSURE,t.isClosureInquired){switch(s.body.state){case d.a.Message.ClosureState.CONFIRMED:i.status=d.a.Ticket.Status.CLOSED,o&&(this.ticketElementList.splice(a,1),this.ticketList.removeChild(o.element))}}this.dialog&&this.dialog.isOpened&&this.dialog.ticket.channel.url===e.url&&(this.dialog.updateMessage(t),i.status===d.a.Ticket.Status.CLOSED&&this.dialog.disableForm())})},this.sendbird.addChannelHandler("widget",r)})})})}loadTicket(e,t,n){switch(e){case d.a.Ticket.Status.OPEN:d.a.Ticket.getOpenedList(t,(e,t)=>{const r=e;this.noMoreTicket=r.length<d.a.Ticket.defaultLimit,n(e,t)});break;case d.a.Ticket.Status.CLOSED:d.a.Ticket.getClosedList(t,(e,t)=>{const r=e;this.noMoreTicket=r.length<d.a.Ticket.defaultLimit,n(e,t)});break;default:n(null,[])}}appendTicket(e){const t=new g(this,e);this.ticketElementList.push(t),this.ticketList.appendChild(t.element)}clearTicket(){this.ticketElementList=[],this.ticketList.removeAll("-sbd-ticket-item")}signout(){this.sendbird.disconnect(()=>{o.send("signout"),this.panel.hasClass("fade-in")&&(this.panel.toggleClass("fade-in"),setTimeout(()=>{this.element.removeChild(this.panel)},250)),this.element.removeChild(this.action)})}isBottom(){return this.ticketList.scrollHeight-this.ticketList.scrollTop===this.ticketList.clientHeight}startNewDialog(e){this.dialog=new f(e),this.dialog.open(this)}}class _{constructor(){const e=!!window.localStorage,t={appId:"",userId:"",nickname:""},n={active:!1,wsHost:"",apiHost:""};e&&(t.appId=localStorage.getItem("sb-desk-appId")||"",t.userId=localStorage.getItem("sb-desk-userId")||"",t.nickname=localStorage.getItem("sb-desk-nickname")||"",n.active="true"===localStorage.getItem("sb-desk-advanced")||!1,n.wsHost=localStorage.getItem("sb-desk-advanced-wshost")||"",n.apiHost=localStorage.getItem("sb-desk-advanced-apihost")||"",n.deskApiHost=localStorage.getItem("sb-desk-advanced-deskApihost")||""),this.element=i(`<div class='-sbd-login-background'>\n          <div class='-sbd-login'>\n            <div class='logo'></div>\n            <div class='title'><span class='bold'>Desk Widget</span> Login</div>\n            <div class='panel'>\n              <div class='form form-login'>\n                <span class='input-label'>App ID</span>\n                <input class='appId input' placeholder='App ID' value='${t.appId}'></input>\n                <span class='input-label'>User ID</span>\n                <input class='userId input' placeholder='User ID' value='${t.userId}'></input>\n                <span class='input-label'>Name</span>\n                <input class='nickname input' placeholder='Name' value='${t.nickname}'></input>\n                <div class='error'></div>\n              </div>\n              <div class='separator'></div>\n              <div class='control'>\n                <div class='advanced'>\n                  <div class='label'>Advanced</div>\n                </div>\n                <div class='login button'>Login</div>\n              </div>\n              <div class='form form-advanced'>\n                <span class='input-label'>Custom WebSocket host</span>\n                <input class='wsHost input' placeholder='Custom WebSocket host' value='${n.wsHost}'></input>\n                <span class='input-label'>Custom API host</span>\n                <input class='apiHost input' placeholder='Custom API host' value='${n.apiHost}'></input>\n                <span class='input-label'>Custom Desk API host</span>\n                <input class='deskApiHost input' placeholder='Custom Desk API host' value='${n.deskApiHost}'></input>\n              </div>\n            </div>\n          </div>\n        </div>`);const s=r(this.element.querySelector(".form-login .appId")),a=r(this.element.querySelector(".form-login .userId")),l=r(this.element.querySelector(".form-login .nickname"));let u=n.active;const c=r(this.element.querySelector(".advanced .label")),d=r(this.element.querySelector(".form-advanced"));c.on("click",()=>{c.toggleClass("open"),u=!u,u?d.show():d.hide()}),u?d.show():d.hide();const h=r(this.element.querySelector(".form-advanced .wsHost")),p=r(this.element.querySelector(".form-advanced .apiHost")),f=r(this.element.querySelector(".form-advanced .deskApiHost"));const g=r(this.element.querySelector(".form-login .error"));r(this.element.querySelector(".control .login")).on("click",()=>{const t={appId:s.val(),userId:a.val(),nickname:l.val()};if(t.appId&&t.userId&&t.nickname){const n={};e&&(localStorage.setItem("sb-desk-appId",t.appId),localStorage.setItem("sb-desk-userId",t.userId),localStorage.setItem("sb-desk-nickname",t.nickname),u?(n.wsHost=h.val(),n.apiHost=p.val(),n.deskApiHost=f.val(),localStorage.setItem("sb-desk-advanced-wshost",n.wsHost),localStorage.setItem("sb-desk-advanced-apihost",n.apiHost),localStorage.setItem("sb-desk-advanced-deskApihost",n.deskApiHost)):(n.wsHost=null,n.apiHost=null,n.deskApiHost=null),localStorage.setItem("sb-desk-advanced",u&&n.wsHost&&n.apiHost&&n.deskApiHost?"true":"false")),new m(t,n),this.hide()}else g.html("Insert app ID, user ID and name to login."),g.show()}),o.subscribe("signout",()=>this.show()),this.show()}show(){document.body.appendChild(this.element),this.element.addClass("shown")}hide(){this.element.removeClass("shown"),setTimeout(()=>{document.body.removeChild(this.element)},2e3)}}window.onload=()=>{new _}}]);