diff --git a/assets/__bundle-2aa1a987-z06C6246.js b/assets/__bundle-2aa1a987-CHiZbB3_.js similarity index 98% rename from assets/__bundle-2aa1a987-z06C6246.js rename to assets/__bundle-2aa1a987-CHiZbB3_.js index e3e6e5d8e..39dc851cf 100644 --- a/assets/__bundle-2aa1a987-z06C6246.js +++ b/assets/__bundle-2aa1a987-CHiZbB3_.js @@ -1 +1 @@ -import{c as F}from"./index-DSXVqpYc.js";function I(s,h){for(var b=0;bc[u]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var A={},T;T=function(){function s(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function h(t,r){for(var n=0;n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var n,e=c(t);if(r){var o=c(this).constructor;n=Reflect.construct(e,arguments,o)}else n=e.apply(this,arguments);return function(i,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(i)}(this,n)}}function O(){return O=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(t,r,n){var e=function(i,a){for(;!Object.prototype.hasOwnProperty.call(i,a)&&(i=c(i))!==null;);return i}(t,r);if(e){var o=Object.getOwnPropertyDescriptor(e,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},O.apply(this,arguments)}var _=function(){function t(){s(this,t),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return b(t,[{key:"addEventListener",value:function(r,n,e){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:e})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var e=this.listeners[r],o=0,i=e.length;o"u")(e=new Error("This operation was aborted")).name="AbortError";else try{e=new DOMException("signal is aborted without reason")}catch{(e=new Error("This operation was aborted")).name="AbortError"}this.signal.reason=e,this.signal.dispatchEvent(n)}},{key:"toString",value:function(){return"[object AbortController]"}}]),t}();function E(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof t.Request=="function"&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}typeof Symbol<"u"&&Symbol.toStringTag&&(m.prototype[Symbol.toStringTag]="AbortController",w.prototype[Symbol.toStringTag]="AbortSignal"),function(t){if(E(t))if(t.fetch){var r=function(o){typeof o=="function"&&(o={fetch:o});var i=o,a=i.fetch,P=i.Request,g=P===void 0?a.Request:P,C=i.AbortController,R=i.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,L=R!==void 0&&R;if(!E({fetch:a,Request:g,AbortController:C,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:L}))return{fetch:a,Request:p};var p=g;(p&&!p.prototype.hasOwnProperty("signal")||L)&&((p=function(d,l){var y;l&&l.signal&&(y=l.signal,delete l.signal);var v=new g(d,l);return y&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),v}).prototype=g.prototype);var j=a;return{fetch:function(d,l){var y=p&&p.prototype.isPrototypeOf(d)?d.signal:l?l.signal:void 0;if(y){var v;try{v=new DOMException("Aborted","AbortError")}catch{(v=new Error("Aborted")).name="AbortError"}if(y.aborted)return Promise.reject(v);var k=new Promise(function(q,N){y.addEventListener("abort",function(){return N(v)},{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([k,j(d,l)])}return j(d,l)},Request:p}}(t),n=r.fetch,e=r.Request;t.fetch=n,t.Request=e,Object.defineProperty(t,"AbortController",{writable:!0,enumerable:!1,configurable:!0,value:m}),Object.defineProperty(t,"AbortSignal",{writable:!0,enumerable:!1,configurable:!0,value:w})}else console.warn("fetch() is not available, cannot install abortcontroller-polyfill")}(typeof self<"u"?self:F)},T();const x=I({__proto__:null,default:A},[A]);export{x as _}; +import{c as F}from"./index-B4P7rRPo.js";function I(s,h){for(var b=0;bc[u]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var A={},T;T=function(){function s(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function h(t,r){for(var n=0;n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var n,e=c(t);if(r){var o=c(this).constructor;n=Reflect.construct(e,arguments,o)}else n=e.apply(this,arguments);return function(i,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(i)}(this,n)}}function O(){return O=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(t,r,n){var e=function(i,a){for(;!Object.prototype.hasOwnProperty.call(i,a)&&(i=c(i))!==null;);return i}(t,r);if(e){var o=Object.getOwnPropertyDescriptor(e,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},O.apply(this,arguments)}var _=function(){function t(){s(this,t),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return b(t,[{key:"addEventListener",value:function(r,n,e){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:e})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var e=this.listeners[r],o=0,i=e.length;o"u")(e=new Error("This operation was aborted")).name="AbortError";else try{e=new DOMException("signal is aborted without reason")}catch{(e=new Error("This operation was aborted")).name="AbortError"}this.signal.reason=e,this.signal.dispatchEvent(n)}},{key:"toString",value:function(){return"[object AbortController]"}}]),t}();function E(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof t.Request=="function"&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}typeof Symbol<"u"&&Symbol.toStringTag&&(m.prototype[Symbol.toStringTag]="AbortController",w.prototype[Symbol.toStringTag]="AbortSignal"),function(t){if(E(t))if(t.fetch){var r=function(o){typeof o=="function"&&(o={fetch:o});var i=o,a=i.fetch,P=i.Request,g=P===void 0?a.Request:P,C=i.AbortController,R=i.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,L=R!==void 0&&R;if(!E({fetch:a,Request:g,AbortController:C,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:L}))return{fetch:a,Request:p};var p=g;(p&&!p.prototype.hasOwnProperty("signal")||L)&&((p=function(d,l){var y;l&&l.signal&&(y=l.signal,delete l.signal);var v=new g(d,l);return y&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),v}).prototype=g.prototype);var j=a;return{fetch:function(d,l){var y=p&&p.prototype.isPrototypeOf(d)?d.signal:l?l.signal:void 0;if(y){var v;try{v=new DOMException("Aborted","AbortError")}catch{(v=new Error("Aborted")).name="AbortError"}if(y.aborted)return Promise.reject(v);var k=new Promise(function(q,N){y.addEventListener("abort",function(){return N(v)},{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([k,j(d,l)])}return j(d,l)},Request:p}}(t),n=r.fetch,e=r.Request;t.fetch=n,t.Request=e,Object.defineProperty(t,"AbortController",{writable:!0,enumerable:!1,configurable:!0,value:m}),Object.defineProperty(t,"AbortSignal",{writable:!0,enumerable:!1,configurable:!0,value:w})}else console.warn("fetch() is not available, cannot install abortcontroller-polyfill")}(typeof self<"u"?self:F)},T();const x=I({__proto__:null,default:A},[A]);export{x as _}; diff --git a/assets/__bundle-347d730c-D3NhhyJB.js b/assets/__bundle-347d730c-D-KRdieC.js similarity index 99% rename from assets/__bundle-347d730c-D3NhhyJB.js rename to assets/__bundle-347d730c-D-KRdieC.js index 0f9623b78..696140567 100644 --- a/assets/__bundle-347d730c-D3NhhyJB.js +++ b/assets/__bundle-347d730c-D-KRdieC.js @@ -1,2 +1,2 @@ -import{c as g}from"./index-DSXVqpYc.js";function H(e,t){for(var o=0;os[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var x={},u=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof g<"u"&&g||{},P="URLSearchParams"in u,D="Symbol"in u&&"iterator"in Symbol,m="FileReader"in u&&"Blob"in u&&function(){try{return new Blob,!0}catch{return!1}}(),j="FormData"in u,_="ArrayBuffer"in u;if(_)var L=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],q=ArrayBuffer.isView||function(e){return e&&L.indexOf(Object.prototype.toString.call(e))>-1};function y(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function E(e){return typeof e!="string"&&(e=String(e)),e}function v(e){var t={next:function(){var o=e.shift();return{done:o===void 0,value:o}}};return D&&(t[Symbol.iterator]=function(){return t}),t}function i(e){this.map={},e instanceof i?e.forEach(function(t,o){this.append(o,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function A(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function S(e){return new Promise(function(t,o){e.onload=function(){t(e.result)},e.onerror=function(){o(e.error)}})}function N(e){var t=new FileReader,o=S(t);return t.readAsArrayBuffer(e),o}function U(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:m&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:j&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:P&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():_&&m&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=U(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):_&&(ArrayBuffer.prototype.isPrototypeOf(e)||q(e))?this._bodyArrayBuffer=U(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):P&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},m&&(this.blob=function(){var e=A(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=A(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(m)return this.blob().then(N);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,o,s,n,r=A(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,o=S(t),s=/charset=([A-Za-z0-9_-]+)/.exec(e.type),n=s?s[1]:"utf-8",t.readAsText(e,n),o;if(this._bodyArrayBuffer)return Promise.resolve(function(w){for(var c=new Uint8Array(w),a=new Array(c.length),h=0;h-1?s:o),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in u)return new AbortController().signal}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!(this.method!=="GET"&&this.method!=="HEAD"||t.cache!=="no-store"&&t.cache!=="no-cache")){var r=/([?&])_=[^&]*/;r.test(this.url)?this.url=this.url.replace(r,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function G(e){var t=new FormData;return e.trim().split("&").forEach(function(o){if(o){var s=o.split("="),n=s.shift().replace(/\+/g," "),r=s.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(r))}}),t}function f(e,t){if(!(this instanceof f))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new i(t.headers),this.url=t.url||"",this._initBody(e)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})},R.call(d.prototype),R.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},f.error=function(){var e=new f(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var M=[301,302,303,307,308];f.redirect=function(e,t){if(M.indexOf(t)===-1)throw new RangeError("Invalid status code");return new f(null,{status:t,headers:{location:e}})};var p=u.DOMException;try{new p}catch{(p=function(t,o){this.message=t,this.name=o;var s=Error(t);this.stack=s.stack}).prototype=Object.create(Error.prototype),p.prototype.constructor=p}function T(e,t){return new Promise(function(o,s){var n=new d(e,t);if(n.signal&&n.signal.aborted)return s(new p("Aborted","AbortError"));var r=new XMLHttpRequest;function w(){r.abort()}if(r.onload=function(){var a,h,b={statusText:r.statusText,headers:(a=r.getAllResponseHeaders()||"",h=new i,a.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(l){return l.indexOf(` +import{c as g}from"./index-B4P7rRPo.js";function H(e,t){for(var o=0;os[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var x={},u=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof g<"u"&&g||{},P="URLSearchParams"in u,D="Symbol"in u&&"iterator"in Symbol,m="FileReader"in u&&"Blob"in u&&function(){try{return new Blob,!0}catch{return!1}}(),j="FormData"in u,_="ArrayBuffer"in u;if(_)var L=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],q=ArrayBuffer.isView||function(e){return e&&L.indexOf(Object.prototype.toString.call(e))>-1};function y(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function E(e){return typeof e!="string"&&(e=String(e)),e}function v(e){var t={next:function(){var o=e.shift();return{done:o===void 0,value:o}}};return D&&(t[Symbol.iterator]=function(){return t}),t}function i(e){this.map={},e instanceof i?e.forEach(function(t,o){this.append(o,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function A(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function S(e){return new Promise(function(t,o){e.onload=function(){t(e.result)},e.onerror=function(){o(e.error)}})}function N(e){var t=new FileReader,o=S(t);return t.readAsArrayBuffer(e),o}function U(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:m&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:j&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:P&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():_&&m&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=U(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):_&&(ArrayBuffer.prototype.isPrototypeOf(e)||q(e))?this._bodyArrayBuffer=U(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):P&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},m&&(this.blob=function(){var e=A(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=A(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(m)return this.blob().then(N);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,o,s,n,r=A(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,o=S(t),s=/charset=([A-Za-z0-9_-]+)/.exec(e.type),n=s?s[1]:"utf-8",t.readAsText(e,n),o;if(this._bodyArrayBuffer)return Promise.resolve(function(w){for(var c=new Uint8Array(w),a=new Array(c.length),h=0;h-1?s:o),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in u)return new AbortController().signal}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!(this.method!=="GET"&&this.method!=="HEAD"||t.cache!=="no-store"&&t.cache!=="no-cache")){var r=/([?&])_=[^&]*/;r.test(this.url)?this.url=this.url.replace(r,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function G(e){var t=new FormData;return e.trim().split("&").forEach(function(o){if(o){var s=o.split("="),n=s.shift().replace(/\+/g," "),r=s.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(r))}}),t}function f(e,t){if(!(this instanceof f))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new i(t.headers),this.url=t.url||"",this._initBody(e)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})},R.call(d.prototype),R.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},f.error=function(){var e=new f(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var M=[301,302,303,307,308];f.redirect=function(e,t){if(M.indexOf(t)===-1)throw new RangeError("Invalid status code");return new f(null,{status:t,headers:{location:e}})};var p=u.DOMException;try{new p}catch{(p=function(t,o){this.message=t,this.name=o;var s=Error(t);this.stack=s.stack}).prototype=Object.create(Error.prototype),p.prototype.constructor=p}function T(e,t){return new Promise(function(o,s){var n=new d(e,t);if(n.signal&&n.signal.aborted)return s(new p("Aborted","AbortError"));var r=new XMLHttpRequest;function w(){r.abort()}if(r.onload=function(){var a,h,b={statusText:r.statusText,headers:(a=r.getAllResponseHeaders()||"",h=new i,a.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(l){return l.indexOf(` `)===0?l.substr(1,l.length):l}).forEach(function(l){var B=l.split(":"),O=B.shift().trim();if(O){var I=B.join(":").trim();try{h.append(O,I)}catch(C){console.warn("Response "+C.message)}}}),h)};n.url.indexOf("file://")===0&&(r.status<200||r.status>599)?b.status=200:b.status=r.status,b.url="responseURL"in r?r.responseURL:b.headers.get("X-Request-URL");var F="response"in r?r.response:r.responseText;setTimeout(function(){o(new f(F,b))},0)},r.onerror=function(){setTimeout(function(){s(new TypeError("Network request failed"))},0)},r.ontimeout=function(){setTimeout(function(){s(new TypeError("Network request timed out"))},0)},r.onabort=function(){setTimeout(function(){s(new p("Aborted","AbortError"))},0)},r.open(n.method,function(a){try{return a===""&&u.location.href?u.location.href:a}catch{return a}}(n.url),!0),n.credentials==="include"?r.withCredentials=!0:n.credentials==="omit"&&(r.withCredentials=!1),"responseType"in r&&(m?r.responseType="blob":_&&(r.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof i||u.Headers&&t.headers instanceof u.Headers)){var c=[];Object.getOwnPropertyNames(t.headers).forEach(function(a){c.push(y(a)),r.setRequestHeader(a,E(t.headers[a]))}),n.headers.forEach(function(a,h){c.indexOf(h)===-1&&r.setRequestHeader(h,a)})}else n.headers.forEach(function(a,h){r.setRequestHeader(h,a)});n.signal&&(n.signal.addEventListener("abort",w),r.onreadystatechange=function(){r.readyState===4&&n.signal.removeEventListener("abort",w)}),r.send(n._bodyInit===void 0?null:n._bodyInit)})}T.polyfill=!0,u.fetch||(u.fetch=T,u.Headers=i,u.Request=d,u.Response=f),(typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof g<"u"&&g||{fetch:null}).fetch=T;const V=H({__proto__:null,default:x},[x]);export{V as _}; diff --git a/assets/__bundle-c839c84a-Cf0ATRMk.js b/assets/__bundle-c839c84a-BFaoQucn.js similarity index 95% rename from assets/__bundle-c839c84a-Cf0ATRMk.js rename to assets/__bundle-c839c84a-BFaoQucn.js index b67171002..ebe77dfce 100644 --- a/assets/__bundle-c839c84a-Cf0ATRMk.js +++ b/assets/__bundle-c839c84a-BFaoQucn.js @@ -1 +1 @@ -import{j as y,v as s,R as L,x as g,M,X,z as b,J as I}from"./index-DSXVqpYc.js";var N=function(i,n){return new Promise(function(w,r){if(typeof XMLHttpRequest<"u"){var d=y.of(i),a=d.dispatcher,m=d.logger,p=n.requestId,E=n.method,R=n.url,u=n.headers,f=u===void 0?{}:u,c=n.data,x=c===void 0?"":c,l=n.uploadProgressHandler,h=!1,e=new XMLHttpRequest;e.open(E,R),Object.keys(f).forEach(function(t){e.setRequestHeader(t,f[t])}),l&&e.upload.addEventListener("progress",function(t){t.lengthComputable?l(p,t.loaded,t.total):m.debug("Progress computing failed: `Content-Length` header is not given.")}),e.onabort=function(){r(s.requestCanceled)},e.onerror=function(t){r(s.networkError)},e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE&&!h)if(e.status===0||e.status>=200&&e.status<400)try{var t=JSON.parse(e.responseText);w(new L(i,t))}catch{r(s.networkError)}else try{var q=JSON.parse(e.responseText);if(q){var o=new s(q);if(o.isSessionExpiredError){if(a.dispatch(new g({reason:o.code})),!(e instanceof M)){var v=new X;return a.dispatch(new b({request:e,deferred:v,error:o})),v.promise}}else o.isSessionInvalidatedError&&a.dispatch(new g({reason:o.code}));r(o)}else r(s.requestFailed)}catch{r(s.requestFailed)}},a.on(function(t){t instanceof I&&(t.requestId&&t.requestId!==p||(h=!0,e.abort()))}),e.send(x)}else r(s.xmlHttpRequestNotSupported)})};export{N as xmlHttpRequest}; +import{j as y,v as s,R as L,x as g,M,X,z as b,J as I}from"./index-B4P7rRPo.js";var N=function(i,n){return new Promise(function(w,r){if(typeof XMLHttpRequest<"u"){var d=y.of(i),a=d.dispatcher,m=d.logger,p=n.requestId,E=n.method,R=n.url,u=n.headers,f=u===void 0?{}:u,c=n.data,x=c===void 0?"":c,l=n.uploadProgressHandler,h=!1,e=new XMLHttpRequest;e.open(E,R),Object.keys(f).forEach(function(t){e.setRequestHeader(t,f[t])}),l&&e.upload.addEventListener("progress",function(t){t.lengthComputable?l(p,t.loaded,t.total):m.debug("Progress computing failed: `Content-Length` header is not given.")}),e.onabort=function(){r(s.requestCanceled)},e.onerror=function(t){r(s.networkError)},e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE&&!h)if(e.status===0||e.status>=200&&e.status<400)try{var t=JSON.parse(e.responseText);w(new L(i,t))}catch{r(s.networkError)}else try{var q=JSON.parse(e.responseText);if(q){var o=new s(q);if(o.isSessionExpiredError){if(a.dispatch(new g({reason:o.code})),!(e instanceof M)){var v=new X;return a.dispatch(new b({request:e,deferred:v,error:o})),v.promise}}else o.isSessionInvalidatedError&&a.dispatch(new g({reason:o.code}));r(o)}else r(s.requestFailed)}catch{r(s.requestFailed)}},a.on(function(t){t instanceof I&&(t.requestId&&t.requestId!==p||(h=!0,e.abort()))}),e.send(x)}else r(s.xmlHttpRequestNotSupported)})};export{N as xmlHttpRequest}; diff --git a/assets/index-DSXVqpYc.js b/assets/index-B4P7rRPo.js similarity index 74% rename from assets/index-DSXVqpYc.js rename to assets/index-B4P7rRPo.js index 7ce910c3b..9f5073f6e 100644 --- a/assets/index-DSXVqpYc.js +++ b/assets/index-B4P7rRPo.js @@ -1,4 +1,4 @@ -var $p=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var G=(e,n,t)=>($p(e,n,"read from private field"),t?t.call(e):n.get(e)),Ye=(e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)},Be=(e,n,t,r)=>($p(e,n,"write to private field"),r?r.call(e,t):n.set(e,t),t);var dh=(e,n,t,r)=>({set _(i){Be(e,n,i,t)},get _(){return G(e,n,r)}}),vt=(e,n,t)=>($p(e,n,"access private method"),t);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var dG=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function B0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tb={exports:{}},$0={},wb={exports:{}},_t={};/** +var Gp=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var G=(e,n,t)=>(Gp(e,n,"read from private field"),t?t.call(e):n.get(e)),Ye=(e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)},Be=(e,n,t,r)=>(Gp(e,n,"write to private field"),r?r.call(e,t):n.set(e,t),t);var hh=(e,n,t,r)=>({set _(i){Be(e,n,i,t)},get _(){return G(e,n,r)}}),vt=(e,n,t)=>(Gp(e,n,"access private method"),t);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var pG=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tb={exports:{}},G0={},Nb={exports:{}},_t={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var $p=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var G=(e,n,t)=>($p(e * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Kd=Symbol.for("react.element"),dI=Symbol.for("react.portal"),hI=Symbol.for("react.fragment"),fI=Symbol.for("react.strict_mode"),pI=Symbol.for("react.profiler"),_I=Symbol.for("react.provider"),mI=Symbol.for("react.context"),vI=Symbol.for("react.forward_ref"),gI=Symbol.for("react.suspense"),yI=Symbol.for("react.memo"),EI=Symbol.for("react.lazy"),o1=Symbol.iterator;function bI(e){return e===null||typeof e!="object"?null:(e=o1&&e[o1]||e["@@iterator"],typeof e=="function"?e:null)}var Nb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ib=Object.assign,Ab={};function Fu(e,n,t){this.props=e,this.context=n,this.refs=Ab,this.updater=t||Nb}Fu.prototype.isReactComponent={};Fu.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,n,"setState")};Fu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Mb(){}Mb.prototype=Fu.prototype;function dg(e,n,t){this.props=e,this.context=n,this.refs=Ab,this.updater=t||Nb}var hg=dg.prototype=new Mb;hg.constructor=dg;Ib(hg,Fu.prototype);hg.isPureReactComponent=!0;var l1=Array.isArray,xb=Object.prototype.hasOwnProperty,fg={current:null},Ob={key:!0,ref:!0,__self:!0,__source:!0};function Rb(e,n,t){var r,i={},s=null,a=null;if(n!=null)for(r in n.ref!==void 0&&(a=n.ref),n.key!==void 0&&(s=""+n.key),n)xb.call(n,r)&&!Ob.hasOwnProperty(r)&&(i[r]=n[r]);var o=arguments.length-2;if(o===1)i.children=t;else if(1{if(!n.has(e))throw TypeError("Cannot "+t)};var G=(e,n,t)=>($p(e * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var NI=D,II=Symbol.for("react.element"),AI=Symbol.for("react.fragment"),MI=Object.prototype.hasOwnProperty,xI=NI.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,OI={key:!0,ref:!0,__self:!0,__source:!0};function Lb(e,n,t){var r,i={},s=null,a=null;t!==void 0&&(s=""+t),n.key!==void 0&&(s=""+n.key),n.ref!==void 0&&(a=n.ref);for(r in n)MI.call(n,r)&&!OI.hasOwnProperty(r)&&(i[r]=n[r]);if(e&&e.defaultProps)for(r in n=e.defaultProps,n)i[r]===void 0&&(i[r]=n[r]);return{$$typeof:II,type:e,key:s,ref:a,props:i,_owner:xI.current}}$0.Fragment=AI;$0.jsx=Lb;$0.jsxs=Lb;Tb.exports=$0;var C=Tb.exports,um={},Db={exports:{}},Ti={},Ub={exports:{}},Pb={};/** + */var AI=D,MI=Symbol.for("react.element"),xI=Symbol.for("react.fragment"),OI=Object.prototype.hasOwnProperty,RI=AI.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,kI={key:!0,ref:!0,__self:!0,__source:!0};function Db(e,n,t){var r,i={},s=null,a=null;t!==void 0&&(s=""+t),n.key!==void 0&&(s=""+n.key),n.ref!==void 0&&(a=n.ref);for(r in n)OI.call(n,r)&&!kI.hasOwnProperty(r)&&(i[r]=n[r]);if(e&&e.defaultProps)for(r in n=e.defaultProps,n)i[r]===void 0&&(i[r]=n[r]);return{$$typeof:MI,type:e,key:s,ref:a,props:i,_owner:RI.current}}G0.Fragment=xI;G0.jsx=Db;G0.jsxs=Db;Tb.exports=G0;var C=Tb.exports,dm={},Ub={exports:{}},wi={},Pb={exports:{}},Fb={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var $p=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var G=(e,n,t)=>($p(e * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function n(q,ee){var ie=q.length;q.push(ee);e:for(;0>>1,X=q[Ne];if(0>>1;Nei(ce,ie))$i(ke,ce)?(q[Ne]=ke,q[$]=ie,Ne=$):(q[Ne]=ce,q[te]=ie,Ne=te);else if($i(ke,ie))q[Ne]=ke,q[$]=ie,Ne=$;else break e}}return ee}function i(q,ee){var ie=q.sortIndex-ee.sortIndex;return ie!==0?ie:q.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var l=[],u=[],c=1,d=null,h=3,f=!1,p=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(q){for(var ee=t(u);ee!==null;){if(ee.callback===null)r(u);else if(ee.startTime<=q)r(u),ee.sortIndex=ee.expirationTime,n(l,ee);else break;ee=t(u)}}function S(q){if(m=!1,E(q),!p)if(t(l)!==null)p=!0,H(w);else{var ee=t(u);ee!==null&&Te(S,ee.startTime-q)}}function w(q,ee){p=!1,m&&(m=!1,v(x),x=-1),f=!0;var ie=h;try{for(E(ee),d=t(l);d!==null&&(!(d.expirationTime>ee)||q&&!U());){var Ne=d.callback;if(typeof Ne=="function"){d.callback=null,h=d.priorityLevel;var X=Ne(d.expirationTime<=ee);ee=e.unstable_now(),typeof X=="function"?d.callback=X:d===t(l)&&r(l),E(ee)}else r(l);d=t(l)}if(d!==null)var oe=!0;else{var te=t(u);te!==null&&Te(S,te.startTime-ee),oe=!1}return oe}finally{d=null,h=ie,f=!1}}var N=!1,I=null,x=-1,A=5,O=-1;function U(){return!(e.unstable_now()-Oq||125Ne?(q.sortIndex=ie,n(u,q),t(l)===null&&q===t(u)&&(m?(v(x),x=-1):m=!0,Te(S,ie-Ne))):(q.sortIndex=X,n(l,q),p||f||(p=!0,H(w))),q},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(q){var ee=h;return function(){var ie=h;h=ee;try{return q.apply(this,arguments)}finally{h=ie}}}})(Pb);Ub.exports=Pb;var RI=Ub.exports;/** + */(function(e){function n(q,ee){var ie=q.length;q.push(ee);e:for(;0>>1,X=q[Ne];if(0>>1;Nei(ce,ie))$i(ke,ce)?(q[Ne]=ke,q[$]=ie,Ne=$):(q[Ne]=ce,q[te]=ie,Ne=te);else if($i(ke,ie))q[Ne]=ke,q[$]=ie,Ne=$;else break e}}return ee}function i(q,ee){var ie=q.sortIndex-ee.sortIndex;return ie!==0?ie:q.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var l=[],u=[],c=1,d=null,h=3,f=!1,p=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(q){for(var ee=t(u);ee!==null;){if(ee.callback===null)r(u);else if(ee.startTime<=q)r(u),ee.sortIndex=ee.expirationTime,n(l,ee);else break;ee=t(u)}}function S(q){if(m=!1,E(q),!p)if(t(l)!==null)p=!0,H(T);else{var ee=t(u);ee!==null&&we(S,ee.startTime-q)}}function T(q,ee){p=!1,m&&(m=!1,v(x),x=-1),f=!0;var ie=h;try{for(E(ee),d=t(l);d!==null&&(!(d.expirationTime>ee)||q&&!U());){var Ne=d.callback;if(typeof Ne=="function"){d.callback=null,h=d.priorityLevel;var X=Ne(d.expirationTime<=ee);ee=e.unstable_now(),typeof X=="function"?d.callback=X:d===t(l)&&r(l),E(ee)}else r(l);d=t(l)}if(d!==null)var oe=!0;else{var te=t(u);te!==null&&we(S,te.startTime-ee),oe=!1}return oe}finally{d=null,h=ie,f=!1}}var N=!1,I=null,x=-1,A=5,O=-1;function U(){return!(e.unstable_now()-Oq||125Ne?(q.sortIndex=ie,n(u,q),t(l)===null&&q===t(u)&&(m?(v(x),x=-1):m=!0,we(S,ie-Ne))):(q.sortIndex=X,n(l,q),p||f||(p=!0,H(T))),q},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(q){var ee=h;return function(){var ie=h;h=ee;try{return q.apply(this,arguments)}finally{h=ie}}}})(Fb);Pb.exports=Fb;var LI=Pb.exports;/** * @license React * react-dom.production.min.js * @@ -30,28 +30,28 @@ var $p=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var G=(e,n,t)=>($p(e * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var kI=D,Ci=RI;function we(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cm=Object.prototype.hasOwnProperty,LI=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,c1={},d1={};function DI(e){return cm.call(d1,e)?!0:cm.call(c1,e)?!1:LI.test(e)?d1[e]=!0:(c1[e]=!0,!1)}function UI(e,n,t,r){if(t!==null&&t.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function PI(e,n,t,r){if(n===null||typeof n>"u"||UI(e,n,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function Qr(e,n,t,r,i,s,a){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=e,this.type=n,this.sanitizeURL=s,this.removeEmptyString=a}var Sr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Sr[e]=new Qr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];Sr[n]=new Qr(n,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Sr[e]=new Qr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Sr[e]=new Qr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Sr[e]=new Qr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Sr[e]=new Qr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Sr[e]=new Qr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Sr[e]=new Qr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Sr[e]=new Qr(e,5,!1,e.toLowerCase(),null,!1,!1)});var _g=/[\-:]([a-z])/g;function mg(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(_g,mg);Sr[n]=new Qr(n,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(_g,mg);Sr[n]=new Qr(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(_g,mg);Sr[n]=new Qr(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Sr[e]=new Qr(e,1,!1,e.toLowerCase(),null,!1,!1)});Sr.xlinkHref=new Qr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Sr[e]=new Qr(e,1,!1,e.toLowerCase(),null,!0,!0)});function vg(e,n,t,r){var i=Sr.hasOwnProperty(n)?Sr[n]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hm=Object.prototype.hasOwnProperty,UI=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d1={},h1={};function PI(e){return hm.call(h1,e)?!0:hm.call(d1,e)?!1:UI.test(e)?h1[e]=!0:(d1[e]=!0,!1)}function FI(e,n,t,r){if(t!==null&&t.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function HI(e,n,t,r){if(n===null||typeof n>"u"||FI(e,n,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function Qr(e,n,t,r,i,s,a){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=e,this.type=n,this.sanitizeURL=s,this.removeEmptyString=a}var Sr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Sr[e]=new Qr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];Sr[n]=new Qr(n,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Sr[e]=new Qr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Sr[e]=new Qr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Sr[e]=new Qr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Sr[e]=new Qr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Sr[e]=new Qr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Sr[e]=new Qr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Sr[e]=new Qr(e,5,!1,e.toLowerCase(),null,!1,!1)});var mg=/[\-:]([a-z])/g;function vg(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(mg,vg);Sr[n]=new Qr(n,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(mg,vg);Sr[n]=new Qr(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(mg,vg);Sr[n]=new Qr(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Sr[e]=new Qr(e,1,!1,e.toLowerCase(),null,!1,!1)});Sr.xlinkHref=new Qr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Sr[e]=new Qr(e,1,!1,e.toLowerCase(),null,!0,!0)});function gg(e,n,t,r){var i=Sr.hasOwnProperty(n)?Sr[n]:null;(i!==null?i.type!==0:r||!(2o||i[a]!==s[o]){var l=` -`+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=o);break}}}finally{Vp=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?_c(e):""}function FI(e){switch(e.tag){case 5:return _c(e.type);case 16:return _c("Lazy");case 13:return _c("Suspense");case 19:return _c("SuspenseList");case 0:case 2:case 15:return e=qp(e.type,!1),e;case 11:return e=qp(e.type.render,!1),e;case 1:return e=qp(e.type,!0),e;default:return""}}function pm(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case kl:return"Fragment";case Rl:return"Portal";case dm:return"Profiler";case gg:return"StrictMode";case hm:return"Suspense";case fm:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case jb:return(e.displayName||"Context")+".Consumer";case Hb:return(e._context.displayName||"Context")+".Provider";case yg:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Eg:return n=e.displayName||null,n!==null?n:pm(e.type)||"Memo";case Ea:n=e._payload,e=e._init;try{return pm(e(n))}catch{}}return null}function HI(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return pm(n);case 8:return n===gg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function to(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $b(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function jI(e){var n=$b(e)?"checked":"value",t=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),r=""+e[n];if(!e.hasOwnProperty(n)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(e,n,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function ph(e){e._valueTracker||(e._valueTracker=jI(e))}function Gb(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var t=n.getValue(),r="";return e&&(r=$b(e)?e.checked?"true":"false":e.value),e=r,e!==t?(n.setValue(e),!0):!1}function Of(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function _m(e,n){var t=n.checked;return hn({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function f1(e,n){var t=n.defaultValue==null?"":n.defaultValue,r=n.checked!=null?n.checked:n.defaultChecked;t=to(n.value!=null?n.value:t),e._wrapperState={initialChecked:r,initialValue:t,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function zb(e,n){n=n.checked,n!=null&&vg(e,"checked",n,!1)}function mm(e,n){zb(e,n);var t=to(n.value),r=n.type;if(t!=null)r==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+t):e.value!==""+t&&(e.value=""+t);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?vm(e,n.type,t):n.hasOwnProperty("defaultValue")&&vm(e,n.type,to(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function p1(e,n,t){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var r=n.type;if(!(r!=="submit"&&r!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,t||n===e.value||(e.value=n),e.defaultValue=n}t=e.name,t!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,t!==""&&(e.name=t)}function vm(e,n,t){(n!=="number"||Of(e.ownerDocument)!==e)&&(t==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}var mc=Array.isArray;function Ql(e,n,t,r){if(e=e.options,n){n={};for(var i=0;i"+n.valueOf().toString()+"",n=_h.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function ud(e,n){if(n){var t=e.firstChild;if(t&&t===e.lastChild&&t.nodeType===3){t.nodeValue=n;return}}e.textContent=n}var Mc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},BI=["Webkit","ms","Moz","O"];Object.keys(Mc).forEach(function(e){BI.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Mc[n]=Mc[e]})});function Kb(e,n,t){return n==null||typeof n=="boolean"||n===""?"":t||typeof n!="number"||n===0||Mc.hasOwnProperty(e)&&Mc[e]?(""+n).trim():n+"px"}function Qb(e,n){e=e.style;for(var t in n)if(n.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=Kb(t,n[t],r);t==="float"&&(t="cssFloat"),r?e.setProperty(t,i):e[t]=i}}var $I=hn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Em(e,n){if(n){if($I[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(we(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(we(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(we(61))}if(n.style!=null&&typeof n.style!="object")throw Error(we(62))}}function bm(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Cm=null;function bg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Sm=null,Yl=null,Zl=null;function v1(e){if(e=Zd(e)){if(typeof Sm!="function")throw Error(we(280));var n=e.stateNode;n&&(n=W0(n),Sm(e.stateNode,e.type,n))}}function Yb(e){Yl?Zl?Zl.push(e):Zl=[e]:Yl=e}function Zb(){if(Yl){var e=Yl,n=Zl;if(Zl=Yl=null,v1(e),n)for(e=0;e>>=0,e===0?32:31-(JI(e)/e4|0)|0}var mh=64,vh=4194304;function vc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Df(e,n){var t=e.pendingLanes;if(t===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,a=t&268435455;if(a!==0){var o=a&~i;o!==0?r=vc(o):(s&=a,s!==0&&(r=vc(s)))}else a=t&~i,a!==0?r=vc(a):s!==0&&(r=vc(s));if(r===0)return 0;if(n!==0&&n!==r&&!(n&i)&&(i=r&-r,s=n&-n,i>=s||i===16&&(s&4194240)!==0))return n;if(r&4&&(r|=t&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=r;0t;t++)n.push(e);return n}function Qd(e,n,t){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-as(n),e[n]=t}function i4(e,n){var t=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Oc),N1=" ",I1=!1;function vC(e,n){switch(e){case"keyup":return R4.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ll=!1;function L4(e,n){switch(e){case"compositionend":return gC(n);case"keypress":return n.which!==32?null:(I1=!0,N1);case"textInput":return e=n.data,e===N1&&I1?null:e;default:return null}}function D4(e,n){if(Ll)return e==="compositionend"||!Mg&&vC(e,n)?(e=_C(),lf=Ng=La=null,Ll=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:t,offset:n-e};e=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=O1(t)}}function CC(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?CC(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function SC(){for(var e=window,n=Of();n instanceof e.HTMLIFrameElement;){try{var t=typeof n.contentWindow.location.href=="string"}catch{t=!1}if(t)e=n.contentWindow;else break;n=Of(e.document)}return n}function xg(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function z4(e){var n=SC(),t=e.focusedElem,r=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&CC(t.ownerDocument.documentElement,t)){if(r!==null&&xg(t)){if(n=r.start,e=r.end,e===void 0&&(e=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(e,t.value.length);else if(e=(n=t.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=R1(t,s);var a=R1(t,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(n=n.createRange(),n.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(n),e.extend(a.node,a.offset)):(n.setEnd(a.node,a.offset),e.addRange(n)))}}for(n=[],e=t;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Dl=null,Mm=null,kc=null,xm=!1;function k1(e,n,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;xm||Dl==null||Dl!==Of(r)||(r=Dl,"selectionStart"in r&&xg(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kc&&_d(kc,r)||(kc=r,r=Ff(Mm,"onSelect"),0Fl||(e.current=Um[Fl],Um[Fl]=null,Fl--)}function Wt(e,n){Fl++,Um[Fl]=e.current,e.current=n}var no={},kr=ao(no),ri=ao(!1),Jo=no;function gu(e,n){var t=e.type.contextTypes;if(!t)return no;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===n)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=n[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=i),i}function ii(e){return e=e.childContextTypes,e!=null}function jf(){Zt(ri),Zt(kr)}function j1(e,n,t){if(kr.current!==no)throw Error(we(168));Wt(kr,n),Wt(ri,t)}function RC(e,n,t){var r=e.stateNode;if(n=n.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in n))throw Error(we(108,HI(e)||"Unknown",i));return hn({},t,r)}function Bf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||no,Jo=kr.current,Wt(kr,e),Wt(ri,ri.current),!0}function B1(e,n,t){var r=e.stateNode;if(!r)throw Error(we(169));t?(e=RC(e,n,Jo),r.__reactInternalMemoizedMergedChildContext=e,Zt(ri),Zt(kr),Wt(kr,e)):Zt(ri),Wt(ri,t)}var Ks=null,K0=!1,a_=!1;function kC(e){Ks===null?Ks=[e]:Ks.push(e)}function nA(e){K0=!0,kC(e)}function oo(){if(!a_&&Ks!==null){a_=!0;var e=0,n=Ot;try{var t=Ks;for(Ot=1;e>=a,i-=a,Xs=1<<32-as(n)+i|t<x?(A=I,I=null):A=I.sibling;var O=h(v,I,E[x],S);if(O===null){I===null&&(I=A);break}e&&I&&O.alternate===null&&n(v,I),_=s(O,_,x),N===null?w=O:N.sibling=O,N=O,I=A}if(x===E.length)return t(v,I),rn&&_o(v,x),w;if(I===null){for(;xx?(A=I,I=null):A=I.sibling;var U=h(v,I,O.value,S);if(U===null){I===null&&(I=A);break}e&&I&&U.alternate===null&&n(v,I),_=s(U,_,x),N===null?w=U:N.sibling=U,N=U,I=A}if(O.done)return t(v,I),rn&&_o(v,x),w;if(I===null){for(;!O.done;x++,O=E.next())O=d(v,O.value,S),O!==null&&(_=s(O,_,x),N===null?w=O:N.sibling=O,N=O);return rn&&_o(v,x),w}for(I=r(v,I);!O.done;x++,O=E.next())O=f(I,v,x,O.value,S),O!==null&&(e&&O.alternate!==null&&I.delete(O.key===null?x:O.key),_=s(O,_,x),N===null?w=O:N.sibling=O,N=O);return e&&I.forEach(function(W){return n(v,W)}),rn&&_o(v,x),w}function b(v,_,E,S){if(typeof E=="object"&&E!==null&&E.type===kl&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case fh:e:{for(var w=E.key,N=_;N!==null;){if(N.key===w){if(w=E.type,w===kl){if(N.tag===7){t(v,N.sibling),_=i(N,E.props.children),_.return=v,v=_;break e}}else if(N.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Ea&&z1(w)===N.type){t(v,N.sibling),_=i(N,E.props),_.ref=Xu(v,N,E),_.return=v,v=_;break e}t(v,N);break}else n(v,N);N=N.sibling}E.type===kl?(_=qo(E.props.children,v.mode,S,E.key),_.return=v,v=_):(S=mf(E.type,E.key,E.props,null,v.mode,S),S.ref=Xu(v,_,E),S.return=v,v=S)}return a(v);case Rl:e:{for(N=E.key;_!==null;){if(_.key===N)if(_.tag===4&&_.stateNode.containerInfo===E.containerInfo&&_.stateNode.implementation===E.implementation){t(v,_.sibling),_=i(_,E.children||[]),_.return=v,v=_;break e}else{t(v,_);break}else n(v,_);_=_.sibling}_=p_(E,v.mode,S),_.return=v,v=_}return a(v);case Ea:return N=E._init,b(v,_,N(E._payload),S)}if(mc(E))return p(v,_,E,S);if(Wu(E))return m(v,_,E,S);Th(v,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,_!==null&&_.tag===6?(t(v,_.sibling),_=i(_,E),_.return=v,v=_):(t(v,_),_=f_(E,v.mode,S),_.return=v,v=_),a(v)):t(v,_)}return b}var Eu=PC(!0),FC=PC(!1),zf=ao(null),Vf=null,Bl=null,Lg=null;function Dg(){Lg=Bl=Vf=null}function Ug(e){var n=zf.current;Zt(zf),e._currentValue=n}function Hm(e,n,t){for(;e!==null;){var r=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,r!==null&&(r.childLanes|=n)):r!==null&&(r.childLanes&n)!==n&&(r.childLanes|=n),e===t)break;e=e.return}}function Jl(e,n){Vf=e,Lg=Bl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&n&&(ni=!0),e.firstContext=null)}function Gi(e){var n=e._currentValue;if(Lg!==e)if(e={context:e,memoizedValue:n,next:null},Bl===null){if(Vf===null)throw Error(we(308));Bl=e,Vf.dependencies={lanes:0,firstContext:e}}else Bl=Bl.next=e;return n}var No=null;function Pg(e){No===null?No=[e]:No.push(e)}function HC(e,n,t,r){var i=n.interleaved;return i===null?(t.next=t,Pg(n)):(t.next=i.next,i.next=t),n.interleaved=t,aa(e,r)}function aa(e,n){e.lanes|=n;var t=e.alternate;for(t!==null&&(t.lanes|=n),t=e,e=e.return;e!==null;)e.childLanes|=n,t=e.alternate,t!==null&&(t.childLanes|=n),t=e,e=e.return;return t.tag===3?t.stateNode:null}var ba=!1;function Fg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jC(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ta(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function $a(e,n,t){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,gt&2){var i=r.pending;return i===null?n.next=n:(n.next=i.next,i.next=n),r.pending=n,aa(e,t)}return i=r.interleaved,i===null?(n.next=n,Pg(r)):(n.next=i.next,i.next=n),r.interleaved=n,aa(e,t)}function cf(e,n,t){if(n=n.updateQueue,n!==null&&(n=n.shared,(t&4194240)!==0)){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,Sg(e,t)}}function V1(e,n){var t=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var a={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=a:s=s.next=a,t=t.next}while(t!==null);s===null?i=s=n:s=s.next=n}else i=s=n;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=t;return}e=t.lastBaseUpdate,e===null?t.firstBaseUpdate=n:e.next=n,t.lastBaseUpdate=n}function qf(e,n,t,r){var i=e.updateQueue;ba=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var l=o,u=l.next;l.next=null,a===null?s=u:a.next=u,a=l;var c=e.alternate;c!==null&&(c=c.updateQueue,o=c.lastBaseUpdate,o!==a&&(o===null?c.firstBaseUpdate=u:o.next=u,c.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;a=0,c=u=l=null,o=s;do{var h=o.lane,f=o.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:f,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var p=e,m=o;switch(h=n,f=t,m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(f,d,h);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,h=typeof p=="function"?p.call(f,d,h):p,h==null)break e;d=hn({},d,h);break e;case 2:ba=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[o]:h.push(o))}else f={eventTime:f,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},c===null?(u=c=f,l=d):c=c.next=f,a|=h;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;h=o,o=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(c===null&&(l=d),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,n=i.shared.interleaved,n!==null){i=n;do a|=i.lane,i=i.next;while(i!==n)}else s===null&&(i.shared.lanes=0);nl|=a,e.lanes=a,e.memoizedState=d}}function q1(e,n,t){if(e=n.effects,n.effects=null,e!==null)for(n=0;nt?t:4,e(!0);var r=l_.transition;l_.transition={};try{e(!1),n()}finally{Ot=t,l_.transition=r}}function rS(){return zi().memoizedState}function aA(e,n,t){var r=za(e);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},iS(e))sS(n,t);else if(t=HC(e,n,t,r),t!==null){var i=Vr();os(t,e,r,i),aS(t,n,r)}}function oA(e,n,t){var r=za(e),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(iS(e))sS(n,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=n.lastRenderedReducer,s!==null))try{var a=n.lastRenderedState,o=s(a,t);if(i.hasEagerState=!0,i.eagerState=o,us(o,a)){var l=n.interleaved;l===null?(i.next=i,Pg(n)):(i.next=l.next,l.next=i),n.interleaved=i;return}}catch{}finally{}t=HC(e,n,i,r),t!==null&&(i=Vr(),os(t,e,r,i),aS(t,n,r))}}function iS(e){var n=e.alternate;return e===dn||n!==null&&n===dn}function sS(e,n){Lc=Kf=!0;var t=e.pending;t===null?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function aS(e,n,t){if(t&4194240){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,Sg(e,t)}}var Qf={readContext:Gi,useCallback:Nr,useContext:Nr,useEffect:Nr,useImperativeHandle:Nr,useInsertionEffect:Nr,useLayoutEffect:Nr,useMemo:Nr,useReducer:Nr,useRef:Nr,useState:Nr,useDebugValue:Nr,useDeferredValue:Nr,useTransition:Nr,useMutableSource:Nr,useSyncExternalStore:Nr,useId:Nr,unstable_isNewReconciler:!1},lA={readContext:Gi,useCallback:function(e,n){return ms().memoizedState=[e,n===void 0?null:n],e},useContext:Gi,useEffect:K1,useImperativeHandle:function(e,n,t){return t=t!=null?t.concat([e]):null,hf(4194308,4,XC.bind(null,n,e),t)},useLayoutEffect:function(e,n){return hf(4194308,4,e,n)},useInsertionEffect:function(e,n){return hf(4,2,e,n)},useMemo:function(e,n){var t=ms();return n=n===void 0?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var r=ms();return n=t!==void 0?t(n):n,r.memoizedState=r.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},r.queue=e,e=e.dispatch=aA.bind(null,dn,e),[r.memoizedState,e]},useRef:function(e){var n=ms();return e={current:e},n.memoizedState=e},useState:W1,useDebugValue:qg,useDeferredValue:function(e){return ms().memoizedState=e},useTransition:function(){var e=W1(!1),n=e[0];return e=sA.bind(null,e[1]),ms().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,t){var r=dn,i=ms();if(rn){if(t===void 0)throw Error(we(407));t=t()}else{if(t=n(),or===null)throw Error(we(349));tl&30||zC(r,n,t)}i.memoizedState=t;var s={value:t,getSnapshot:n};return i.queue=s,K1(qC.bind(null,r,s,e),[e]),r.flags|=2048,Sd(9,VC.bind(null,r,s,t,n),void 0,null),t},useId:function(){var e=ms(),n=or.identifierPrefix;if(rn){var t=Js,r=Xs;t=(r&~(1<<32-as(r)-1)).toString(32)+t,n=":"+n+"R"+t,t=bd++,0")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=o);break}}}finally{qp=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?_c(e):""}function jI(e){switch(e.tag){case 5:return _c(e.type);case 16:return _c("Lazy");case 13:return _c("Suspense");case 19:return _c("SuspenseList");case 0:case 2:case 15:return e=Wp(e.type,!1),e;case 11:return e=Wp(e.type.render,!1),e;case 1:return e=Wp(e.type,!0),e;default:return""}}function mm(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case kl:return"Fragment";case Rl:return"Portal";case fm:return"Profiler";case yg:return"StrictMode";case pm:return"Suspense";case _m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bb:return(e.displayName||"Context")+".Consumer";case jb:return(e._context.displayName||"Context")+".Provider";case Eg:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case bg:return n=e.displayName||null,n!==null?n:mm(e.type)||"Memo";case Ea:n=e._payload,e=e._init;try{return mm(e(n))}catch{}}return null}function BI(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mm(n);case 8:return n===yg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function to(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gb(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function $I(e){var n=Gb(e)?"checked":"value",t=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),r=""+e[n];if(!e.hasOwnProperty(n)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(e,n,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function _h(e){e._valueTracker||(e._valueTracker=$I(e))}function zb(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var t=n.getValue(),r="";return e&&(r=Gb(e)?e.checked?"true":"false":e.value),e=r,e!==t?(n.setValue(e),!0):!1}function kf(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function vm(e,n){var t=n.checked;return fn({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function p1(e,n){var t=n.defaultValue==null?"":n.defaultValue,r=n.checked!=null?n.checked:n.defaultChecked;t=to(n.value!=null?n.value:t),e._wrapperState={initialChecked:r,initialValue:t,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Vb(e,n){n=n.checked,n!=null&&gg(e,"checked",n,!1)}function gm(e,n){Vb(e,n);var t=to(n.value),r=n.type;if(t!=null)r==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+t):e.value!==""+t&&(e.value=""+t);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?ym(e,n.type,t):n.hasOwnProperty("defaultValue")&&ym(e,n.type,to(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function _1(e,n,t){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var r=n.type;if(!(r!=="submit"&&r!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,t||n===e.value||(e.value=n),e.defaultValue=n}t=e.name,t!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,t!==""&&(e.name=t)}function ym(e,n,t){(n!=="number"||kf(e.ownerDocument)!==e)&&(t==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}var mc=Array.isArray;function Ql(e,n,t,r){if(e=e.options,n){n={};for(var i=0;i"+n.valueOf().toString()+"",n=mh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function ud(e,n){if(n){var t=e.firstChild;if(t&&t===e.lastChild&&t.nodeType===3){t.nodeValue=n;return}}e.textContent=n}var Mc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},GI=["Webkit","ms","Moz","O"];Object.keys(Mc).forEach(function(e){GI.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Mc[n]=Mc[e]})});function Qb(e,n,t){return n==null||typeof n=="boolean"||n===""?"":t||typeof n!="number"||n===0||Mc.hasOwnProperty(e)&&Mc[e]?(""+n).trim():n+"px"}function Yb(e,n){e=e.style;for(var t in n)if(n.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=Qb(t,n[t],r);t==="float"&&(t="cssFloat"),r?e.setProperty(t,i):e[t]=i}}var zI=fn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Cm(e,n){if(n){if(zI[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(Te(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(Te(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(Te(61))}if(n.style!=null&&typeof n.style!="object")throw Error(Te(62))}}function Sm(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wm=null;function Cg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Tm=null,Yl=null,Zl=null;function g1(e){if(e=Xd(e)){if(typeof Tm!="function")throw Error(Te(280));var n=e.stateNode;n&&(n=K0(n),Tm(e.stateNode,e.type,n))}}function Zb(e){Yl?Zl?Zl.push(e):Zl=[e]:Yl=e}function Xb(){if(Yl){var e=Yl,n=Zl;if(Zl=Yl=null,g1(e),n)for(e=0;e>>=0,e===0?32:31-(t4(e)/n4|0)|0}var vh=64,gh=4194304;function vc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pf(e,n){var t=e.pendingLanes;if(t===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,a=t&268435455;if(a!==0){var o=a&~i;o!==0?r=vc(o):(s&=a,s!==0&&(r=vc(s)))}else a=t&~i,a!==0?r=vc(a):s!==0&&(r=vc(s));if(r===0)return 0;if(n!==0&&n!==r&&!(n&i)&&(i=r&-r,s=n&-n,i>=s||i===16&&(s&4194240)!==0))return n;if(r&4&&(r|=t&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=r;0t;t++)n.push(e);return n}function Yd(e,n,t){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-as(n),e[n]=t}function a4(e,n){var t=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Oc),I1=" ",A1=!1;function gC(e,n){switch(e){case"keyup":return L4.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ll=!1;function U4(e,n){switch(e){case"compositionend":return yC(n);case"keypress":return n.which!==32?null:(A1=!0,I1);case"textInput":return e=n.data,e===I1&&A1?null:e;default:return null}}function P4(e,n){if(Ll)return e==="compositionend"||!xg&&gC(e,n)?(e=mC(),uf=Ig=La=null,Ll=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:t,offset:n-e};e=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=R1(t)}}function SC(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?SC(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function wC(){for(var e=window,n=kf();n instanceof e.HTMLIFrameElement;){try{var t=typeof n.contentWindow.location.href=="string"}catch{t=!1}if(t)e=n.contentWindow;else break;n=kf(e.document)}return n}function Og(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function q4(e){var n=wC(),t=e.focusedElem,r=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&SC(t.ownerDocument.documentElement,t)){if(r!==null&&Og(t)){if(n=r.start,e=r.end,e===void 0&&(e=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(e,t.value.length);else if(e=(n=t.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=k1(t,s);var a=k1(t,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(n=n.createRange(),n.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(n),e.extend(a.node,a.offset)):(n.setEnd(a.node,a.offset),e.addRange(n)))}}for(n=[],e=t;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Dl=null,Om=null,kc=null,Rm=!1;function L1(e,n,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Rm||Dl==null||Dl!==kf(r)||(r=Dl,"selectionStart"in r&&Og(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kc&&_d(kc,r)||(kc=r,r=jf(Om,"onSelect"),0Fl||(e.current=Fm[Fl],Fm[Fl]=null,Fl--)}function Wt(e,n){Fl++,Fm[Fl]=e.current,e.current=n}var no={},kr=ao(no),ri=ao(!1),Jo=no;function gu(e,n){var t=e.type.contextTypes;if(!t)return no;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===n)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=n[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=i),i}function ii(e){return e=e.childContextTypes,e!=null}function $f(){Zt(ri),Zt(kr)}function B1(e,n,t){if(kr.current!==no)throw Error(Te(168));Wt(kr,n),Wt(ri,t)}function kC(e,n,t){var r=e.stateNode;if(n=n.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in n))throw Error(Te(108,BI(e)||"Unknown",i));return fn({},t,r)}function Gf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||no,Jo=kr.current,Wt(kr,e),Wt(ri,ri.current),!0}function $1(e,n,t){var r=e.stateNode;if(!r)throw Error(Te(169));t?(e=kC(e,n,Jo),r.__reactInternalMemoizedMergedChildContext=e,Zt(ri),Zt(kr),Wt(kr,e)):Zt(ri),Wt(ri,t)}var Ks=null,Q0=!1,o_=!1;function LC(e){Ks===null?Ks=[e]:Ks.push(e)}function iA(e){Q0=!0,LC(e)}function oo(){if(!o_&&Ks!==null){o_=!0;var e=0,n=Ot;try{var t=Ks;for(Ot=1;e>=a,i-=a,Xs=1<<32-as(n)+i|t<x?(A=I,I=null):A=I.sibling;var O=h(v,I,E[x],S);if(O===null){I===null&&(I=A);break}e&&I&&O.alternate===null&&n(v,I),_=s(O,_,x),N===null?T=O:N.sibling=O,N=O,I=A}if(x===E.length)return t(v,I),rn&&_o(v,x),T;if(I===null){for(;xx?(A=I,I=null):A=I.sibling;var U=h(v,I,O.value,S);if(U===null){I===null&&(I=A);break}e&&I&&U.alternate===null&&n(v,I),_=s(U,_,x),N===null?T=U:N.sibling=U,N=U,I=A}if(O.done)return t(v,I),rn&&_o(v,x),T;if(I===null){for(;!O.done;x++,O=E.next())O=d(v,O.value,S),O!==null&&(_=s(O,_,x),N===null?T=O:N.sibling=O,N=O);return rn&&_o(v,x),T}for(I=r(v,I);!O.done;x++,O=E.next())O=f(I,v,x,O.value,S),O!==null&&(e&&O.alternate!==null&&I.delete(O.key===null?x:O.key),_=s(O,_,x),N===null?T=O:N.sibling=O,N=O);return e&&I.forEach(function(W){return n(v,W)}),rn&&_o(v,x),T}function b(v,_,E,S){if(typeof E=="object"&&E!==null&&E.type===kl&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case ph:e:{for(var T=E.key,N=_;N!==null;){if(N.key===T){if(T=E.type,T===kl){if(N.tag===7){t(v,N.sibling),_=i(N,E.props.children),_.return=v,v=_;break e}}else if(N.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ea&&V1(T)===N.type){t(v,N.sibling),_=i(N,E.props),_.ref=Xu(v,N,E),_.return=v,v=_;break e}t(v,N);break}else n(v,N);N=N.sibling}E.type===kl?(_=qo(E.props.children,v.mode,S,E.key),_.return=v,v=_):(S=vf(E.type,E.key,E.props,null,v.mode,S),S.ref=Xu(v,_,E),S.return=v,v=S)}return a(v);case Rl:e:{for(N=E.key;_!==null;){if(_.key===N)if(_.tag===4&&_.stateNode.containerInfo===E.containerInfo&&_.stateNode.implementation===E.implementation){t(v,_.sibling),_=i(_,E.children||[]),_.return=v,v=_;break e}else{t(v,_);break}else n(v,_);_=_.sibling}_=__(E,v.mode,S),_.return=v,v=_}return a(v);case Ea:return N=E._init,b(v,_,N(E._payload),S)}if(mc(E))return p(v,_,E,S);if(Wu(E))return m(v,_,E,S);Th(v,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,_!==null&&_.tag===6?(t(v,_.sibling),_=i(_,E),_.return=v,v=_):(t(v,_),_=p_(E,v.mode,S),_.return=v,v=_),a(v)):t(v,_)}return b}var Eu=FC(!0),HC=FC(!1),qf=ao(null),Wf=null,Bl=null,Dg=null;function Ug(){Dg=Bl=Wf=null}function Pg(e){var n=qf.current;Zt(qf),e._currentValue=n}function Bm(e,n,t){for(;e!==null;){var r=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,r!==null&&(r.childLanes|=n)):r!==null&&(r.childLanes&n)!==n&&(r.childLanes|=n),e===t)break;e=e.return}}function Jl(e,n){Wf=e,Dg=Bl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&n&&(ni=!0),e.firstContext=null)}function Gi(e){var n=e._currentValue;if(Dg!==e)if(e={context:e,memoizedValue:n,next:null},Bl===null){if(Wf===null)throw Error(Te(308));Bl=e,Wf.dependencies={lanes:0,firstContext:e}}else Bl=Bl.next=e;return n}var No=null;function Fg(e){No===null?No=[e]:No.push(e)}function jC(e,n,t,r){var i=n.interleaved;return i===null?(t.next=t,Fg(n)):(t.next=i.next,i.next=t),n.interleaved=t,aa(e,r)}function aa(e,n){e.lanes|=n;var t=e.alternate;for(t!==null&&(t.lanes|=n),t=e,e=e.return;e!==null;)e.childLanes|=n,t=e.alternate,t!==null&&(t.childLanes|=n),t=e,e=e.return;return t.tag===3?t.stateNode:null}var ba=!1;function Hg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function BC(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ta(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function $a(e,n,t){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,gt&2){var i=r.pending;return i===null?n.next=n:(n.next=i.next,i.next=n),r.pending=n,aa(e,t)}return i=r.interleaved,i===null?(n.next=n,Fg(r)):(n.next=i.next,i.next=n),r.interleaved=n,aa(e,t)}function df(e,n,t){if(n=n.updateQueue,n!==null&&(n=n.shared,(t&4194240)!==0)){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,wg(e,t)}}function q1(e,n){var t=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var a={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=a:s=s.next=a,t=t.next}while(t!==null);s===null?i=s=n:s=s.next=n}else i=s=n;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=t;return}e=t.lastBaseUpdate,e===null?t.firstBaseUpdate=n:e.next=n,t.lastBaseUpdate=n}function Kf(e,n,t,r){var i=e.updateQueue;ba=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var l=o,u=l.next;l.next=null,a===null?s=u:a.next=u,a=l;var c=e.alternate;c!==null&&(c=c.updateQueue,o=c.lastBaseUpdate,o!==a&&(o===null?c.firstBaseUpdate=u:o.next=u,c.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;a=0,c=u=l=null,o=s;do{var h=o.lane,f=o.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:f,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var p=e,m=o;switch(h=n,f=t,m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(f,d,h);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,h=typeof p=="function"?p.call(f,d,h):p,h==null)break e;d=fn({},d,h);break e;case 2:ba=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[o]:h.push(o))}else f={eventTime:f,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},c===null?(u=c=f,l=d):c=c.next=f,a|=h;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;h=o,o=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(c===null&&(l=d),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,n=i.shared.interleaved,n!==null){i=n;do a|=i.lane,i=i.next;while(i!==n)}else s===null&&(i.shared.lanes=0);nl|=a,e.lanes=a,e.memoizedState=d}}function W1(e,n,t){if(e=n.effects,n.effects=null,e!==null)for(n=0;nt?t:4,e(!0);var r=u_.transition;u_.transition={};try{e(!1),n()}finally{Ot=t,u_.transition=r}}function iS(){return zi().memoizedState}function lA(e,n,t){var r=za(e);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},sS(e))aS(n,t);else if(t=jC(e,n,t,r),t!==null){var i=Vr();os(t,e,r,i),oS(t,n,r)}}function uA(e,n,t){var r=za(e),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(sS(e))aS(n,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=n.lastRenderedReducer,s!==null))try{var a=n.lastRenderedState,o=s(a,t);if(i.hasEagerState=!0,i.eagerState=o,us(o,a)){var l=n.interleaved;l===null?(i.next=i,Fg(n)):(i.next=l.next,l.next=i),n.interleaved=i;return}}catch{}finally{}t=jC(e,n,i,r),t!==null&&(i=Vr(),os(t,e,r,i),oS(t,n,r))}}function sS(e){var n=e.alternate;return e===hn||n!==null&&n===hn}function aS(e,n){Lc=Yf=!0;var t=e.pending;t===null?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function oS(e,n,t){if(t&4194240){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,wg(e,t)}}var Zf={readContext:Gi,useCallback:Nr,useContext:Nr,useEffect:Nr,useImperativeHandle:Nr,useInsertionEffect:Nr,useLayoutEffect:Nr,useMemo:Nr,useReducer:Nr,useRef:Nr,useState:Nr,useDebugValue:Nr,useDeferredValue:Nr,useTransition:Nr,useMutableSource:Nr,useSyncExternalStore:Nr,useId:Nr,unstable_isNewReconciler:!1},cA={readContext:Gi,useCallback:function(e,n){return ms().memoizedState=[e,n===void 0?null:n],e},useContext:Gi,useEffect:Q1,useImperativeHandle:function(e,n,t){return t=t!=null?t.concat([e]):null,ff(4194308,4,JC.bind(null,n,e),t)},useLayoutEffect:function(e,n){return ff(4194308,4,e,n)},useInsertionEffect:function(e,n){return ff(4,2,e,n)},useMemo:function(e,n){var t=ms();return n=n===void 0?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var r=ms();return n=t!==void 0?t(n):n,r.memoizedState=r.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},r.queue=e,e=e.dispatch=lA.bind(null,hn,e),[r.memoizedState,e]},useRef:function(e){var n=ms();return e={current:e},n.memoizedState=e},useState:K1,useDebugValue:Wg,useDeferredValue:function(e){return ms().memoizedState=e},useTransition:function(){var e=K1(!1),n=e[0];return e=oA.bind(null,e[1]),ms().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,t){var r=hn,i=ms();if(rn){if(t===void 0)throw Error(Te(407));t=t()}else{if(t=n(),or===null)throw Error(Te(349));tl&30||VC(r,n,t)}i.memoizedState=t;var s={value:t,getSnapshot:n};return i.queue=s,Q1(WC.bind(null,r,s,e),[e]),r.flags|=2048,Sd(9,qC.bind(null,r,s,t,n),void 0,null),t},useId:function(){var e=ms(),n=or.identifierPrefix;if(rn){var t=Js,r=Xs;t=(r&~(1<<32-as(r)-1)).toString(32)+t,n=":"+n+"R"+t,t=bd++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(t,{is:r.is}):(e=a.createElement(t),t==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,t),e[ws]=n,e[gd]=r,mS(e,n,!1,!1),n.stateNode=e;e:{switch(a=bm(t,r),t){case"dialog":Kt("cancel",e),Kt("close",e),i=r;break;case"iframe":case"object":case"embed":Kt("load",e),i=r;break;case"video":case"audio":for(i=0;iSu&&(n.flags|=128,r=!0,Ju(s,!1),n.lanes=4194304)}else{if(!r)if(e=Wf(a),e!==null){if(n.flags|=128,r=!0,t=e.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),Ju(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!rn)return Ir(n),null}else 2*Dn()-s.renderingStartTime>Su&&t!==1073741824&&(n.flags|=128,r=!0,Ju(s,!1),n.lanes=4194304);s.isBackwards?(a.sibling=n.child,n.child=a):(t=s.last,t!==null?t.sibling=a:n.child=a,s.last=a)}return s.tail!==null?(n=s.tail,s.rendering=n,s.tail=n.sibling,s.renderingStartTime=Dn(),n.sibling=null,t=cn.current,Wt(cn,r?t&1|2:t&1),n):(Ir(n),null);case 22:case 23:return Xg(),r=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(n.flags|=8192),r&&n.mode&1?hi&1073741824&&(Ir(n),n.subtreeFlags&6&&(n.flags|=8192)):Ir(n),null;case 24:return null;case 25:return null}throw Error(we(156,n.tag))}function mA(e,n){switch(Rg(n),n.tag){case 1:return ii(n.type)&&jf(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return bu(),Zt(ri),Zt(kr),Bg(),e=n.flags,e&65536&&!(e&128)?(n.flags=e&-65537|128,n):null;case 5:return jg(n),null;case 13:if(Zt(cn),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(we(340));yu()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Zt(cn),null;case 4:return bu(),null;case 10:return Ug(n.type._context),null;case 22:case 23:return Xg(),null;case 24:return null;default:return null}}var Nh=!1,xr=!1,vA=typeof WeakSet=="function"?WeakSet:Set,je=null;function $l(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Cn(e,n,r)}else t.current=null}function Km(e,n,t){try{t()}catch(r){Cn(e,n,r)}}var sy=!1;function gA(e,n){if(Om=Uf,e=SC(),xg(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{t=(t=e.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var a=0,o=-1,l=-1,u=0,c=0,d=e,h=null;t:for(;;){for(var f;d!==t||i!==0&&d.nodeType!==3||(o=a+i),d!==s||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(f=d.firstChild)!==null;)h=d,d=f;for(;;){if(d===e)break t;if(h===t&&++u===i&&(o=a),h===s&&++c===r&&(l=a),(f=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=f}t=o===-1||l===-1?null:{start:o,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(Rm={focusedElem:e,selectionRange:t},Uf=!1,je=n;je!==null;)if(n=je,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,je=e;else for(;je!==null;){n=je;try{var p=n.alternate;if(n.flags&1024)switch(n.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,b=p.memoizedState,v=n.stateNode,_=v.getSnapshotBeforeUpdate(n.elementType===n.type?m:ts(n.type,m),b);v.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var E=n.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(we(163))}}catch(S){Cn(n,n.return,S)}if(e=n.sibling,e!==null){e.return=n.return,je=e;break}je=n.return}return p=sy,sy=!1,p}function Dc(e,n,t){var r=n.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Km(n,t,s)}i=i.next}while(i!==r)}}function Z0(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var t=n=n.next;do{if((t.tag&e)===e){var r=t.create;t.destroy=r()}t=t.next}while(t!==n)}}function Qm(e){var n=e.ref;if(n!==null){var t=e.stateNode;switch(e.tag){case 5:e=t;break;default:e=t}typeof n=="function"?n(e):n.current=e}}function yS(e){var n=e.alternate;n!==null&&(e.alternate=null,yS(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ws],delete n[gd],delete n[Dm],delete n[eA],delete n[tA])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ES(e){return e.tag===5||e.tag===3||e.tag===4}function ay(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ES(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ym(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.nodeType===8?t.parentNode.insertBefore(e,n):t.insertBefore(e,n):(t.nodeType===8?(n=t.parentNode,n.insertBefore(e,t)):(n=t,n.appendChild(e)),t=t._reactRootContainer,t!=null||n.onclick!==null||(n.onclick=Hf));else if(r!==4&&(e=e.child,e!==null))for(Ym(e,n,t),e=e.sibling;e!==null;)Ym(e,n,t),e=e.sibling}function Zm(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.insertBefore(e,n):t.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Zm(e,n,t),e=e.sibling;e!==null;)Zm(e,n,t),e=e.sibling}var _r=null,rs=!1;function fa(e,n,t){for(t=t.child;t!==null;)bS(e,n,t),t=t.sibling}function bS(e,n,t){if(Rs&&typeof Rs.onCommitFiberUnmount=="function")try{Rs.onCommitFiberUnmount(G0,t)}catch{}switch(t.tag){case 5:xr||$l(t,n);case 6:var r=_r,i=rs;_r=null,fa(e,n,t),_r=r,rs=i,_r!==null&&(rs?(e=_r,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):_r.removeChild(t.stateNode));break;case 18:_r!==null&&(rs?(e=_r,t=t.stateNode,e.nodeType===8?s_(e.parentNode,t):e.nodeType===1&&s_(e,t),fd(e)):s_(_r,t.stateNode));break;case 4:r=_r,i=rs,_r=t.stateNode.containerInfo,rs=!0,fa(e,n,t),_r=r,rs=i;break;case 0:case 11:case 14:case 15:if(!xr&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&Km(t,n,a),i=i.next}while(i!==r)}fa(e,n,t);break;case 1:if(!xr&&($l(t,n),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(o){Cn(t,n,o)}fa(e,n,t);break;case 21:fa(e,n,t);break;case 22:t.mode&1?(xr=(r=xr)||t.memoizedState!==null,fa(e,n,t),xr=r):fa(e,n,t);break;default:fa(e,n,t)}}function oy(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new vA),n.forEach(function(r){var i=IA.bind(null,e,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Qi(e,n){var t=n.deletions;if(t!==null)for(var r=0;ri&&(i=a),r&=~s}if(r=i,r=Dn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*EA(r/1960))-r,10e?16:e,Da===null)var r=!1;else{if(e=Da,Da=null,Xf=0,gt&6)throw Error(we(331));var i=gt;for(gt|=4,je=e.current;je!==null;){var s=je,a=s.child;if(je.flags&16){var o=s.deletions;if(o!==null){for(var l=0;lDn()-Yg?Vo(e,0):Qg|=t),si(e,n)}function MS(e,n){n===0&&(e.mode&1?(n=vh,vh<<=1,!(vh&130023424)&&(vh=4194304)):n=1);var t=Vr();e=aa(e,n),e!==null&&(Qd(e,n,t),si(e,t))}function NA(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),MS(e,t)}function IA(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(we(314))}r!==null&&r.delete(n),MS(e,t)}var xS;xS=function(e,n,t){if(e!==null)if(e.memoizedProps!==n.pendingProps||ri.current)ni=!0;else{if(!(e.lanes&t)&&!(n.flags&128))return ni=!1,pA(e,n,t);ni=!!(e.flags&131072)}else ni=!1,rn&&n.flags&1048576&&LC(n,Gf,n.index);switch(n.lanes=0,n.tag){case 2:var r=n.type;ff(e,n),e=n.pendingProps;var i=gu(n,kr.current);Jl(n,t),i=Gg(null,n,r,e,i,t);var s=zg();return n.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,ii(r)?(s=!0,Bf(n)):s=!1,n.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Fg(n),i.updater=Y0,n.stateNode=i,i._reactInternals=n,Bm(n,r,e,t),n=zm(null,n,r,!0,s,t)):(n.tag=0,rn&&s&&Og(n),jr(null,n,i,t),n=n.child),n;case 16:r=n.elementType;e:{switch(ff(e,n),e=n.pendingProps,i=r._init,r=i(r._payload),n.type=r,i=n.tag=MA(r),e=ts(r,e),i){case 0:n=Gm(null,n,r,e,t);break e;case 1:n=ny(null,n,r,e,t);break e;case 11:n=ey(null,n,r,e,t);break e;case 14:n=ty(null,n,r,ts(r.type,e),t);break e}throw Error(we(306,r,""))}return n;case 0:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ts(r,i),Gm(e,n,r,i,t);case 1:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ts(r,i),ny(e,n,r,i,t);case 3:e:{if(fS(n),e===null)throw Error(we(387));r=n.pendingProps,s=n.memoizedState,i=s.element,jC(e,n),qf(n,r,null,t);var a=n.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},n.updateQueue.baseState=s,n.memoizedState=s,n.flags&256){i=Cu(Error(we(423)),n),n=ry(e,n,r,t,i);break e}else if(r!==i){i=Cu(Error(we(424)),n),n=ry(e,n,r,t,i);break e}else for(gi=Ba(n.stateNode.containerInfo.firstChild),Ei=n,rn=!0,is=null,t=FC(n,null,r,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(yu(),r===i){n=oa(e,n,t);break e}jr(e,n,r,t)}n=n.child}return n;case 5:return BC(n),e===null&&Fm(n),r=n.type,i=n.pendingProps,s=e!==null?e.memoizedProps:null,a=i.children,km(r,i)?a=null:s!==null&&km(r,s)&&(n.flags|=32),hS(e,n),jr(e,n,a,t),n.child;case 6:return e===null&&Fm(n),null;case 13:return pS(e,n,t);case 4:return Hg(n,n.stateNode.containerInfo),r=n.pendingProps,e===null?n.child=Eu(n,null,r,t):jr(e,n,r,t),n.child;case 11:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ts(r,i),ey(e,n,r,i,t);case 7:return jr(e,n,n.pendingProps,t),n.child;case 8:return jr(e,n,n.pendingProps.children,t),n.child;case 12:return jr(e,n,n.pendingProps.children,t),n.child;case 10:e:{if(r=n.type._context,i=n.pendingProps,s=n.memoizedProps,a=i.value,Wt(zf,r._currentValue),r._currentValue=a,s!==null)if(us(s.value,a)){if(s.children===i.children&&!ri.current){n=oa(e,n,t);break e}}else for(s=n.child,s!==null&&(s.return=n);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=ta(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),Hm(s.return,t,n),o.lanes|=t;break}l=l.next}}else if(s.tag===10)a=s.type===n.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(we(341));a.lanes|=t,o=a.alternate,o!==null&&(o.lanes|=t),Hm(a,t,n),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===n){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}jr(e,n,i.children,t),n=n.child}return n;case 9:return i=n.type,r=n.pendingProps.children,Jl(n,t),i=Gi(i),r=r(i),n.flags|=1,jr(e,n,r,t),n.child;case 14:return r=n.type,i=ts(r,n.pendingProps),i=ts(r.type,i),ty(e,n,r,i,t);case 15:return cS(e,n,n.type,n.pendingProps,t);case 17:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ts(r,i),ff(e,n),n.tag=1,ii(r)?(e=!0,Bf(n)):e=!1,Jl(n,t),oS(n,r,i),Bm(n,r,i,t),zm(null,n,r,!0,e,t);case 19:return _S(e,n,t);case 22:return dS(e,n,t)}throw Error(we(156,n.tag))};function OS(e,n){return iC(e,n)}function AA(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ji(e,n,t,r){return new AA(e,n,t,r)}function e2(e){return e=e.prototype,!(!e||!e.isReactComponent)}function MA(e){if(typeof e=="function")return e2(e)?1:0;if(e!=null){if(e=e.$$typeof,e===yg)return 11;if(e===Eg)return 14}return 2}function Va(e,n){var t=e.alternate;return t===null?(t=ji(e.tag,n,e.key,e.mode),t.elementType=e.elementType,t.type=e.type,t.stateNode=e.stateNode,t.alternate=e,e.alternate=t):(t.pendingProps=n,t.type=e.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=e.flags&14680064,t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,n=e.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},t.sibling=e.sibling,t.index=e.index,t.ref=e.ref,t}function mf(e,n,t,r,i,s){var a=2;if(r=e,typeof e=="function")e2(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case kl:return qo(t.children,i,s,n);case gg:a=8,i|=8;break;case dm:return e=ji(12,t,n,i|2),e.elementType=dm,e.lanes=s,e;case hm:return e=ji(13,t,n,i),e.elementType=hm,e.lanes=s,e;case fm:return e=ji(19,t,n,i),e.elementType=fm,e.lanes=s,e;case Bb:return J0(t,i,s,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Hb:a=10;break e;case jb:a=9;break e;case yg:a=11;break e;case Eg:a=14;break e;case Ea:a=16,r=null;break e}throw Error(we(130,e==null?e:typeof e,""))}return n=ji(a,t,n,i),n.elementType=e,n.type=r,n.lanes=s,n}function qo(e,n,t,r){return e=ji(7,e,r,n),e.lanes=t,e}function J0(e,n,t,r){return e=ji(22,e,r,n),e.elementType=Bb,e.lanes=t,e.stateNode={isHidden:!1},e}function f_(e,n,t){return e=ji(6,e,null,n),e.lanes=t,e}function p_(e,n,t){return n=ji(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function xA(e,n,t,r,i){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Kp(0),this.expirationTimes=Kp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kp(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function t2(e,n,t,r,i,s,a,o,l){return e=new xA(e,n,t,o,l),n===1?(n=1,s===!0&&(n|=8)):n=0,s=ji(3,null,null,n),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fg(s),e}function OA(e,n,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(DS)}catch(e){console.error(e)}}DS(),Db.exports=Ti;var Jd=Db.exports;const US=B0(Jd);var _y=Jd;um.createRoot=_y.createRoot,um.hydrateRoot=_y.hydrateRoot;var PS={exports:{}},Rt={};/** @license React v16.13.1 +`+s.stack}return{value:e,source:n,stack:i,digest:null}}function h_(e,n,t){return{value:e,source:null,stack:t??null,digest:n??null}}function zm(e,n){try{console.error(n.value)}catch(t){setTimeout(function(){throw t})}}var fA=typeof WeakMap=="function"?WeakMap:Map;function uS(e,n,t){t=ta(-1,t),t.tag=3,t.payload={element:null};var r=n.value;return t.callback=function(){Jf||(Jf=!0,ev=r),zm(e,n)},t}function cS(e,n,t){t=ta(-1,t),t.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=n.value;t.payload=function(){return r(i)},t.callback=function(){zm(e,n)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){zm(e,n),typeof r!="function"&&(Ga===null?Ga=new Set([this]):Ga.add(this));var a=n.stack;this.componentDidCatch(n.value,{componentStack:a!==null?a:""})}),t}function X1(e,n,t){var r=e.pingCache;if(r===null){r=e.pingCache=new fA;var i=new Set;r.set(n,i)}else i=r.get(n),i===void 0&&(i=new Set,r.set(n,i));i.has(t)||(i.add(t),e=IA.bind(null,e,n,t),n.then(e,e))}function J1(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function ey(e,n,t,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===n?e.flags|=65536:(e.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(n=ta(-1,1),n.tag=2,$a(t,n,1))),t.lanes|=1),e)}var pA=ua.ReactCurrentOwner,ni=!1;function jr(e,n,t,r){n.child=e===null?HC(n,null,t,r):Eu(n,e.child,t,r)}function ty(e,n,t,r,i){t=t.render;var s=n.ref;return Jl(n,i),r=zg(e,n,t,r,s,i),t=Vg(),e!==null&&!ni?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i,oa(e,n,i)):(rn&&t&&Rg(n),n.flags|=1,jr(e,n,r,i),n.child)}function ny(e,n,t,r,i){if(e===null){var s=t.type;return typeof s=="function"&&!t2(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(n.tag=15,n.type=s,dS(e,n,s,r,i)):(e=vf(t.type,null,r,n,n.mode,i),e.ref=n.ref,e.return=n,n.child=e)}if(s=e.child,!(e.lanes&i)){var a=s.memoizedProps;if(t=t.compare,t=t!==null?t:_d,t(a,r)&&e.ref===n.ref)return oa(e,n,i)}return n.flags|=1,e=Va(s,r),e.ref=n.ref,e.return=n,n.child=e}function dS(e,n,t,r,i){if(e!==null){var s=e.memoizedProps;if(_d(s,r)&&e.ref===n.ref)if(ni=!1,n.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(ni=!0);else return n.lanes=e.lanes,oa(e,n,i)}return Vm(e,n,t,r,i)}function hS(e,n,t){var r=n.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(n.mode&1))n.memoizedState={baseLanes:0,cachePool:null,transitions:null},Wt(Gl,hi),hi|=t;else{if(!(t&1073741824))return e=s!==null?s.baseLanes|t:t,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,Wt(Gl,hi),hi|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,Wt(Gl,hi),hi|=r}else s!==null?(r=s.baseLanes|t,n.memoizedState=null):r=t,Wt(Gl,hi),hi|=r;return jr(e,n,i,t),n.child}function fS(e,n){var t=n.ref;(e===null&&t!==null||e!==null&&e.ref!==t)&&(n.flags|=512,n.flags|=2097152)}function Vm(e,n,t,r,i){var s=ii(t)?Jo:kr.current;return s=gu(n,s),Jl(n,i),t=zg(e,n,t,r,s,i),r=Vg(),e!==null&&!ni?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i,oa(e,n,i)):(rn&&r&&Rg(n),n.flags|=1,jr(e,n,t,i),n.child)}function ry(e,n,t,r,i){if(ii(t)){var s=!0;Gf(n)}else s=!1;if(Jl(n,i),n.stateNode===null)pf(e,n),lS(n,t,r),Gm(n,t,r,i),r=!0;else if(e===null){var a=n.stateNode,o=n.memoizedProps;a.props=o;var l=a.context,u=t.contextType;typeof u=="object"&&u!==null?u=Gi(u):(u=ii(t)?Jo:kr.current,u=gu(n,u));var c=t.getDerivedStateFromProps,d=typeof c=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||l!==u)&&Z1(n,a,r,u),ba=!1;var h=n.memoizedState;a.state=h,Kf(n,r,a,i),l=n.memoizedState,o!==r||h!==l||ri.current||ba?(typeof c=="function"&&($m(n,t,c,r),l=n.memoizedState),(o=ba||Y1(n,t,o,r,h,l,u))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(n.flags|=4194308)):(typeof a.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=r,n.memoizedState=l),a.props=r,a.state=l,a.context=u,r=o):(typeof a.componentDidMount=="function"&&(n.flags|=4194308),r=!1)}else{a=n.stateNode,BC(e,n),o=n.memoizedProps,u=n.type===n.elementType?o:ts(n.type,o),a.props=u,d=n.pendingProps,h=a.context,l=t.contextType,typeof l=="object"&&l!==null?l=Gi(l):(l=ii(t)?Jo:kr.current,l=gu(n,l));var f=t.getDerivedStateFromProps;(c=typeof f=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==d||h!==l)&&Z1(n,a,r,l),ba=!1,h=n.memoizedState,a.state=h,Kf(n,r,a,i);var p=n.memoizedState;o!==d||h!==p||ri.current||ba?(typeof f=="function"&&($m(n,t,f,r),p=n.memoizedState),(u=ba||Y1(n,t,u,r,h,p,l)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,p,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,p,l)),typeof a.componentDidUpdate=="function"&&(n.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(n.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(n.flags|=1024),n.memoizedProps=r,n.memoizedState=p),a.props=r,a.state=p,a.context=l,r=u):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(n.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(n.flags|=1024),r=!1)}return qm(e,n,t,r,s,i)}function qm(e,n,t,r,i,s){fS(e,n);var a=(n.flags&128)!==0;if(!r&&!a)return i&&$1(n,t,!1),oa(e,n,s);r=n.stateNode,pA.current=n;var o=a&&typeof t.getDerivedStateFromError!="function"?null:r.render();return n.flags|=1,e!==null&&a?(n.child=Eu(n,e.child,null,s),n.child=Eu(n,null,o,s)):jr(e,n,o,s),n.memoizedState=r.state,i&&$1(n,t,!0),n.child}function pS(e){var n=e.stateNode;n.pendingContext?B1(e,n.pendingContext,n.pendingContext!==n.context):n.context&&B1(e,n.context,!1),jg(e,n.containerInfo)}function iy(e,n,t,r,i){return yu(),Lg(i),n.flags|=256,jr(e,n,t,r),n.child}var Wm={dehydrated:null,treeContext:null,retryLane:0};function Km(e){return{baseLanes:e,cachePool:null,transitions:null}}function _S(e,n,t){var r=n.pendingProps,i=dn.current,s=!1,a=(n.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(i&2)!==0),o?(s=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Wt(dn,i&1),e===null)return jm(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(n.mode&1?e.data==="$!"?n.lanes=8:n.lanes=1073741824:n.lanes=1,null):(a=r.children,e=r.fallback,s?(r=n.mode,s=n.child,a={mode:"hidden",children:a},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=ep(a,r,0,null),e=qo(e,r,t,null),s.return=n,e.return=n,s.sibling=e,n.child=s,n.child.memoizedState=Km(t),n.memoizedState=Wm,e):Kg(n,a));if(i=e.memoizedState,i!==null&&(o=i.dehydrated,o!==null))return _A(e,n,a,r,o,i,t);if(s){s=r.fallback,a=n.mode,i=e.child,o=i.sibling;var l={mode:"hidden",children:r.children};return!(a&1)&&n.child!==i?(r=n.child,r.childLanes=0,r.pendingProps=l,n.deletions=null):(r=Va(i,l),r.subtreeFlags=i.subtreeFlags&14680064),o!==null?s=Va(o,s):(s=qo(s,a,t,null),s.flags|=2),s.return=n,r.return=n,r.sibling=s,n.child=r,r=s,s=n.child,a=e.child.memoizedState,a=a===null?Km(t):{baseLanes:a.baseLanes|t,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=e.childLanes&~t,n.memoizedState=Wm,r}return s=e.child,e=s.sibling,r=Va(s,{mode:"visible",children:r.children}),!(n.mode&1)&&(r.lanes=t),r.return=n,r.sibling=null,e!==null&&(t=n.deletions,t===null?(n.deletions=[e],n.flags|=16):t.push(e)),n.child=r,n.memoizedState=null,r}function Kg(e,n){return n=ep({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function Nh(e,n,t,r){return r!==null&&Lg(r),Eu(n,e.child,null,t),e=Kg(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function _A(e,n,t,r,i,s,a){if(t)return n.flags&256?(n.flags&=-257,r=h_(Error(Te(422))),Nh(e,n,a,r)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(s=r.fallback,i=n.mode,r=ep({mode:"visible",children:r.children},i,0,null),s=qo(s,i,a,null),s.flags|=2,r.return=n,s.return=n,r.sibling=s,n.child=r,n.mode&1&&Eu(n,e.child,null,a),n.child.memoizedState=Km(a),n.memoizedState=Wm,s);if(!(n.mode&1))return Nh(e,n,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var o=r.dgst;return r=o,s=Error(Te(419)),r=h_(s,r,void 0),Nh(e,n,a,r)}if(o=(a&e.childLanes)!==0,ni||o){if(r=or,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,aa(e,i),os(r,e,i,-1))}return e2(),r=h_(Error(Te(421))),Nh(e,n,a,r)}return i.data==="$?"?(n.flags|=128,n.child=e.child,n=AA.bind(null,e),i._reactRetry=n,null):(e=s.treeContext,gi=Ba(i.nextSibling),Ei=n,rn=!0,is=null,e!==null&&(Li[Di++]=Xs,Li[Di++]=Js,Li[Di++]=el,Xs=e.id,Js=e.overflow,el=n),n=Kg(n,r.children),n.flags|=4096,n)}function sy(e,n,t){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n),Bm(e.return,n,t)}function f_(e,n,t,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:i}:(s.isBackwards=n,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=t,s.tailMode=i)}function mS(e,n,t){var r=n.pendingProps,i=r.revealOrder,s=r.tail;if(jr(e,n,r.children,t),r=dn.current,r&2)r=r&1|2,n.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sy(e,t,n);else if(e.tag===19)sy(e,t,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Wt(dn,r),!(n.mode&1))n.memoizedState=null;else switch(i){case"forwards":for(t=n.child,i=null;t!==null;)e=t.alternate,e!==null&&Qf(e)===null&&(i=t),t=t.sibling;t=i,t===null?(i=n.child,n.child=null):(i=t.sibling,t.sibling=null),f_(n,!1,i,t,s);break;case"backwards":for(t=null,i=n.child,n.child=null;i!==null;){if(e=i.alternate,e!==null&&Qf(e)===null){n.child=i;break}e=i.sibling,i.sibling=t,t=i,i=e}f_(n,!0,t,null,s);break;case"together":f_(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function pf(e,n){!(n.mode&1)&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function oa(e,n,t){if(e!==null&&(n.dependencies=e.dependencies),nl|=n.lanes,!(t&n.childLanes))return null;if(e!==null&&n.child!==e.child)throw Error(Te(153));if(n.child!==null){for(e=n.child,t=Va(e,e.pendingProps),n.child=t,t.return=n;e.sibling!==null;)e=e.sibling,t=t.sibling=Va(e,e.pendingProps),t.return=n;t.sibling=null}return n.child}function mA(e,n,t){switch(n.tag){case 3:pS(n),yu();break;case 5:$C(n);break;case 1:ii(n.type)&&Gf(n);break;case 4:jg(n,n.stateNode.containerInfo);break;case 10:var r=n.type._context,i=n.memoizedProps.value;Wt(qf,r._currentValue),r._currentValue=i;break;case 13:if(r=n.memoizedState,r!==null)return r.dehydrated!==null?(Wt(dn,dn.current&1),n.flags|=128,null):t&n.child.childLanes?_S(e,n,t):(Wt(dn,dn.current&1),e=oa(e,n,t),e!==null?e.sibling:null);Wt(dn,dn.current&1);break;case 19:if(r=(t&n.childLanes)!==0,e.flags&128){if(r)return mS(e,n,t);n.flags|=128}if(i=n.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Wt(dn,dn.current),r)break;return null;case 22:case 23:return n.lanes=0,hS(e,n,t)}return oa(e,n,t)}var vS,Qm,gS,yS;vS=function(e,n){for(var t=n.child;t!==null;){if(t.tag===5||t.tag===6)e.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break;for(;t.sibling===null;){if(t.return===null||t.return===n)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};Qm=function(){};gS=function(e,n,t,r){var i=e.memoizedProps;if(i!==r){e=n.stateNode,Io(ks.current);var s=null;switch(t){case"input":i=vm(e,i),r=vm(e,r),s=[];break;case"select":i=fn({},i,{value:void 0}),r=fn({},r,{value:void 0}),s=[];break;case"textarea":i=Em(e,i),r=Em(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Bf)}Cm(t,r);var a;t=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var o=i[u];for(a in o)o.hasOwnProperty(a)&&(t||(t={}),t[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(ld.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(o=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&l!==o&&(l!=null||o!=null))if(u==="style")if(o){for(a in o)!o.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(t||(t={}),t[a]="");for(a in l)l.hasOwnProperty(a)&&o[a]!==l[a]&&(t||(t={}),t[a]=l[a])}else t||(s||(s=[]),s.push(u,t)),t=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,o=o?o.__html:void 0,l!=null&&o!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(ld.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Kt("scroll",e),s||o===l||(s=[])):(s=s||[]).push(u,l))}t&&(s=s||[]).push("style",t);var u=s;(n.updateQueue=u)&&(n.flags|=4)}};yS=function(e,n,t,r){t!==r&&(n.flags|=4)};function Ju(e,n){if(!rn)switch(e.tailMode){case"hidden":n=e.tail;for(var t=null;n!==null;)n.alternate!==null&&(t=n),n=n.sibling;t===null?e.tail=null:t.sibling=null;break;case"collapsed":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ir(e){var n=e.alternate!==null&&e.alternate.child===e.child,t=0,r=0;if(n)for(var i=e.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=t,n}function vA(e,n,t){var r=n.pendingProps;switch(kg(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ir(n),null;case 1:return ii(n.type)&&$f(),Ir(n),null;case 3:return r=n.stateNode,bu(),Zt(ri),Zt(kr),$g(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(wh(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&!(n.flags&256)||(n.flags|=1024,is!==null&&(rv(is),is=null))),Qm(e,n),Ir(n),null;case 5:Bg(n);var i=Io(Ed.current);if(t=n.type,e!==null&&n.stateNode!=null)gS(e,n,t,r,i),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!r){if(n.stateNode===null)throw Error(Te(166));return Ir(n),null}if(e=Io(ks.current),wh(n)){r=n.stateNode,t=n.type;var s=n.memoizedProps;switch(r[Ts]=n,r[gd]=s,e=(n.mode&1)!==0,t){case"dialog":Kt("cancel",r),Kt("close",r);break;case"iframe":case"object":case"embed":Kt("load",r);break;case"video":case"audio":for(i=0;i<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(t,{is:r.is}):(e=a.createElement(t),t==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,t),e[Ts]=n,e[gd]=r,vS(e,n,!1,!1),n.stateNode=e;e:{switch(a=Sm(t,r),t){case"dialog":Kt("cancel",e),Kt("close",e),i=r;break;case"iframe":case"object":case"embed":Kt("load",e),i=r;break;case"video":case"audio":for(i=0;iSu&&(n.flags|=128,r=!0,Ju(s,!1),n.lanes=4194304)}else{if(!r)if(e=Qf(a),e!==null){if(n.flags|=128,r=!0,t=e.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),Ju(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!rn)return Ir(n),null}else 2*Dn()-s.renderingStartTime>Su&&t!==1073741824&&(n.flags|=128,r=!0,Ju(s,!1),n.lanes=4194304);s.isBackwards?(a.sibling=n.child,n.child=a):(t=s.last,t!==null?t.sibling=a:n.child=a,s.last=a)}return s.tail!==null?(n=s.tail,s.rendering=n,s.tail=n.sibling,s.renderingStartTime=Dn(),n.sibling=null,t=dn.current,Wt(dn,r?t&1|2:t&1),n):(Ir(n),null);case 22:case 23:return Jg(),r=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(n.flags|=8192),r&&n.mode&1?hi&1073741824&&(Ir(n),n.subtreeFlags&6&&(n.flags|=8192)):Ir(n),null;case 24:return null;case 25:return null}throw Error(Te(156,n.tag))}function gA(e,n){switch(kg(n),n.tag){case 1:return ii(n.type)&&$f(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return bu(),Zt(ri),Zt(kr),$g(),e=n.flags,e&65536&&!(e&128)?(n.flags=e&-65537|128,n):null;case 5:return Bg(n),null;case 13:if(Zt(dn),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(Te(340));yu()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Zt(dn),null;case 4:return bu(),null;case 10:return Pg(n.type._context),null;case 22:case 23:return Jg(),null;case 24:return null;default:return null}}var Ih=!1,xr=!1,yA=typeof WeakSet=="function"?WeakSet:Set,je=null;function $l(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Cn(e,n,r)}else t.current=null}function Ym(e,n,t){try{t()}catch(r){Cn(e,n,r)}}var ay=!1;function EA(e,n){if(km=Ff,e=wC(),Og(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{t=(t=e.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var a=0,o=-1,l=-1,u=0,c=0,d=e,h=null;t:for(;;){for(var f;d!==t||i!==0&&d.nodeType!==3||(o=a+i),d!==s||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(f=d.firstChild)!==null;)h=d,d=f;for(;;){if(d===e)break t;if(h===t&&++u===i&&(o=a),h===s&&++c===r&&(l=a),(f=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=f}t=o===-1||l===-1?null:{start:o,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(Lm={focusedElem:e,selectionRange:t},Ff=!1,je=n;je!==null;)if(n=je,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,je=e;else for(;je!==null;){n=je;try{var p=n.alternate;if(n.flags&1024)switch(n.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,b=p.memoizedState,v=n.stateNode,_=v.getSnapshotBeforeUpdate(n.elementType===n.type?m:ts(n.type,m),b);v.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var E=n.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Te(163))}}catch(S){Cn(n,n.return,S)}if(e=n.sibling,e!==null){e.return=n.return,je=e;break}je=n.return}return p=ay,ay=!1,p}function Dc(e,n,t){var r=n.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Ym(n,t,s)}i=i.next}while(i!==r)}}function X0(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var t=n=n.next;do{if((t.tag&e)===e){var r=t.create;t.destroy=r()}t=t.next}while(t!==n)}}function Zm(e){var n=e.ref;if(n!==null){var t=e.stateNode;switch(e.tag){case 5:e=t;break;default:e=t}typeof n=="function"?n(e):n.current=e}}function ES(e){var n=e.alternate;n!==null&&(e.alternate=null,ES(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[Ts],delete n[gd],delete n[Pm],delete n[nA],delete n[rA])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function bS(e){return e.tag===5||e.tag===3||e.tag===4}function oy(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bS(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xm(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.nodeType===8?t.parentNode.insertBefore(e,n):t.insertBefore(e,n):(t.nodeType===8?(n=t.parentNode,n.insertBefore(e,t)):(n=t,n.appendChild(e)),t=t._reactRootContainer,t!=null||n.onclick!==null||(n.onclick=Bf));else if(r!==4&&(e=e.child,e!==null))for(Xm(e,n,t),e=e.sibling;e!==null;)Xm(e,n,t),e=e.sibling}function Jm(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.insertBefore(e,n):t.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Jm(e,n,t),e=e.sibling;e!==null;)Jm(e,n,t),e=e.sibling}var _r=null,rs=!1;function fa(e,n,t){for(t=t.child;t!==null;)CS(e,n,t),t=t.sibling}function CS(e,n,t){if(Rs&&typeof Rs.onCommitFiberUnmount=="function")try{Rs.onCommitFiberUnmount(z0,t)}catch{}switch(t.tag){case 5:xr||$l(t,n);case 6:var r=_r,i=rs;_r=null,fa(e,n,t),_r=r,rs=i,_r!==null&&(rs?(e=_r,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):_r.removeChild(t.stateNode));break;case 18:_r!==null&&(rs?(e=_r,t=t.stateNode,e.nodeType===8?a_(e.parentNode,t):e.nodeType===1&&a_(e,t),fd(e)):a_(_r,t.stateNode));break;case 4:r=_r,i=rs,_r=t.stateNode.containerInfo,rs=!0,fa(e,n,t),_r=r,rs=i;break;case 0:case 11:case 14:case 15:if(!xr&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&Ym(t,n,a),i=i.next}while(i!==r)}fa(e,n,t);break;case 1:if(!xr&&($l(t,n),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(o){Cn(t,n,o)}fa(e,n,t);break;case 21:fa(e,n,t);break;case 22:t.mode&1?(xr=(r=xr)||t.memoizedState!==null,fa(e,n,t),xr=r):fa(e,n,t);break;default:fa(e,n,t)}}function ly(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new yA),n.forEach(function(r){var i=MA.bind(null,e,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Qi(e,n){var t=n.deletions;if(t!==null)for(var r=0;ri&&(i=a),r&=~s}if(r=i,r=Dn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*CA(r/1960))-r,10e?16:e,Da===null)var r=!1;else{if(e=Da,Da=null,e0=0,gt&6)throw Error(Te(331));var i=gt;for(gt|=4,je=e.current;je!==null;){var s=je,a=s.child;if(je.flags&16){var o=s.deletions;if(o!==null){for(var l=0;lDn()-Zg?Vo(e,0):Yg|=t),si(e,n)}function xS(e,n){n===0&&(e.mode&1?(n=gh,gh<<=1,!(gh&130023424)&&(gh=4194304)):n=1);var t=Vr();e=aa(e,n),e!==null&&(Yd(e,n,t),si(e,t))}function AA(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),xS(e,t)}function MA(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Te(314))}r!==null&&r.delete(n),xS(e,t)}var OS;OS=function(e,n,t){if(e!==null)if(e.memoizedProps!==n.pendingProps||ri.current)ni=!0;else{if(!(e.lanes&t)&&!(n.flags&128))return ni=!1,mA(e,n,t);ni=!!(e.flags&131072)}else ni=!1,rn&&n.flags&1048576&&DC(n,Vf,n.index);switch(n.lanes=0,n.tag){case 2:var r=n.type;pf(e,n),e=n.pendingProps;var i=gu(n,kr.current);Jl(n,t),i=zg(null,n,r,e,i,t);var s=Vg();return n.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,ii(r)?(s=!0,Gf(n)):s=!1,n.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Hg(n),i.updater=Z0,n.stateNode=i,i._reactInternals=n,Gm(n,r,e,t),n=qm(null,n,r,!0,s,t)):(n.tag=0,rn&&s&&Rg(n),jr(null,n,i,t),n=n.child),n;case 16:r=n.elementType;e:{switch(pf(e,n),e=n.pendingProps,i=r._init,r=i(r._payload),n.type=r,i=n.tag=OA(r),e=ts(r,e),i){case 0:n=Vm(null,n,r,e,t);break e;case 1:n=ry(null,n,r,e,t);break e;case 11:n=ty(null,n,r,e,t);break e;case 14:n=ny(null,n,r,ts(r.type,e),t);break e}throw Error(Te(306,r,""))}return n;case 0:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ts(r,i),Vm(e,n,r,i,t);case 1:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ts(r,i),ry(e,n,r,i,t);case 3:e:{if(pS(n),e===null)throw Error(Te(387));r=n.pendingProps,s=n.memoizedState,i=s.element,BC(e,n),Kf(n,r,null,t);var a=n.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},n.updateQueue.baseState=s,n.memoizedState=s,n.flags&256){i=Cu(Error(Te(423)),n),n=iy(e,n,r,t,i);break e}else if(r!==i){i=Cu(Error(Te(424)),n),n=iy(e,n,r,t,i);break e}else for(gi=Ba(n.stateNode.containerInfo.firstChild),Ei=n,rn=!0,is=null,t=HC(n,null,r,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(yu(),r===i){n=oa(e,n,t);break e}jr(e,n,r,t)}n=n.child}return n;case 5:return $C(n),e===null&&jm(n),r=n.type,i=n.pendingProps,s=e!==null?e.memoizedProps:null,a=i.children,Dm(r,i)?a=null:s!==null&&Dm(r,s)&&(n.flags|=32),fS(e,n),jr(e,n,a,t),n.child;case 6:return e===null&&jm(n),null;case 13:return _S(e,n,t);case 4:return jg(n,n.stateNode.containerInfo),r=n.pendingProps,e===null?n.child=Eu(n,null,r,t):jr(e,n,r,t),n.child;case 11:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ts(r,i),ty(e,n,r,i,t);case 7:return jr(e,n,n.pendingProps,t),n.child;case 8:return jr(e,n,n.pendingProps.children,t),n.child;case 12:return jr(e,n,n.pendingProps.children,t),n.child;case 10:e:{if(r=n.type._context,i=n.pendingProps,s=n.memoizedProps,a=i.value,Wt(qf,r._currentValue),r._currentValue=a,s!==null)if(us(s.value,a)){if(s.children===i.children&&!ri.current){n=oa(e,n,t);break e}}else for(s=n.child,s!==null&&(s.return=n);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=ta(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),Bm(s.return,t,n),o.lanes|=t;break}l=l.next}}else if(s.tag===10)a=s.type===n.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(Te(341));a.lanes|=t,o=a.alternate,o!==null&&(o.lanes|=t),Bm(a,t,n),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===n){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}jr(e,n,i.children,t),n=n.child}return n;case 9:return i=n.type,r=n.pendingProps.children,Jl(n,t),i=Gi(i),r=r(i),n.flags|=1,jr(e,n,r,t),n.child;case 14:return r=n.type,i=ts(r,n.pendingProps),i=ts(r.type,i),ny(e,n,r,i,t);case 15:return dS(e,n,n.type,n.pendingProps,t);case 17:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ts(r,i),pf(e,n),n.tag=1,ii(r)?(e=!0,Gf(n)):e=!1,Jl(n,t),lS(n,r,i),Gm(n,r,i,t),qm(null,n,r,!0,e,t);case 19:return mS(e,n,t);case 22:return hS(e,n,t)}throw Error(Te(156,n.tag))};function RS(e,n){return sC(e,n)}function xA(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ji(e,n,t,r){return new xA(e,n,t,r)}function t2(e){return e=e.prototype,!(!e||!e.isReactComponent)}function OA(e){if(typeof e=="function")return t2(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Eg)return 11;if(e===bg)return 14}return 2}function Va(e,n){var t=e.alternate;return t===null?(t=ji(e.tag,n,e.key,e.mode),t.elementType=e.elementType,t.type=e.type,t.stateNode=e.stateNode,t.alternate=e,e.alternate=t):(t.pendingProps=n,t.type=e.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=e.flags&14680064,t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,n=e.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},t.sibling=e.sibling,t.index=e.index,t.ref=e.ref,t}function vf(e,n,t,r,i,s){var a=2;if(r=e,typeof e=="function")t2(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case kl:return qo(t.children,i,s,n);case yg:a=8,i|=8;break;case fm:return e=ji(12,t,n,i|2),e.elementType=fm,e.lanes=s,e;case pm:return e=ji(13,t,n,i),e.elementType=pm,e.lanes=s,e;case _m:return e=ji(19,t,n,i),e.elementType=_m,e.lanes=s,e;case $b:return ep(t,i,s,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case jb:a=10;break e;case Bb:a=9;break e;case Eg:a=11;break e;case bg:a=14;break e;case Ea:a=16,r=null;break e}throw Error(Te(130,e==null?e:typeof e,""))}return n=ji(a,t,n,i),n.elementType=e,n.type=r,n.lanes=s,n}function qo(e,n,t,r){return e=ji(7,e,r,n),e.lanes=t,e}function ep(e,n,t,r){return e=ji(22,e,r,n),e.elementType=$b,e.lanes=t,e.stateNode={isHidden:!1},e}function p_(e,n,t){return e=ji(6,e,null,n),e.lanes=t,e}function __(e,n,t){return n=ji(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function RA(e,n,t,r,i){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Qp(0),this.expirationTimes=Qp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qp(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function n2(e,n,t,r,i,s,a,o,l){return e=new RA(e,n,t,o,l),n===1?(n=1,s===!0&&(n|=8)):n=0,s=ji(3,null,null,n),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hg(s),e}function kA(e,n,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(US)}catch(e){console.error(e)}}US(),Ub.exports=wi;var eh=Ub.exports;const PS=$0(eh);var my=eh;dm.createRoot=my.createRoot,dm.hydrateRoot=my.hydrateRoot;var FS={exports:{}},Rt={};/** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ur=typeof Symbol=="function"&&Symbol.for,s2=ur?Symbol.for("react.element"):60103,a2=ur?Symbol.for("react.portal"):60106,ip=ur?Symbol.for("react.fragment"):60107,sp=ur?Symbol.for("react.strict_mode"):60108,ap=ur?Symbol.for("react.profiler"):60114,op=ur?Symbol.for("react.provider"):60109,lp=ur?Symbol.for("react.context"):60110,o2=ur?Symbol.for("react.async_mode"):60111,up=ur?Symbol.for("react.concurrent_mode"):60111,cp=ur?Symbol.for("react.forward_ref"):60112,dp=ur?Symbol.for("react.suspense"):60113,UA=ur?Symbol.for("react.suspense_list"):60120,hp=ur?Symbol.for("react.memo"):60115,fp=ur?Symbol.for("react.lazy"):60116,PA=ur?Symbol.for("react.block"):60121,FA=ur?Symbol.for("react.fundamental"):60117,HA=ur?Symbol.for("react.responder"):60118,jA=ur?Symbol.for("react.scope"):60119;function Ni(e){if(typeof e=="object"&&e!==null){var n=e.$$typeof;switch(n){case s2:switch(e=e.type,e){case o2:case up:case ip:case ap:case sp:case dp:return e;default:switch(e=e&&e.$$typeof,e){case lp:case cp:case fp:case hp:case op:return e;default:return n}}case a2:return n}}}function FS(e){return Ni(e)===up}Rt.AsyncMode=o2;Rt.ConcurrentMode=up;Rt.ContextConsumer=lp;Rt.ContextProvider=op;Rt.Element=s2;Rt.ForwardRef=cp;Rt.Fragment=ip;Rt.Lazy=fp;Rt.Memo=hp;Rt.Portal=a2;Rt.Profiler=ap;Rt.StrictMode=sp;Rt.Suspense=dp;Rt.isAsyncMode=function(e){return FS(e)||Ni(e)===o2};Rt.isConcurrentMode=FS;Rt.isContextConsumer=function(e){return Ni(e)===lp};Rt.isContextProvider=function(e){return Ni(e)===op};Rt.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===s2};Rt.isForwardRef=function(e){return Ni(e)===cp};Rt.isFragment=function(e){return Ni(e)===ip};Rt.isLazy=function(e){return Ni(e)===fp};Rt.isMemo=function(e){return Ni(e)===hp};Rt.isPortal=function(e){return Ni(e)===a2};Rt.isProfiler=function(e){return Ni(e)===ap};Rt.isStrictMode=function(e){return Ni(e)===sp};Rt.isSuspense=function(e){return Ni(e)===dp};Rt.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===ip||e===up||e===ap||e===sp||e===dp||e===UA||typeof e=="object"&&e!==null&&(e.$$typeof===fp||e.$$typeof===hp||e.$$typeof===op||e.$$typeof===lp||e.$$typeof===cp||e.$$typeof===FA||e.$$typeof===HA||e.$$typeof===jA||e.$$typeof===PA)};Rt.typeOf=Ni;PS.exports=Rt;var l2=PS.exports,BA=function(n,t,r,i){var s=r?r.call(i,n,t):void 0;if(s!==void 0)return!!s;if(n===t)return!0;if(typeof n!="object"||!n||typeof t!="object"||!t)return!1;var a=Object.keys(n),o=Object.keys(t);if(a.length!==o.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),u=0;uEe)&&(ue=(re=re.replace(" ",":")).length),0ce&&(ce=(oe=oe.trim()).charCodeAt(0)),ce){case 38:return oe.replace(v,"$1"+X.trim());case 58:return X.trim()+oe.replace(v,"$1"+X.trim());default:if(0<1*te&&0B.charCodeAt(8))break;case 115:$=$.replace(B,"-webkit-"+B)+";"+$;break;case 207:case 102:$=$.replace(B,"-webkit-"+(102te.charCodeAt(0)&&(te=te.trim()),Ne=te,te=[Ne],01?n-1:0),r=1;r0?" Args: "+t.join(", "):""))}var r6=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}var n=e.prototype;return n.indexOfGroup=function(t){for(var r=0,i=0;i=this.groupSizes.length){for(var i=this.groupSizes,s=i.length,a=s;t>=a;)(a<<=1)<0&&il(16,""+t);this.groupSizes=new Uint32Array(a),this.groupSizes.set(i),this.length=a;for(var o=s;o=this.length||this.groupSizes[t]===0)return r;for(var i=this.groupSizes[t],s=this.indexOfGroup(t),a=s+i,o=s;o=Fc&&(Fc=n+1),vf.set(e,n),n0.set(n,e)},a6="style["+wu+'][data-styled-version="5.3.11"]',o6=new RegExp("^"+wu+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),l6=function(e,n,t){for(var r,i=t.split(","),s=0,a=i.length;s=0;u--){var c=l[u];if(c&&c.nodeType===1&&c.hasAttribute(wu))return c}}(t),s=i!==void 0?i.nextSibling:null;r.setAttribute(wu,"active"),r.setAttribute("data-styled-version","5.3.11");var a=c6();return a&&r.setAttribute("nonce",a),t.insertBefore(r,s),r},d6=function(){function e(t){var r=this.element=BS(t);r.appendChild(document.createTextNode("")),this.sheet=function(i){if(i.sheet)return i.sheet;for(var s=document.styleSheets,a=0,o=s.length;a=0){var i=document.createTextNode(r),s=this.nodes[t];return this.element.insertBefore(i,s||null),this.length++,!0}return!1},n.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},n.getRule=function(t){return t0&&(d+=h+",")}),s+=""+u+c+'{content:"'+d+`"}/*!sc*/ -`}}}return s}(this)},e}(),_6=/(a)(d)/gi,Sy=function(e){return String.fromCharCode(e+(e>25?39:97))};function rv(e){var n,t="";for(n=Math.abs(e);n>52;n=n/52|0)t=Sy(n%52)+t;return(Sy(n%52)+t).replace(_6,"$1-$2")}var zl=function(e,n){for(var t=n.length;t;)e=33*e^n.charCodeAt(--t);return e},GS=function(e){return zl(5381,e)};function m6(e){for(var n=0;n>>0);if(!t.hasNameForId(i,o)){var l=r(a,"."+o,void 0,i);t.insertRules(i,o,l)}s.push(o),this.staticRulesId=o}else{for(var u=this.rules.length,c=zl(this.baseHash,r.hash),d="",h=0;h>>0);if(!t.hasNameForId(i,b)){var v=r(d,"."+b,void 0,i);t.insertRules(i,b,v)}s.push(b)}}return s.join(" ")},e}(),y6=/^\s*\/\/.*$/gm,E6=[":","[",".","#"];function zS(e){var n,t,r,i,s=e===void 0?qa:e,a=s.options,o=a===void 0?qa:a,l=s.plugins,u=l===void 0?t0:l,c=new GA(o),d=[],h=function(m){function b(v){if(v)try{m(v+"}")}catch{}}return function(v,_,E,S,w,N,I,x,A,O){switch(v){case 1:if(A===0&&_.charCodeAt(0)===64)return m(_+";"),"";break;case 2:if(x===0)return _+"/*|*/";break;case 3:switch(x){case 102:case 112:return m(E[0]+_),"";default:return _+(O===0?"/*|*/":"")}case-2:_.split("/*|*/}").forEach(b)}}}(function(m){d.push(m)}),f=function(m,b,v){return b===0&&E6.indexOf(v[t.length])!==-1||v.match(i)?m:"."+n};function p(m,b,v,_){_===void 0&&(_="&");var E=m.replace(y6,""),S=b&&v?v+" "+b+" { "+E+" }":E;return n=_,t=b,r=new RegExp("\\"+t+"\\b","g"),i=new RegExp("(\\"+t+"\\b){2,}"),c(v||!b?"":b,S)}return c.use([].concat(u,[function(m,b,v){m===2&&v.length&&v[0].lastIndexOf(t)>0&&(v[0]=v[0].replace(r,f))},h,function(m){if(m===-2){var b=d;return d=[],b}}])),p.hash=u.length?u.reduce(function(m,b){return b.name||il(15),zl(m,b.name)},5381).toString():"",p}var f2=Dt.createContext();f2.Consumer;var p2=Dt.createContext(),b6=(p2.Consumer,new $S),iv=zS();function VS(){return D.useContext(f2)||b6}function C6(){return D.useContext(p2)||iv}function S6(e){var n=D.useState(e.stylisPlugins),t=n[0],r=n[1],i=VS(),s=D.useMemo(function(){var o=i;return e.sheet?o=e.sheet:e.target&&(o=o.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(o=o.reconstructWithOptions({useCSSOMInjection:!1})),o},[e.disableCSSOMInjection,e.sheet,e.target]),a=D.useMemo(function(){return zS({options:{prefix:!e.disableVendorPrefixes},plugins:t})},[e.disableVendorPrefixes,t]);return D.useEffect(function(){$A(t,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]),Dt.createElement(f2.Provider,{value:s},Dt.createElement(p2.Provider,{value:a},e.children))}var qS=function(){function e(n,t){var r=this;this.inject=function(i,s){s===void 0&&(s=iv);var a=r.name+s.hash;i.hasNameForId(r.id,a)||i.insertRules(r.id,a,s(r.rules,a,"@keyframes"))},this.toString=function(){return il(12,String(r.name))},this.name=n,this.id="sc-keyframes-"+n,this.rules=t}return e.prototype.getName=function(n){return n===void 0&&(n=iv),this.name+n.hash},e}(),T6=/([A-Z])/,w6=/([A-Z])/g,N6=/^ms-/,I6=function(e){return"-"+e.toLowerCase()};function Ty(e){return T6.test(e)?e.replace(w6,I6).replace(N6,"-ms-"):e}var wy=function(e){return e==null||e===!1||e===""};function Nu(e,n,t,r){if(Array.isArray(e)){for(var i,s=[],a=0,o=e.length;a1?n-1:0),r=1;r?@[\\\]^`{|}~-]+/g,x6=/(^-|-$)/g;function __(e){return e.replace(M6,"-").replace(x6,"")}var WS=function(e){return rv(GS(e)>>>0)};function xh(e){return typeof e=="string"&&!0}var sv=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},O6=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function R6(e,n,t){var r=e[t];sv(n)&&sv(r)?KS(r,n):e[t]=n}function KS(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r=0||(O[x]=N[x]);return O}(n,["componentId"]),w=E&&E+"-"+(xh(_)?_:__(by(_)));return QS(_,xs({},S,{attrs:h,componentId:w}),t)},Object.defineProperty(p,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(_){this._foldedDefaultProps=r?KS({},e.defaultProps,_):_}}),Object.defineProperty(p,"toString",{value:function(){return"."+p.styledComponentId}}),i&&t6(p,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),p}var Se=function(e){return function n(t,r,i){if(i===void 0&&(i=qa),!l2.isValidElementType(r))return il(1,String(r));var s=function(){return t(r,i,ro.apply(void 0,arguments))};return s.withConfig=function(a){return n(t,r,xs({},i,{},a))},s.attrs=function(a){return n(t,r,xs({},i,{attrs:Array.prototype.concat(i.attrs,a).filter(Boolean)}))},s}(QS,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){Se[e]=Se(e)});function L6(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.all(t.map(o=>{if(o=U6(o),o in Iy)return;Iy[o]=!0;const l=o.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${u}`))return;const c=document.createElement("link");if(c.rel=l?"stylesheet":D6,l||(c.as="script",c.crossOrigin=""),c.href=o,a&&c.setAttribute("nonce",a),document.head.appendChild(c),l)return new Promise((d,h)=>{c.addEventListener("load",d),c.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${o}`)))})}))}return i.then(()=>n()).catch(s=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s})};var av=function(e,n){return av=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},av(e,n)};function T(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}av(e,n),e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var M=function(){return M=Object.assign||function(e){for(var n,t=1,r=arguments.length;t0&&i[i.length-1])||c[0]!==6&&c[0]!==2)){a=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function Me(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var r,i,s=t.call(e),a=[];try{for(;(n===void 0||n-- >0)&&!(r=s.next()).done;)a.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(t=s.return)&&t.call(s)}finally{if(i)throw i.error}}return a}function Fe(e,n,t){if(arguments.length===2)for(var r,i=0,s=n.length;i0&&F6.indexOf(e)>=0},i0=function(e){return e>0&&H6.indexOf(e)>=0},Er=function(e,n){if(n===void 0&&(n=!1),n&&eh(e))return!0;var t=typeof e=="object"&&e!==null&&e.hasOwnProperty("name")&&typeof e.name=="string"&&e.hasOwnProperty("uri")&&typeof e.uri=="string"&&e.hasOwnProperty("type")&&typeof e.type=="string";if(!t){if(typeof Blob<"u")return e instanceof Blob;if(typeof File<"u")return e instanceof File}return t},$6=function(e,n){if(e===n)return!0;if(e==null||n==null||e.length!==n.length)return!1;for(var t=Fe([],Me(e),!1).sort(),r=Fe([],Me(n),!1).sort(),i=0;i=1e3&&n<=9e3&&(this._typingIndicatorThrottle=n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"websocketResponseTimeout",{get:function(){return this._websocketResponseTimeout},set:function(n){k("number",n)&&n>=5e3&&n<=3e4&&(this._websocketResponseTimeout=n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionTokenRefreshTimeout",{get:function(){return this._sessionTokenRefreshTimeout},set:function(n){k("number",n)&&(n<60?n=60:n>1800&&(n=1800),this._sessionTokenRefreshTimeout=n)},enumerable:!1,configurable:!0}),e}(),JS={encrypt:function(e){return e},decrypt:function(e){return e}},My=function(){function e(n){var t=n.store;this._preference=new Map,this._store=t}return e.prototype._savePreferenceKeys=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._store.set({key:this._keysAddress,value:Fe([],Me(this._preference.keys()),!1)})];case 1:return n.sent(),[2]}})})},e.prototype.init=function(n,t){var r;return t===void 0&&(t=1),y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return this._version=t,this._keysAddress=n,i="".concat(n,".metadata.version"),[4,this._store.get(i)];case 1:return s=p.sent(),[4,this._store.get(n)];case 2:return a=(r=p.sent())!==null&&r!==void 0?r:[],!s||s.versiond.channel.messageCollectionLastAccessedAt?1:-1},this._maxSize=Math.max(i,64),o?(this._clearOrder=a,this._customClearOrderComparator=o):this._clearOrder=Hc.MESSAGE_COLLECTION_ACCESSED_AT,this._enableAutoResend=u}return Object.defineProperty(e.prototype,"maxSize",{get:function(){return this._maxSize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrder",{get:function(){return this._clearOrder},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrderComparator",{get:function(){var n;return this._clearOrder===Hc.MESSAGE_COLLECTION_ACCESSED_AT?this._clearOrderComparatorUseMessageCollectionAccessedAt:(n=this._customClearOrderComparator)!==null&&n!==void 0?n:this._clearOrderComparatorUseMessageCollectionAccessedAt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableAutoResend",{get:function(){return this._enableAutoResend},enumerable:!1,configurable:!0}),e}();(function(e){e.FEED="feed",e.CHAT="chat"})(wd||(wd={}));var et,Bi,Ns,wt,ar,Iu,lr,Bn,cs,ht,xy,lv,uv,V6=function(){function e(){this.isRefreshing=!1}return Object.defineProperty(e.prototype,"hasSession",{get:function(){return!!this.sessionKey},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]},e}(),la=function(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(n==="x"?t:3&t|8).toString(16)})},Oy=function(){function e(n){var t=n.container;this._container={},this._container=t,this.key=la()}return e.prototype._register=function(n,t,r){var i;return n in this._container||(this._container[n]=new Map),(i=this._container[n])===null||i===void 0||i.set(this.key,{occurence:t,handler:r}),this},e.prototype.on=function(n,t){return this._register(n,-1,t)},e.prototype.once=function(n,t){return this._register(n,1,t)},e.prototype.close=function(){var n=this;Object.keys(this._container).forEach(function(t){var r;(r=n._container[t])===null||r===void 0||r.delete(n.key)})},e}(),fl=function(){function e(){this._container={}}return e.prototype.on=function(n,t){return new Oy({container:this._container}).on(n,t)},e.prototype.once=function(n,t){return new Oy({container:this._container}).once(n,t)},e.prototype.dispatch=function(n,t){var r,i,s=this._container[n];if(s){var a=[];try{for(var o=ge(s.keys()),l=o.next();!l.done;l=o.next()){var u=l.value,c=s.get(u);c.handler(t),c.occurence>0&&(c.occurence--,c.occurence===0&&a.push(u))}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}a.forEach(function(d){return s.delete(d)})}},e}(),q6=function(){function e(){this._dispatcher=new fl}return e.prototype.on=function(n){return this._dispatcher.on("event",n)},e.prototype.once=function(n){return this._dispatcher.once("event",n)},e.prototype.dispatch=function(n){this._dispatcher.dispatch("event",n)},e}(),At=function(){},be=function(e){var n={};return e&&Object.keys(e).forEach(function(t){e[t]===void 0||Number.isNaN(e[t])||e[t]===null||(n[t]=e[t])}),n},Ie=function(e){if(e!=null){if(typeof e=="object"){if(Array.isArray(e)){for(var n=Fe([],Me(e),!1),t=0;t"u"&&typeof navigator<"u"&&navigator.product=="ReactNative"},Ry=function(){return!(typeof navigator>"u"||!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent))};(function(e){e.CHAT="chat",e.CALLS="calls",e.DESK="desk",e.LIVE="live",e.UIKIT_CHAT="uikit-chat",e.UIKIT_LIVE="uikit-live"})(jc||(jc={})),function(e){e.ANDROID="android",e.IOS="ios",e.JS="js",e.UNREAL="unreal",e.UNITY="unity",e.REACT_NATIVE="react-native",e.FLUTTER="flutter"}(Wo||(Wo={})),function(e){e.ANDROID="android",e.IOS="ios",e.WEB="web",e.MOBILE_WEB="mobile_web",e.WINDOWS="windows"}(Ui||(Ui={}));var sM="^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",s0=function(){function e(){}return e.sendbirdSdkUserAgentWithExtension=function(n){var t=dv()?Wo.REACT_NATIVE:Wo.JS,r={main_sdk_info:"chat/".concat(t,"/").concat(Wa.SDK_VERSION),device_os_platform:Ry()?"mobile-web":"web",os_version:Wa.OS_VERSION};if(n){var i=n.sendbirdExtensions,s=n.deviceOS,a=n.customData,o=a===void 0?{}:a;s.version&&(r.os_version=s.version),s.platform&&(r.device_os_platform=s.platform),i.length>0&&(r.extension_sdk_info=i.map(function(l){var u=l.product,c=l.platform,d=l.version;return"".concat(u,"/").concat(c,"/").concat(d)}).join(",")),Object.keys(r).forEach(function(l){return delete o[l]}),Object.keys(o).length>0&&(r=M(M({},r),o))}return Object.entries(r).map(function(l){var u=Me(l,2),c=u[0],d=u[1];return"".concat(c,"=").concat(d)}).join("&")},e.userAgentWithExtension=function(n){var t=dv()?"reactnative":"JS",r=n.sb_syncmanager?"s".concat(n.sb_syncmanager):"",i=n.sb_uikit?"u".concat(n.sb_uikit):"",s=n["device-os-platform"]?"o".concat(n["device-os-platform"]):Ry()?"omobile-web":"oweb";return"".concat(t,"/c").concat(Wa.SDK_VERSION,"/").concat(r,"/").concat(i,"/").concat(s)},e}(),Or=function(){var e=this;this.promise=new Promise(function(n,t){e.resolve=n,e.reject=function(r){t(r)}})},a0=function(e){function n(t){var r=e.call(this)||this;return r.requestId=t.requestId,r}return T(n,e),n}(At),oT=function(e){function n(t){var r=e.call(this)||this;return r.method=Y.DELETE,r.path="".concat(nt(t.channelType),"/").concat(t.channelUrl,"/messages/").concat(t.messageId),t.messageToken&&(r.params=be({mesg_token:t.messageToken})),r}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var aM=function(e){function n(t,r,i){var s,a=this;return(a=e.call(this,t,"DELM",i)||this).channelUrl=i.channel_url,a.channelType=i.channel_type,a.messageId=Number(i.msg_id),a.silent=i.silent,a.messageCreatedAt=i.message_created_at?Number(i.message_created_at):-1,a.senderId=(s=i.sender_id)!==null&&s!==void 0?s:void 0,a}return T(n,e),n}(Et),oM=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,a=t.logger,o=t.useFetchCompat,l=o!==void 0&&o,u=this;this._abortControl=new Map,this._shouldImportFetchCompat=!1,this._iid=n,this._session=r,this._sdkState=i,this._dispatcher=s,this._dispatcher.on(function(c){c instanceof tM&&u.cancel(c.requestId)}),this._logger=a,this._shouldImportFetchCompat=l}return e.prototype._createHeader=function(n,t){var r=this._sdkState,i=r.appId,s=r.appVersion,a=r.sendbirdRuntimeEnvironment,o=M(M({},n.headers),{SendBird:"JS,".concat(Wa.OS_VERSION,",").concat(Wa.SDK_VERSION,",").concat(i).concat(s?",".concat(s):""),"SB-User-Agent":s0.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":s0.sendbirdSdkUserAgentWithExtension(a)});return t||(o["Content-Type"]="application/json; charset=utf-8"),n.requireAuth&&!n.hasSessionKey&&this._session.hasSession&&(o["Session-Key"]=this._session.sessionKey),o["App-Id"]=i,this._session&&this._session.authToken&&(o["Access-Token"]=this._session.authToken),o},e.prototype._statLogApiResult=function(n,t,r){this._dispatcher.dispatch(new v2(new Vt({type:St.API_RESULT,data:{endpoint:n.path,method:n.method,success:!r,latency:Date.now()-t,error_code:r==null?void 0:r.code,error_description:r==null?void 0:r.message}})))},e.prototype._isBodyRequired=function(n){var t=n.method;return t!==Y.GET&&(t!==Y.DELETE||n instanceof oT)},e.prototype.send=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w;return g(this,function(N){switch(N.label){case 0:t=n.path,r=n.method,i=n.uploadProgressHandler,s=this._isBodyRequired(n),a=this._sdkState.api,o="".concat(a.host).concat(t).concat(s?"":n.query),l=s?n.payload:null,u=this._createHeader(n,l instanceof FormData?l:void 0),c=new AbortController,d=c.signal,this._abortControl.set(n.requestId,c),h=Date.now(),N.label=1;case 1:return N.trys.push([1,13,,14]),i?[4,v_(()=>import("./__bundle-c839c84a-Cf0ATRMk.js"),[])]:[3,6];case 2:f=N.sent().xmlHttpRequest,N.label=3;case 3:return N.trys.push([3,5,,6]),[4,f(this._iid,{requestId:n.requestId,method:n.method,url:o,headers:u,data:l??void 0,uploadProgressHandler:i})];case 4:return p=N.sent(),this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,p];case 5:if(!((m=N.sent())instanceof L&&m.code===Ae.XMLHTTPREQUEST_NOT_SUPPORTED))throw m;return this._logger.debug("XMLHttpRequest is not available in this environment. progressHandler is ignored."),[3,6];case 6:return this._shouldImportFetchCompat&&(this._shouldImportFetchCompat=!1,(typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{fetch:null}).fetch=null),typeof AbortController<"u"?[3,8]:[4,v_(()=>import("./__bundle-2aa1a987-z06C6246.js").then(I=>I._),[])];case 7:N.sent(),N.label=8;case 8:return typeof fetch=="function"?[3,10]:[4,v_(()=>import("./__bundle-347d730c-D3NhhyJB.js").then(I=>I._),[])];case 9:N.sent(),N.label=10;case 10:return[4,fetch(o,{method:r,body:l,headers:u,signal:d})];case 11:return[4,(b=N.sent()).json()];case 12:if(v=N.sent(),b.ok||b.redirected)return this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,new le(this._iid,v)];if(v){if((_=new L(v)).isSessionExpiredError){if(this._dispatcher.dispatch(new Mu({reason:_.code})),!(n instanceof m2))return E=new Or,this._dispatcher.dispatch(new aT({request:n,deferred:E,error:_})),[2,E.promise];throw _}throw _.isSessionInvalidatedError&&this._dispatcher.dispatch(new Mu({reason:_.code})),_}throw L.requestFailed;case 13:throw S=N.sent(),this._statLogApiResult(n,h,S),S instanceof L?(this._logger.debug("fail api request",S),S):(S==null?void 0:S.name)==="AbortError"?L.requestCanceled:(w=L.networkError,this._logger.debug("fail api request",w),w);case 14:return[2]}})})},e.prototype.cancel=function(n){this._abortControl.has(n)&&(this._abortControl.get(n).abort(),this._abortControl.delete(n)),this._dispatcher.dispatch(new a0({requestId:n}))},e.prototype.cancelAll=function(){var n,t;try{for(var r=ge(this._abortControl.values()),i=r.next();!i.done;i=r.next())i.value.abort()}catch(s){n={error:s}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(n)throw n.error}}this._abortControl.clear(),this._dispatcher.dispatch(new a0({}))},e}(),Ke=function(){};function Bu(e){let n=e.length;for(;--n>=0;)e[n]=0}const g2=256,lT=286,Bc=30,$c=15,hv=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),gf=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),lM=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ky=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vs=new Array(576);Bu(Vs);const Gc=new Array(60);Bu(Gc);const Nd=new Array(512);Bu(Nd);const zc=new Array(256);Bu(zc);const y2=new Array(29);Bu(y2);const o0=new Array(Bc);function g_(e,n,t,r,i){this.static_tree=e,this.extra_bits=n,this.extra_base=t,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let Ly,Dy,Uy;function y_(e,n){this.dyn_tree=e,this.max_code=0,this.stat_desc=n}Bu(o0);const uT=e=>e<256?Nd[e]:Nd[256+(e>>>7)],Id=(e,n)=>{e.pending_buf[e.pending++]=255&n,e.pending_buf[e.pending++]=n>>>8&255},ti=(e,n,t)=>{e.bi_valid>16-t?(e.bi_buf|=n<>16-e.bi_valid,e.bi_valid+=t-16):(e.bi_buf|=n<{ti(e,t[2*n],t[2*n+1])},cT=(e,n)=>{let t=0;do t|=1&e,e>>>=1,t<<=1;while(--n>0);return t>>>1},dT=(e,n,t)=>{const r=new Array(16);let i,s,a=0;for(i=1;i<=$c;i++)a=a+t[i-1]<<1,r[i]=a;for(s=0;s<=n;s++){let o=e[2*s+1];o!==0&&(e[2*s]=cT(r[o]++,o))}},hT=e=>{let n;for(n=0;n{e.bi_valid>8?Id(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Py=(e,n,t,r)=>{const i=2*n,s=2*t;return e[i]{const r=e.heap[t];let i=t<<1;for(;i<=e.heap_len&&(i{let r,i,s,a,o=0;if(e.sym_next!==0)do r=255&e.pending_buf[e.sym_buf+o++],r+=(255&e.pending_buf[e.sym_buf+o++])<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Is(e,i,n):(s=zc[i],Is(e,s+g2+1,n),a=hv[s],a!==0&&(i-=y2[s],ti(e,i,a)),r--,s=uT(r),Is(e,s,t),a=gf[s],a!==0&&(r-=o0[s],ti(e,r,a)));while(o{const t=n.dyn_tree,r=n.stat_desc.static_tree,i=n.stat_desc.has_stree,s=n.stat_desc.elems;let a,o,l,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a>1;a>=1;a--)E_(e,t,a);l=s;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],E_(e,t,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,t[2*l]=t[2*a]+t[2*o],e.depth[l]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,t[2*a+1]=t[2*o+1]=l,e.heap[1]=l++,E_(e,t,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((c,d)=>{const h=d.dyn_tree,f=d.max_code,p=d.stat_desc.static_tree,m=d.stat_desc.has_stree,b=d.stat_desc.extra_bits,v=d.stat_desc.extra_base,_=d.stat_desc.max_length;let E,S,w,N,I,x,A=0;for(N=0;N<=$c;N++)c.bl_count[N]=0;for(h[2*c.heap[c.heap_max]+1]=0,E=c.heap_max+1;E<573;E++)S=c.heap[E],N=h[2*h[2*S+1]+1]+1,N>_&&(N=_,A++),h[2*S+1]=N,S>f||(c.bl_count[N]++,I=0,S>=v&&(I=b[S-v]),x=h[2*S],c.opt_len+=x*(N+I),m&&(c.static_len+=x*(p[2*S+1]+I)));if(A!==0){do{for(N=_-1;c.bl_count[N]===0;)N--;c.bl_count[N]--,c.bl_count[N+1]+=2,c.bl_count[_]--,A-=2}while(A>0);for(N=_;N!==0;N--)for(S=c.bl_count[N];S!==0;)w=c.heap[--E],w>f||(h[2*w+1]!==N&&(c.opt_len+=(N-h[2*w+1])*h[2*w],h[2*w+1]=N),S--)}})(e,n),dT(t,u,e.bl_count)},Hy=(e,n,t)=>{let r,i,s=-1,a=n[1],o=0,l=7,u=4;for(a===0&&(l=138,u=3),n[2*(t+1)+1]=65535,r=0;r<=t;r++)i=a,a=n[2*(r+1)+1],++o{let r,i,s=-1,a=n[1],o=0,l=7,u=4;for(a===0&&(l=138,u=3),r=0;r<=t;r++)if(i=a,a=n[2*(r+1)+1],!(++o{ti(e,0+(r?1:0),3),fT(e),Id(e,t),Id(e,~t),t&&e.pending_buf.set(e.window.subarray(n,n+t),e.pending),e.pending+=t};var uM=(e,n,t,r)=>{let i,s,a=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=(o=>{let l,u=4093624447;for(l=0;l<=31;l++,u>>>=1)if(1&u&&o.dyn_ltree[2*l]!==0)return 0;if(o.dyn_ltree[18]!==0||o.dyn_ltree[20]!==0||o.dyn_ltree[26]!==0)return 1;for(l=32;l{let l;for(Hy(o,o.dyn_ltree,o.l_desc.max_code),Hy(o,o.dyn_dtree,o.d_desc.max_code),b_(o,o.bl_desc),l=18;l>=3&&o.bl_tree[2*ky[l]+1]===0;l--);return o.opt_len+=3*(l+1)+5+5+4,l})(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=t+5,t+4<=i&&n!==-1?pT(e,n,t,r):e.strategy===4||s===i?(ti(e,2+(r?1:0),3),Fy(e,Vs,Gc)):(ti(e,4+(r?1:0),3),((o,l,u,c)=>{let d;for(ti(o,l-257,5),ti(o,u-1,5),ti(o,c-4,4),d=0;d{By||((()=>{let n,t,r,i,s;const a=new Array(16);for(r=0,i=0;i<28;i++)for(y2[i]=r,n=0;n<1<>=7;i(e.pending_buf[e.sym_buf+e.sym_next++]=n,e.pending_buf[e.sym_buf+e.sym_next++]=n>>8,e.pending_buf[e.sym_buf+e.sym_next++]=t,n===0?e.dyn_ltree[2*t]++:(e.matches++,n--,e.dyn_ltree[2*(zc[t]+g2+1)]++,e.dyn_dtree[2*uT(n)]++),e.sym_next===e.sym_end),_tr_align:e=>{ti(e,2,3),Is(e,256,Vs),(n=>{n.bi_valid===16?(Id(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=255&n.bi_buf,n.bi_buf>>=8,n.bi_valid-=8)})(e)}},Vc=(e,n,t,r)=>{let i=65535&e,s=e>>>16&65535,a=0;for(;t!==0;){a=t>2e3?2e3:t,t-=a;do i=i+n[r++]|0,s=s+i|0;while(--a);i%=65521,s%=65521}return i|s<<16};const dM=new Uint32Array((()=>{let e,n=[];for(var t=0;t<256;t++){e=t;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;n[t]=e}return n})());var rr=(e,n,t,r)=>{const i=dM,s=r+t;e^=-1;for(let a=r;a>>8^i[255&(e^n[a])];return~e},sl={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},pl={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:hM,_tr_stored_block:fv,_tr_flush_block:fM,_tr_tally:Ka,_tr_align:pM}=cM,{Z_NO_FLUSH:Qa,Z_PARTIAL_FLUSH:_M,Z_FULL_FLUSH:mM,Z_FINISH:Pi,Z_BLOCK:$y,Z_OK:fr,Z_STREAM_END:Gy,Z_STREAM_ERROR:vs,Z_DATA_ERROR:vM,Z_BUF_ERROR:C_,Z_DEFAULT_COMPRESSION:gM,Z_FILTERED:yM,Z_HUFFMAN_ONLY:Oh,Z_RLE:EM,Z_FIXED:bM,Z_DEFAULT_STRATEGY:CM,Z_UNKNOWN:SM,Z_DEFLATED:l0}=pl,Mo=258,Ls=262,tu=42,Eo=113,yc=666,bo=(e,n)=>(e.msg=sl[n],n),zy=e=>2*e-(e>4?9:0),Na=e=>{let n=e.length;for(;--n>=0;)e[n]=0},TM=e=>{let n,t,r,i=e.w_size;n=e.hash_size,r=n;do t=e.head[--r],e.head[r]=t>=i?t-i:0;while(--n);n=i,r=n;do t=e.prev[--r],e.prev[r]=t>=i?t-i:0;while(--n)};let Ya=(e,n,t)=>(n<{const n=e.state;let t=n.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.output.set(n.pending_buf.subarray(n.pending_out,n.pending_out+t),e.next_out),e.next_out+=t,n.pending_out+=t,e.total_out+=t,e.avail_out-=t,n.pending-=t,n.pending===0&&(n.pending_out=0))},pi=(e,n)=>{fM(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,n),e.block_start=e.strstart,ci(e.strm)},Ct=(e,n)=>{e.pending_buf[e.pending++]=n},tc=(e,n)=>{e.pending_buf[e.pending++]=n>>>8&255,e.pending_buf[e.pending++]=255&n},pv=(e,n,t,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,n.set(e.input.subarray(e.next_in,e.next_in+i),t),e.state.wrap===1?e.adler=Vc(e.adler,n,i,t):e.state.wrap===2&&(e.adler=rr(e.adler,n,i,t)),e.next_in+=i,e.total_in+=i,i)},_T=(e,n)=>{let t,r,i=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match;const l=e.strstart>e.w_size-Ls?e.strstart-(e.w_size-Ls):0,u=e.window,c=e.w_mask,d=e.prev,h=e.strstart+Mo;let f=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do if(t=n,u[t+a]===p&&u[t+a-1]===f&&u[t]===u[s]&&u[++t]===u[s+1]){s+=2,t++;do;while(u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&sa){if(e.match_start=n,a=r,r>=o)break;f=u[s+a-1],p=u[s+a]}}while((n=d[n&c])>l&&--i!=0);return a<=e.lookahead?a:e.lookahead},Vl=e=>{const n=e.w_size;let t,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-Ls)&&(e.window.set(e.window.subarray(n,n+n-r),0),e.match_start-=n,e.strstart-=n,e.block_start-=n,e.insert>e.strstart&&(e.insert=e.strstart),TM(e),r+=n),e.strm.avail_in===0)break;if(t=pv(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=t,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ya(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ya(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead{let t,r,i,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,o=e.strm.avail_in;do{if(t=65535,i=e.bi_valid+42>>3,e.strm.avail_outr+e.strm.avail_in&&(t=r+e.strm.avail_in),t>i&&(t=i),t>8,e.pending_buf[e.pending-2]=~t,e.pending_buf[e.pending-1]=~t>>8,ci(e.strm),r&&(r>t&&(r=t),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,t-=r),t&&(pv(e.strm,e.strm.output,e.strm.next_out,t),e.strm.next_out+=t,e.strm.avail_out-=t,e.strm.total_out+=t)}while(a===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_wateri&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(pv(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,s=i>e.w_size?e.w_size:i,r=e.strstart-e.block_start,(r>=s||(r||n===Pi)&&n!==Qa&&e.strm.avail_in===0&&r<=i)&&(t=r>i?i:r,a=n===Pi&&e.strm.avail_in===0&&t===r?1:0,fv(e,e.block_start,t,a),e.block_start+=t,ci(e.strm)),a?3:1)},S_=(e,n)=>{let t,r;for(;;){if(e.lookahead=3&&(e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),t!==0&&e.strstart-t<=e.w_size-Ls&&(e.match_length=_T(e,t)),e.match_length>=3)if(r=Ka(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do e.strstart++,e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!=0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+1]);else r=Ka(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(pi(e,!1),e.strm.avail_out===0))return 1}return e.insert=e.strstart<2?e.strstart:2,n===Pi?(pi(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(pi(e,!1),e.strm.avail_out===0)?1:2},wl=(e,n)=>{let t,r,i;for(;;){if(e.lookahead=3&&(e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,t!==0&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=Ka(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!=0);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(pi(e,!1),e.strm.avail_out===0))return 1}else if(e.match_available){if(r=Ka(e,0,e.window[e.strstart-1]),r&&pi(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ka(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,n===Pi?(pi(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(pi(e,!1),e.strm.avail_out===0)?1:2};function _s(e,n,t,r,i){this.good_length=e,this.max_lazy=n,this.nice_length=t,this.max_chain=r,this.func=i}const Ec=[new _s(0,0,0,0,mT),new _s(4,4,8,4,S_),new _s(4,5,16,8,S_),new _s(4,6,32,32,S_),new _s(4,4,16,16,wl),new _s(8,16,32,32,wl),new _s(8,16,128,128,wl),new _s(8,32,128,256,wl),new _s(32,128,258,1024,wl),new _s(32,258,258,4096,wl)];function wM(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=l0,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Na(this.dyn_ltree),Na(this.dyn_dtree),Na(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Na(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Na(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const bc=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.status!==tu&&n.status!==57&&n.status!==69&&n.status!==73&&n.status!==91&&n.status!==103&&n.status!==Eo&&n.status!==yc?1:0},vT=e=>{if(bc(e))return bo(e,vs);e.total_in=e.total_out=0,e.data_type=SM;const n=e.state;return n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap===2?57:n.wrap?tu:Eo,e.adler=n.wrap===2?0:1,n.last_flush=-2,hM(n),fr},gT=e=>{const n=vT(e);var t;return n===fr&&((t=e.state).window_size=2*t.w_size,Na(t.head),t.max_lazy_match=Ec[t.level].max_lazy,t.good_match=Ec[t.level].good_length,t.nice_match=Ec[t.level].nice_length,t.max_chain_length=Ec[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n},Vy=(e,n,t,r,i,s)=>{if(!e)return vs;let a=1;if(n===gM&&(n=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>9||t!==l0||r<8||r>15||n<0||n>9||s<0||s>bM||r===8&&a!==1)return bo(e,vs);r===8&&(r=9);const o=new wM;return e.state=o,o.strm=e,o.status=tu,o.wrap=a,o.gzhead=null,o.w_bits=r,o.w_size=1<Vy(e,n,l0,15,8,CM),deflateInit2:Vy,deflateReset:gT,deflateResetKeep:vT,deflateSetHeader:(e,n)=>bc(e)||e.state.wrap!==2?vs:(e.state.gzhead=n,fr),deflate:(e,n)=>{if(bc(e)||n>$y||n<0)return e?bo(e,vs):vs;const t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===yc&&n!==Pi)return bo(e,e.avail_out===0?C_:vs);const r=t.last_flush;if(t.last_flush=n,t.pending!==0){if(ci(e),e.avail_out===0)return t.last_flush=-1,fr}else if(e.avail_in===0&&zy(n)<=zy(r)&&n!==Pi)return bo(e,C_);if(t.status===yc&&e.avail_in!==0)return bo(e,C_);if(t.status===tu&&t.wrap===0&&(t.status=Eo),t.status===tu){let i=l0+(t.w_bits-8<<4)<<8,s=-1;if(s=t.strategy>=Oh||t.level<2?0:t.level<6?1:t.level===6?2:3,i|=s<<6,t.strstart!==0&&(i|=32),i+=31-i%31,tc(t,i),t.strstart!==0&&(tc(t,e.adler>>>16),tc(t,65535&e.adler)),e.adler=1,t.status=Eo,ci(e),t.pending!==0)return t.last_flush=-1,fr}if(t.status===57){if(e.adler=0,Ct(t,31),Ct(t,139),Ct(t,8),t.gzhead)Ct(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),Ct(t,255&t.gzhead.time),Ct(t,t.gzhead.time>>8&255),Ct(t,t.gzhead.time>>16&255),Ct(t,t.gzhead.time>>24&255),Ct(t,t.level===9?2:t.strategy>=Oh||t.level<2?4:0),Ct(t,255&t.gzhead.os),t.gzhead.extra&&t.gzhead.extra.length&&(Ct(t,255&t.gzhead.extra.length),Ct(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=rr(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=69;else if(Ct(t,0),Ct(t,0),Ct(t,0),Ct(t,0),Ct(t,0),Ct(t,t.level===9?2:t.strategy>=Oh||t.level<2?4:0),Ct(t,3),t.status=Eo,ci(e),t.pending!==0)return t.last_flush=-1,fr}if(t.status===69){if(t.gzhead.extra){let i=t.pending,s=(65535&t.gzhead.extra.length)-t.gzindex;for(;t.pending+s>t.pending_buf_size;){let o=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>i&&(e.adler=rr(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=o,ci(e),t.pending!==0)return t.last_flush=-1,fr;i=0,s-=o}let a=new Uint8Array(t.gzhead.extra);t.pending_buf.set(a.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending+=s,t.gzhead.hcrc&&t.pending>i&&(e.adler=rr(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=73}if(t.status===73){if(t.gzhead.name){let i,s=t.pending;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(e.adler=rr(e.adler,t.pending_buf,t.pending-s,s)),ci(e),t.pending!==0)return t.last_flush=-1,fr;s=0}i=t.gzindexs&&(e.adler=rr(e.adler,t.pending_buf,t.pending-s,s)),t.gzindex=0}t.status=91}if(t.status===91){if(t.gzhead.comment){let i,s=t.pending;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(e.adler=rr(e.adler,t.pending_buf,t.pending-s,s)),ci(e),t.pending!==0)return t.last_flush=-1,fr;s=0}i=t.gzindexs&&(e.adler=rr(e.adler,t.pending_buf,t.pending-s,s))}t.status=103}if(t.status===103){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(ci(e),t.pending!==0))return t.last_flush=-1,fr;Ct(t,255&e.adler),Ct(t,e.adler>>8&255),e.adler=0}if(t.status=Eo,ci(e),t.pending!==0)return t.last_flush=-1,fr}if(e.avail_in!==0||t.lookahead!==0||n!==Qa&&t.status!==yc){let i=t.level===0?mT(t,n):t.strategy===Oh?((s,a)=>{let o;for(;;){if(s.lookahead===0&&(Vl(s),s.lookahead===0)){if(a===Qa)return 1;break}if(s.match_length=0,o=Ka(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,o&&(pi(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,a===Pi?(pi(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(pi(s,!1),s.strm.avail_out===0)?1:2})(t,n):t.strategy===EM?((s,a)=>{let o,l,u,c;const d=s.window;for(;;){if(s.lookahead<=Mo){if(Vl(s),s.lookahead<=Mo&&a===Qa)return 1;if(s.lookahead===0)break}if(s.match_length=0,s.lookahead>=3&&s.strstart>0&&(u=s.strstart-1,l=d[u],l===d[++u]&&l===d[++u]&&l===d[++u])){c=s.strstart+Mo;do;while(l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&us.lookahead&&(s.match_length=s.lookahead)}if(s.match_length>=3?(o=Ka(s,1,s.match_length-3),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0):(o=Ka(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++),o&&(pi(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,a===Pi?(pi(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(pi(s,!1),s.strm.avail_out===0)?1:2})(t,n):Ec[t.level].func(t,n);if(i!==3&&i!==4||(t.status=yc),i===1||i===3)return e.avail_out===0&&(t.last_flush=-1),fr;if(i===2&&(n===_M?pM(t):n!==$y&&(fv(t,0,0,!1),n===mM&&(Na(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),ci(e),e.avail_out===0))return t.last_flush=-1,fr}return n!==Pi?fr:t.wrap<=0?Gy:(t.wrap===2?(Ct(t,255&e.adler),Ct(t,e.adler>>8&255),Ct(t,e.adler>>16&255),Ct(t,e.adler>>24&255),Ct(t,255&e.total_in),Ct(t,e.total_in>>8&255),Ct(t,e.total_in>>16&255),Ct(t,e.total_in>>24&255)):(tc(t,e.adler>>>16),tc(t,65535&e.adler)),ci(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?fr:Gy)},deflateEnd:e=>{if(bc(e))return vs;const n=e.state.status;return e.state=null,n===Eo?bo(e,vM):fr},deflateSetDictionary:(e,n)=>{let t=n.length;if(bc(e))return vs;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==tu||r.lookahead)return vs;if(i===1&&(e.adler=Vc(e.adler,n,t,0)),r.wrap=0,t>=r.w_size){i===0&&(Na(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(n.subarray(t-r.w_size,t),0),n=l,t=r.w_size}const s=e.avail_in,a=e.next_in,o=e.input;for(e.avail_in=t,e.next_in=0,e.input=n,Vl(r);r.lookahead>=3;){let l=r.strstart,u=r.lookahead-2;do r.ins_h=Ya(r,r.ins_h,r.window[l+3-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=2,Vl(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=a,e.input=o,e.avail_in=s,r.wrap=i,fr},deflateInfo:"pako deflate (from Nodeca project)"};const NM=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var pp={assign:function(e){const n=Array.prototype.slice.call(arguments,1);for(;n.length;){const t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const r in t)NM(t,r)&&(e[r]=t[r])}}return e},flattenChunks:e=>{let n=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ad[254]=Ad[254]=1;var Md={string2buf:e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,r,i,s,a=e.length,o=0;for(i=0;i>>6,n[s++]=128|63&t):t<65536?(n[s++]=224|t>>>12,n[s++]=128|t>>>6&63,n[s++]=128|63&t):(n[s++]=240|t>>>18,n[s++]=128|t>>>12&63,n[s++]=128|t>>>6&63,n[s++]=128|63&t);return n},buf2string:(e,n)=>{const t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let r,i;const s=new Array(2*t);for(i=0,r=0;r4)s[i++]=65533,r+=o-1;else{for(a&=o===2?31:o===3?15:7;o>1&&r1?s[i++]=65533:a<65536?s[i++]=a:(a-=65536,s[i++]=55296|a>>10&1023,s[i++]=56320|1023&a)}}return((a,o)=>{if(o<65534&&a.subarray&&yT)return String.fromCharCode.apply(null,a.length===o?a:a.subarray(0,o));let l="";for(let u=0;u{(n=n||e.length)>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(192&e[t])==128;)t--;return t<0||t===0?n:t+Ad[e[t]]>n?t:n}},ET=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const bT=Object.prototype.toString,{Z_NO_FLUSH:IM,Z_SYNC_FLUSH:AM,Z_FULL_FLUSH:MM,Z_FINISH:xM,Z_OK:u0,Z_STREAM_END:OM,Z_DEFAULT_COMPRESSION:RM,Z_DEFAULT_STRATEGY:kM,Z_DEFLATED:LM}=pl;function Wc(e){this.options=pp.assign({level:RM,method:LM,chunkSize:16384,windowBits:15,memLevel:8,strategy:kM},e||{});let n=this.options;n.raw&&n.windowBits>0?n.windowBits=-n.windowBits:n.gzip&&n.windowBits>0&&n.windowBits<16&&(n.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ET,this.strm.avail_out=0;let t=qc.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(t!==u0)throw new Error(sl[t]);if(n.header&&qc.deflateSetHeader(this.strm,n.header),n.dictionary){let r;if(r=typeof n.dictionary=="string"?Md.string2buf(n.dictionary):bT.call(n.dictionary)==="[object ArrayBuffer]"?new Uint8Array(n.dictionary):n.dictionary,t=qc.deflateSetDictionary(this.strm,r),t!==u0)throw new Error(sl[t]);this._dict_set=!0}}function T_(e,n){const t=new Wc(n);if(t.push(e,!0),t.err)throw t.msg||sl[t.err];return t.result}Wc.prototype.push=function(e,n){const t=this.strm,r=this.options.chunkSize;let i,s;if(this.ended)return!1;for(s=n===~~n?n:n===!0?xM:IM,typeof e=="string"?t.input=Md.string2buf(e):bT.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;)if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(s===AM||s===MM)&&t.avail_out<=6)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else{if(i=qc.deflate(t,s),i===OM)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=qc.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===u0;if(t.avail_out!==0){if(s>0&&t.next_out>0)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else if(t.avail_in===0)break}else this.onData(t.output)}return!0},Wc.prototype.onData=function(e){this.chunks.push(e)},Wc.prototype.onEnd=function(e){e===u0&&(this.result=pp.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var DM={Deflate:Wc,deflate:T_,deflateRaw:function(e,n){return(n=n||{}).raw=!0,T_(e,n)},gzip:function(e,n){return(n=n||{}).gzip=!0,T_(e,n)},constants:pl};const Rh=16209;var UM=function(e,n){let t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x,A;const O=e.state;t=e.next_in,x=e.input,r=t+(e.avail_in-5),i=e.next_out,A=e.output,s=i-(n-e.avail_out),a=i+(e.avail_out-257),o=O.dmax,l=O.wsize,u=O.whave,c=O.wnext,d=O.window,h=O.hold,f=O.bits,p=O.lencode,m=O.distcode,b=(1<>>24,h>>>=E,f-=E,E=_>>>16&255,E===0)A[i++]=65535&_;else{if(!(16&E)){if(64&E){if(32&E){O.mode=16191;break e}e.msg="invalid literal/length code",O.mode=Rh;break e}_=p[(65535&_)+(h&(1<>>=E,f-=E),f<15&&(h+=x[t++]<>>24,h>>>=E,f-=E,E=_>>>16&255,16&E){if(w=65535&_,E&=15,fo){e.msg="invalid distance too far back",O.mode=Rh;break e}if(h>>>=E,f-=E,E=i-s,w>E){if(E=w-E,E>u&&O.sane){e.msg="invalid distance too far back",O.mode=Rh;break e}if(N=0,I=d,c===0){if(N+=l-E,E2;)A[i++]=I[N++],A[i++]=I[N++],A[i++]=I[N++],S-=3;S&&(A[i++]=I[N++],S>1&&(A[i++]=I[N++]))}else{N=i-w;do A[i++]=A[N++],A[i++]=A[N++],A[i++]=A[N++],S-=3;while(S>2);S&&(A[i++]=A[N++],S>1&&(A[i++]=A[N++]))}break}if(64&E){e.msg="invalid distance code",O.mode=Rh;break e}_=m[(65535&_)+(h&(1<>3,t-=S,f-=S<<3,h&=(1<{const l=o.bits;let u,c,d,h,f,p,m=0,b=0,v=0,_=0,E=0,S=0,w=0,N=0,I=0,x=0,A=null;const O=new Uint16Array(16),U=new Uint16Array(16);let W,P,J,V=null;for(m=0;m<=kh;m++)O[m]=0;for(b=0;b=1&&O[_]===0;_--);if(E>_&&(E=_),_===0)return i[s++]=20971520,i[s++]=20971520,o.bits=1,0;for(v=1;v<_&&O[v]===0;v++);for(E0&&(e===0||_!==1))return-1;for(U[1]=0,m=1;m852||e===2&&I>592)return 1;for(;;){W=m-w,a[b]+1=p?(P=V[a[b]-p],J=A[a[b]-p]):(P=96,J=0),u=1<>w)+c]=W<<24|P<<16|J;while(c!==0);for(u=1<>=1;if(u!==0?(x&=u-1,x+=u):x=0,b++,--O[m]==0){if(m===_)break;m=n[t+a[b]]}if(m>E&&(x&h)!==d){for(w===0&&(w=E),f+=v,S=m-w,N=1<852||e===2&&I>592)return 1;d=x&h,i[d]=E<<24|S<<16|f-s}}return x!==0&&(i[f+x]=m-w<<24|64<<16),o.bits=E,0};const{Z_FINISH:qy,Z_BLOCK:BM,Z_TREES:Lh,Z_OK:Co,Z_STREAM_END:$M,Z_NEED_DICT:GM,Z_STREAM_ERROR:ki,Z_DATA_ERROR:Wy,Z_MEM_ERROR:Ky,Z_BUF_ERROR:zM,Z_DEFLATED:Qy}=pl,_p=16180,Dh=16190,Hs=16191,w_=16192,N_=16194,Uh=16199,Ph=16200,I_=16206,en=16209,Yy=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function VM(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const xo=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.mode<_p||n.mode>16211?1:0},CT=e=>{if(xo(e))return ki;const n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=1&n.wrap),n.mode=_p,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(852),n.distcode=n.distdyn=new Int32Array(592),n.sane=1,n.back=-1,Co},ST=e=>{if(xo(e))return ki;const n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,CT(e)},TT=(e,n)=>{let t;if(xo(e))return ki;const r=e.state;return n<0?(t=0,n=-n):(t=5+(n>>4),n<48&&(n&=15)),n&&(n<8||n>15)?ki:(r.window!==null&&r.wbits!==n&&(r.window=null),r.wrap=t,r.wbits=n,ST(e))},Zy=(e,n)=>{if(!e)return ki;const t=new VM;e.state=t,t.strm=e,t.window=null,t.mode=_p;const r=TT(e,n);return r!==Co&&(e.state=null),r};let A_,M_,Xy=!0;const qM=e=>{if(Xy){A_=new Int32Array(512),M_=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(Kc(1,e.lens,0,288,A_,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;Kc(2,e.lens,0,32,M_,0,e.work,{bits:5}),Xy=!1}e.lencode=A_,e.lenbits=9,e.distcode=M_,e.distbits=5},Jy=(e,n,t,r)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<=s.wsize?(s.window.set(n.subarray(t-s.wsize,t),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(n.subarray(t-r,t-r+i),s.wnext),(r-=i)?(s.window.set(n.subarray(t-r,t),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whaveZy(e,15),inflateInit2:Zy,inflate:(e,n)=>{let t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x=0;const A=new Uint8Array(4);let O,U;const W=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(xo(e)||!e.output||!e.input&&e.avail_in!==0)return ki;t=e.state,t.mode===Hs&&(t.mode=w_),a=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,o=e.avail_in,u=t.hold,c=t.bits,d=o,h=l,I=Co;e:for(;;)switch(t.mode){case _p:if(t.wrap===0){t.mode=w_;break}for(;c<16;){if(o===0)break e;o--,u+=r[s++]<>>8&255,t.check=rr(t.check,A,2,0),u=0,c=0,t.mode=16181;break}if(t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",t.mode=en;break}if((15&u)!==Qy){e.msg="unknown compression method",t.mode=en;break}if(u>>>=4,c-=4,N=8+(15&u),t.wbits===0&&(t.wbits=N),N>15||N>t.wbits){e.msg="invalid window size",t.mode=en;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(A[0]=255&u,A[1]=u>>>8&255,t.check=rr(t.check,A,2,0)),u=0,c=0,t.mode=16182;case 16182:for(;c<32;){if(o===0)break e;o--,u+=r[s++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,t.check=rr(t.check,A,4,0)),u=0,c=0,t.mode=16183;case 16183:for(;c<16;){if(o===0)break e;o--,u+=r[s++]<>8),512&t.flags&&4&t.wrap&&(A[0]=255&u,A[1]=u>>>8&255,t.check=rr(t.check,A,2,0)),u=0,c=0,t.mode=16184;case 16184:if(1024&t.flags){for(;c<16;){if(o===0)break e;o--,u+=r[s++]<>>8&255,t.check=rr(t.check,A,2,0)),u=0,c=0}else t.head&&(t.head.extra=null);t.mode=16185;case 16185:if(1024&t.flags&&(f=t.length,f>o&&(f=o),f&&(t.head&&(N=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(s,s+f),N)),512&t.flags&&4&t.wrap&&(t.check=rr(t.check,r,f,s)),o-=f,s+=f,t.length-=f),t.length))break e;t.length=0,t.mode=16186;case 16186:if(2048&t.flags){if(o===0)break e;f=0;do N=r[s+f++],t.head&&N&&t.length<65536&&(t.head.name+=String.fromCharCode(N));while(N&&f>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=Hs;break;case 16189:for(;c<32;){if(o===0)break e;o--,u+=r[s++]<>>=7&c,c-=7&c,t.mode=I_;break}for(;c<3;){if(o===0)break e;o--,u+=r[s++]<>>=1,c-=1,3&u){case 0:t.mode=16193;break;case 1:if(qM(t),t.mode=Uh,n===Lh){u>>>=2,c-=2;break e}break;case 2:t.mode=16196;break;case 3:e.msg="invalid block type",t.mode=en}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(o===0)break e;o--,u+=r[s++]<>>16^65535)){e.msg="invalid stored block lengths",t.mode=en;break}if(t.length=65535&u,u=0,c=0,t.mode=N_,n===Lh)break e;case N_:t.mode=16195;case 16195:if(f=t.length,f){if(f>o&&(f=o),f>l&&(f=l),f===0)break e;i.set(r.subarray(s,s+f),a),o-=f,s+=f,l-=f,a+=f,t.length-=f;break}t.mode=Hs;break;case 16196:for(;c<14;){if(o===0)break e;o--,u+=r[s++]<>>=5,c-=5,t.ndist=1+(31&u),u>>>=5,c-=5,t.ncode=4+(15&u),u>>>=4,c-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=en;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,c-=3}for(;t.have<19;)t.lens[W[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,O={bits:t.lenbits},I=Kc(0,t.lens,0,19,t.lencode,0,t.work,O),t.lenbits=O.bits,I){e.msg="invalid code lengths set",t.mode=en;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,v=x>>>16&255,_=65535&x,!(b<=c);){if(o===0)break e;o--,u+=r[s++]<>>=b,c-=b,t.lens[t.have++]=_;else{if(_===16){for(U=b+2;c>>=b,c-=b,t.have===0){e.msg="invalid bit length repeat",t.mode=en;break}N=t.lens[t.have-1],f=3+(3&u),u>>>=2,c-=2}else if(_===17){for(U=b+3;c>>=b,c-=b,N=0,f=3+(7&u),u>>>=3,c-=3}else{for(U=b+7;c>>=b,c-=b,N=0,f=11+(127&u),u>>>=7,c-=7}if(t.have+f>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=en;break}for(;f--;)t.lens[t.have++]=N}}if(t.mode===en)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=en;break}if(t.lenbits=9,O={bits:t.lenbits},I=Kc(1,t.lens,0,t.nlen,t.lencode,0,t.work,O),t.lenbits=O.bits,I){e.msg="invalid literal/lengths set",t.mode=en;break}if(t.distbits=6,t.distcode=t.distdyn,O={bits:t.distbits},I=Kc(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,O),t.distbits=O.bits,I){e.msg="invalid distances set",t.mode=en;break}if(t.mode=Uh,n===Lh)break e;case Uh:t.mode=Ph;case Ph:if(o>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=s,e.avail_in=o,t.hold=u,t.bits=c,UM(e,h),a=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,o=e.avail_in,u=t.hold,c=t.bits,t.mode===Hs&&(t.back=-1);break}for(t.back=0;x=t.lencode[u&(1<>>24,v=x>>>16&255,_=65535&x,!(b<=c);){if(o===0)break e;o--,u+=r[s++]<>E)],b=x>>>24,v=x>>>16&255,_=65535&x,!(E+b<=c);){if(o===0)break e;o--,u+=r[s++]<>>=E,c-=E,t.back+=E}if(u>>>=b,c-=b,t.back+=b,t.length=_,v===0){t.mode=16205;break}if(32&v){t.back=-1,t.mode=Hs;break}if(64&v){e.msg="invalid literal/length code",t.mode=en;break}t.extra=15&v,t.mode=16201;case 16201:if(t.extra){for(U=t.extra;c>>=t.extra,c-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=16202;case 16202:for(;x=t.distcode[u&(1<>>24,v=x>>>16&255,_=65535&x,!(b<=c);){if(o===0)break e;o--,u+=r[s++]<>E)],b=x>>>24,v=x>>>16&255,_=65535&x,!(E+b<=c);){if(o===0)break e;o--,u+=r[s++]<>>=E,c-=E,t.back+=E}if(u>>>=b,c-=b,t.back+=b,64&v){e.msg="invalid distance code",t.mode=en;break}t.offset=_,t.extra=15&v,t.mode=16203;case 16203:if(t.extra){for(U=t.extra;c>>=t.extra,c-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=en;break}t.mode=16204;case 16204:if(l===0)break e;if(f=h-l,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=en;break}f>t.wnext?(f-=t.wnext,p=t.wsize-f):p=t.wnext-f,f>t.length&&(f=t.length),m=t.window}else m=i,p=a-t.offset,f=t.length;f>l&&(f=l),l-=f,t.length-=f;do i[a++]=m[p++];while(--f);t.length===0&&(t.mode=Ph);break;case 16205:if(l===0)break e;i[a++]=t.length,l--,t.mode=Ph;break;case I_:if(t.wrap){for(;c<32;){if(o===0)break e;o--,u|=r[s++]<{if(xo(e))return ki;let n=e.state;return n.window&&(n.window=null),e.state=null,Co},inflateGetHeader:(e,n)=>{if(xo(e))return ki;const t=e.state;return 2&t.wrap?(t.head=n,n.done=!1,Co):ki},inflateSetDictionary:(e,n)=>{const t=n.length;let r,i,s;return xo(e)?ki:(r=e.state,r.wrap!==0&&r.mode!==Dh?ki:r.mode===Dh&&(i=1,i=Vc(i,n,t,0),i!==r.check)?Wy:(s=Jy(e,n,t,t),s?(r.mode=16210,Ky):(r.havedict=1,Co)))},inflateInfo:"pako inflate (from Nodeca project)"},WM=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const wT=Object.prototype.toString,{Z_NO_FLUSH:KM,Z_FINISH:QM,Z_OK:Qc,Z_STREAM_END:x_,Z_NEED_DICT:O_,Z_STREAM_ERROR:YM,Z_DATA_ERROR:eE,Z_MEM_ERROR:ZM}=pl;function Yc(e){this.options=pp.assign({chunkSize:65536,windowBits:15,to:""},e||{});const n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),!(n.windowBits>=0&&n.windowBits<16)||e&&e.windowBits||(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(15&n.windowBits||(n.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ET,this.strm.avail_out=0;let t=Qs.inflateInit2(this.strm,n.windowBits);if(t!==Qc)throw new Error(sl[t]);if(this.header=new WM,Qs.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Md.string2buf(n.dictionary):wT.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=Qs.inflateSetDictionary(this.strm,n.dictionary),t!==Qc)))throw new Error(sl[t])}function R_(e,n){const t=new Yc(n);if(t.push(e),t.err)throw t.msg||sl[t.err];return t.result}Yc.prototype.push=function(e,n){const t=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=n===~~n?n:n===!0?QM:KM,wT.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),s=Qs.inflate(t,a),s===O_&&i&&(s=Qs.inflateSetDictionary(t,i),s===Qc?s=Qs.inflate(t,a):s===eE&&(s=O_));t.avail_in>0&&s===x_&&t.state.wrap>0&&e[t.next_in]!==0;)Qs.inflateReset(t),s=Qs.inflate(t,a);switch(s){case YM:case eE:case O_:case ZM:return this.onEnd(s),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||s===x_))if(this.options.to==="string"){let l=Md.utf8border(t.output,t.next_out),u=t.next_out-l,c=Md.buf2string(t.output,l);t.next_out=u,t.avail_out=r-u,u&&t.output.set(t.output.subarray(l,l+u),0),this.onData(c)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(s!==Qc||o!==0){if(s===x_)return s=Qs.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},Yc.prototype.onData=function(e){this.chunks.push(e)},Yc.prototype.onEnd=function(e){e===Qc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=pp.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var XM={Inflate:Yc,inflate:R_,inflateRaw:function(e,n){return(n=n||{}).raw=!0,R_(e,n)},ungzip:R_,constants:pl};const{Deflate:JM,deflate:ex,deflateRaw:tx,gzip:nx}=DM,{Inflate:rx,inflate:ix,inflateRaw:sx,ungzip:ax}=XM;var As,ox={Deflate:JM,deflate:ex,deflateRaw:tx,gzip:nx,Inflate:rx,inflate:ix,inflateRaw:sx,ungzip:ax,constants:pl},tE=function(e){return y(void 0,void 0,void 0,function(){var n;return g(this,function(t){return n=ox.ungzip(e),[2,String.fromCharCode.apply(null,n)]})})};(function(e){e.CONNECTING="CONNECTING",e.OPEN="OPEN",e.CLOSED="CLOSED"})(As||(As={}));var lt,lx=function(e){function n(t,r){var i=r.sdkState,s=r.dispatcher,a=r.logger,o=e.call(this)||this;return o.lastActive=0,o._iid=t,o._sdkState=i,o._dispatcher=s,o._logger=a,o}return T(n,e),Object.defineProperty(n.prototype,"isOpen",{get:function(){return this.connectionState===As.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"connectionState",{get:function(){if(this._ws)switch(this._ws.readyState){case 0:return As.CONNECTING;case 1:return As.OPEN}return As.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ws",{get:function(){var t;return(t=this._ws)!==null&&t!==void 0?t:null},enumerable:!1,configurable:!0}),n.prototype._handleMessage=function(t){var r=this;t.split(` -`).forEach(function(i){if(i){var s=Et.createFromRawMessage(r._iid,i);if(r._logger.debug("receive websocket event",s),s.code==="LOGI")r.dispatch("message",s);else if(s.code==="PONG")r.dispatch("pong");else if(s.code==="EXPR"){if(s.payload){var a=new Mu(s.payload);a.expiresIn>=0&&r._dispatcher.dispatch(a)}}else s.code==="NOOP"||r.dispatch("message",s)}})},n.prototype.connect=function(t,r){var i=this;r===void 0&&(r=""),this._ws=new WebSocket(t,encodeURIComponent(r)),this._ws.onopen=function(){i._logger.debug("websocket open"),i.dispatch("open")},this._ws.onmessage=function(s){return y(i,void 0,void 0,function(){var a,o,l,u,c=this;return g(this,function(d){switch(d.label){case 0:return!((u=this._sdkState.websocket)===null||u===void 0)&&u.compression?s.data instanceof Blob?((a=new FileReader).readAsArrayBuffer(s.data),a.onloadend=function(){return y(c,void 0,void 0,function(){var h,f;return g(this,function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),[4,tE(a.result)];case 1:return h=p.sent(),this._handleMessage(h),[3,3];case 2:return f=p.sent(),this.error(f),[3,3];case 3:return[2]}})})},[3,7]):[3,1]:[3,8];case 1:if(!(s.data instanceof ArrayBuffer))return[3,6];d.label=2;case 2:return d.trys.push([2,4,,5]),[4,tE(new Uint8Array(s.data))];case 3:return o=d.sent(),this._handleMessage(o),[3,5];case 4:return l=d.sent(),this.error(l),[3,5];case 5:return[3,7];case 6:typeof s.data=="string"&&this._handleMessage(s.data),d.label=7;case 7:return[3,9];case 8:this._handleMessage(s.data),d.label=9;case 9:return[2]}})})},this._ws.onerror=function(){i._logger.debug("websocket error"),i.dispatch("error",L.networkError)},this._ws.onclose=function(){i._logger.debug("websocket close"),i.dispatch("close")},this.lastActive=Date.now()},n.prototype.disconnect=function(){var t=this;return new Promise(function(r){t._logger.debug("websocket disconnect"),t._ws?(t._ws.onopen=Ke,t._ws.onmessage=Ke,t._ws.onerror=Ke,t.connectionState!==As.CLOSED?(t._ws.onclose=function(){t.dispatch("close"),r()},t._ws.close(),t._ws=void 0):r()):r()})},n.prototype.send=function(t){if(!this._ws)throw L.connectionClosed;t.code!=="PING"?this.dispatch("ping-refresh"):this._logger.debug("send ping",t),this._ws.send(t.convertToMessage())},n.prototype.error=function(t){this._logger.debug("websocket error",t),this.dispatch("error",t)},n}(fl),NT=function(e){function n(t){var r=t.all,i=t.feed,s=t.custom_types,a=t.ts,o=e.call(this)||this;return o.all=r,o.feed=i,o.customTypes=s,o.ts=a,o}return T(n,e),n}(At),ux=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,a=t.logger,o=t.useFetchCompat,l=o!==void 0&&o,u=this;this._ackStateMap=new Map,this._sdkState=i,this._dispatcher=s,this._logger=a,this.apiClient=new oM(n,{session:r,sdkState:i,dispatcher:s,logger:a,useFetchCompat:l}),this.websocketClient=new lx(n,{sdkState:i,dispatcher:s,logger:a}),this.websocketClient.on("message",function(c){if(c.payload.unread_cnt&&u._dispatcher.dispatch(new NT(c.payload.unread_cnt)),c.requestId){if(u._ackStateMap.has(c.requestId)){var d=u._ackStateMap.get(c.requestId);c.code!=="EROR"?d.resolve(c):d.reject(new L({code:c.payload.code,message:c.payload.message}))}}else u._dispatcher.dispatch(c)}).on("close",function(){u._ackStateMap.forEach(function(c){c.reject(L.connectionClosed)}),u._ackStateMap.clear()})}return e.prototype._sendApiRequest=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.apiClient.send(n)];case 1:return[2,t.sent()]}})})},e.prototype._sendWebsocketRequest=function(n){return y(this,void 0,void 0,function(){var t,r,i,s=this;return g(this,function(a){if(!this._sdkState.websocket)throw L.connectionRequired;if(t=new Or,n.ackRequired){i=function(o,l){s._ackStateMap.has(n.requestId)&&(s._ackStateMap.delete(n.requestId),r&&(clearTimeout(r),r=null),o?(s._logger.debug("fail websocket request",n.requestId,o),t.reject(o)):(s._logger.debug("receive websocket ack",n.requestId,n),s._logger.debug("receive websocket ack",l),t.resolve(l)))};try{r=setTimeout(function(){return i(L.noAckTimeout)},this._sdkState.websocket.responseTimeout),this._ackStateMap.set(n.requestId,{resolve:function(o){return i(void 0,o)},reject:function(o){return i(o)}}),this.websocketClient.send(n)}catch(o){i(o)}}else try{this.websocketClient.send(n),t.resolve()}catch(o){t.reject(o)}return[2,t.promise]})})},e.prototype.send=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return n instanceof Z?[4,this._sendApiRequest(n)]:[3,2];case 1:case 3:return[2,t.sent()];case 2:return n instanceof Rr?[4,this._sendWebsocketRequest(n)]:[3,4];case 4:throw L.invalidParameters}})})},e.prototype.cancel=function(n){this.apiClient.cancel(n)},e.prototype.cancelAll=function(){this.apiClient.cancelAll()},e}();(function(e){e[e.NONE=0]="NONE",e[e.INITIALIZED=1]="INITIALIZED",e[e.CONNECTING=2]="CONNECTING",e[e.CONNECTED=3]="CONNECTED",e[e.RECONNECTING=4]="RECONNECTING",e[e.INTERNAL_DISCONNECTED=5]="INTERNAL_DISCONNECTED",e[e.EXTERNAL_DISCONNECTED=6]="EXTERNAL_DISCONNECTED",e[e.LOGOUT=7]="LOGOUT"})(lt||(lt={}));var Oo,Ro,Ii=function(e){function n(t){var r=t.stateType,i=e.call(this)||this;return i.stateType=r,i}return T(n,e),n}(At),IT=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(At),_v=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(At),AT=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(At),nE=function(){function e(n){var t,r,i,s;this.isEnabled=(t=n.enabled)!==null&&t!==void 0&&t,this.feedChannels=(r=n.feed_channels)!==null&&r!==void 0?r:{},this.templateListToken=(i=n.template_list_token)!==null&&i!==void 0?i:null,this.settingsUpdatedAt=(s=n.settings_updated_at)!==null&&s!==void 0?s:0}return e.payloadify=function(n){return be(Ie({enabled:n.isEnabled,feed_channels:n.feedChannels,template_list_token:n.templateListToken,settings_updated_at:n.settingsUpdatedAt}))},e}(),E2=function(e){return"sendbird@".concat(e,"/changelog_include_chat_notifications")},rE=function(){function e(n){var t;this.lastUpdatedAt=(t=n.last_updated_at)!==null&&t!==void 0?t:0}return e.payloadify=function(n){return be(Ie({last_updated_at:n.lastUpdatedAt}))},e}(),iE=function(){function e(n){var t;this.token=(t=n.template_list_token)!==null&&t!==void 0?t:""}return e.payloadify=function(n){return be(Ie({template_list_token:n.token}))},e}(),Fh=function(){function e(n){n===void 0&&(n={min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}),this.minStatCount=n.min_stat_count,this.minInterval=1e3*n.min_interval,this.maxStatCountPerRequest=n.max_stat_count_per_request,this.lowerThreshold=n.lower_threshold,this.requestDelayRange=1e3*n.request_delay_range}return e.payloadify=function(n){return be(Ie({min_stat_count:n.minStatCount,min_interval:n.minInterval/1e3,max_stat_count_per_request:n.maxStatCountPerRequest,lower_threshold:n.lowerThreshold,request_delay_range:n.requestDelayRange/1e3}))},e}(),k_=function(){function e(n){n===void 0&&(n={default:{min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}}),this.default=new Fh(n.default),this.realTime=new Fh(n.realtime)}return e.payloadify=function(n){return be(Ie({default:Fh.payloadify(n.default),realtime:Fh.payloadify(n.realTime)}))},e}(),sE=1048576,cx=5;(function(e){e[e.NONE=0]="NONE",e[e.INCLUDE_REPLY=1]="INCLUDE_REPLY",e[e.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",e[e.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL"})(Oo||(Oo={})),function(e){e[e.NONE=0]="NONE",e[e.INCLUDE_REPLY=1]="INCLUDE_REPLY",e[e.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",e[e.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL"}(Ro||(Ro={}));var aE=function(){function e(n){var t,r,i,s,a,o,l;n===void 0&&(n={}),this.emojiHash=n.emoji_hash||"",this.uploadSizeLimit=n.file_upload_size_limit?n.file_upload_size_limit*sE:Number.MAX_SAFE_INTEGER,this.useReaction=!!n.use_reaction,this.applicationAttributes=(t=n.application_attributes)!==null&&t!==void 0?t:[],this.premiumFeatureList=(r=n.premium_feature_list)!==null&&r!==void 0?r:[],this.deviceTokenCache=this.applicationAttributes.includes("sdk_device_token_cache"),this.enabledChannelMemberShipHistory=this.applicationAttributes.includes("channel_membership_history"),this.multipleFilesMessageFileCountLimit=(i=n.multiple_file_send_max_size)!==null&&i!==void 0?i:5,this.allowSdkStatsUpload=(s=n.allow_sdk_log_ingestion)===null||s===void 0||s,this.unreadCountThreadingPolicy=(a=n.unread_cnt_threading_policy)!==null&&a!==void 0?a:Oo.NONE,this.lastMessageThreadingPolicy=(o=n.last_msg_threading_policy)!==null&&o!==void 0?o:Ro.NONE,this.uikitConfigInfo=new rE((l=n.uikit_config)!==null&&l!==void 0?l:{}),this.notificationInfo=n.notifications?new nE(n.notifications):null,this.messageTemplateInfo=n.message_template?new iE(n.message_template):null,this.statConfigInfo=n.log_publish_config?new k_(n.log_publish_config):new k_}return e.payloadify=function(n){return be(Ie({emoji_hash:n.emojiHash,file_upload_size_limit:n.uploadSizeLimit/sE,application_attributes:n.applicationAttributes,premium_feature_list:n.premiumFeatureList,use_reaction:n.useReaction,allow_sdk_log_ingestion:n.allowSdkStatsUpload,unread_cnt_threading_policy:n.unreadCountThreadingPolicy,last_msg_threading_policy:n.lastMessageThreadingPolicy,uikit_config:n.uikitConfigInfo?rE.payloadify(n.uikitConfigInfo):null,notifications:n.notificationInfo?nE.payloadify(n.notificationInfo):null,message_template:n.messageTemplateInfo?iE.payloadify(n.messageTemplateInfo):null,log_publish_config:n.statConfigInfo?k_.payloadify(n.statConfigInfo):null}))},e}(),Jn=function(){function e(n){this._iid="",this._iid=n}return e.payloadify=function(n){return{}},e}(),dx=function(e){function n(t){var r=t.userId,i=t.metadata,s=e.call(this)||this;return s.method=Y.POST,s.path="".concat(tt,"/").concat(r,"/metadata"),s.params={metadata:i},s}return T(n,e),n}(Z),hx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaData=r,i}return T(n,e),n}(le),fx=function(e){function n(t){var r=t.userId,i=t.metadata,s=t.upsert,a=e.call(this)||this;return a.method=Y.PUT,a.path="".concat(tt,"/").concat(r,"/metadata"),a.params={metadata:i,upsert:s},a}return T(n,e),n}(Z),px=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metadata=r,i}return T(n,e),n}(le),_x=function(e){function n(t){var r=t.userId,i=t.metadataKey,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(r,"/metadata/").concat(i),s}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var mx=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.DELETE,i.path="".concat(tt,"/").concat(r,"/metadata"),i}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var ql,th=function(e,n){var t=JSON.parse(JSON.stringify(e));return t._iid&&delete t._iid,n&&n(t),t},Ko=function(e,n){var t=JSON.parse(JSON.stringify(e));return t},Q=function(e){return{do:function(n){e||n()},throw:function(n){if(!e)throw n}}};(function(e){e.ONLINE="online",e.OFFLINE="offline",e.NON_AVAILABLE="nonavailable"})(ql||(ql={}));var xu,Ze=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b=this;return(b=e.call(this,t)||this).userId=(s=(i=r.guest_id)!==null&&i!==void 0?i:r.user_id)!==null&&s!==void 0?s:"",b.nickname=(o=(a=r.nickname)!==null&&a!==void 0?a:r.name)!==null&&o!==void 0?o:"",b.plainProfileUrl=(u=(l=r.profile_url)!==null&&l!==void 0?l:r.image)!==null&&u!==void 0?u:"",b.requireAuth=(c=r.require_auth_for_profile_image)!==null&&c!==void 0&&c,b.metaData=(d=r.metadata)!==null&&d!==void 0?d:{},b.connectionStatus=ql.NON_AVAILABLE,Ve(ql,r.is_online)?b.connectionStatus=r.is_online:k("boolean",r.is_online)&&(b.connectionStatus=r.is_online?ql.ONLINE:ql.OFFLINE),b.isActive=(h=r.is_active)===null||h===void 0||h,b.lastSeenAt=(f=r.last_seen_at)!==null&&f!==void 0?f:null,b.preferredLanguages=r.preferred_languages?Fe([],Me(r.preferred_languages),!1):null,b.friendDiscoveryKey=(p=r.friend_discovery_key)!==null&&p!==void 0?p:null,b.friendName=(m=r.friend_name)!==null&&m!==void 0?m:null,b}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{user_id:t.userId,nickname:t.nickname,profile_url:t.plainProfileUrl,require_auth_for_profile_image:t.requireAuth,metadata:t.metaData,is_online:t.connectionStatus,is_active:t.isActive,last_seen_at:t.lastSeenAt,preferred_languages:t.preferredLanguages,friend_discovery_key:t.friendDiscoveryKey,friend_name:t.friendName})))},Object.defineProperty(n.prototype,"profileUrl",{get:function(){var t=R.of(this._iid).sessionManager;return this.requireAuth&&t.ekey?"".concat(this.plainProfileUrl,"?auth=").concat(t.ekey):this.plainProfileUrl},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){return th(this)},n.prototype._isValidMetaData=function(t){return!Array.isArray(t)&&Object.keys(t).length>0&&Object.keys(t).map(function(r){return t[r]}).every(function(r){return k("string",r)})},n.prototype._applyMetaData=function(t,r){var i=this;r===void 0&&(r=!1),Object.keys(t).forEach(function(s){r?delete i.metaData[s]:i.metaData[s]=t[s]})},n.prototype.createMetaData=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(this._isValidMetaData(t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=new dx({userId:i.userId,metadata:t}),[4,s.send(a)];case 1:return o=u.sent(),l=o.as(hx).metaData,this._applyMetaData(l),[2,this.metaData]}})})},n.prototype.updateMetaData=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(this._isValidMetaData(t)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new fx({userId:s.userId,metadata:t,upsert:r}),[4,a.send(o)];case 1:return l=c.sent(),u=l.as(px).metadata,this._applyMetaData(u),[2,this.metaData]}})})},n.prototype.deleteMetaData=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return Q(k("string",t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=new _x({userId:i.userId,metadataKey:t}),[4,s.send(a)];case 1:return l.sent(),this._applyMetaData(((o={})[t]=!0,o),!0),[2,this.metaData]}})})},n.prototype.deleteAllMetaData=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new mx({userId:r.userId}),[4,i.send(s)];case 1:return a.sent(),this.metaData={},[2]}})})},n}(Jn),MT=function(e){function n(t){var r=t.userProfile,i=e.call(this)||this;return i.userProfile=r,i}return T(n,e),n}(At),mv=function(){function e(n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b;this._iid=n,this.appInfo=new aE(t),this.user=new Ze(n,t),this.connectedAt=(r=t.login_ts)!==null&&r!==void 0?r:0,this.firstConnectedAt=0,this.pingInterval=(i=t.ping_interval)!==null&&i!==void 0?i:15e3,this.pongTimeout=(s=t.pong_timeout)!==null&&s!==void 0?s:5e3,this.reconnectInterval=(o=(a=t.reconnect)===null||a===void 0?void 0:a.interval)!==null&&o!==void 0?o:3e3,this.reconnectMaxInterval=(u=(l=t.reconnect)===null||l===void 0?void 0:l.max_interval)!==null&&u!==void 0?u:6e4,this.reconnectRetryCount=(d=(c=t.reconnect)===null||c===void 0?void 0:c.retry_cnt)!==null&&d!==void 0?d:5,this.reconnectIntervalMultiple=(f=(h=t.reconnect)===null||h===void 0?void 0:h.mul)!==null&&f!==void 0?f:2,this.maxUnreadCountOnSuperGroup=(p=t.max_unread_cnt_on_super_group)!==null&&p!==void 0?p:100,this.profileImageEncryption=!!t.profile_image_encryption,this.concurrentCallLimit=(m=t.concurrent_call_limit)!==null&&m!==void 0?m:5,this.backOffDelay=(b=t.back_off_delay)!==null&&b!==void 0?b:100}return e.payloadify=function(n){return be(Ie(M(M(M({},Ze.payloadify(n.user)),aE.payloadify(n.appInfo)),{login_ts:n.connectedAt,ping_interval:n.pingInterval,pong_timeout:n.pongTimeout,reconnect:{interval:n.reconnectInterval,max_interval:n.reconnectMaxInterval,retry_cnt:n.reconnectRetryCount,mul:n.reconnectIntervalMultiple},max_unread_cnt_on_super_group:n.maxUnreadCountOnSuperGroup,profile_image_encryption:n.profileImageEncryption,concurrent_call_limit:n.concurrentCallLimit,back_off_delay:n.backOffDelay})))},e.prototype.apply=function(){var n=this.reconnectInterval,t=this.reconnectMaxInterval,r=this.reconnectIntervalMultiple,i=R.of(this._iid);i.sdkState.websocket&&(i.sdkState.websocket.pingInterval=1e3*this.pingInterval,i.sdkState.websocket.pongTimeout=1e3*this.pongTimeout,i.sdkState.websocket.reconnectMaxRetry=this.reconnectRetryCount,i.sdkState.websocket.reconnectRetryStrategy={calcTimeout:function(s){return s>0?1e3*Math.min(n*Math.pow(r,s-1),t):10}}),i.appInfo=this.appInfo,i.sessionManager.currentUser=this.user,i.connectedAt=this.connectedAt,this.firstConnectedAt||(i.firstConnectedAt=this.connectedAt),i.maxSuperGroupChannelUnreadCount=this.maxUnreadCountOnSuperGroup,i.concurrentCallLimit=this.concurrentCallLimit,i.backOffDelay=this.backOffDelay,i.dispatcher.dispatch(new MT({userProfile:this}))},e}(),xT=function(e){function n(t){var r=t.request,i=r===void 0||r,s=t.features,a=s===void 0?{}:s,o=t.options,l=o===void 0?{}:o,u=t.statConfigInfo,c=e.call(this)||this;return c.request=i,c.features=M({localCache:!0,notification:!0},a),c.options=M({ingestion:!0},l),c.statConfigInfo=u,c}return T(n,e),n}(At),yf=function(e){function n(t,r,i){var s,a,o,l,u=this;return(u=e.call(this,t,r,i)||this).error=null,u.services=[],u.userProfile=new mv(t,i),u.deviceTokenLastDeletedAt=(s=i.device_token_last_deleted_at)!==null&&s!==void 0?s:0,u.key=(a=i.key)!==null&&a!==void 0?a:"",u.ekey=(o=i.ekey)!==null&&o!==void 0?o:"",u.error=i.error?new L(i):null,u.services=(l=i.services)!==null&&l!==void 0?l:[],u}return T(n,e),n.asError=function(t){return new n("","LOGI",M({user_id:"",error:!0},t))},n.prototype.applyTo=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(a){switch(a.label){case 0:return this.error?[3,4]:(r=R.of(t))?(i=r.sessionManager,s=r.dispatcher,[4,i.login(this)]):[3,2];case 1:return a.sent(),this.userProfile.apply(),s.dispatch(new xT({request:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_request_log_publish"),features:{localCache:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_feature_local_cache_log_publish"),notification:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_noti_stats_log_publish")},options:{ingestion:this.userProfile.appInfo.allowSdkStatsUpload},statConfigInfo:this.userProfile.appInfo.statConfigInfo})),[3,3];case 2:throw L.lostInstance;case 3:return[3,5];case 4:throw this.error;case 5:return[2]}})})},n}(Et),_l=function(){function e(){this.type=lt.NONE,this.name="none"}return e.prototype.run=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},e.prototype.onConnect=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onReconnect=function(n,t){return t.resetReconnectCount,y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onDisconnect=function(n,t){return t.error,t.autoReconnect,t.cause,y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onDisconnectWebSocket=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onLogout=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},e}(),Ue=function(e){return y(void 0,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e()];case 1:return t.sent(),[3,3];case 2:if(!((n=t.sent())instanceof L))throw n;return n.throwOutside(),[3,3];case 3:return[2]}})})},Lt=function(e){return y(void 0,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:case 2:return n.sent(),[3,3];case 3:return[2]}})})},Za=function(e){function n(t){t===void 0&&(t={});var r,i=this;return(i=e.call(this)||this).type=lt.LOGOUT,i.name="logout",i._wasPreviouslyConnected=(r=t.wasPreviouslyConnected)===null||r===void 0||r,i}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){var r,i,s=this;return g(this,function(a){switch(a.label){case 0:return r=Date.now(),i=t.sdkState.userId,[4,t.logout()];case 1:return a.sent(),[4,t.changeState(new b2,r)];case 2:return a.sent(),this._wasPreviouslyConnected&&Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(o){return t.connectionHandlers.forEach(function(l){l.onDisconnected&&l.onDisconnected(i)}),[2]})})}),[2]}})})},n}(_l),mp=function(e){function n(){var t=e.call(this)||this;return t.type=lt.EXTERNAL_DISCONNECTED,t.name="externaldisconnected",t}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,t.disconnect()];case 1:return r.sent(),[2]}})})},n.prototype.onConnect=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new gp({authToken:r}),i)];case 2:return s.sent(),[2]}})})},n.prototype.onReconnect=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new d0,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new Za,r)];case 1:return i.sent(),[2]}})})},n}(_l),c0=function(e){function n(t){var r=t.autoReconnect,i=e.call(this)||this;return i.type=lt.INTERNAL_DISCONNECTED,i.name="internaldisconnected",i._autoReconnect=!1,i._autoReconnect=r,i}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.disconnect()];case 1:return i.sent(),this._autoReconnect?[4,t.changeState(new d0,r)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},n.prototype.onConnect=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new gp({authToken:r}),i)];case 2:return s.sent(),[2]}})})},n.prototype.onReconnect=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new d0,r)];case 1:return i.sent(),[2]}})})},n.prototype.onDisconnectWebSocket=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new mp,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new Za,r)];case 1:return i.sent(),[2]}})})},n}(_l),Br=function(e){return y(void 0,void 0,void 0,function(){return g(this,function(n){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},OT=function(){function e(){}return e.prototype.calcTimeout=function(){return 0},e}(),vp=function(e,n,t){return t===void 0&&(t=new OT),y(void 0,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:r=0,i=null,s=function(c){return i=c??new Error("Halted")},a=function(){r=0},u.label=1;case 1:if(!(n===-1||r=this._stateUpdatedAt?(this._currentState=t,this._stateUpdatedAt=r,this._dispatcher.dispatch(new Ii({stateType:t.type})),this._logger.debug("connection state changes to ".concat(t.name)),[4,this._currentState.run(this)]):[3,2];case 1:return i.sent(),[2,!0];case 2:return[2,!1]}})})},n.prototype._tryResolveConnectionRequest=function(){var t;return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=this._unresolvedLogi,this._websocketClient.isOpen&&r?(this._unresolvedLogi=void 0,r.error?[3,2]:[4,r.applyTo(this._iid)]):[3,3];case 1:return i.sent(),this._statLogConnection(),(t=this._pinger)===null||t===void 0||t.start(),this._connectionRequestQueue.forEach(function(s){return s.resolve()}),this._connectionRequestQueue=[],this.sdkState.appState="foreground",[3,3];case 2:this._sessionManager.session.authToken=void 0,(r.error.isSessionExpiredError||r.error.isSessionInvalidatedError)&&this._dispatcher.dispatch(new Mu({reason:r.error.code})),this._rejectConnectionRequest(r.error),i.label=3;case 3:return[2]}})})},n.prototype._rejectConnectionRequest=function(t){var r;if((r=this._pinger)===null||r===void 0||r.stop(),this.clearLoginTimer(),this._connectionRequestQueue.length>0){var i=this._connectionRequestQueue;this._connectionRequestQueue=[],i.forEach(function(s){return s.reject(t)}),this._statLogConnection(t)}},n.prototype._url=function(){var t,r=this.sdkState,i=r.appId,s=r.appVersion,a=r.userId,o=r.extensions,l=r.sendbirdRuntimeEnvironment,u=this.cacheContext.localCacheEnabled,c=this._sessionManager.session,d=(t=this.sdkState.websocket)===null||t===void 0?void 0:t.compression,h=!!(o??{}).sb_uikit,f=s0.userAgentWithExtension(o);return"".concat(this.sdkState.websocket.host,"/?p=JS&pv=").concat(encodeURIComponent(Wa.OS_VERSION),"&sv=").concat(encodeURIComponent(Wa.SDK_VERSION),"&ai=").concat(i).concat(s?"&av=".concat(s):"").concat(c.hasSession?"":"&user_id=".concat(encodeURIComponent(a)),"&pmce=").concat(d?1:0,"&active=1&device_token_types=").concat(encodeURIComponent(["gcm","huawei","apns"].join(",")),"&SB-User-Agent=").concat(f,"&SB-SDK-User-Agent=").concat(encodeURIComponent(s0.sendbirdSdkUserAgentWithExtension(l)),"&Request-Sent-Timestamp=").concat(Date.now().toString(),"&include_extra_data=").concat(encodeURIComponent(String(kT))).concat(this._sessionManager.handler?"&expiring_session=1":"","&use_local_cache=").concat(u?1:0,"&include_poll_details=1").concat(h?"&uikit_config=1":"")},n.prototype._statLogConnection=function(t){var r;this._dispatcher.dispatch(new v2(new Vt({type:St.WEBSOCKET_CONNECT,data:{host_url:(r=this.sdkState.websocket)===null||r===void 0?void 0:r.host,success:!t,latency:Date.now()-this._connectingAt,error_code:t==null?void 0:t.code,error_description:t==null?void 0:t.message}})))},n.prototype.connect=function(t){var r;return t===void 0&&(t=""),y(this,void 0,void 0,function(){var i,s,a,o=this;return g(this,function(l){return this._logiProcessingTimer&&(clearTimeout(this._logiProcessingTimer),this._logiProcessingTimer=void 0,this._rejectConnectionRequest(L.connectionCanceled)),i=this._url(),s=new Or,this._connectionRequestQueue.push(s),this._connectionRequestQueue.length===1&&(this._connectingAt=Date.now(),this._loginTimer=setTimeout(function(){o._loginTimer=void 0,o._rejectConnectionRequest(L.loginTimeout)},(r=this.sdkState.websocket)===null||r===void 0?void 0:r.responseTimeout),a=this._sessionManager.session,t&&(a.authToken=t),a.sessionKey||a.authToken?this._websocketClient.connect(i,JSON.stringify(a.hasSession?{auth:a.sessionKey}:{token:a.authToken})):this._websocketClient.connect(i,JSON.stringify({}))),[2,s.promise]})})},n.prototype.cancelConnectForRetry=function(){this._dispatcher.dispatch(yf.asError(L.connectionRenew))},n.prototype.disconnect=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._websocketClient.disconnect()];case 1:return t.sent(),[2]}})})},n.prototype.logout=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.sdkState.userId=void 0,this._unresolvedLogi=void 0,[4,this.disconnect()];case 1:return t.sent(),[4,this._sessionManager.clear()];case 2:return t.sent(),[2]}})})},n.prototype.clearLoginTimer=function(){this._loginTimer&&(clearTimeout(this._loginTimer),this._loginTimer=void 0)},n}(fl),LT=function(e){function n(t){var r=t.appId,i=t.userId,s=t.services,a=t.includeUIKitConfig,o=a!==void 0&&a,l=t.localCacheEnabled,u=l===void 0||l,c=t.expiringSession,d=c===void 0||c,h=e.call(this)||this;return h.path="".concat(tt,"/").concat(i,"/login"),h.method=Y.POST,h.params=be({expiring_session:!!d,services:s,include_logi:!0,include_extra_data:String(kT),uikit_config:o,use_local_cache:u,app_id:r}),h.requireAuth=!1,h}return T(n,e),n}(Z),bx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.logi=new yf(t,"LOGI",r),i}return T(n,e),n}(le);(function(e){e[e.ALL=0]="ALL",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.API=2]="API"})(Ca||(Ca={}));var jt,lE,Cx=[m2,LT],Sx=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,a=t.logger,o=t.useFetchCompat,l=o!==void 0&&o,u=this;this._currentConnectionStateType=lt.INITIALIZED,this._lazyCallQueue=[],this.commandRouter=new ux(n,{session:r,sdkState:i,dispatcher:s,logger:a,useFetchCompat:l}),this._session=r,this._logger=a,this._dispatcher=s,this._dispatcher.on(function(c){var d,h,f,p;if(c instanceof Ii){var m=c.stateType;switch(u._currentConnectionStateType=m,m){case lt.CONNECTED:u._resolveLazyCallQueue();break;case lt.INITIALIZED:case lt.INTERNAL_DISCONNECTED:case lt.EXTERNAL_DISCONNECTED:case lt.LOGOUT:u._rejectLazyCallQueue(!((f=u._session)===null||f===void 0)&&f.hasSession?L.connectionClosed:L.connectionRequired)}}else if(c instanceof IT)!((p=u._session.services)===null||p===void 0)&&p.includes(wd.CHAT)||u._resolveLazyCallQueue(Ca.API);else if(c instanceof _v||c instanceof AT)u._rejectLazyCallQueue(L.connectionClosed);else if(c instanceof aT){var b=c.request,v=c.deferred,_=c.error;try{for(var E=ge(Cx),S=E.next();!S.done;S=E.next())if(b instanceof S.value)return void v.reject(_)}catch(w){d={error:w}}finally{try{S&&!S.done&&(h=E.return)&&h.call(E)}finally{if(d)throw d.error}}u._lazyCallQueue.push({command:b,deferred:v})}})}return Object.defineProperty(e.prototype,"isReady",{get:function(){return this._currentConnectionStateType===lt.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLazyCallActivated",{get:function(){return this._currentConnectionStateType===lt.CONNECTING||this._currentConnectionStateType===lt.RECONNECTING||this._session.isRefreshing},enumerable:!1,configurable:!0}),e.prototype._classifyLazyCallQueueByScope=function(n){var t,r=[],i=[];switch(n){case Ca.ALL:t=null;break;case Ca.WEBSOCKET:t=Rr;break;case Ca.API:t=Z}var s=!1;return this._lazyCallQueue.forEach(function(a){!t||a.command instanceof t||(s=!0),s?i.push(a):r.push(a)}),[r,i]},e.prototype._resolveLazyCallQueue=function(n){var t=this;n===void 0&&(n=Ca.ALL);var r=Me(this._classifyLazyCallQueueByScope(n),2),i=r[0],s=r[1];this._lazyCallQueue=s,i.forEach(function(a){return y(t,void 0,void 0,function(){var o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:o=a.command,l=a.deferred,(u=a.timeout)&&clearTimeout(u),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.send(o)];case 2:return c=h.sent(),l.resolve(c),[3,4];case 3:return d=h.sent(),l.reject(d),[3,4];case 4:return[2]}})})})},e.prototype._rejectLazyCallQueue=function(n,t){var r=this;t===void 0&&(t=Ca.ALL);var i=Me(this._classifyLazyCallQueueByScope(t),2),s=i[0],a=i[1];this._lazyCallQueue=a,s.forEach(function(o){return y(r,void 0,void 0,function(){var l,u;return g(this,function(c){return l=o.deferred,u=o.timeout,clearTimeout(u),l.reject(n),[2]})})})},e.prototype.send=function(n){return y(this,void 0,void 0,function(){var t,r,i=this;return g(this,function(s){switch(s.label){case 0:return n instanceof Rr?this.isReady?(this._logger.debug("send websocket request",n),[4,this.commandRouter.send(n)]):[3,2]:[3,4];case 1:case 5:case 7:return[2,s.sent()];case 2:if(this.isLazyCallActivated)return this._logger.debug("wait websocket request",n),t=new Or,this._lazyCallQueue.push({command:n,deferred:t,timeout:setTimeout(function(){return i.timeout(n.requestId)},1e4)}),[2,t.promise];throw this._logger.debug("fail websocket request"),L.connectionRequired;case 3:case 9:return[3,11];case 4:return n instanceof Z?this._session.hasSession?(this._logger.debug("send api request",n),[4,this.commandRouter.send(n)]):[3,6]:[3,10];case 6:return n.hasSessionKey?(this._logger.debug("send api request with tmp session key",n),[4,this.commandRouter.send(n)]):[3,8];case 8:if(this.isLazyCallActivated)return this._logger.debug("wait api request",n),t=new Or,this._lazyCallQueue.push({command:n,deferred:t,timeout:setTimeout(function(){return i.timeout(n.requestId)},1e4)}),[2,t.promise];throw r=L.connectionRequired,this._logger.debug("fail api request",r),r;case 10:throw L.invalidCommand;case 11:return[2]}})})},e.prototype.forceSend=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this._logger.debug("send forced request",n),n instanceof Rr||n instanceof Z?[4,this.commandRouter.send(n)]:[3,2];case 1:return[2,t.sent()];case 2:throw L.invalidCommand}})})},e.prototype.timeout=function(n){this._logger.debug("timeout request",n);var t=this._lazyCallQueue.findIndex(function(r){return r.command.requestId===n});t>-1&&(this._lazyCallQueue[t].deferred.reject(L.connectionRequired),this._lazyCallQueue.splice(t,1))},e.prototype.cancel=function(n){this._logger.debug("cancel api request",n),this.commandRouter.cancel(n)},e.prototype.cancelAll=function(){this._logger.debug("cancel all api requests"),this.commandRouter.cancelAll()},e}(),L_="sendbird@devicetokens",D_=function(){function e(n){var t=n.type,r=n.token,i=n.device_os,s=n.device_manufacturer,a=n.system_push_enabled;this.type=t,this.token=r,this.deviceOS=i,this.deviceManufacturer=s,this.systemPushEnabled=a}return e.payloadify=function(n){return be(Ie({type:n.type,token:n.token,device_os:n.deviceOS,device_manufacturer:n.deviceManufacturer,system_push_enabled:n.systemPushEnabled}))},e}(),U_=new WeakMap,Tx=function(e){function n(t){var r=t._iid,i=t.session,s=t.cacheContext,a=t.sdkState,o=t.dispatcher,l=t.requestQueue,u=t.logger,c=t.pushNotificationAckManager,d=e.call(this)||this;return d._currentConnectionStateType=lt.INITIALIZED,d._isRefreshingAuthToken=!1,d.currentUser=null,d.session=i,d._iid=r,d._cacheContext=s,d._sdkState=a,d._dispatcher=o,d._requestQueue=l,d._logger=u,d._pushNotificationAckManager=c,d._deviceTokens=[],d._dispatcher.on(function(h){var f,p,m;if(h instanceof Ii){var b=h.stateType;d._currentConnectionStateType=b}else h instanceof Mu&&d.handler&&!d.isSessionKeyRefreshing&&(!((f=h.error)===null||f===void 0)&&f.isSessionInvalidatedError?d.close():(!((p=h.error)===null||p===void 0)&&p.isSessionTokenExpiredError&&d.refreshAuthToken().catch(function(v){if(zr(v)&&d._sdkState.appState==="foreground")throw v}),!((m=h.error)===null||m===void 0)&&m.isSessionKeyExpiredError&&(d._logger.debug("session expired"),d.handler.onSessionExpired&&d.handler.onSessionExpired(),d.refreshSessionKey().catch(function(v){if(zr(v)&&d._sdkState.appState==="foreground")throw v}))))}),d}return T(n,e),Object.defineProperty(n.prototype,"ekey",{get:function(){return U_.get(this)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceTokens",{get:function(){return this._deviceTokens},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceTokenLastDeletedAt",{get:function(){return this._deviceTokenLastDeletedAt},enumerable:!1,configurable:!0}),n.prototype.indexOfDeviceToken=function(t,r){return this._deviceTokens.findIndex(function(i){return i.type===t&&i.token===r})},n.prototype.hasDeviceToken=function(t,r){return this.indexOfDeviceToken(t,r)>=0},n.prototype.createRefreshWebsocketCommand=function(t,r){return new nM({authToken:t,expiringSession:!0,requestId:r})},n.prototype._refreshSessionKeyByWebSocket=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return r=this.createRefreshWebsocketCommand(t),[4,this._requestQueue.forceSend(r)];case 1:if(i=l.sent(),s=i.as(iM),a=s.newKey,o=s.error)throw o;return this.session.sessionKey=a??this.session.sessionKey,[2]}})})},n.prototype._refreshSessionKeyByApi=function(t){return y(this,void 0,void 0,function(){var r,i=this;return g(this,function(s){switch(s.label){case 0:return r=new m2({userId:this._sdkState.userId,authToken:t,services:this.session.services&&this.session.services.length>0?this.session.services:void 0,expiringSession:!0}),[4,vp(function(a){return y(i,void 0,void 0,function(){var o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return h.trys.push([0,2,,3]),[4,this._requestQueue.forceSend(r)];case 1:return o=h.sent(),l=o.as(rM),u=l.key,c=l.services,this.session.sessionKey=u,this.session.services=c,[3,3];case 2:if(d=h.sent(),!this._isSessionRelatedError(d))throw d;return a(d),[3,3];case 3:return[2]}})})},3)];case 1:return s.sent(),[2]}})})},n.prototype._refreshSessionKey=function(t,r){return r===void 0&&(r=!0),y(this,void 0,void 0,function(){var i,s;return g(this,function(a){switch(a.label){case 0:if(this._currentConnectionStateType!==lt.CONNECTED)return[3,8];a.label=1;case 1:return a.trys.push([1,3,,8]),[4,this._refreshSessionKeyByWebSocket(t)];case 2:return a.sent(),this.complete(),[2];case 3:i=a.sent(),a.label=4;case 4:return a.trys.push([4,6,,7]),[4,this._handleSessionRefreshError(i,r)];case 5:return a.sent(),[2];case 6:return a.sent(),[3,7];case 7:return[3,8];case 8:return a.trys.push([8,10,,12]),[4,this._refreshSessionKeyByApi(t)];case 9:return a.sent(),this.complete(),[3,12];case 10:return s=a.sent(),[4,this._handleSessionRefreshError(s,r)];case 11:return a.sent(),[3,12];case 12:return[2]}})})},n.prototype._receiveNewAuthToken=function(){var t,r=this,i=new Or;if(this._isRefreshingAuthToken=!0,this.session.sessionKey=void 0,this.session.authToken=void 0,(t=this.handler)===null||t===void 0?void 0:t.onSessionTokenRequired){var s=null,a=function(){s&&(clearTimeout(s),s=null)},o=function(u){a(),r._isRefreshingAuthToken&&(r._isRefreshingAuthToken=!1,i.resolve(u))},l=function(u){a(),r._isRefreshingAuthToken&&(r._isRefreshingAuthToken=!1,i.reject(u))};s=setTimeout(function(){return l()},1e3*this._sdkState.sessionTokenRefreshTimeout),Ue(function(){return y(r,void 0,void 0,function(){var u;return g(this,function(c){return!((u=this.handler)===null||u===void 0)&&u.onSessionTokenRequired&&this.handler.onSessionTokenRequired(o,l),[2]})})})}else i.resolve(null);return i.promise},n.prototype._handleSessionRefreshError=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return t instanceof L&&(t.isSessionTokenExpiredError||t.code===Ae.APPLICATION_NOT_FOUND)?(this.session.authToken=void 0,r?[4,this._receiveNewAuthToken()]:[3,6]):[3,6];case 1:return(i=s.sent())?(this.session.authToken=i,[4,this._refreshSessionKey(this.session.authToken,!1)]):[3,3];case 2:return s.sent(),this.complete(),[3,5];case 3:return[4,this.clear()];case 4:s.sent(),s.label=5;case 5:return[2];case 6:throw t}})})},n.prototype._isSessionRelatedError=function(t){return t instanceof L&&(t.isSessionExpiredError||t.isSessionInvalidatedError)},Object.defineProperty(n.prototype,"isSessionKeyRefreshing",{get:function(){return this.session.isRefreshing},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRefreshingAuthToken",{get:function(){return this._isRefreshingAuthToken},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSessionExpiring",{get:function(){return!!this.handler},enumerable:!1,configurable:!0}),n.prototype.authenticateFeed=function(t,r){var i;return y(this,void 0,void 0,function(){var s,a,o;return g(this,function(l){switch(l.label){case 0:return this.session.authToken=r,s=new LT({appId:this._sdkState.appId,userId:t,services:[wd.FEED],includeUIKitConfig:!!((i=this._sdkState.extensions)!==null&&i!==void 0?i:{}).sb_uikit,localCacheEnabled:this._cacheContext.localCacheEnabled,expiringSession:!r||this.isSessionExpiring}),[4,this._requestQueue.commandRouter.send(s)];case 1:return a=l.sent(),(o=a.as(bx).logi).error?[3,3]:[4,o.applyTo(this._iid)];case 2:return l.sent(),[3,4];case 3:throw o.error;case 4:return[2]}})})},n.prototype.login=function(t){var r;return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return i=t.key,s=t.ekey,a=t.services,o=t.userProfile,l=t.deviceTokenLastDeletedAt,u=l===void 0?0:l,this.session.sessionKey=i,this.session.services=a,U_.set(this,s),this._deviceTokenCacheEnabled=(r=o==null?void 0:o.appInfo)===null||r===void 0?void 0:r.deviceTokenCache,c=this._cacheContext.preference,this._deviceTokenCacheEnabled?[4,c.get(L_)]:[3,5];case 1:return!(d=h.sent())||d.lastDeletedAt0&&(this.queue=this.queue.concat(this.flushWaitQueue),this.flushWaitQueue=[])},e.prototype._isDuplicateStat=function(n){var t=this._sentLogStats.find(function(r){var i;return r.channelUrl===n.data.channel_url&&r.messageId===((i=n.data.notificationId)!==null&&i!==void 0?i:n.data.message_id)&&r.action===n.data.action});return t||this._sentLogStats.push({channelUrl:n.data.channel_url,messageId:n.data.message_id,action:n.data.action}),!!t},e.prototype._flush=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:if(t=!0,!(n.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,a.label=1;case 1:return a.trys.push([1,4,8,9]),r=Fe([],Me(n),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new wx({deviceId:this.deviceId,statLogs:r}),[4,this.requestQueue.send(i)];case 2:return a.sent(),this.queue=Fe([],Me(n),!1).slice(r.length).concat(this.flushWaitQueue),this.flushWaitQueue=[],this.limit=100,this.logInfo.lastFlushedAt=Date.now(),[4,this._save()];case 3:return a.sent(),[3,9];case 4:return(s=a.sent())instanceof L?s.code!==Ae.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return a.sent(),this.enabledState=jt.DISABLED,[3,7];case 6:s.code===Ae.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=jt.COLLECT_ONLY),a.label=7;case 7:return this.limit=this.limit+20,t=!1,[3,9];case 8:return this.isFlushing=!1,[7];case 9:return[3,11];case 10:this.isFlushing=!1,a.label=11;case 11:return[2,t]}})})},e.prototype._save=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=Fe(Fe([],Me(this.queue),!1),Me(this.flushWaitQueue),!1),[4,this.cacheContext.preference.set(this.key,{deviceId:this.logInfo.deviceId,statLogs:n.map(function(r){return Vt.payloadify(r)}),generation:this.logInfo.generation++,lastFlushedAt:this.logInfo.lastFlushedAt})];case 1:return t.sent(),[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this.queue=[],this.flushWaitQueue=[],this.logInfo.generation=1,this._save(),[2]})})},e}(),Ou=function(e){function n(t){var r,i,s,a,o=t.type,l=t.data,u=t.ts,c=u===void 0?Date.now():u,d=e.call(this,{type:o,data:l,ts:c})||this;return d.date=new Date(c),d.key="".concat((r=d.date,i=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),a=String(r.getDate()).padStart(2,"0"),"".concat(i).concat(s).concat(a)),"_").concat(o),d}return T(n,e),n}(Vt),Nx=function(e){function n(t){var r=t.deviceId,i=t.cacheContext,s=t.requestQueue;return e.call(this,{deviceId:r,cacheContext:i,requestQueue:s})||this}return T(n,e),Object.defineProperty(n.prototype,"_isSendable",{get:function(){return this.queue.length!==0&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval},enumerable:!1,configurable:!0}),n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.init.call(this,t+".daily")];case 1:return r.sent(),this.queue=this.logInfo.statLogs.map(function(i){return new Vt({type:i.stat_type,ts:i.ts,data:i.data})}),[2]}})})},n.prototype.setConfig=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this.statConfig=t,this.statConfig.minInterval=864e5,this._mergeQueue(),r.localCacheStat?(this.enabledState=r.enabledStat?jt.ENABLED:jt.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=jt.DISABLED,[4,this.clear()];case 2:l.sent(),l.label=3;case 3:return this.isEnabled&&this._isSendable?[4,this._getUploadStats()]:[3,9];case 4:i=l.sent(),s=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),a=0,l.label=5;case 5:return a=this.statConfig.minStatCount&&this.queue.length>this.statConfig.lowerThreshold||this.logInfo.lastFlushedAt>0&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval},enumerable:!1,configurable:!0}),n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.init.call(this,t+".realtime")];case 1:return r.sent(),this.queue=this.logInfo.statLogs.map(function(i){var s;return i.data=be(M(M({},i.data),{message_id:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,notificationId:void 0})),new Vt({type:i.stat_type,ts:i.ts,data:i.data})}),this._sentLogStats=this.queue.map(function(i){var s;return{channelUrl:i.data.channelUrl,messageId:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,action:i.data.action}}),[2]}})})},n.prototype.setConfig=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return this.statConfig=t,this._mergeQueue(),r.notificationStat?(this.enabledState=r.enabledStat?jt.ENABLED:jt.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=jt.DISABLED,[4,this.clear()];case 2:s.sent(),s.label=3;case 3:return this.isEnabled&&this._isSendable?(i=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),[4,Br(i)]):[3,6];case 4:return s.sent(),[4,this._flush(this.queue)];case 5:s.sent(),s.label=6;case 6:return[2]}})})},n.prototype.put=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.enabledState===jt.DISABLED?[2,!0]:(r=this.enabledState===jt.PENDING||this.isFlushing?this.flushWaitQueue:this.queue,this._isDuplicateStat(t)?[2,!0]:(r.push(t),this.enabledState===jt.PENDING?[3,2]:[4,this._save()]));case 1:i.sent(),i.label=2;case 2:return this.isEnabled?(this._mergeQueue(),this.isEnabled&&this._isSendable?[4,this._flush(r)]:[3,4]):[3,4];case 3:return[2,i.sent()];case 4:return[2,!0]}})})},n}(C2),Mx=function(){function e(n){var t=n.cacheContext,r=n.requestQueue,i=n.dispatcher,s=n.logger;this._collectRequestStat=!0,this._collectFeatureLocalCacheStat=!0,this._collectionNotificationStat=!0,this._retryCount=0,this.deviceId=la(),this.cacheContext=t,this.requestQueue=r,this.dispatcher=i,this.logger=s,this._dailyStatCollector=new Nx({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._defaultStatCollector=new Ix({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._realTimeStatCollector=new Ax({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue})}return e.prototype._migration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return[4,this.cacheContext.preference.get(this.key)];case 1:return(n=s.sent())?(t=[],n.statLogs.forEach(function(a){a.stat_type===St.FEATURE_LOCALCACHE&&t.push(new Vt({type:a.stat_type,ts:a.ts,data:a.data}))}),[4,this.cacheContext.preference.set(this.key+".daily",{deviceId:n.deviceId,statLogs:t.map(function(a){return Vt.payloadify(a)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})]):[3,6];case 2:return s.sent(),r=[],n.statLogs.forEach(function(a){a.stat_type!==St.FEATURE_LOCALCACHE&&a.stat_type!==St.NOTIFICATION&&(a.stat_type===St.FEATURE_LOCALCACHE_EVENT&&(a.data=M({message_init_policy:"",starting_point:0},a.data)),r.push(new Vt({type:a.stat_type,ts:a.ts,data:a.data})))}),[4,this.cacheContext.preference.set(this.key+".default",{deviceId:n.deviceId,statLogs:r.map(function(a){return Vt.payloadify(a)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 3:return s.sent(),i=[],n.statLogs.forEach(function(a){var o;a.stat_type===St.NOTIFICATION&&(a.data=be(M(M({},a.data),{message_id:(o=a.data.notificationId)!==null&&o!==void 0?o:a.data.message_id,notificationId:void 0})),i.push(new Vt({type:a.stat_type,ts:a.ts,data:a.data})))}),[4,this.cacheContext.preference.set(this.key+".realtime",{deviceId:n.deviceId,statLogs:i.map(function(a){return Vt.payloadify(a)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 4:return s.sent(),[4,this.cacheContext.preference.remove(this.key)];case 5:s.sent(),s.label=6;case 6:return[2]}})})},e.prototype.init=function(n){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return this.key=n,[4,this._migration()];case 1:return r.sent(),[4,this._dailyStatCollector.init(this.key)];case 2:return r.sent(),[4,this._defaultStatCollector.init(this.key)];case 3:return r.sent(),[4,this._realTimeStatCollector.init(this.key)];case 4:return r.sent(),this.commandEventContext||(this.commandEventContext=this.dispatcher.on(function(i){return y(t,void 0,void 0,function(){var s,a,o,l,u,c;return g(this,function(d){return i instanceof v2?(s=i.statLog,this.put(s)):i instanceof xT&&(a=i.request,o=i.features,l=i.options,u=i.statConfigInfo,this._retryCount=0,this._collectRequestStat=a,this._collectFeatureLocalCacheStat=o==null?void 0:o.localCache,this._collectionNotificationStat=o==null?void 0:o.notification,this._statConfig=u,this._dailyStatCollector.setConfig(this._statConfig.default,{localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:l.ingestion}),this._defaultStatCollector.setConfig(this._statConfig.default,{requestStat:this._collectRequestStat,localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:l.ingestion}),this._realTimeStatCollector.setConfig((c=this._statConfig.realTime)!==null&&c!==void 0?c:this._statConfig.default,{notificationStat:this._collectionNotificationStat,enabledStat:l.ingestion})),[2]})})})),[2]}})})},e.prototype.put=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return t=!0,n instanceof Ou?this._collectFeatureLocalCacheStat?[4,this._dailyStatCollector.put(n)]:[3,2]:[3,3];case 1:t=r.sent(),r.label=2;case 2:return[3,13];case 3:switch(n.type){case St.API_RESULT:case St.WEBSOCKET_CONNECT:return[3,4];case St.FEATURE_LOCALCACHE:case St.FEATURE_LOCALCACHE_EVENT:return[3,7];case St.NOTIFICATION:return[3,10]}return[3,13];case 4:return this._collectRequestStat?[4,this._defaultStatCollector.put(n)]:[3,6];case 5:t=r.sent(),r.label=6;case 6:return[3,13];case 7:return this._collectFeatureLocalCacheStat?[4,this._defaultStatCollector.put(n)]:[3,9];case 8:t=r.sent(),r.label=9;case 9:return[3,13];case 10:return this._collectionNotificationStat?[4,this._realTimeStatCollector.put(n)]:[3,12];case 11:t=r.sent(),r.label=12;case 12:return[3,13];case 13:return t?this._retryCount=0:(this._retryCount++,this._retryCount>20&&(this._dailyStatCollector.enabledState=jt.COLLECT_ONLY,this._defaultStatCollector.enabledState=jt.COLLECT_ONLY,this._realTimeStatCollector.enabledState=jt.COLLECT_ONLY,this.logger.debug(L.statLogUploadLimitExceededError))),[2]}})})},e.prototype.close=function(){this.commandEventContext&&(this.commandEventContext.close(),this.commandEventContext=void 0)},e}();(function(e){e.DELIVERY_RECEIPT="delivery_receipt",e.PUSH_ACKNOWLEDGEMENT="push_acknowledgement"})(h0||(h0={}));var z,xx=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._pushAckedCache={},t}return T(n,e),n.prototype.isAcked=function(t,r){var i,s="".concat(t,"_").concat(r);return(i=this._pushAckedCache[s])!==null&&i!==void 0&&i},n.prototype.markAsAcked=function(t,r){var i="".concat(t,"_").concat(r);this._pushAckedCache[i]=!0},n.prototype.clear=function(){R.of(this._iid).logger.debug("clear push acked cache"),this._pushAckedCache={}},n.prototype.parseData=function(t){var r,i,s,a,o=R.of(this._iid).logger,l=t.sendbird;if(typeof l=="string")try{l=JSON.parse(l)}catch{throw o.info("push notification payload does not contain sendbird payload in JSON format."),L.malformedDataError}if(!l||typeof l!="object")throw o.info("push notification payload does not contain sendbird payload in JSON format."),L.malformedDataError;var u=(r=l.push_tracking_id)!==null&&r!==void 0?r:"",c=l.notification_message_id,d=l.notification_channel_key,h=l.notification_template_key,f=l.notification_event_deadline,p=(i=l.session_key)!==null&&i!==void 0?i:{},m=(s=p==null?void 0:p.key)!==null&&s!==void 0?s:"",b=(a=p==null?void 0:p.topics)!==null&&a!==void 0?a:[];if(typeof u!="string"||u.length===0)throw o.info("push tracking id is not available"),L.malformedDataError;if(typeof c!="string"||c.length===0)throw o.info("message id is not available"),L.malformedDataError;return{pushTrackingId:u,sessionKey:m,sessionTopics:b,messageId:c,channelKey:d,templateKey:h,notificationEventDeadline:f}},n}(Jn),co={},R=function(){function e(n,t){var r,i,s,a,o,l,u,c,d;if(this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map,!co[n]){co[n]=this;var h=(r=t.options)!==null&&r!==void 0?r:new XS,f=this.sdkState={appId:t.appId,appVersion:(i=t.appVersion)!==null&&i!==void 0?i:"",appState:"foreground",userId:void 0,extensions:{},api:{host:(s=t.apiHost)!==null&&s!==void 0?s:"https://api-".concat(t.appId,".sendbird.com")},websocket:{host:(a=t.websocketHost)!==null&&a!==void 0?a:"wss://ws-".concat(t.appId,".sendbird.com"),pingerDisabled:!!t.noPingpong,pingInterval:void 0,pongTimeout:void 0,connectMaxRetry:2,compression:!0,reconnectMaxRetry:-1,reconnectRetryStrategy:new OT,responseTimeout:h.websocketResponseTimeout},sessionTokenRefreshTimeout:h.sessionTokenRefreshTimeout};this.appInfo=void 0,this.subscribedUnreadMessageCount={all:0,feed:0,customTypes:{},ts:0};var p=this.logger=t.logger;this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map;var m=this.cacheContext=new G6({encryption:t.encryption,store:t.store,localCacheEnabled:(o=t.localCacheEnabled)!==null&&o!==void 0&&o,localCacheConfig:(l=t.localCacheConfig)!==null&&l!==void 0?l:new eT});this.debugMode=(u=t.debugMode)!==null&&u!==void 0&&u,this.maxSuperGroupChannelUnreadCount=Wa.DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL,this.useMemberInfoInMessage=h.useMemberInfoInMessage,this.typingIndicatorInvalidateTime=h.typingIndicatorInvalidateTime,this.typingIndicatorThrottle=h.typingIndicatorThrottle,this.concurrentCallLimit=void 0,this.backOffDelay=void 0;var b=this.dispatcher=new q6,v=new V6;this.requestQueue=new Sx(n,{session:v,sdkState:f,dispatcher:b,logger:p,useFetchCompat:t.useFetchCompat}),this.pushNotificationAckManager=new xx(n),this.sessionManager=new Tx({_iid:n,session:v,cacheContext:m,sdkState:f,dispatcher:b,requestQueue:this.requestQueue,logger:p,pushNotificationAckManager:this.pushNotificationAckManager}),this.connectionManager=new vx(n,{sdkState:f,cacheContext:this.cacheContext,connectionHandlers:this.connectionHandlers,dispatcher:b,sessionManager:this.sessionManager,websocketClient:this.requestQueue.commandRouter.websocketClient,disableWebSocketCloseEventHandling:(c=t.disableWebSocketCloseEventHandling)!==null&&c!==void 0&&c,logger:p}),this.statManager=new Mx({cacheContext:this.cacheContext,requestQueue:this.requestQueue,dispatcher:this.dispatcher,logger:p}),this.appStateToggleEnabled=(d=t.appStateToggleEnabled)===null||d===void 0||d}return co[n]}return e.of=function(n){if(co[n])return co[n];throw L.lostInstance},e.clear=function(n){co[n]&&delete co[n]},e.prototype.hasExtension=function(n){return this.sdkState.extensions&&this.sdkState.extensions[n]},e}(),S2=function(){function e(){}return e.prototype.init=function(n,t){var r=t.sdkState,i=t.dispatcher,s=t.sessionManager,a=t.requestQueue,o=t.logger;t.onlineDetector;var l=t.cacheContext;this._iid=n,this._cacheContext=l,this._sdkState=r,this._dispatcher=i,this._sessionManager=s,this._requestQueue=a,this._logger=o},e}();(function(e){e.UNKNOWN="UNKNOWN",e.EVENT_CHANNEL_CREATED="EVENT_CHANNEL_CREATED",e.EVENT_CHANNEL_UPDATED="EVENT_CHANNEL_UPDATED",e.EVENT_CHANNEL_DELETED="EVENT_CHANNEL_DELETED",e.EVENT_CHANNEL_READ="EVENT_CHANNEL_READ",e.EVENT_CHANNEL_DELIVERED="EVENT_CHANNEL_DELIVERED",e.EVENT_CHANNEL_INVITED="EVENT_CHANNEL_INVITED",e.EVENT_CHANNEL_JOINED="EVENT_CHANNEL_JOINED",e.EVENT_CHANNEL_LEFT="EVENT_CHANNEL_LEFT",e.EVENT_CHANNEL_ACCEPTED_INVITE="EVENT_CHANNEL_ACCEPTED_INVITE",e.EVENT_CHANNEL_DECLINED_INVITE="EVENT_CHANNEL_DECLINED_INVITE",e.EVENT_CHANNEL_OPERATOR_UPDATED="EVENT_CHANNEL_OPERATOR_UPDATED",e.EVENT_CHANNEL_BANNED="EVENT_CHANNEL_BANNED",e.EVENT_CHANNEL_UNBANNED="EVENT_CHANNEL_UNBANNED",e.EVENT_CHANNEL_MUTED="EVENT_CHANNEL_MUTED",e.EVENT_CHANNEL_UNMUTED="EVENT_CHANNEL_UNMUTED",e.EVENT_CHANNEL_FROZEN="EVENT_CHANNEL_FROZEN",e.EVENT_CHANNEL_UNFROZEN="EVENT_CHANNEL_UNFROZEN",e.EVENT_CHANNEL_HIDDEN="EVENT_CHANNEL_HIDDEN",e.EVENT_CHANNEL_UNHIDDEN="EVENT_CHANNEL_UNHIDDEN",e.EVENT_CHANNEL_RESET_HISTORY="EVENT_CHANNEL_RESET_HISTORY",e.EVENT_CHANNEL_TYPING_STATUS_UPDATE="EVENT_CHANNEL_TYPING_STATUS_UPDATE",e.EVENT_CHANNEL_MEMBER_COUNT_UPDATED="EVENT_CHANNEL_MEMBER_COUNT_UPDATED",e.EVENT_CHANNEL_METADATA_CREATED="EVENT_CHANNEL_METADATA_CREATED",e.EVENT_CHANNEL_METADATA_UPDATED="EVENT_CHANNEL_METADATA_UPDATED",e.EVENT_CHANNEL_METADATA_DELETED="EVENT_CHANNEL_METADATA_DELETED",e.EVENT_CHANNEL_METACOUNTER_CREATED="EVENT_CHANNEL_METACOUNTER_CREATED",e.EVENT_CHANNEL_METACOUNTER_UPDATED="EVENT_CHANNEL_METACOUNTER_UPDATED",e.EVENT_CHANNEL_METACOUNTER_DELETED="EVENT_CHANNEL_METACOUNTER_DELETED",e.EVENT_MESSAGE_SENT="EVENT_MESSAGE_SENT",e.EVENT_MESSAGE_RECEIVED="EVENT_MESSAGE_RECEIVED",e.EVENT_MESSAGE_UPDATED="EVENT_MESSAGE_UPDATED",e.EVENT_PINNED_MESSAGE_UPDATED="EVENT_PINNED_MESSAGE_UPDATED",e.REQUEST_CHANNEL="REQUEST_CHANNEL",e.REQUEST_CHANNEL_CHANGELOGS="REQUEST_CHANNEL_CHANGELOGS",e.REFRESH_CHANNEL="REFRESH_CHANNEL",e.CHANNEL_LASTACCESSEDAT_UPDATED="CHANNEL_LASTACCESSEDAT_UPDATED",e.SYNC_CHANNEL_BACKGROUND="SYNC_CHANNEL_BACKGROUND",e.SYNC_CHANNEL_CHANGELOGS="SYNC_CHANNEL_CHANGELOGS",e.EVENT_MESSAGE_SENT_SUCCESS="EVENT_MESSAGE_SENT_SUCCESS",e.EVENT_MESSAGE_SENT_FAILED="EVENT_MESSAGE_SENT_FAILED",e.EVENT_MESSAGE_SENT_PENDING="EVENT_MESSAGE_SENT_PENDING",e.EVENT_MESSAGE_DELETED="EVENT_MESSAGE_DELETED",e.EVENT_MESSAGE_FEEDBACK_ADDED="EVENT_MESSAGE_FEEDBACK_ADDED",e.EVENT_MESSAGE_FEEDBACK_UPDATED="EVENT_MESSAGE_FEEDBACK_UPDATED",e.EVENT_MESSAGE_FEEDBACK_DELETED="EVENT_MESSAGE_FEEDBACK_DELETED",e.EVENT_MESSAGE_READ="EVENT_MESSAGE_READ",e.EVENT_MESSAGE_DELIVERED="EVENT_MESSAGE_DELIVERED",e.EVENT_MESSAGE_REACTION_UPDATED="EVENT_MESSAGE_REACTION_UPDATED",e.EVENT_MESSAGE_THREADINFO_UPDATED="EVENT_MESSAGE_THREADINFO_UPDATED",e.EVENT_MESSAGE_OFFSET_UPDATED="EVENT_MESSAGE_OFFSET_UPDATED",e.REQUEST_MESSAGE="REQUEST_MESSAGE",e.EVENT_THREAD_INFO_UPDATED="EVENT_THREADINFO_UPDATED",e.EVENT_POLL_UPDATED="EVENT_POLL_UPDATED",e.EVENT_POLL_VOTED="EVENT_POLL_VOTED",e.SYNC_POLL_CHANGELOGS="SYNC_POLL_CHANGELOGS",e.REQUEST_RESEND_MESSAGE="REQUEST_RESEND_MESSAGE",e.REQUEST_THREADED_MESSAGE="REQUEST_THREADED_MESSAGE",e.REQUEST_MESSAGE_CHANGELOGS="REQUEST_MESSAGE_CHANGELOGS",e.SYNC_MESSAGE_FILL="SYNC_MESSAGE_FILL",e.SYNC_MESSAGE_BACKGROUND="SYNC_MESSAGE_BACKGROUND",e.SYNC_MESSAGE_CHANGELOGS="SYNC_MESSAGE_CHANGELOGS",e.LOCAL_MESSAGE_PENDING_CREATED="LOCAL_MESSAGE_PENDING_CREATED",e.LOCAL_MESSAGE_FAILED="LOCAL_MESSAGE_FAILED",e.LOCAL_MESSAGE_CANCELED="LOCAL_MESSAGE_CANCELED",e.LOCAL_MESSAGE_RESEND_STARTED="LOCAL_MESSAGE_RESEND_STARTED"})(z||(z={}));var Ru;M({},z);var qs=function(e){return e.startsWith("EVENT_")||e.startsWith("LOCAL_MESSAGE_")||e===z.SYNC_MESSAGE_FILL||e===z.SYNC_MESSAGE_CHANGELOGS||e===z.SYNC_POLL_CHANGELOGS},Tt=function(e){function n(t){var r=t.messages,i=t.source,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.messages=r,o.source=i,o.isWebSocketEventComing=a,o}return T(n,e),n}(At),T2=function(e){function n(t){var r=t.messageIds,i=t.source,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.messageIds=r,o.source=i,o.isWebSocketEventComing=a,o}return T(n,e),n}(At),UT=function(e){function n(t){var r=t.event,i=t.source,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.event=r,o.source=i,o.isWebSocketEventComing=a,o}return T(n,e),n}(At),PT=function(e){function n(t){var r=t.event,i=t.source,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.event=r,o.source=i,o.isWebSocketEventComing=a,o}return T(n,e),n}(At),FT=function(e){function n(t){var r=t.reqId,i=t.source,s=e.call(this)||this;return s.reqId=r,s.source=i,s}return T(n,e),n}(At),HT=function(e){function n(t){var r=t.polls,i=t.source,s=e.call(this)||this;return s.polls=r,s.source=i,s}return T(n,e),n}(At),jT=function(e){function n(t){var r=t.event,i=t.source,s=e.call(this)||this;return s.event=r,s.source=i,s}return T(n,e),n}(At),w2=function(e){function n(t){var r=t.event,i=t.source,s=e.call(this)||this;return s.event=r,s.source=i,s}return T(n,e),n}(At);(function(e){e.OPEN="open",e.CLOSED="closed"})(Ru||(Ru={}));var Ox="removed",vv=function(e){switch(e){case"open":return Ru.OPEN;case"closed":return Ru.CLOSED;default:return null}},BT=function(e){return!e||!!e.text&&k("string",e.text)},Ef=function(e){function n(t,r){var i,s,a,o,l,u,c,d=this;return(d=e.call(this,t)||this).pollId=0,d.id=0,d.text=null,d.voteCount=0,d.createdBy=null,d.createdAt=0,d.updatedAt=0,d._lastVotedAt=0,d.pollId=(i=r.poll_id)!==null&&i!==void 0?i:0,d.id=(s=r.id)!==null&&s!==void 0?s:0,d.text=(a=r.text)!==null&&a!==void 0?a:null,d.voteCount=(o=r.vote_count)!==null&&o!==void 0?o:0,d.createdBy=(l=r.created_by)!==null&&l!==void 0?l:null,d.createdAt=(u=r.created_at)!==null&&u!==void 0?u:0,d.updatedAt=(c=r.updated_at)!==null&&c!==void 0?c:0,d}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{vote_count:t.voteCount,poll_id:t.pollId,text:t.text,created_at:t.createdAt,id:t.id,created_by:t.createdBy,updated_at:t.updatedAt})))},n}(Jn),Vi=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v=this;return(v=e.call(this,t)||this).id=0,v.title=null,v.createdAt=0,v.updatedAt=0,v.closeAt=-1,v.status=Ru.CLOSED,v.messageId=0,v.data=null,v.voterCount=-1,v.options=[],v.createdBy=null,v.allowUserSuggestion=!1,v.allowMultipleVotes=!1,v.votedPollOptionIds=[],v.id=(i=r.id)!==null&&i!==void 0?i:0,v.title=(s=r.title)!==null&&s!==void 0?s:null,v.createdAt=(a=r.created_at)!==null&&a!==void 0?a:0,v.updatedAt=(o=r.updated_at)!==null&&o!==void 0?o:0,v.closeAt=(l=r.close_at)!==null&&l!==void 0?l:-1,v.status=(u=vv(r.status))!==null&&u!==void 0?u:Ru.CLOSED,v.messageId=(c=r.message_id)!==null&&c!==void 0?c:0,v.data=(d=r.data)!==null&&d!==void 0?d:null,v.voterCount=(h=r.voter_count)!==null&&h!==void 0?h:-1,v.options=r.options?r.options.map(function(_){return new Ef(v._iid,_)}):[],v.createdBy=(f=r.created_by)!==null&&f!==void 0?f:null,v.allowUserSuggestion=(p=r.allow_user_suggestion)!==null&&p!==void 0&&p,v.allowMultipleVotes=(m=r.allow_multiple_votes)!==null&&m!==void 0&&m,v.votedPollOptionIds=(b=r.voted_option_ids)!==null&&b!==void 0?b:[],v}return T(n,e),n.prototype._applyPollUpdatePayload=function(t){var r,i,s,a,o,l,u,c,d=this;this.title=(r=t.title)!==null&&r!==void 0?r:this.title,this.updatedAt=(i=t.updated_at)!==null&&i!==void 0?i:this.updatedAt,this.closeAt=(s=t.close_at)!==null&&s!==void 0?s:this.closeAt,this.status=(a=vv(t.status))!==null&&a!==void 0?a:this.status,this.data=(o=t.data)!==null&&o!==void 0?o:this.data,this.voterCount=(l=t.voter_count)!==null&&l!==void 0?l:this.voterCount,t.options&&(this.options=t.options.map(function(h){return new Ef(d._iid,h)}),this.votedPollOptionIds=t.options.filter(function(h){return h.vote_count>0}).map(function(h){return h.id})),this.allowUserSuggestion=(u=t.allow_user_suggestion)!==null&&u!==void 0?u:this.allowUserSuggestion,this.allowMultipleVotes=(c=t.allow_multiple_votes)!==null&&c!==void 0?c:this.allowMultipleVotes},n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{id:t.id,title:t.title,created_at:t.createdAt,updated_at:t.updatedAt,close_at:t.closeAt,status:t.status,message_id:t.messageId,data:t.data,voter_count:t.voterCount,options:t.options.map(function(r){return Ef.payloadify(r)}),created_by:t.createdBy,allow_user_suggestion:t.allowUserSuggestion,allow_multiple_votes:t.allowMultipleVotes,voted_option_ids:t.votedPollOptionIds})))},n.prototype.applyPollUpdateEvent=function(t){var r=t._payload.poll;return!(!r||this.id!==r.id||r.updated_at-1){var u=r[l];a>=u._lastVotedAt&&(u.voteCount=o.vote_count,u._lastVotedAt=a)}}),s.req_id&&s.voted_option_ids&&(this.votedPollOptionIds=s.voted_option_ids),typeof s.voter_count=="number"&&(this.voterCount=s.voter_count),!0},n.prototype.serialize=function(){return th(this)},n}(Jn),lo=function(){function e(n,t){var r;this.limit=20,this._isLoading=!1,this._hasNext=!0,this._token="",this._iid=n,this.limit=(r=t.limit)!==null&&r!==void 0?r:20}return Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),e.prototype._validate=function(){return k("number",this.limit)&&this.limit>0},e}(),ca=function(e){function n(t,r,i,s){var a=e.call(this,t,s)||this;return a.channelUrl=r,a.channelType=i,a}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.channelUrl)&&Ve(et,this.channelType)},n}(lo),Rx=function(e){this.pollId=0,this.messageId=0,this.pollId=e.poll_id,this.messageId=e.message_id,this._payload=e},kx=function(e){function n(t){var r=t.title,i=t.optionTexts,s=t.data,a=t.allowUserSuggestion,o=t.allowMultipleVotes,l=t.closeAt,u=e.call(this)||this;return u.method=Y.POST,u.path=ds,u.params={title:r,options:i,data:s,allow_user_suggestion:a,allow_multiple_votes:o,close_at:l},u}return T(n,e),n}(Z),Lx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return T(n,e),n}(le),Dx=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,a=e.call(this)||this;return a.method=Y.GET,a.path="".concat(ds,"/").concat(encodeURIComponent(s)),a.params={channel_url:r,channel_type:i},a}return T(n,e),n}(Z),Ux=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return T(n,e),n}(le),Px=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,a=t.pollOptionId,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(ds,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(a)),o.params={channel_url:r,channel_type:i},o}return T(n,e),n}(Z),Fx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pollOption=new Ef(t,r),i}return T(n,e),n}(le),Hx=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,a=t.token,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/polls/changelogs"),o.params=be({change_ts:s,token:a}),o}return T(n,e),n}(Z),jx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedPolls=r.updated.map(function(s){return function(a,o){return new Vi(a,o)}(t,s)}),i.deletedPollIds=r.deleted.map(function(s){return s}),i.hasMore=r.has_more,i.nextToken=r.next,i}return T(n,e),n}(le),Bx={title:"",optionTexts:[],data:void 0,allowUserSuggestion:void 0,allowMultipleVotes:void 0,closeAt:-1},$T=function(e){return k("string",e.title)&&(n=e.optionTexts,Qe("string",n)&&n.every(function(t){return t.trim()!==""}))&&BT(e.data)&&k("boolean",e.allowUserSuggestion,!0)&&k("boolean",e.allowMultipleVotes,!0)&&k("number",e.closeAt,!0);var n},$x={channelUrl:"",channelType:et.BASE,pollId:0,pollOptionId:0},GT=function(e){return k("string",e.channelUrl)&&e.channelUrl!==""&&Ve(et,e.channelType)&&k("number",e.pollId)&&e.pollId>0&&k("number",e.pollOptionId)&&e.pollOptionId>0},Gx={channelUrl:"",channelType:et.BASE,pollId:0},zT=function(e){return k("string",e.channelUrl)&&e.channelUrl!==""&&Ve(et,e.channelType)&&k("number",e.pollId)},uE={},f0=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.sessionManager,a=t.requestQueue,o=t.logger;this._iid=n,this._sdkState=r,this._sessionManager=s,this._requestQueue=a,this._dispatcher=i,this._logger=o,uE[n]=this}return e.of=function(n){return uE[n]},e.prototype.buildPollFromSerializedData=function(n){var t=Ko(n);return new Vi(this._iid,Vi.payloadify(t))},e.prototype.get=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return Q(zT(n)).throw(L.invalidParameters),t=new Dx(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(Ux).poll]}})})},e.prototype.create=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return Q($T(n)).throw(L.invalidParameters),t=new kx(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(Lx).poll]}})})},e.prototype.getOption=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return Q(GT(n)).throw(L.invalidParameters),t=new Px(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(Fx).pollOption]}})})},e.prototype.getPollChangeLogs=function(n,t,r,i){return i===void 0&&(i=z.SYNC_POLL_CHANGELOGS),y(this,void 0,void 0,function(){var s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return s=new Hx(Ie({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null})),[4,this._requestQueue.send(s)];case 1:return a=h.sent(),o=a.as(jx),l=o.updatedPolls,u=o.deletedPollIds,c=o.hasMore,d=o.nextToken,l.length>0&&this._dispatcher.dispatch(new HT({polls:l,source:i})),[2,{updatedPolls:l,deletedPollIds:u,hasMore:c,token:d}]}})})},e}(),zx=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.token,a=t.limit,o=e.call(this)||this;return o.method=Y.GET,o.path=ds,o.params={channel_url:r,channel_type:i,token:s,limit:a},o}return T(n,e),n}(Z),Vx=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).polls=((i=r.polls)!==null&&i!==void 0?i:[]).map(function(a){return new Vi(t,a)}),s.token=r.next,s}return T(n,e),n}(le),VT=function(e){function n(t,r){return e.call(this,t,r.channelUrl,r.channelType,r)||this}return T(n,e),n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new zx(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Vx),a=s.polls,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),qx=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,a=t.pollOptionId,o=t.token,l=t.limit,u=e.call(this)||this;return u.method=Y.GET,u.path="".concat(ds,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(a),"/voters"),u.params={channel_url:r,channel_type:i,token:o,limit:l},u}return T(n,e),n}(Z),Wx=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).voters=((i=r.voters)!==null&&i!==void 0?i:[]).map(function(a){return new Ze(t,a)}),s.token=r.next,s}return T(n,e),n}(le),qT=function(e){function n(t,r){var i=e.call(this,t,r.channelUrl,r.channelType,r)||this;return i.pollId=r.pollId,i.pollOptionId=r.pollOptionId,i}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("number",this.pollId)&&k("number",this.pollOptionId)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new qx(M(M({},this),{pollId:this.pollId,pollOptionId:this.pollOptionId,token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Wx),a=s.voters,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),xd,da=function(){function e(n,t,r){var i,s;this.width=0,this.height=0,this.realWidth=0,this.realHeight=0,this._requireAuth=!1,this._iid=n,this.plainUrl=t.url,this.width=t.width,this.height=t.height,this.realWidth=(i=t.real_width)!==null&&i!==void 0?i:t.width,this.realHeight=(s=t.real_height)!==null&&s!==void 0?s:t.height,this._requireAuth=r}return e.payloadify=function(n){return be(Ie(n instanceof e?{url:n.plainUrl,width:n.width,height:n.height,real_width:n.realWidth,real_height:n.realHeight}:{url:"",width:n.maxWidth,height:n.maxHeight,real_width:0,real_height:0}))},Object.defineProperty(e.prototype,"url",{get:function(){var n=R.of(this._iid).sessionManager;return this._requireAuth&&n.ekey?"".concat(this.plainUrl,"?auth=").concat(n.ekey):this.plainUrl},enumerable:!1,configurable:!0}),e}(),p0=function(e){function n(t){var r=e.call(this)||this;if(r.method=Y.POST,r.path="".concat(W6),r.params=be({file:t.file,channel_url:t.channelUrl}),t.thumbnailSizes)for(var i=0;i0:void 0,u.lastRepliedAt=(o=r.last_replied_at)!==null&&o!==void 0?o:0,u.updatedAt=(l=r.updated_at)!==null&&l!==void 0?l:0,u}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{reply_count:t.replyCount,unread_message_count:t.unreadReplyCount,member_count:t.memberCount,most_replies:Array.isArray(t.mostRepliedUsers)?t.mostRepliedUsers.map(function(r){return Ze.payloadify(r)}):[],push_enabled:typeof t.isPushNotificationEnabled=="boolean"?t.isPushNotificationEnabled?1:0:void 0,last_replied_at:t.lastRepliedAt,updated_at:t.updatedAt})))},Object.defineProperty(n.prototype,"_isUpdateRequired",{get:function(){return this.unreadReplyCount===void 0||this.isPushNotificationEnabled===void 0},enumerable:!1,configurable:!0}),n.prototype._updateFrom=function(t){var r,i;this.unreadReplyCount=(r=t.unreadReplyCount)!==null&&r!==void 0?r:this.unreadReplyCount,this.isPushNotificationEnabled=(i=t.isPushNotificationEnabled)!==null&&i!==void 0?i:this.isPushNotificationEnabled},n}(Jn);(function(e){e.ADD="add",e.DELETE="delete"})(xd||(xd={}));var Sa,N2=function(e){this.messageId=0,this.operation=null,this.updatedAt=0;var n=k("string",e.msg_id)?parseInt(e.msg_id):e.msg_id,t=e.user_id,r=e.operation?e.operation.toLowerCase():null,i=e.reaction,s=e.updated_at;n&&k("string",t)&&k("string",r)&&Ve(xd,r)&&k("string",i)&&i&&k("number",s)&&(this.messageId=n,this.userId=t,this.key=i,this.operation=r,this.updatedAt=s)},Hh=function(){function e(n){var t,r,i,s=n.key,a=(i=Fe([],Me(n.user_ids),!1))!==null&&i!==void 0?i:[],o=n.updated_at;k("string",s)&&s&&Qe("string",a)&&a.length>0&&k("number",o)&&(this.key=s,this.userIds=a,this.updatedAt=o);var l={};try{for(var u=ge(this.userIds),c=u.next();!c.done;c=u.next())l[c.value]=this.updatedAt}catch(d){t={error:d}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}this._version=l}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.userIds.length===0},enumerable:!1,configurable:!0}),e.payloadify=function(n){return be(Ie({key:n.key,user_ids:n.userIds,updated_at:n.updatedAt}))},e.prototype.applyEvent=function(n){if(n.key===this.key&&this.updatedAt<=n.updatedAt){if(!this._version[n.userId]||this._version[n.userId]<=n.updatedAt){var t=this.userIds.indexOf(n.userId);switch(n.operation){case xd.ADD:t<0&&this.userIds.push(n.userId);break;case xd.DELETE:t>=0&&this.userIds.splice(t,1)}this._version[n.userId]=n.updatedAt}this.updatedAt=Math.max(this.updatedAt,n.updatedAt)}},e}(),cE=function(){function e(n){this.secureUrl=null,this.type=null,this.width=0,this.height=0,this.alt=null,this.url=n.url,n.secure_url&&(this.secureUrl=n.secure_url),n.type&&(this.type=n.type),n.width&&(this.width=n.width),n.height&&(this.height=n.height),n.alt&&(this.alt=n.alt)}return e.payloadify=function(n){var t,r;return be(Ie({url:n.url,secure_url:n.secureUrl,type:n.type,width:(t=n.width)!==null&&t!==void 0?t:0,height:(r=n.height)!==null&&r!==void 0?r:0,alt:n.alt}))},e}(),dE=function(){function e(n){this.title=null,this.url=null,this.description=null,this.defaultImage=null,n["og:title"]&&(this.title=n["og:title"]),n["og:url"]&&(this.url=n["og:url"]),n["og:description"]&&(this.description=n["og:description"]),n["og:image"]&&(this.defaultImage=new cE(n["og:image"]))}return e.payloadify=function(n){return be(Ie({"og:title":n.title,"og:url":n.url,"og:description":n.description,"og:image":n.defaultImage?cE.payloadify(n.defaultImage):null}))},e}(),qi=function(){function e(n){var t,r;this.volume=0,this.name=(t=n.name)!==null&&t!==void 0?t:"default",this.volume=(r=n.volume)!==null&&r!==void 0?r:1}return e.prototype.serialize=function(){return{name:this.name,volume:this.volume}},e.payloadify=function(n){return be(Ie({name:n.name,volume:n.volume}))},e}();(function(e){e.GOOD="good",e.BAD="bad"})(Sa||(Sa={}));var hE,Qo=function(){function e(n){this.id=n.id,this.rating=n.rating,this.comment=n.comment}return e.parseFeedbackStatusFromPayload=function(n){return n&&n.id!==null&&n.rating!==null?"SUBMITTED":"NOT_APPLICABLE"},e.payloadify=function(n){return be(Ie({id:n.id,rating:n.rating,comment:n.comment}))},e}(),ku=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).isBlockedByMe=!1,s.role=Ve(Bi,r.role)?r.role:Bi.NONE,s.isBlockedByMe=(i=r.is_blocked_by_me)!==null&&i!==void 0&&i,s}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{role:t.role,is_blocked_by_me:t.isBlockedByMe})))},n}(Ze),br=function(){function e(n){this.key=n.key,this.value=Qe("string",n.value)?Fe([],Me(n.value),!1):[]}return e.payloadify=function(n){var t;return be(Ie({key:n.key,value:(t=n.value)!==null&&t!==void 0?t:[]}))},e}(),WT=function(e){switch(e){case wt.BASE:return"";case wt.USER:return"MESG";case wt.FILE:return"FILE";case wt.ADMIN:return"ADMM"}},KT=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p=this;(p=e.call(this,t)||this).channelType=et.BASE,p.messageType=wt.BASE,p.mentionType=null,p.mentionedUsers=null,p.mentionedUserIds=null,p.metaArrays=[],p.extendedMessage={},p.createdAt=0,p.updatedAt=0,p.channelUrl=r.channel_url,p.channelType=Ve(et,r.channel_type)?r.channel_type:et.GROUP,r.channel&&(r.channel.channel_url&&(p.channelUrl=r.channel.channel_url),r.channel.channel_type&&(p.channelType=r.channel.channel_type)),p.data=(i=r.data)!==null&&i!==void 0?i:"",p.customType=(s=r.custom_type)!==null&&s!==void 0?s:"",p.mentionType=Ve(lr,r.mention_type)?r.mention_type:null,p.mentionedUsers=r.mentioned_users?r.mentioned_users.map(function(E){return new Ze(p._iid,E)}):null,p.mentionedUserIds=(a=r.mentioned_user_ids)!==null&&a!==void 0?a:null,p.mentionedUsers&&!p.mentionedUserIds&&(p.mentionedUserIds=p.mentionedUsers.map(function(E){return E.userId})),p.mentionedMessageTemplate=(o=r.mentioned_message_template)!==null&&o!==void 0?o:"";var m=(l=r.metaarray)!==null&&l!==void 0?l:{},b=(u=r.metaarray_key_order)!==null&&u!==void 0?u:Object.keys(m).sort(function(E,S){return E.localeCompare(S)});p.metaArrays=[];for(var v=0;v0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSubmittable",{get:function(){return this.fields.every(function(n){return n.isSubmittable})},enumerable:!1,configurable:!0}),e.prototype.getFieldAnswer=function(n){var t;return(t=this.answers)===null||t===void 0?void 0:t[n]},e.payloadify=function(n){var t;return be(Ie({key:(t=n.formKey)!==null&&t!==void 0?t:n.key,fields:n.fields.map(function(r){return QT.payloadify(r)})}))},e.isFormPayload=function(n){var t;return!!(!((t=n==null?void 0:n.forms)===null||t===void 0)&&t[0])},e}(),QT=function(){function e(n){this.key=n.key,this.inputType=n.input_type,this.title=n.title,this.required=n.required,this.regex=n.regex,this.placeholder=n.placeholder,this.fieldKey=n.key}return e.prototype.isValid=function(n){if(!this.regex)return!0;try{return new RegExp(this.regex).test(n)}catch{return!0}},Object.defineProperty(e.prototype,"isSubmittable",{get:function(){return!(this.temporaryAnswer!=null&&!this.isValid(this.temporaryAnswer)||this.required&&this.temporaryAnswer==null)},enumerable:!1,configurable:!0}),e.payloadify=function(n){var t;return be(Ie({key:(t=n.fieldKey)!==null&&t!==void 0?t:n.key,input_type:n.inputType,title:n.title,required:n.required,regex:n.regex,placeholder:n.placeholder}))},e}(),YT=function(e){function n(t,r){var i,s,a=this;return(a=e.call(this,t)||this).channelUrl=(i=r.channel_url)!==null&&i!==void 0?i:"",a.channelType=(s=r.channel_type)!==null&&s!==void 0?s:et.GROUP,a.reader=new Ze(a._iid,r.user),a.readAt=r.ts,a}return T(n,e),n}(Jn),Kx=function(e){function n(t){var r=t.channelUrl;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:r}})||this}return T(n,e),n}(Rr);(function(e){function n(t){var r=e.call(this)||this,i=t.channelUrl,s=t.channelType,a=t.userId,o=t.notificationIds;return r.method=Y.PUT,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/messages/mark_as_read"),r.params=be(Ie({user_id:a,message_ids:o})),r}return T(n,e),n})(Z);var ZT=function(e){function n(t,r,i){var s=e.call(this,t,"READ",i)||this;return s.readStatus=new YT(t,i),s}return T(n,e),n}(Et);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.readAt=r.ts,i.unreadMessageCount=r.unread_message_count,i}return T(n,e),n})(le);var Qx=function(e){function n(t){var r=t.channelUrl,i=t.messageId;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:r,parent_message_id:i}})||this}return T(n,e),n}(Rr),Yx=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.pushEnabled,o=e.call(this)||this;return o.method=Y.PUT,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/thread_push"),o.params={push_enabled:a},o}return T(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(le);var fE=function(e){function n(t){var r=e.call(this)||this;return r.method=Y.POST,r.path="".concat(cr,"/").concat(encodeURIComponent(t.channelUrl),"/messages/").concat(t.messageId,"/submit_forms"),r.params=be({forms:t.forms}),r}return T(n,e),n}(Z),Zx=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.rating,o=t.comment,l=e.call(this)||this;return l.method=Y.POST,l.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks"),l.params={rating:a,comment:o},l}return T(n,e),n}(Z),Xx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new Qo(r),i}return T(n,e),n}(le),Jx=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.feedbackId,o=t.rating,l=t.comment,u=e.call(this)||this;return u.method=Y.PUT,u.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(a),u.params={rating:o,comment:l},u}return T(n,e),n}(Z),eO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new Qo(r),i}return T(n,e),n}(le),tO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.feedbackId,o=e.call(this)||this;return o.method=Y.DELETE,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(a),o}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new Qo(r),i}T(n,e)})(le);var Ua,_i,gv=function(e){function n(t,r){var i,s,a,o,l,u=this;return(u=e.call(this,t)||this).plainUrl="",u.fileName=null,u.mimeType=null,u.fileSize=0,u.thumbnails=[],u._requireAuth=!1,u.plainUrl=(i=r.url)!==null&&i!==void 0?i:"",u.fileName=(s=r.file_name)!==null&&s!==void 0?s:null,u.mimeType=(a=r.file_type)!==null&&a!==void 0?a:null,u.fileSize=(o=r.file_size)!==null&&o!==void 0?o:0,u._requireAuth=(l=r.require_auth)!==null&&l!==void 0&&l,u.thumbnails=r.thumbnails?r.thumbnails.map(function(c){var d;return new da(u._iid,typeof c=="string"?{url:c,width:0,height:0}:M(M({},c),{url:((d=c.url)!==null&&d!==void 0?d:"").split("auth=")[0]}),u._requireAuth)}):[],u}return T(n,e),n.payloadify=function(t){var r;return be(Ie({url:t.plainUrl,file_name:t.fileName,file_type:t.mimeType,file_size:t.fileSize,thumbnails:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){var s;return{url:((s=i.plainUrl)!==null&&s!==void 0?s:"").split("auth=")[0],width:i.width,height:i.height,real_width:i.realWidth,real_height:i.realHeight}}),require_auth:t._requireAuth}))},Object.defineProperty(n.prototype,"url",{get:function(){var t=R.of(this._iid).sessionManager;return this._requireAuth&&t.ekey?"".concat(this.plainUrl,"?auth=").concat(t.ekey):this.plainUrl},enumerable:!1,configurable:!0}),n}(Jn),XT=function(e){var n=e.channelUrl,t=e.channelType,r=e.parentMessage;this.channelUrl=n,this.channelType=t,this.parentMessage=r};(function(e){e.PENDING="pending",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled"})(Ua||(Ua={})),function(e){e.PENDING="pending",e.IN_QUEUE="in_queue",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled",e.REMOVED="removed"}(_i||(_i={}));var ko,vr=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p=this;return(p=e.call(this,t,r)||this).parentMessage=null,p.silent=!1,p.isOperatorMessage=!1,p.threadInfo=null,p.reactions=[],p.appleCriticalAlertOptions=null,p.scheduledInfo=null,p.suggestedReplies=null,p.myFeedback=null,p.myFeedbackStatus="NOT_APPLICABLE",p.forms=null,p._isContinuousMessages=!1,p._scheduledStatus=null,p.messageId=(s=(i=r.msg_id)!==null&&i!==void 0?i:r.message_id)!==null&&s!==void 0?s:0,p.parentMessageId=(a=typeof r.parent_message_id=="string"?parseInt(r.parent_message_id):r.parent_message_id)!==null&&a!==void 0?a:0,p.threadInfo=r.thread_info?new m0(p._iid,r.thread_info):null,p.reactions=r.reactions?r.reactions.map(function(m){return new Hh(m)}):[],p.ogMetaData=r.og_tag?new dE(r.og_tag):null,p.silent=(o=r.silent)!==null&&o!==void 0&&o,p.isOperatorMessage=(l=r.is_op_msg)!==null&&l!==void 0&&l,p.appleCriticalAlertOptions=r.apple_critical_alert_options?new qi(r.apple_critical_alert_options):null,typeof r.scheduled_message_id=="number"&&typeof r.scheduled_at=="number"&&r.scheduled_status&&(p.scheduledInfo={scheduledMessageId:r.scheduled_message_id,scheduledAt:r.scheduled_at},p._scheduledStatus=r.scheduled_status),p._isContinuousMessages=(u=r.is_continuous_messages)!==null&&u!==void 0&&u,p.myFeedback=!((c=r.feedback)===null||c===void 0)&&c.id?new Qo(r.feedback):null,p.myFeedbackStatus=(d=r.my_feedback_status)!==null&&d!==void 0?d:Qo.parseFeedbackStatusFromPayload(r.feedback),p.suggestedReplies=(f=(h=r.extended_message_payload)===null||h===void 0?void 0:h.suggested_replies)!==null&&f!==void 0?f:null,p.forms=jh.isFormPayload(r.extended_message_payload)?r.extended_message_payload.forms.map(function(m){return new jh(p.messageId,m.key,m.fields.map(function(b){return new QT(b)}))}):null,p}return T(n,e),n.payloadify=function(t){var r,i;return be(Ie(M(M({},e.payloadify.call(this,t)),{message_id:t.messageId,parent_message_id:t.parentMessageId,thread_info:t.threadInfo?m0.payloadify(t.threadInfo):null,reactions:t.reactions.map(function(s){return Hh.payloadify(s)}),og_tag:t.ogMetaData?dE.payloadify(t.ogMetaData):null,silent:t.silent,is_op_msg:t.isOperatorMessage,apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,scheduled_message_id:(r=t.scheduledInfo)===null||r===void 0?void 0:r.scheduledMessageId,scheduled_at:(i=t.scheduledInfo)===null||i===void 0?void 0:i.scheduledAt,scheduled_status:t._scheduledStatus,feedback:t.myFeedback?Qo.payloadify(t.myFeedback):null,my_feedback_status:t.myFeedbackStatus,forms:t.forms?t.forms.map(function(s){return jh.payloadify(s)}):null})))},n._getParentMessageInfoPayload=function(t){return be(Ie({type:WT(t.messageType),ts:t.createdAt,user:t.sender?ku.payloadify(t.sender):null,message:t.message,file:{url:t.plainUrl,name:t.name,type:t.type,require_auth:t.requireAuth},files:Array.isArray(t.fileInfoList)?t.fileInfoList.map(function(r){return gv.payloadify(r)}):null}))},n.prototype.isIdentical=function(t){return this.messageId===t.messageId},n.prototype.applyThreadInfoUpdateEvent=function(t){return this.messageId===t.targetMessageId&&(t.threadInfo._isUpdateRequired&&this.threadInfo&&t.threadInfo._updateFrom(this.threadInfo),this.threadInfo=t.threadInfo,!0)},n.prototype.applyReactionEvent=function(t){if(this.messageId===t.messageId){for(var r=!1,i=0;i=r)return this.parentMessage=t,!0}return!1},n.prototype._triggerThreadInfoUpdatedEvent=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){return(t=R.of(this._iid).dispatcher).dispatch(new XT({channelType:et.GROUP,channelUrl:this.channelUrl,parentMessage:this})),t.dispatch(new Tt({messages:[this],source:z.EVENT_MESSAGE_THREADINFO_UPDATED})),[2]})})},n.prototype.markThreadAsRead=function(){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=R.of(this._iid).requestQueue,r=new Qx({channelUrl:this.channelUrl,messageId:this.messageId}),[4,t.send(r)];case 1:return i.sent(),this.threadInfo&&this.threadInfo.unreadReplyCount!==0?(this.threadInfo.unreadReplyCount=0,[4,this._triggerThreadInfoUpdatedEvent()]):[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},n.prototype.setPushNotificationEnabled=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return r=R.of(this._iid).requestQueue,i=new Yx({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,pushEnabled:t}),[4,r.send(i)];case 1:return s.sent(),this.threadInfo&&this.threadInfo.isPushNotificationEnabled!==t&&(this.threadInfo.isPushNotificationEnabled=t),[2]}})})},n.prototype.submitForm=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:if(Q(t.form&&t.form instanceof jh||k("string",t.formId)&&k("object",t.answers)).throw(L.invalidParameters),r=R.of(this._iid),i=r.requestQueue,s=r.sdkState,a=r.logger,!t.form)return[3,2];if(!(o=t.form).isSubmittable)throw new L({code:Ae.INVALID_PARAMETER,message:"The given form is not submittable."});if(o.isSubmitted)throw new L({code:Ae.INVALID_PARAMETER,message:"The given form is already submitted."});if(o.messageId!=this.messageId)throw new L({code:Ae.INVALID_PARAMETER,message:"This form does not belong to the message."});return l=o.fields.reduce(function(d,h){return d[h.key]=h.temporaryAnswer,d},{}),u=new fE({userId:s.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:o.key,data:l}]}),[4,i.send(u)];case 1:return c.sent(),[3,4];case 2:return t.formId&&t.answers?(a.warn("The submitForm method with formId and answers is deprecated. Use submitForm({ form: Form }) instead."),u=new fE({userId:s.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:t.formId,data:t.answers}]}),[4,i.send(u)]):[3,4];case 3:c.sent(),c.label=4;case 4:return[2]}})})},n.prototype.submitFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=R.of(this._iid),i=r.requestQueue,s=r.dispatcher,a=new Zx({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,rating:t.rating,comment:t.comment}),[4,i.send(a)];case 1:return o=u.sent(),l=o.as(Xx),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new Tt({messages:[this],source:z.EVENT_MESSAGE_FEEDBACK_ADDED})),[2]}})})},n.prototype.updateFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=R.of(this._iid),i=r.requestQueue,s=r.dispatcher,a=new Jx({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:t.id,rating:t.rating,comment:t.comment}),[4,i.send(a)];case 1:return o=u.sent(),l=o.as(eO),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new Tt({messages:[this],source:z.EVENT_MESSAGE_FEEDBACK_UPDATED})),[2]}})})},n.prototype.deleteFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=R.of(this._iid),i=r.requestQueue,s=r.dispatcher,a=new tO({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:t}),[4,i.send(a)];case 1:return o.sent(),this.myFeedback=null,this.myFeedbackStatus="NO_FEEDBACK",s.dispatch(new Tt({messages:[this],source:z.EVENT_MESSAGE_FEEDBACK_DELETED})),[2]}})})},n}(KT),Ht=function(e){function n(t,r){var i,s,a,o,l=this;if((l=e.call(this,t,r)||this).reqId="",l.replyToChannel=!1,l.errorCode=0,l.sender=r.user?new ku(l._iid,r.user):r.sender_id,l.reqId=(s=(i=r.req_id)!==null&&i!==void 0?i:r.request_id)!==null&&s!==void 0?s:"",l.replyToChannel=(a=r.is_reply_to_channel)!==null&&a!==void 0&&a,r.request_state&&Ve(ht,r.request_state)&&(l.sendingStatus=r.request_state),!l.sendingStatus)if(l.messageId>0)l.sendingStatus=ht.SUCCEEDED;else if(l.scheduledInfo)switch(r.scheduled_status&&(l._scheduledStatus=r.scheduled_status),r.scheduled_status){case _i.SENT:case _i.IN_QUEUE:l.sendingStatus=ht.SUCCEEDED;break;case _i.PENDING:l.sendingStatus=ht.SCHEDULED;break;case _i.FAILED:case _i.REMOVED:l.sendingStatus=ht.FAILED;break;case _i.CANCELED:l.sendingStatus=ht.CANCELED}else l.sendingStatus=ht.PENDING;return l.errorCode=(o=r.error_code)!==null&&o!==void 0?o:0,l._messageToken=r.mesg_token,l}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{user:ku.payloadify(t.sender),req_id:t.reqId,is_reply_to_channel:t.replyToChannel,request_state:t.sendingStatus,error_code:t.errorCode,mesg_token:t._messageToken})))},Object.defineProperty(n.prototype,"isResendable",{get:function(){return(this.sendingStatus===ht.FAILED||this.sendingStatus===ht.CANCELED)&&B6(this.errorCode)},enumerable:!1,configurable:!0}),n.prototype.isIdentical=function(t){return this.messageId>0&&t.messageId>0?this.messageId===t.messageId:this.reqId===t.reqId},n}(vr),nh={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:ar.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1},yp=function(e){return k("number",e.prevResultSize)&&k("number",e.nextResultSize)&&k("boolean",e.isInclusive)&&k("boolean",e.reverse)&&k("string",e.messageTypeFilter)&&Ve(ar,e.messageTypeFilter)&&Qe("string",e.customTypesFilter,!0)&&Qe("string",e.senderUserIdsFilter,!0)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeReactions)&&k("boolean",e.includeParentMessageInfo)},Lu=function(e){function n(t,r){var i,s,a,o,l=this;if((l=e.call(this,t,r)||this).translations={},l.message=(i=r.message)!==null&&i!==void 0?i:"",l.messageType=wt.ADMIN,l.translations=(s=r.translations)!==null&&s!==void 0?s:{},r.parent_message_info){var u=r.parent_message_info;l.parentMessage=Tr(t,be(Ie(M(M({},u),{message_id:l.parentMessageId,channel_url:l.channelUrl,channel_type:l.channelType,file:u.file,url:(a=u.file)===null||a===void 0?void 0:a.url,require_auth:(o=u.file)===null||o===void 0?void 0:o.require_auth}))))}return l}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{message:t.message,translations:t.translations,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},nh),r),Q(this.messageId>0&&k("number",t)&&yp(i)).throw(L.invalidParameters),[4,Ln.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(vr),pE=function(){function e(n){var t,r;this.detail={},this.type=(t=n.type)!==null&&t!==void 0?t:"",this.vendor=(r=n.vendor)!==null&&r!==void 0?r:"",n.detail&&k("object",n.detail)&&!Array.isArray(n.detail)&&(this.detail=n.detail)}return e.payloadify=function(n){return be(Ie({type:n.type,vendor:n.vendor,detail:n.detail}))},e}(),_E=function(){function e(n){this.status=n.status,n.original_message_info&&(this.originalMessageInfo={createdAt:n.original_message_info.ts,messageId:n.original_message_info.id})}return e.payloadify=function(n){return be({status:n.status,original_message_info:n.originalMessageInfo?{id:n.originalMessageInfo.messageId,ts:n.originalMessageInfo.createdAt}:void 0})},e}(),sr=function(e){function n(t,r){var i,s,a,o,l,u,c,d=this;if((d=e.call(this,t,r)||this).message="",d.messageParams=null,d.translations={},d.translationTargetLanguages=[],d.messageSurvivalSeconds=-1,d.plugins=[],d._poll=null,d.message=r.message,d.messageType=wt.USER,d.translations=(a=r.translations)!==null&&a!==void 0?a:{},d.translationTargetLanguages=(o=r.target_langs)!==null&&o!==void 0?o:[],Object.keys(d.translations).length===0&&d.translationTargetLanguages.length>0)try{for(var h=ge(d.translationTargetLanguages),f=h.next();!f.done;f=h.next()){var p=f.value;d.translations[p]=""}}catch(b){i={error:b}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}if(d.messageSurvivalSeconds=(l=r.message_survival_seconds)!==null&&l!==void 0?l:-1,d.plugins=r.plugins?r.plugins.map(function(b){return new pE(b)}):[],d._poll=r.poll?new Vi(d._iid,r.poll):null,r.parent_message_info){var m=r.parent_message_info;d.parentMessage=Tr(t,be(Ie(M(M({},m),{created_at:m.ts,message_id:d.parentMessageId,channel_url:d.channelUrl,channel_type:d.channelType,file:m.file,url:(u=m.file)===null||u===void 0?void 0:u.url,require_auth:(c=m.file)===null||c===void 0?void 0:c.require_auth}))))}return r.review_info&&(d.messageReviewInfo=new _E(r.review_info)),d}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{message:t.message,translations:t.translations,message_survival_seconds:t.messageSurvivalSeconds,plugins:t.plugins.map(function(r){return pE.payloadify(r)}),poll:t._poll?Vi.payloadify(t._poll):null,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null,review_info:t.messageReviewInfo?_E.payloadify(t.messageReviewInfo):void 0})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},nh),r),Q(this.messageId>0&&k("number",t)&&yp(i)).throw(L.invalidParameters),[4,Ln.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n.prototype.applyPoll=function(t){return!(this._poll&&this._poll.id===t.id&&this._poll.updatedAt>t.updatedAt)&&(this._poll=t,!0)},Object.defineProperty(n.prototype,"poll",{get:function(){return this._poll},enumerable:!1,configurable:!0}),n}(Ht),yi=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h=this;if((h=e.call(this,t,r)||this).messageParams=null,h.fileInfoList=[],h.messageSurvivalSeconds=-1,h.messageType=wt.FILE,h.data=(a=(s=(i=r.file)===null||i===void 0?void 0:i.data)!==null&&s!==void 0?s:r.custom)!==null&&a!==void 0?a:"",h.fileInfoList=(l=(o=r.files)===null||o===void 0?void 0:o.map(function(p){return new gv(t,p)}))!==null&&l!==void 0?l:[],h.messageSurvivalSeconds=(u=r.message_survival_seconds)!==null&&u!==void 0?u:-1,r.parent_message_info){var f=r.parent_message_info;h.parentMessage=Tr(t,be(Ie(M(M({},f),{created_at:f.ts,message_id:h.parentMessageId,channel_url:h.channelUrl,channel_type:h.channelType,file:f.file,url:(c=f.file)===null||c===void 0?void 0:c.url,require_auth:(d=f.file)===null||d===void 0?void 0:d.require_auth}))))}return h}return T(n,e),n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},nh),r),Q(this.messageId>0&&k("number",t)&&yp(i)).throw(L.invalidParameters),[4,Ln.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n.payloadify=function(t){var r,i,s,a,o,l;return be(Ie(M(M({},e.payloadify.call(this,t)),{file:{name:(i=(r=t.fileInfoList[0])===null||r===void 0?void 0:r.fileName)!==null&&i!==void 0?i:"",size:(a=(s=t.fileInfoList[0])===null||s===void 0?void 0:s.fileSize)!==null&&a!==void 0?a:0,type:(l=(o=t.fileInfoList[0])===null||o===void 0?void 0:o.mimeType)!==null&&l!==void 0?l:"",data:t.data},files:Array.isArray(t.fileInfoList)?t.fileInfoList.map(function(u){return gv.payloadify(u)}):null,message_survival_seconds:t.messageSurvivalSeconds,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},n._isMultipleFilesMessagePayload=function(t){var r=t.files;return Array.isArray(r)&&r.length>=2},n._isMultipleFilesMessageSerializedData=function(t){var r=t.fileInfoList;return Array.isArray(r)},n}(Ht);(function(e){e.SENT="SENT",e.READ="READ"})(ko||(ko={}));var al=function(e){function n(t,r){var i,s,a=this;if((a=e.call(this,t,r)||this).notificationData=null,a.notificationId=r.notification_message_id,a.messageType=wt.ADMIN,a.messageStatus=(i=r.message_status)!==null&&i!==void 0?i:ko.SENT,a.priority=(s=r.priority)!==null&&s!==void 0?s:lv.NORMAL,a.notificationEventDeadline=r.notification_event_deadline,a.extendedMessage.sub_type===0)try{var o=JSON.parse(a.extendedMessage.sub_data),l=o.label,u=o.tags,c=u===void 0?[]:u,d=o.template_key,h=o.template_variables;a.notificationData={label:l,tags:c,templateKey:d,templateVariables:h}}catch{}return a}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{notification_message_id:t.notificationId,message_status:t.messageStatus,priority:t.priority,notification_event_deadline:t.notificationEventDeadline})))},n.prototype.isIdentical=function(t){return this.notificationId===t.notificationId},n}(KT),mE=function(e){if(e.notificationId)return al.payloadify(e);switch(e.messageType){case wt.USER:return sr.payloadify(e);case wt.FILE:return e.fileInfoList?yi.payloadify(e):nn.payloadify(e);case wt.ADMIN:return Lu.payloadify(e);default:throw L.unknown}},Tr=function(e,n){if(n.notification_message_id)return new al(e,n);switch(n.type){case"MESG":return new sr(e,n);case"FILE":return yi._isMultipleFilesMessagePayload(n)?new yi(e,n):new nn(e,n);case"ADMM":case"BRDM":return new Lu(e,n);default:return null}},nn=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_=this;(_=e.call(this,t,r)||this).messageParams=null,_.plainUrl="",_.requireAuth=!1,_.thumbnails=[],_.messageSurvivalSeconds=-1,_.messageType=wt.FILE;var E=r.file;if(_.plainUrl=((s=(i=E==null?void 0:E.url)!==null&&i!==void 0?i:r.url)!==null&&s!==void 0?s:"").split("?auth=")[0],_.name=(o=(a=E==null?void 0:E.name)!==null&&a!==void 0?a:r.name)!==null&&o!==void 0?o:"File",_.size=(u=(l=E==null?void 0:E.size)!==null&&l!==void 0?l:r.size)!==null&&u!==void 0?u:0,_.data=(d=(c=E==null?void 0:E.data)!==null&&c!==void 0?c:r.custom)!==null&&d!==void 0?d:"",_.type=E?(h=E.type)!==null&&h!==void 0?h:"":(f=r.type)!==null&&f!==void 0?f:"",_.requireAuth=(p=r.require_auth)!==null&&p!==void 0&&p,_.thumbnails=r.thumbnails?r.thumbnails.map(function(w){var N;return new da(_._iid,typeof w=="string"?{url:w,width:0,height:0}:M(M({},w),{url:((N=w.url)!==null&&N!==void 0?N:"").split("auth=")[0]}),_.requireAuth)}):[],_.messageSurvivalSeconds=(m=r.message_survival_seconds)!==null&&m!==void 0?m:-1,r.parent_message_info){var S=r.parent_message_info;_.parentMessage=Tr(t,be(Ie(M(M({},S),{created_at:S.ts,message_id:_.parentMessageId,channel_url:_.channelUrl,channel_type:_.channelType,file:S.file,url:(b=S.file)===null||b===void 0?void 0:b.url,require_auth:(v=S.file)===null||v===void 0?void 0:v.require_auth}))))}return _}return T(n,e),n.payloadify=function(t){var r;return be(Ie(M(M({},e.payloadify.call(this,t)),{url:t.plainUrl,require_auth:t.requireAuth,file:{name:t.name,size:t.size,type:t.type,data:t.data},thumbnails:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){return{url:i.plainUrl,width:i.width,height:i.height,real_width:i.realWidth,real_height:i.realHeight}}),message_survival_seconds:t.messageSurvivalSeconds,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},Object.defineProperty(n.prototype,"url",{get:function(){var t=R.of(this._iid).sessionManager;return this.requireAuth&&t.ekey?"".concat(this.plainUrl,"?auth=").concat(t.ekey):this.plainUrl},enumerable:!1,configurable:!0}),n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},nh),r),Q(this.messageId>0&&k("number",t)&&yp(i)).throw(L.invalidParameters),[4,Ln.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(Ht),v0=function(e){function n(t,r){var i=r.file,s=r.fileUrl,a=r.fileName,o=r.fileSize,l=r.mimeType,u=r.thumbnailSizes,c=r._uploadedMetaData,d=r._thumbnails,h=e.call(this,t)||this;return h._plainUrl=s,h.file=i,h.fileName=a,h.fileSize=o,h.mimeType=l,h.thumbnailSizes=u,h._uploadedMetaData=c,h._thumbnails=d,h}return T(n,e),n.getPlainUrl=function(t){return t instanceof n?t._plainUrl:t.fileUrl},Object.defineProperty(n.prototype,"fileUrl",{get:function(){var t,r=R.of(this._iid).sessionManager;return this._plainUrl&&(!((t=this._uploadedMetaData)===null||t===void 0)&&t.requireAuth)&&r.ekey?"".concat(this._plainUrl,"?auth=").concat(r.ekey):this._plainUrl},set:function(t){this._plainUrl=t},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return{file:this.file,fileUrl:this._plainUrl,fileName:this.fileName,fileSize:this.fileSize,mimeType:this.mimeType,thumbnailSizes:this.thumbnailSizes,_thumbnails:this._thumbnails,_uploadedMetaData:this._uploadedMetaData}},n}(Jn),nO=function(e){function n(t){var r,i,s,a,o=[];return t.mentionType===lr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(l){return l.userId}))),e.call(this,{code:"FILE",ackRequired:!0,payload:be(Ie({channel_url:t.channelUrl,files:t.files?ew(t.files):null,url:t.url,name:(r=t.fileName)!==null&&r!==void 0?r:"",type:(i=t.mimeType)!==null&&i!==void 0?i:"",size:(s=t.fileSize)!==null&&s!==void 0?s:0,custom:t.data,custom_type:t.customType,thumbnails:(a=t._thumbnails)===null||a===void 0?void 0:a.map(function(l){return da.payloadify(l)}),require_auth:t.requireAuth,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:o,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==cs.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,silent:t.silent,reply_to_channel:t.isReplyToChannel,parent_message_id:t.parentMessageId?t.parentMessageId:null,req_id:t.reqId,pin_message:t.isPinnedMessage}))})||this}return T(n,e),n}(Rr),rO=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var a=[];return t.mentionType===lr.USERS&&(t.mentionedUserIds?a=t.mentionedUserIds:t.mentionedUsers&&(a=t.mentionedUsers.map(function(o){return o.userId}))),s.method=Y.POST,s.path="".concat(nt(t.channelType),"/").concat(encodeURIComponent(t.channelUrl),"/messages"),s.params=be(Ie({message_type:wt.FILE,user_id:t.userId,files:t.files?ew(t.files):null,url:t.fileUrl,mention_type:t.mentionType,mentioned_user_ids:a,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,data:t.data,custom_type:t.customType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(o){return da.payloadify(o)}),require_auth:t.requireAuth,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(o){return br.payloadify(o)}),push_option:t.pushNotificationDeliveryOption,parent_message_id:t.parentMessageId?t.parentMessageId:null,apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,reply_to_channel:t.isReplyToChannel,req_id:t.reqId,pin_message:t.isPinnedMessage})),s}return T(n,e),n}(Z),JT=function(e){function n(t,r,i){var s,a,o,l,u=this;(u=e.call(this,t,"FILE",i)||this).message=i.files&&i.files.length>=2?new yi(t,i):new nn(t,i);var c=R.of(t).sdkState;return u.isMentioned=Au(u.message.mentionType,(o=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(a=u.message.mentionedUsers)===null||a===void 0?void 0:a.map(function(d){return d.userId}))!==null&&o!==void 0?o:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return T(n,e),n}(Et),iO=function(e){function n(t,r){var i,s,a,o,l=this;(l=e.call(this,t,r)||this).message=r.files&&r.files.length>=2?new yi(t,r):new nn(t,r);var u=R.of(t).sdkState;return l.isMentioned=Au(l.message.mentionType,(a=(i=l.message.mentionedUserIds)!==null&&i!==void 0?i:(s=l.message.mentionedUsers)===null||s===void 0?void 0:s.map(function(c){return c.userId}))!==null&&a!==void 0?a:[],u.userId),l.forceUpdateLastMessage=(o=r.force_update_last_message)!==null&&o!==void 0&&o,l}return T(n,e),n}(le);function ew(e){return e.map(function(n){var t,r;return be(Ie({url:v0.getPlainUrl(n),file_name:n.fileName,file_type:n.mimeType,file_size:n.fileSize,thumbnails:(t=n._thumbnails)===null||t===void 0?void 0:t.map(function(i){return da.payloadify(i)}),require_auth:(r=n._uploadedMetaData)===null||r===void 0?void 0:r.requireAuth}))})}var Mn;(function(e){e[e.PENDING=0]="PENDING",e[e.UPLOADING=1]="UPLOADING",e[e.UPLOADED=2]="UPLOADED",e[e.SENDING=3]="SENDING",e[e.FAILED=4]="FAILED"})(Mn||(Mn={}));var sO=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.requestQueue,a=t.onlineDetector,o=t.cacheContext,l=this;this._queueMap=new Map,this._iid=n,this._sdkState=r,this._requestQueue=s,this._cacheContext=o,this._dispatcher=i,this._dispatcher.on(function(u){u instanceof Ii&&(l._connectionState=u.stateType)}),this._onlineDetector=a}return Object.defineProperty(e.prototype,"_shouldSendThroughWebSocket",{get:function(){return this._connectionState===lt.CONNECTED||this._connectionState===lt.CONNECTING||this._connectionState===lt.RECONNECTING},enumerable:!1,configurable:!0}),e.prototype._sendFileMessage=function(n,t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(a){switch(a.label){case 0:return r=this._createSendFileMessageRequestParams(n,t),this._shouldSendThroughWebSocket?(i=new nO(r),[4,this._requestQueue.send(i)]):[3,2];case 1:return s=a.sent(),[2,s.as(JT).message];case 2:return i=new rO(M(M({},r),{userId:this._sdkState.userId})),[4,this._requestQueue.send(i)];case 3:return s=a.sent(),[2,s.as(iO).message]}})})},e.prototype._createSendFileMessageRequestParams=function(n,t){var r=M(M({},t.params),{channelUrl:n.url,channelType:n.channelType,reqId:t.requestId,url:""});if(t.multipleFileUploadInfo){var i=t.params;r.files=i.fileInfoList}else i=t.params,r.url=i.fileUrl,r.requireAuth=i.requireAuth;return r},e.prototype._resolveMessageQueue=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p,m;return g(this,function(b){switch(b.label){case 0:if(!(r=this._queueMap.get(n.url)))return[3,21];if(r.isResolving)return[3,20];r.isResolving=!0,i=[],s=!0,b.label=1;case 1:b.trys.push([1,15,16,17]),a=ge(r.messageQueue),o=a.next(),b.label=2;case 2:if(o.done)return[3,14];switch(l=o.value,l.state){case Mn.PENDING:case Mn.UPLOADING:return[3,3];case Mn.UPLOADED:return[3,4];case Mn.FAILED:return[3,12]}return[3,13];case 3:return s=!1,i.push(l),[3,13];case 4:if(!s)return[3,10];b.label=5;case 5:return b.trys.push([5,8,,9]),l.state=Mn.SENDING,[4,this._sendFileMessage(n,l)];case 6:return u=b.sent(),l.deferred.resolve(u),[4,Br(100)];case 7:return b.sent(),[3,9];case 8:return c=b.sent(),l.deferred.reject(c),[3,9];case 9:return[3,11];case 10:i.push(l),b.label=11;case 11:return[3,13];case 12:return d=(t=l.error)!==null&&t!==void 0?t:L.unknown,l.deferred.reject(d.code===Ae.REQUEST_CANCELED?L.fileUploadCanceled:d),[3,13];case 13:return o=a.next(),[3,2];case 14:return[3,17];case 15:return h=b.sent(),p={error:h},[3,17];case 16:try{o&&!o.done&&(m=a.return)&&m.call(a)}finally{if(p)throw p.error}return[7];case 17:return f=r.isResolveRequestPending,r.messageQueue=i,r.isResolving=!1,r.isResolveRequestPending=!1,f?[4,this._resolveMessageQueue(n)]:[3,19];case 18:b.sent(),b.label=19;case 19:return[3,21];case 20:r.isResolveRequestPending=!0,b.label=21;case 21:return[2]}})})},e.prototype._uploadNextPendingItem=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return(r=this._queueMap.get(n.url))&&(i=r.messageQueue.find(function(p){return p.state===Mn.PENDING}))?i.multipleFileUploadInfo?(s=i.multipleFileUploadInfo,a=s.uploadIndex,o=s.uploadCount,l=s.requestHandler,h=i.params,u=h.fileInfoList[a],!Er(u.file)||!((t=u._uploadedMetaData)===null||t===void 0)&&t.isUploaded?[3,2]:[4,this._tryUploadNextItemAndUpdateItemState(n,r,i)]):[3,4]:[3,9];case 1:return f.sent(),[3,3];case 2:i.state=a=0&&n.uploadQueue.splice(r,1)},e.prototype._uploadNextFileForSingleFileItemAndUpdateParams=function(n,t,r){var i,s,a;return y(this,void 0,void 0,function(){var o,l,u,c,d,h,f,p,m,b;return g(this,function(v){switch(v.label){case 0:return o=new p0({file:r.file,channelUrl:n.url,thumbnailSizes:r.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(o)];case 1:return l=v.sent(),u=l.as(_0),c=u.url,d=u.fileSize,h=d===void 0?r.fileSize:d,f=u.thumbnails,p=f===void 0?[]:f,m=u.requireAuth,b=m!==void 0&&m,r.fileName=(i=r.fileName)!==null&&i!==void 0?i:r.file.name,r.mimeType=(s=r.mimeType)!==null&&s!==void 0?s:r.file.type,r.fileSize=(a=r.fileSize)!==null&&a!==void 0?a:r.file.size,r.fileUrl=c,r.fileSize=h,r.requireAuth=b,r._thumbnails=p,[2]}})})},e.prototype._uploadNextFileForMultipleFilesItemAndUpdateParams=function(n,t,r){var i,s,a;return y(this,void 0,void 0,function(){var o,l,u,c,d,h,f,p,m,b,v;return g(this,function(_){switch(_.label){case 0:return o=t.multipleFileUploadInfo.uploadIndex,l=r.fileInfoList[o],u=new p0({file:l.file,channelUrl:n.url,thumbnailSizes:l.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(u)];case 1:return c=_.sent(),d=c.as(_0),h=d.url,f=d.fileSize,p=f===void 0?l.fileSize:f,m=d.thumbnails,b=d.requireAuth,v=b!==void 0&&b,l.fileName=(i=l.fileName)!==null&&i!==void 0?i:l.file.name,l.mimeType=(s=l.mimeType)!==null&&s!==void 0?s:l.file.type,l.fileSize=(a=l.fileSize)!==null&&a!==void 0?a:l.file.size,l.file=void 0,l.fileUrl=h,l.fileSize=p,l._thumbnails=m,l._uploadedMetaData=M(M({},l._uploadedMetaData),{requireAuth:v,isUploaded:!0}),l instanceof v0||(r.fileInfoList[o]=new v0(this._iid,l)),[2]}})})},e.prototype.request=function(n,t,r,i){return i===void 0&&(i={}),y(this,void 0,void 0,function(){var s,a,o,l,u;return g(this,function(c){return this._queueMap.has(n.url)||(s={messageQueue:[],uploadQueue:[],isResolving:!1,isResolveRequestPending:!1},this._queueMap.set(n.url,s)),a=this._queueMap.get(n.url),o=new Or,l={requestId:t,params:r,state:Mn.PENDING,deferred:o},function(d){return"fileInfoList"in d}(r)&&(u=M({uploadIndex:0,uploadCount:r.fileInfoList.length},i),l.multipleFileUploadInfo=u),a.messageQueue.push(l),this._uploadNextPendingItem(n),[2,o.promise]})})},e.prototype.cancel=function(n,t){var r,i,s=this._queueMap.get(n.url);if(s){var a=t?[s.messageQueue.find(function(p){return p.requestId===t})]:Fe([],Me(s.messageQueue),!1);try{for(var o=ge(a),l=o.next();!l.done;l=o.next()){var u=l.value;if(u)switch(u.state){case Mn.PENDING:if(u.state=Mn.FAILED,u.error=L.requestCanceled,u.multipleFileUploadInfo&&!u.multipleFileUploadInfo.isCopy){var c=u.multipleFileUploadInfo,d=c.uploadIndex,h=c.requestHandler,f=u.params.fileInfoList[d];h==null||h._triggerOnFileUploaded(u.requestId,d,f,L.fileUploadCanceled)}this._resolveMessageQueue(n);break;case Mn.UPLOADING:this._requestQueue.cancel(u.requestId),this._dispatcher.dispatch(new a0({requestId:u.requestId}))}}}catch(p){r={error:p}}finally{try{l&&!l.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}}else t&&(this._requestQueue.cancel(t),this._dispatcher.dispatch(new a0({requestId:t})))},e}(),yv,Zc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:ar.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,replyType:Bn.NONE,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1,showSubchannelMessagesOnly:!1},vE=function(e){return k("number",e.prevResultSize)&&k("number",e.nextResultSize)&&k("boolean",e.isInclusive)&&k("boolean",e.reverse)&&k("string",e.messageTypeFilter)&&Ve(ar,e.messageTypeFilter)&&Qe("string",e.customTypesFilter,!0)&&Qe("string",e.senderUserIdsFilter,!0)&&Ve(Bn,e.replyType)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeReactions)&&k("boolean",e.includeParentMessageInfo)&&k("boolean",e.includeThreadInfo)&&k("boolean",e.showSubchannelMessagesOnly)},Ev={replyType:Bn.NONE,includeReactions:!1,includeThreadInfo:!1,includeMetaArray:!1,includeParentMessageInfo:!1},gE=function(e){return Ve(Bn,e.replyType)&&k("boolean",e.includeReactions)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeParentMessageInfo)&&k("boolean",e.includeThreadInfo)},aO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.includeMetaArray,o=t.includeReactions,l=t.includeThreadInfo,u=t.includeParentMessageInfo,c=e.call(this)||this;return c.method=Y.GET,c.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(encodeURIComponent(s)),c.params={is_sdk:!0,with_sorted_meta_array:a,include_reactions:o,include_thread_info:l,include_parent_message_info:u,include_poll_details:!0},c}return T(n,e),n}(Z),oO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?Tr(t,M({},r)):null,i}return T(n,e),n}(le),Bh=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,a=t.token,o=t.prevResultSize,l=t.nextResultSize,u=t.isInclusive,c=t.reverse,d=t.messageTypeFilter,h=t.customTypesFilter,f=t.senderUserIdsFilter,p=t.replyType,m=t.includeMetaArray,b=t.includeReactions,v=t.parentMessageId,_=t.includeThreadInfo,E=t.includeParentMessageInfo,S=t.showSubchannelMessagesOnly,w=t.checkingHasNext,N=t.checkingContinuousMessages,I=e.call(this)||this;return I.method=Y.GET,I.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages"),I.params=be(Ie({is_sdk:!0,prev_limit:o,next_limit:l,include:u,reverse:c,message_ts:s,message_id:a,message_type:d??null,custom_types:h,sender_ids:f,include_reply_type:p,with_sorted_meta_array:m,include_reactions:b,parent_message_id:v,include_thread_info:_,include_parent_message_info:E,show_subchannel_message_only:S,include_poll_details:!0,checking_has_next:w,checking_continuous_messages:N})),I}return T(n,e),n}(Z),$h=function(e){function n(t,r){var i=e.call(this,t,r)||this;return r.is_continuous_messages!==void 0&&(i.isContinuousMessages=r.is_continuous_messages),r.has_next!==void 0&&(i.hasNext=r.has_next),i.messages=r.messages.map(function(s){return Tr(t,s)}),i}return T(n,e),n}(le),lO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,a=t.token,o=t.replyType,l=t.includeMetaArray,u=t.includeReactions,c=t.includeThreadInfo,d=t.includeParentMessageInfo,h=e.call(this)||this;return h.method=Y.GET,h.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/changelogs"),h.params={change_ts:s,token:a,with_sorted_meta_array:l,include_reactions:u,include_thread_info:c,include_reply_type:o,include_parent_message_info:d,include_poll_details:!0},h}return T(n,e),n}(Z),uO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedMessages=r.updated.map(function(s){return Tr(t,s)}),i.deletedMessagesInfo=r.deleted.map(function(s){return{messageId:s.message_id,deletedAt:s.deleted_at}}),i.hasMore=r.has_more,i.nextToken=r.next,i}return T(n,e),n}(le),cO=function(e){function n(t){var r=t.channelUrl,i=t.scheduledMessageId,s=e.call(this)||this;return s.method=Y.GET,s.path="".concat(cr,"/").concat(encodeURIComponent(r),"/scheduled_messages/").concat(encodeURIComponent(i)),s.params={},s}return T(n,e),n}(Z),dO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?Tr(t,M({},r)):null,i}return T(n,e),n}(le);(function(e){e.MUTED="muted",e.BANNED="banned"})(yv||(yv={}));var yE=function(){function e(n){var t,r,i,s;this.restrictionType=null,Ve(yv,n.restriction_type)&&(this.restrictionType=n.restriction_type),this.description=(t=n.description)!==null&&t!==void 0?t:null,this.endAt=(i=(r=n.end_at)!==null&&r!==void 0?r:n.muted_end_at)!==null&&i!==void 0?i:-1,this.remainingDuration=(s=n.remaining_duration)!==null&&s!==void 0?s:-1}return e.payloadify=function(n){return be(Ie({restriction_type:n.restrictionType,description:n.description,end_at:n.endAt,remaining_duration:n.remainingDuration}))},e}(),ml=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.restrictionInfo=new yE(r),i}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),yE.payloadify(t.restrictionInfo))))},n}(Ze);(function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).isMuted=!1,s.isMuted=(i=r.is_muted)!==null&&i!==void 0&&i,s}return T(n,e),n})(Ze);var Xr=function(){function e(){this._onPending=Ke,this._onFailed=Ke,this._onSucceeded=Ke}return e.prototype._trigger=function(n){switch(n==null?void 0:n.sendingStatus){case ht.PENDING:n.errorCode===0&&this._onPending(n);break;case ht.SCHEDULED:case ht.SUCCEEDED:this._onSucceeded(n)}},e.prototype._triggerFailed=function(n,t){switch(t==null?void 0:t.sendingStatus){case ht.FAILED:case ht.CANCELED:this._onFailed(n,t.scheduledInfo?null:t)}},e.prototype.onPending=function(n){return this._onPending=n,this},e.prototype.onFailed=function(n){return this._onFailed=n,this},e.prototype.onSucceeded=function(n){return this._onSucceeded=n,this},e}(),Ep={data:void 0,customType:void 0,mentionType:lr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,parentMessageId:void 0,isReplyToChannel:!1,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0,isPinnedMessage:!1},bp=function(e){return k("string",e.data,!0)&&k("string",e.customType,!0)&&Ve(lr,e.mentionType)&&Qe("string",e.mentionedUserIds,!0)&&Qe(Ze,e.mentionedUsers,!0)&&k("string",e.mentionedMessageTemplate,!0)&&Qe(br,e.metaArrays,!0)&&k("number",e.parentMessageId,!0)&&k("boolean",e.isReplyToChannel)&&Ve(cs,e.pushNotificationDeliveryOption,!0)&&k(qi,e.appleCriticalAlertOptions,!0)&&k("boolean",e.isPinnedMessage,!0)},EE=function(e){return{isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption,pollId:e.pollId}},tw=M(M({},Ep),{message:"",translationTargetLanguages:void 0,pollId:void 0,extendedMessagePayload:void 0});function nw(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(M(M({},e),{mentionType:e.mentionType,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(i){return i.userId}),translationTargetLanguages:Object.keys(e.translations),pushNotificationDeliveryOption:cs.DEFAULT,parentMessageId:null,isReplyToChannel:!1,isPinnedMessage:!1}))}var Yo,bv=function(e){var n;return be(Ie({data:e.data,customType:e.customType,mentionType:e.mentionType,mentionedUsers:e.mentionedUsers,mentionedUserIds:e.mentionedUserIds,mentionedMessageTemplate:e.mentionedMessageTemplate,metaArrays:e.metaArrays,pollId:(n=e.poll)===null||n===void 0?void 0:n.id,parentMessageId:e.parentMessageId,appleCriticalAlertOptions:e.appleCriticalAlertOptions,message:e.message,translationTargetLanguages:Object.keys(e.translations),extendedMessagePayload:e.extendedMessagePayload}))},rw=function(e){return bp(e)&&k("string",e.message)&&Qe("string",e.translationTargetLanguages,!0)&&k("number",e.pollId,!0)&&k("object",e.extendedMessagePayload,!0)};(function(e){e.FILE="file",e.BLOB="blob",e.BLOB_LIKE_OBJECT="blobLikeObject",e.URL="url"})(Yo||(Yo={}));var bf=function(e){return typeof window<"u"&&"Blob"in window&&typeof Blob<"u"&&e instanceof Blob},P_=function(e){return e===Yo.BLOB||e===Yo.FILE},bE=function(e){return{file:e.file,fileKey:e.fileKey,fileType:e.fileType,isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption}},CE=M(M({},Ep),{file:void 0,fileKey:void 0,fileUrl:void 0,fileName:void 0,fileType:void 0,fileSize:void 0,mimeType:void 0,thumbnailSizes:void 0,requireAuth:!1});function iw(e){var n,t,r,i;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(M(M({},e),{fileUrl:e.plainUrl,fileName:e.name,fileSize:e.size,mimeType:e.type,mentionType:e.mentionType,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(s){return s.userId}),pushNotificationDeliveryOption:cs.DEFAULT,parentMessageId:null,isReplyToChannel:!1,thumbnailSizes:(i=e.thumbnails)===null||i===void 0?void 0:i.map(function(s){return{maxWidth:s.width,maxHeight:s.height}}),requireAuth:e.requireAuth,isPinnedMessage:!1,_thumbnails:e.thumbnails}))}var Xc,Cv=function(e,n){var t;return e.messageParams?(!e.url&&Er(n)&&(e.messageParams.file=n),e.messageParams):be(Ie({data:e.data,customType:e.customType,mentionType:e.mentionType,mentionedUsers:e.mentionedUsers,mentionedUserIds:e.mentionedUserIds,metaArrays:e.metaArrays,parentMessageId:e.parentMessageId,appleCriticalAlertOptions:e.appleCriticalAlertOptions,file:n,fileUrl:e.url,fileName:e.name,fileSize:e.size,mimeType:e.type,thumbnailSizes:(t=e.thumbnails)===null||t===void 0?void 0:t.map(function(r){return{maxWidth:r.width,maxHeight:r.height}})}))},SE=function(e){return bp(e)&&(Er(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return k("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},I2={data:void 0,customType:void 0,mentionType:lr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0},A2=function(e){return k("string",e.data,!0)&&k("string",e.customType,!0)&&Ve(lr,e.mentionType)&&Qe("string",e.mentionedUserIds,!0)&&Qe(Ze,e.mentionedUsers,!0)&&k("string",e.mentionedMessageTemplate,!0)&&Qe(br,e.metaArrays,!0)&&Ve(cs,e.pushNotificationDeliveryOption,!0)&&k(qi,e.appleCriticalAlertOptions,!0)},sw=M(M({},I2),{message:void 0,translationTargetLanguages:void 0,pollId:void 0}),aw=function(e){return A2(e)&&k("string",e.message,!0)&&Qe("string",e.translationTargetLanguages,!0)&&k("number",e.pollId,!0)},hO=M({},I2),fO=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.token,a=t.limit,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(nt(i),"/").concat(encodeURIComponent(r),"/operators"),o.params={token:s,limit:a},o}return T(n,e),n}(Z),pO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.operators=r.operators.map(function(s){return new Ze(t,s)}),i.token=r.next,i}return T(n,e),n}(le),_O=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:(t=[],this._hasNext?(this._isLoading=!0,r=R.of(this._iid).requestQueue,i=new fO(M(M({},this),{channelUrl:this.channelUrl,token:this._token})),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),a=s.as(pO),o=a.operators,l=a.token,this._token=l,this._hasNext=!!l,this._isLoading=!1,[2,o];case 2:return[2,t];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),mO=function(e){function n(t,r,i,s){var a,o,l,u,c,d,h,f,p,m,b=this;return(b=e.call(this,t,r,i,s)||this).reverse=!1,b.messageTypeFilter=ar.ALL,b.customTypesFilter=null,b.senderUserIdsFilter=null,b.replyType=Bn.NONE,b.includeMetaArray=!1,b.includeReactions=!1,b.includeParentMessageInfo=!1,b.includeThreadInfo=!1,b.showSubchannelMessagesOnly=!1,b._edge=Number.MAX_SAFE_INTEGER,b.reverse=(a=s.reverse)!==null&&a!==void 0&&a,b.messageTypeFilter=(o=s.messageTypeFilter)!==null&&o!==void 0?o:ar.ALL,b.customTypesFilter=(l=s.customTypesFilter)!==null&&l!==void 0?l:null,b.senderUserIdsFilter=(u=s.senderUserIdsFilter)!==null&&u!==void 0?u:null,b.replyType=(c=s.replyType)!==null&&c!==void 0?c:Bn.NONE,b.includeMetaArray=(d=s.includeMetaArray)!==null&&d!==void 0&&d,b.includeReactions=(h=s.includeReactions)!==null&&h!==void 0&&h,b.includeParentMessageInfo=(f=s.includeParentMessageInfo)!==null&&f!==void 0&&f,b.includeThreadInfo=(p=s.includeThreadInfo)!==null&&p!==void 0&&p,b.showSubchannelMessagesOnly=(m=s.showSubchannelMessagesOnly)!==null&&m!==void 0&&m,b}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.reverse)&&Ve(ar,this.messageTypeFilter)&&Ve(Bn,this.replyType)&&Qe("string",this.customTypesFilter,!0)&&Qe("string",this.senderUserIdsFilter,!0)&&k("boolean",this.includeMetaArray)&&k("boolean",this.includeReactions)&&k("boolean",this.includeParentMessageInfo)&&k("boolean",this.includeThreadInfo)&&k("boolean",this.showSubchannelMessagesOnly)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,Ln.of(this._iid).getMessagesByTimestamp(this.channelUrl,this.channelType,this._edge,Ie({prevResultSize:this.limit,nextResultSize:0,isInclusive:!1,reverse:this.reverse,messageTypeFilter:this.messageTypeFilter,customTypesFilter:this.customTypesFilter,replyType:this.replyType,senderUserIdsFilter:this.senderUserIdsFilter,includeReactions:this.includeReactions,includeMetaArray:this.includeMetaArray,includeParentMessageInfo:this.includeParentMessageInfo,includeThreadInfo:this.includeThreadInfo,showSubchannelMessagesOnly:this.showSubchannelMessagesOnly}))]):[3,2]:[3,5];case 1:return t=r.sent(),this._edge=Math.min.apply(Math,Fe([Number.MAX_SAFE_INTEGER],Me(t.map(function(i){return i.createdAt})),!1)),this._hasNext=t.length>=this.limit,this._isLoading=!1,[2,t];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),vO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.limit,o=t.token;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={limit:a,token:o},r}return T(n,e),n}(Z),gO=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.mutedUsers=[];var s=r.next,a=r.muted_list;return i.token=s,a&&a.length>0&&(i.mutedUsers=a.map(function(o){return new ml(t,o)})),i}return T(n,e),n}(le),yO=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return T(n,e),n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new vO(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(gO),a=s.mutedUsers,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),EO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.limit,o=t.token;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=be({limit:a,token:o}),r}return T(n,e),n}(Z),bO=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.bannedUsers=[];var s=r.next,a=r.banned_list;return i.token=s,a&&a.length>0&&(i.bannedUsers=a.map(function(o){return new ml(t,o.user)})),i}return T(n,e),n}(le),CO=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new EO(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(bO),a=s.bannedUsers,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca);(function(e){e.SPAM="spam",e.HARASSING="harassing",e.SUSPICIOUS="suspicious",e.INAPPROPRIATE="inappropriate"})(Xc||(Xc={}));var SO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.operatorUserIds;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:a},r}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var TO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.operatorUserIds;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:a},r}return T(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(le);var wO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/mute/").concat(a),r}return T(n,e),n}(Z),NO=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.isMuted=!1,i.startAt=0,i.endAt=0;var s=r.is_muted,a=r.start_at,o=r.end_at,l=r.remaining_duration,u=r.description;return i.isMuted=s,i.startAt=a,i.endAt=o,i.remainingDuration=l,i.description=u,i}return T(n,e),n}(le),TE=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.keys;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={keys:a,include_ts:!0},r}return T(n,e),n}(Z),wE=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.metadata,a=r.ts;return i.metadata=s,i.ts=a,i}return T(n,e),n}(le),IO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.metadata;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:a,include_ts:!0},r}return T(n,e),n}(Z),AO=function(e){function n(t,r){var i,s,a=this;return(a=e.call(this,t,r)||this).metaData=(i=r.metadata)!==null&&i!==void 0?i:{},a.ts=(s=r.ts)!==null&&s!==void 0?s:null,a}return T(n,e),n}(le),MO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.metadata,o=t.upsert;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:a,include_ts:!0,upsert:o!=null&&o},r}return T(n,e),n}(Z),xO=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.metadata,a=r.ts;return i.metadata=s,i.ts=a,i}return T(n,e),n}(le),OO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return i.data&&(s.created=i.data.created,s.updated=i.data.updated,s.deleted=i.data.deleted),s}return T(n,e),n}(Et),RO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.key;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata/").concat(a),r.params={include_ts:!0},r}return T(n,e),n}(Z),kO=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts;return i.ts=s,i}return T(n,e),n}(le),LO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={include_ts:!0},r}return T(n,e),n}(Z),DO=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts;return i.ts=s,i}return T(n,e),n}(le),NE=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.keys;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={keys:a},r}return T(n,e),n}(Z),IE=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(le),UO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.metaCounter;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:a},r}return T(n,e),n}(Z),PO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(le),F_=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.metaCounter,o=t.upsert,l=o!==void 0&&o,u=t.mode,c=u===void 0?"set":u;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:a,upsert:l,mode:c},r}return T(n,e),n}(Z),H_=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(le),FO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return i.data&&(s.created=i.data.created,s.updated=i.data.updated,s.deleted=i.data.deleted),s}return T(n,e),n}(Et),HO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.key;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter/").concat(a),r.params={},r}return T(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(le);var jO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={},r}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var BO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId,o=t.seconds,l=t.description;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={user_id:a,seconds:o,description:l},r}return T(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(le);var $O=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new ml(t,i.data),s}return T(n,e),n}(Et),GO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/mute/").concat(encodeURIComponent(a)),r}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var zO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new ml(t,i.data),s}return T(n,e),n}(Et),VO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId,o=t.seconds,l=t.description;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=be({user_id:a,seconds:o,description:l}),r}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var qO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new ml(t,i.data),i.data.member_count&&(s.memberCount=i.data.member_count),i.data.joined_member_count&&(s.joinedMemberCount=i.data.joined_member_count),s}return T(n,e),n}(Et),WO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/ban/").concat(encodeURIComponent(a)),r}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var KO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new ml(t,i.data),s}return T(n,e),n}(Et),AE=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.freezing;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/freeze"),r.params={freeze:a},r}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var QO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.freeze=i.data.freeze,s}return T(n,e),n}(Et),YO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.category,o=t.userId,l=t.description;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(iT(s),"/").concat(encodeURIComponent(i)),r.params={report_category:a,reporting_user_id:o,report_description:l},r}return T(n,e),n}(Z),ZO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.category,o=t.userId,l=t.offendingUserId,u=t.description;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(cv,"/users/").concat(l),r.params={channel_url:i,channel_type:s===et.OPEN?"open_channels":"group_channels",report_category:a,reporting_user_id:o,report_description:u},r}return T(n,e),n}(Z),XO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.category,o=t.userId,l=t.offendingUserId,u=t.messageId,c=t.description,d=t.messageToken;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(iT(s),"/").concat(encodeURIComponent(i),"/messages/").concat(u),r.params=be({report_category:a,reporting_user_id:o,report_description:c,offending_user_id:l,mesg_token:d}),r}return T(n,e),n}(Z),JO=function(e){function n(t){var r=[];return t.mentionType===lr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"MESG",ackRequired:!0,payload:be(Ie({channel_url:t.channelUrl,message:t.message,data:t.data,custom_type:t.customType,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:r,mentioned_message_template:t.mentionedMessageTemplate,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==cs.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions,silent:t.silent,reply_to_channel:t.isReplyToChannel,parent_message_id:t.parentMessageId?t.parentMessageId:null,req_id:t.reqId,poll_id:t.pollId,pin_message:t.isPinnedMessage,extended_message_payload:t.extendedMessagePayload}))})||this}return T(n,e),n}(Rr),ow=function(e){function n(t,r,i){var s,a,o,l,u=this;(u=e.call(this,t,"MESG",i)||this).message=new sr(t,i);var c=R.of(t).sdkState;return u.isMentioned=Au(u.message.mentionType,(o=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(a=u.message.mentionedUsers)===null||a===void 0?void 0:a.map(function(d){return d.userId}))!==null&&o!==void 0?o:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return T(n,e),n}(Et),ME=function(e){function n(t){var r=null;return t.mentionType===lr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"MEDI",ackRequired:!0,payload:be(Ie({channel_url:t.channelUrl,msg_id:t.messageId,message:t.message,data:t.data,custom_type:t.customType,metaarray:t.metaArrayParams,mention_type:t.mentionType,mentioned_user_ids:r,mentioned_message_template:t.mentionedMessageTemplate,apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,poll_id:t.pollId}))})||this}return T(n,e),n}(Rr),Sv=function(e){function n(t,r,i){var s,a,o,l,u,c=this;(c=e.call(this,t,"MEDI",i)||this).message=new sr(t,i);var d=R.of(t).sdkState;return c.mentionCountChange=_2({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(o=(a=i.old_values)===null||a===void 0?void 0:a.mentioned_user_ids)!==null&&o!==void 0?o:[]},Ie({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return T(n,e),n}(Et),xE=function(e){function n(t){var r=null;return t.mentionType===lr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"FEDI",ackRequired:!0,payload:be(Ie({channel_url:t.channelUrl,msg_id:t.messageId,data:t.data,custom_type:t.customType,metaarray:t.metaArrayParams,mention_type:t.mentionType,mentioned_user_ids:r,apple_critical_alert_options:t.appleCriticalAlertOptions}))})||this}return T(n,e),n}(Rr),Tv=function(e){function n(t,r,i){var s,a,o,l,u,c=this;(c=e.call(this,t,"FEDI",i)||this).message=new nn(t,i);var d=R.of(t).sdkState;return c.mentionCountChange=_2({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(o=(a=i.old_values)===null||a===void 0?void 0:a.mentioned_user_ids)!==null&&o!==void 0?o:[]},Ie({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return T(n,e),n}(Et),eR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.reactionKey,o=e.call(this)||this;return o.method=Y.POST,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),o.params={reaction:a},o}return T(n,e),n}(Z),tR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new N2(r),i}return T(n,e),n}(le),nR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.reactionKey,o=e.call(this)||this;return o.method=Y.DELETE,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),o.params={reaction:a},o}return T(n,e),n}(Z),rR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new N2(M({},r)),i}return T(n,e),n}(le),iR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.translationTargetLanguages,o=e.call(this)||this;return o.method=Y.POST,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(encodeURIComponent(s),"/translation"),o.params={target_langs:a},o}return T(n,e),n}(Z),sR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new sr(t,r),i}return T(n,e),n}(le),aR=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===lr.USERS&&(t.mentionedUserIds?s=t.mentionedUserIds:t.mentionedUsers&&(s=t.mentionedUsers.map(function(l){return l.userId})));var a=t.channelType,o=t.channelUrl;return i.method=Y.POST,i.path="".concat(nt(a),"/").concat(encodeURIComponent(o),"/scheduled_messages"),i.params=be(Ie({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Iu.USER,message:t.message,custom_type:t.customType,data:t.data,mention_type:t.mentionType,mentioned_user_ids:s,sorted_metaarray:(r=t.metaArrays)===null||r===void 0?void 0:r.map(function(l){return br.payloadify(l)}),apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(Z),lw=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new sr(t,r),i}return T(n,e),n}(le),oR=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var a=[];t.mentionType===lr.USERS&&(t.mentionedUserIds?a=t.mentionedUserIds:t.mentionedUsers&&(a=t.mentionedUsers.map(function(u){return u.userId})));var o=t.channelType,l=t.channelUrl;return s.method=Y.POST,s.path="".concat(nt(o),"/").concat(encodeURIComponent(l),"/scheduled_messages"),s.params=Ie({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Iu.FILE,url:t.fileUrl,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(u){return da.payloadify(u)}),custom_type:t.customType,data:t.data,require_auth:t.requireAuth,mention_type:t.mentionType,mentioned_user_ids:a,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(u){return br.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption}),s}return T(n,e),n}(Z),lR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new nn(t,r),i}return T(n,e),n}(le),uR=function(e){function n(t){var r=t.pollId,i=t.title,s=t.data,a=t.allowUserSuggestion,o=t.allowMultipleVotes,l=t.closeAt,u=e.call(this)||this;return u.method=Y.PUT,u.path="".concat(ds,"/").concat(encodeURIComponent(r)),u.params={title:i,data:s,allow_user_suggestion:a,allow_multiple_votes:o,close_at:l},u}return T(n,e),n}(Z),cR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return T(n,e),n}(le),dR=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Y.DELETE,i.path="".concat(ds,"/").concat(encodeURIComponent(r)),i}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var hR=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Y.PUT,i.path="".concat(ds,"/").concat(encodeURIComponent(r),"/close"),i}return T(n,e),n}(Z),fR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return T(n,e),n}(le),pR=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,a=t.optionText,o=e.call(this)||this;return o.method=Y.POST,o.path="".concat(ds,"/").concat(encodeURIComponent(s),"/options"),o.params={channel_url:r,channel_type:i,text:a},o}return T(n,e),n}(Z),_R=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return T(n,e),n}(le),mR=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=t.optionText,a=e.call(this)||this;return a.method=Y.PUT,a.path="".concat(ds,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),a.params={text:s},a}return T(n,e),n}(Z),vR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return T(n,e),n}(le),gR=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(ds,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var yR=function(e){function n(t){var r=t.reqId,i=t.channelType,s=t.channelUrl,a=t.pollId,o=t.pollOptionIds;return e.call(this,{code:"VOTE",ackRequired:!0,payload:be({req_id:r,channel_type:i===et.OPEN?"open_channels":"group_channels",channel_url:s,poll_id:a,option_ids:o})})||this}return T(n,e),n}(Rr),uw=function(e){function n(t,r,i){var s=e.call(this,t,"VOTE",i)||this;return s.event=new Rx(i),s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(Et),cw=100,dw="GroupChannel",ER="url",hw=100,wv="Message",bR="messageId",fw="NotificationMessage",CR="notificationId",SR="Poll",TR="pollId",wR="FeedChannel",NR="url";function IR(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(M(M({},e),{isReplyToChannel:!1,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(i){return i.userId}),pushNotificationDeliveryOption:cs.DEFAULT,isPinnedMessage:!1,fileInfoList:e.fileInfoList.map(function(i){var s;return{fileUrl:i.plainUrl,fileName:i.fileName,fileSize:i.fileSize,mimeType:i.mimeType,thumbnailSizes:(s=i.thumbnails)===null||s===void 0?void 0:s.map(function(a){return{maxWidth:a.width,maxHeight:a.height}}),_thumbnails:i.thumbnails,_uploadedMetaData:{requireAuth:i._requireAuth,isUploaded:!0}}})}))}var nr,AR=M(M({},Ep),{fileInfoList:[]}),MR=function(e){return(Er(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return n.maxWidth>0&&n.maxHeight>0}))},Cf=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._onFileUploaded=Ke,t}return T(n,e),n.prototype._triggerOnFileUploaded=function(t,r,i,s){this._onFileUploaded(t,r,i,s)},n.prototype.onFileUploaded=function(t){return this._onFileUploaded=t,this},n.prototype.onPending=function(t){return e.prototype.onPending.call(this,t),this},n.prototype.onFailed=function(t){return e.prototype.onFailed.call(this,t),this},n.prototype.onSucceeded=function(t){return e.prototype.onSucceeded.call(this,t),this},n}(Xr),xR=2;(function(e){e.SEND="send",e.RESEND="resend",e.COPY="copy"})(nr||(nr={}));var It,OE=function(e){function n(t,r){var i,s,a,o,l,u,c=this;return(c=e.call(this,t)||this)._name="",c._createdAt=0,c.channelType=et.BASE,c.coverUrl="",c.customType="",c.data="",c.isFrozen=!1,c.isEphemeral=!1,c.creator=null,c._messageCollectionLastAccessedAt=0,c._url=r.channel_url,c._name=(i=r.name)!==null&&i!==void 0?i:"",c._createdAt=1e3*r.created_at,c.coverUrl=(s=r.cover_url)!==null&&s!==void 0?s:"",c.customType=(a=r.custom_type)!==null&&a!==void 0?a:"",c.data=(o=r.data)!==null&&o!==void 0?o:"",c.isFrozen=(l=r.freeze)!==null&&l!==void 0&&l,c.isEphemeral=(u=r.is_ephemeral)!==null&&u!==void 0&&u,c.creator=r.created_by?new Ze(c._iid,r.created_by):null,r.metadata&&Object.keys(r.metadata).length>0&&r.ts&&(c._cachedMetaData=new Map,Object.keys(r.metadata).forEach(function(d){c._cachedMetaData.set(d,{value:r.metadata[d],isRemoved:!1,updatedAt:r.ts})})),c}return T(n,e),Object.defineProperty(n.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},set:function(t){this._name=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"createdAt",{get:function(){return this._createdAt},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return M(M({},this),{url:this._url,name:this._name,createdAt:this._createdAt})},n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{channel_url:t.url,name:t.name,cover_url:t.coverUrl,custom_type:t.customType,data:t.data,freeze:t.isFrozen,is_ephemeral:t.isEphemeral,created_by:t.creator?Ze.payloadify(t.creator):null,created_at:t.createdAt/1e3})))},n.prototype.isGroupChannel=function(){return this.channelType===et.GROUP},n.prototype.isOpenChannel=function(){return this.channelType===et.OPEN},n.prototype.isFeedChannel=function(){return this.channelType===et.FEED},Object.defineProperty(n.prototype,"cachedMetaData",{get:function(){var t={};return this._cachedMetaData&&this._cachedMetaData.forEach(function(r,i){r.isRemoved||(t[i]=r.value)}),t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"messageCollectionLastAccessedAt",{get:function(){return this._messageCollectionLastAccessedAt},enumerable:!1,configurable:!0}),n.prototype._updateMessageCollectionLastAccessedAt=function(){this._messageCollectionLastAccessedAt=Date.now()},n.prototype._update=function(t){var r=be(t);Object.assign(this,r)},n.prototype._upsertCachedMetaData=function(t,r){var i=this;Object.keys(t).forEach(function(s){i._cachedMetaData||(i._cachedMetaData=new Map);var a=i._cachedMetaData.get(s);(!a||a.updatedAt<=r)&&i._cachedMetaData.set(s,{value:t[s],isRemoved:!1,updatedAt:r})})},n.prototype._updateCachedMetaData=function(t,r){var i=this;this._cachedMetaData?this._cachedMetaData.forEach(function(s,a){var o;s.updatedAt<=r&&i._cachedMetaData.set(a,{value:(o=t[a])!==null&&o!==void 0?o:s.value,isRemoved:!t[a],updatedAt:r})}):(this._cachedMetaData=new Map,Object.keys(t).forEach(function(s){i._cachedMetaData.set(s,{value:t[s],isRemoved:!1,updatedAt:r})}))},n.prototype._removeFromCachedMetaData=function(t,r){var i=this;this._cachedMetaData&&t.forEach(function(s){var a=i._cachedMetaData.get(s);a&&a.updatedAt0&&Qe("string",r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new iR({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,translationTargetLanguages:r}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(sR).message]}})})},n.prototype._createScheduledUserMessage=function(t,r){var i=this,s=R.of(this._iid).requestQueue,a=Date.now(),o=this._generateRequestId();Br(2).then(function(){var u=i._createPendingScheduledUserMessage(t,o,a);Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(c){return[2,r._trigger(u)]})})})});var l=new aR(M({reqId:o,channelType:this.channelType,channelUrl:this.url},t));s.send(l).then(function(u){var c=u.as(lw).message;Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(d){return[2,r._trigger(c)]})})})}).catch(function(u){if(zr(u))throw u;Br(2).then(function(){var c=i._createPendingScheduledUserMessage(t,o,a);i._markMessageAsFailed(c,u),Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessage=function(t){var r=M(M({},CE),t);return Q(SE(r)).throw(L.invalidParameters),this._sendFileMessage(r)},n.prototype.sendMultipleFilesMessage=function(t){var r,i=M(M({},AR),t),s=R.of(this._iid);Q(function(o,l){return l===void 0&&(l=cx),bp(o)&&Array.isArray(o.fileInfoList)&&o.fileInfoList.length>=2&&o.fileInfoList.length<=l&&o.fileInfoList.every(function(u){return MR(u)})}(i,(r=s.appInfo)===null||r===void 0?void 0:r.multipleFilesMessageFileCountLimit)).throw(L.invalidParameters);var a=!!t.fileInfoList.find(function(o){var l=s.appInfo.uploadSizeLimit;return o.file instanceof Blob&&o.file.size>l||o.fileSize>l});return Q(!a).throw(L.fileSizeLimitExceededError),this._sendMultipleFilesMessage(i)},n.prototype._sendFileMessage=function(t,r,i){var s=this;r===void 0&&(r=nr.SEND);var a=R.of(this._iid).dispatcher,o=Ln.of(this._iid).fileMessageQueue,l=i??this._generateRequestId(),u=Date.now(),c=new Xr;return Br(2).then(function(){var d=s._createPendingFileMessage(t,l,u);a.dispatch(new Tt({messages:[d],source:r===nr.RESEND?z.LOCAL_MESSAGE_RESEND_STARTED:z.EVENT_MESSAGE_SENT_PENDING})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(h){return[2,c._trigger(d)]})})}),o.request(s,l,t).then(function(h){a.dispatch(new Tt({messages:[h],source:z.EVENT_MESSAGE_SENT_SUCCESS})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(f){return[2,c._trigger(h)]})})})}).catch(function(h){if(zr(h))throw h;Br(2).then(function(){var f=s._createPendingFileMessage(t,l,u),p=R.of(s._iid).cacheContext,m=p.localCacheEnabled&&p.localCacheConfig.enableAutoResend&&i0(h.code);s._markMessageAsFailed(f,h,m),a.dispatch(new Tt({messages:[f],source:f.sendingStatus===ht.PENDING?z.REQUEST_RESEND_MESSAGE:h.code===Ae.FILE_UPLOAD_CANCEL_FAILED?z.LOCAL_MESSAGE_CANCELED:z.EVENT_MESSAGE_SENT_FAILED})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(b){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._autoResendFileMessage=function(t){Q(t instanceof nn&&!!t.messageParams).throw(L.invalidParameters);var r=R.of(this._iid).logger;return r.debug("autoResendFileMessage pending",t),this._sendFileMessage(t.messageParams,nr.SEND,t.reqId).onFailed(function(i){r.debug("autoResendFileMessage failed",i)}).onSucceeded(function(i){r.debug("autoResendFileMessage success",i)})},n.prototype._sendMultipleFilesMessage=function(t,r,i){var s=this,a=R.of(this._iid).dispatcher,o=Ln.of(this._iid).fileMessageQueue,l=i??this._generateRequestId(),u=Date.now(),c=new Cf;return Br(2).then(function(){var d=s._createPendingMultipleFilesMessage(t,l,u);a.dispatch(new Tt({messages:[d],source:r===nr.RESEND?z.LOCAL_MESSAGE_RESEND_STARTED:z.EVENT_MESSAGE_SENT_PENDING})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(h){return[2,c._trigger(d)]})})}),o.request(s,l,t,{requestHandler:c,isCopy:r===nr.COPY}).then(function(h){a.dispatch(new Tt({messages:[h],source:z.EVENT_MESSAGE_SENT_SUCCESS})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(f){return[2,c._trigger(h)]})})})}).catch(function(h){if(zr(h))throw h;Br(2).then(function(){var f=s._createPendingMultipleFilesMessage(t,l,u);s._markMessageAsFailed(f,h),a.dispatch(new Tt({messages:[f],source:z.EVENT_MESSAGE_SENT_FAILED})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(p){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._createScheduledFileMessage=function(t,r,i,s){var a=this,o=R.of(this._iid).requestQueue,l=new oR(M(M({reqId:i,channelType:this.channelType,channelUrl:this.url},t),{fileUrl:t.fileUrl,requireAuth:t.requireAuth}));o.send(l).then(function(u){var c=u.as(lR).message;Ue(function(){return y(a,void 0,void 0,function(){return g(this,function(d){return[2,r._trigger(c)]})})})}).catch(function(u){if(zr(u))throw u;Br(2).then(function(){var c=a._createPendingScheduledFileMessage(t,i,s);a._markMessageAsFailed(c,u),Ue(function(){return y(a,void 0,void 0,function(){return g(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessages=function(t){var r,i;Q(t.every(function(u){return SE(M(M({},CE),u))})).throw(L.invalidParameters);var s=new Xr;try{for(var a=ge(t),o=a.next();!o.done;o=a.next()){var l=o.value;this.sendFileMessage(l).onPending(function(u){return s._trigger(u)}).onFailed(function(u,c){return s._triggerFailed(u,c)}).onSucceeded(function(u){return s._trigger(u)})}}catch(u){r={error:u}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return s},n.prototype.resendFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){return i=this._validateFailedFileMessageHasFile(t,r),Q(t instanceof nn&&i&&!t.scheduledInfo).throw(L.invalidParameters),s=new Or,a=Cv(t,r),this._sendFileMessage(a,nr.RESEND,t.reqId).onFailed(function(l){return s.reject(l)}).onSucceeded(function(l){return s.resolve(l)}),[2,s.promise]})})},n.prototype.resendMessage=function(t,r){var i,s;if(Q(t instanceof Ht&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var a=(i=t.messageParams)!==null&&i!==void 0?i:bv(t);return this._sendUserMessage(a,nr.RESEND,t.reqId)}if(t.isFileMessage()){var o=this._validateFailedFileMessageHasFile(t,r);return Q(o).throw(L.invalidParameters),a=(s=t.messageParams)!==null&&s!==void 0?s:Cv(t,r),this._sendFileMessage(a,nr.RESEND,t.reqId)}if(t.isMultipleFilesMessage())throw L.channelTypeNotSupportedError},n.prototype.updateFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return i=M(M({},hO),r),Q(k("number",t)&&function(u){return A2(u)}(i)).throw(L.invalidParameters),s=R.of(this._iid).requestQueue,a=new xE(M({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:i.metaArrays?{array:i.metaArrays,mode:"add",upsert:!0}:void 0},i)),[4,s.send(a)];case 1:return o=l.sent(),[2,o.as(Tv).message]}})})},n.prototype.uploadFile=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return r=R.of(this._iid).requestQueue,i=la(),(s=new p0({file:t.file,channelUrl:this.url,thumbnailSizes:t.thumbnailSizes,requestId:i})).uploadProgressHandler=t.progressHandler,t.uploadStartedHandler&&t.uploadStartedHandler(i),[4,r.send(s)];case 1:return a=c.sent(),o=a.as(_0),l=o.url,u=o.thumbnails,[2,{requestId:i,url:l,thumbnails:u}]}})})},n.prototype.cancelUploadingFileMessage=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(k("string",t)).throw(L.invalidParameters),Ln.of(this._iid).fileMessageQueue.cancel(this,t),[2,!0]})})},n.prototype.copyFileMessage=function(t,r){var i,s,a;return y(this,void 0,void 0,function(){var o,l;return g(this,function(u){return Q(t instanceof n&&r instanceof nn&&r.sendingStatus===ht.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),o=new Or,l=Ie(M(M({},r),{fileUrl:r.url,fileName:r.name,fileSize:r.size,mimeType:r.type,mentionType:r.mentionType,mentionedUserIds:(i=r.mentionedUserIds)!==null&&i!==void 0?i:(s=r.mentionedUsers)===null||s===void 0?void 0:s.map(function(c){return c.userId}),pushNotificationDeliveryOption:cs.DEFAULT,parentMessageId:null,isReplyToChannel:!1,thumbnailSizes:(a=r.thumbnails)===null||a===void 0?void 0:a.map(function(c){return{maxWidth:c.width,maxHeight:c.height}}),requireAuth:r.requireAuth,isPinnedMessage:!1})),t._sendFileMessage(l).onSucceeded(function(c){return o.resolve(c)}).onFailed(function(c){return o.reject(c)}),[2,o.promise]})})},n.prototype.copyMessage=function(t,r){Q(t instanceof n&&r instanceof Ht&&r.sendingStatus===ht.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters);var i=r,s=t;if(i.isUserMessage()){Q(!i.poll).throw(L.notSupportedError);var a=nw(i);return s._sendUserMessage(a)}if(i.isFileMessage())return a=iw(i),s._sendFileMessage(a);if(r.isMultipleFilesMessage())throw L.channelTypeNotSupportedError},n.prototype.deleteMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return Q(t instanceof vr).throw(L.invalidParameters),t.messageId>0?(r=R.of(this._iid).requestQueue,i=new oT({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,messageToken:t instanceof Ht?t._messageToken:void 0}),[4,r.send(i)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},n.prototype.addReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(t instanceof vr&&t.messageId>0&&k("string",r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new eR({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(tR).reactionEvent]}})})},n.prototype.deleteReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(t instanceof vr&&t.messageId>0&&k("string",r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new nR({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(rR).reactionEvent]}})})},n.prototype._updateUserMessageMetaArray=function(t,r,i,s){return y(this,void 0,void 0,function(){var a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return a=R.of(this._iid),o=a.dispatcher,l=a.requestQueue,u=new ME({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:{array:r,mode:i,upsert:s}}),[4,l.send(u)];case 1:return c=h.sent(),d=c.as(Sv).message,o.dispatch(new Tt({messages:[d],source:z.EVENT_MESSAGE_UPDATED})),[2,d]}})})},n.prototype._updateFileMessageMetaArray=function(t,r,i,s){return y(this,void 0,void 0,function(){var a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return a=R.of(this._iid),o=a.dispatcher,l=a.requestQueue,u=new xE({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:{array:r,mode:i,upsert:s}}),[4,l.send(u)];case 1:return c=h.sent(),d=c.as(Tv).message,o.dispatch(new Tt({messages:[d],source:z.EVENT_MESSAGE_UPDATED})),[2,d]}})})},n.prototype.createMessageMetaArrayKeys=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){return Q(t instanceof vr&&t.messageId>0&&Qe("string",r)).throw(L.invalidParameters),i=r.map(function(a){return new br({key:a})}),t instanceof nn?[2,this._updateFileMessageMetaArray(t.messageId,i,"add",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,i,"add",!0)]})})},n.prototype.deleteMessageMetaArrayKeys=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){return Q(t instanceof vr&&t.messageId>0&&Qe("string",r)).throw(L.invalidParameters),i=r.map(function(a){return new br({key:a})}),t instanceof nn?[2,this._updateFileMessageMetaArray(t.messageId,i,"remove",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,i,"remove",!0)]})})},n.prototype.addMessageMetaArrayValues=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return Q(t instanceof vr&&t.messageId>0&&r.every(function(s){return s instanceof br})).throw(L.invalidParameters),t instanceof nn?[2,this._updateFileMessageMetaArray(t.messageId,r,"add",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,r,"add",!0)]})})},n.prototype.removeMessageMetaArrayValues=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return Q(t instanceof vr&&t.messageId>0&&r.every(function(s){return s instanceof br})).throw(L.invalidParameters),t instanceof nn?[2,this._updateFileMessageMetaArray(t.messageId,r,"remove",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,r,"remove",!0)]})})},n.prototype.report=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return Q(Ve(Xc,t)&&k("string",r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new YO({channelUrl:this.url,channelType:this.channelType,userId:s.userId,category:t,description:r}),[4,a.send(o)];case 1:return l.sent(),[2]}})})},n.prototype.reportUser=function(t,r,i){return y(this,void 0,void 0,function(){var s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(t instanceof Ze&&Ve(Xc,r)&&k("string",i)).throw(L.invalidParameters),s=R.of(this._iid),a=s.sdkState,o=s.requestQueue,l=new ZO({channelUrl:this.url,channelType:this.channelType,userId:a.userId,offendingUserId:t.userId,category:r,description:i}),[4,o.send(l)];case 1:return u.sent(),[2]}})})},n.prototype.reportMessage=function(t,r,i){return y(this,void 0,void 0,function(){var s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(t instanceof Ht&&Ve(Xc,r)&&k("string",i)).throw(L.invalidParameters),s=R.of(this._iid),a=s.sdkState,o=s.requestQueue,l=new XO({channelUrl:this.url,channelType:this.channelType,userId:a.userId,offendingUserId:t.sender.userId,messageId:t.messageId,category:r,description:i,messageToken:t._messageToken}),[4,o.send(l)];case 1:return u.sent(),[2]}})})},n.prototype.updatePoll=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(k("number",t)&&function(l){return k("string",l.title,!0)&&BT(l.data)&&k("boolean",l.allowUserSuggestion,!0)&&k("boolean",l.allowMultipleVotes,!0)&&k("number",l.closeAt,!0)}(r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new uR(M({pollId:t},r)),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(cR).poll]}})})},n.prototype.deletePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(a){switch(a.label){case 0:return r=k("number",t),Q(r).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new dR({pollId:t}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},n.prototype.closePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=k("number",t),Q(r).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new hR({pollId:t}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(fR).poll]}})})},n.prototype.addPollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return i=k("number",t)&&k("string",r)&&r.trim()!=="",Q(i).throw(L.invalidParameters),s=R.of(this._iid).requestQueue,a=new pR({channelUrl:this.url,channelType:this.channelType,pollId:t,optionText:r}),[4,s.send(a)];case 1:return o=l.sent(),[2,o.as(_R).poll]}})})},n.prototype.updatePollOption=function(t,r,i){return y(this,void 0,void 0,function(){var s,a,o,l;return g(this,function(u){switch(u.label){case 0:return s=k("number",t)&&k("number",r)&&k("string",i)&&i.trim()!=="",Q(s).throw(L.invalidParameters),a=R.of(this._iid).requestQueue,o=new mR({pollId:t,pollOptionId:r,optionText:i}),[4,a.send(o)];case 1:return l=u.sent(),[2,l.as(vR).poll]}})})},n.prototype.deletePollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return i=k("number",t)&&k("number",r),Q(i).throw(L.invalidParameters),s=R.of(this._iid).requestQueue,a=new gR({pollId:t,pollOptionId:r}),[4,s.send(a)];case 1:return o.sent(),[2]}})})},n.prototype.votePoll=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:return i=k("number",t)&&Qe("number",r),Q(i).throw(L.invalidParameters),s=R.of(this._iid),a=s.requestQueue,o=s.dispatcher,l=new yR({reqId:this._generateRequestId(),channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionIds:r}),[4,a.send(l)];case 1:return u=d.sent(),c=u.as(uw).event,o.dispatch(new w2({event:c,source:z.EVENT_POLL_VOTED})),[2,c]}})})},n.prototype.getPollChangeLogsSinceTimestamp=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Q(k("number",t)).throw(L.invalidParameters),[4,f0.of(this._iid).getPollChangeLogs(this.url,this.channelType,t)];case 1:return[2,r.sent()]}})})},n.prototype.getPollChangeLogsSinceToken=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Q(k("string",t,!0)),[4,f0.of(this._iid).getPollChangeLogs(this.url,this.channelType,t)];case 1:return[2,r.sent()]}})})},n.prototype.createPollListQuery=function(t){return t===void 0&&(t=10),new VT(this._iid,{channelUrl:this.url,channelType:this.channelType,limit:t})},n.prototype.createPollVoterListQuery=function(t,r,i){return i===void 0&&(i=20),new qT(this._iid,{channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionId:r,limit:i})},n}(Jn),pw=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(){this.onConnected=Ke,this.onReconnectStarted=Ke,this.onReconnectSucceeded=Ke,this.onReconnectFailed=Ke,this.onDisconnected=Ke}),RE=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(){this.onSessionExpired=Ke,this.onSessionTokenRequired=function(e){return e(null)},this.onSessionError=Ke,this.onSessionRefreshed=Ke,this.onSessionClosed=Ke}),OR=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(){this.onFriendsDiscovered=Ke,this.onTotalUnreadMessageCountChanged=Ke,this.onTotalUnreadMessageCountUpdated=Ke}),RR=function(e){function n(t){var r=t.limit,i=t.token,s=t.userIdsFilter,a=t.metaDataKeyFilter,o=t.metaDataValuesFilter,l=t.nicknameStartsWithFilter,u=e.call(this)||this;return u.method=Y.GET,u.path=tt,u.params=be({limit:r,token:i,user_ids:s,metadatakey:a,metadatavalues_in:o,nickname_startswith:l}),u}return T(n,e),n}(Z),kR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ze(t,s)}),i.next=r.next,i}return T(n,e),n}(le),LR=function(e){function n(t,r){var i,s,a,o=this;return(o=e.call(this,t,r)||this).userIdsFilter=null,o.metaDataKeyFilter=null,o.metaDataValuesFilter=null,o.nicknameStartsWithFilter=null,o.userIdsFilter=(i=r.userIdsFilter)!==null&&i!==void 0?i:null,o.metaDataKeyFilter=(s=r.metaDataKeyFilter)!==null&&s!==void 0?s:null,o.metaDataValuesFilter=(a=r.metaDataValuesFilter)!==null&&a!==void 0?a:null,o.nicknameStartsWithFilter=r.nicknameStartsWithFilter||null,o}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&Qe("string",this.userIdsFilter,!0)&&k("string",this.metaDataKeyFilter,!0)&&Qe("string",this.metaDataValuesFilter,!0)&&k("string",this.nicknameStartsWithFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new RR(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(kR),a=s.users,o=s.next,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),DR=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,a=t.userIdsFilter,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(tt,"/").concat(r,"/block"),o.params=be({limit:i,token:s,user_ids:a}),o}return T(n,e),n}(Z),UR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ze(t,s)}),i.next=r.next,i}return T(n,e),n}(le),PR=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).userIdsFilter=null,s.userIdsFilter=(i=r.userIdsFilter)!==null&&i!==void 0?i:null,s}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&Qe("string",this.userIdsFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new DR(Ie(M(M({},this),{userId:r.userId,token:this._token}))),[4,i.send(s)]):[3,2]:[3,5];case 1:return a=c.sent(),o=a.as(UR),l=o.users,u=o.next,this._token=u,this._hasNext=!!u,this._isLoading=!1,[2,l];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),FR=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,a=e.call(this)||this;return a.method=Y.GET,a.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friends"),a.params={limit:i,token:s},a}return T(n,e),n}(Z),HR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.hasMore=r.has_more,i.users=r.users.map(function(s){return new Ze(t,s)}),i.next=r.next,i}return T(n,e),n}(le),jR=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new FR(M(M({},this),{userId:r.userId,token:this._token})),[4,i.send(s)]):[3,2]:[3,5];case 1:return a=d.sent(),o=a.as(HR),l=o.users,u=o.hasMore,c=o.next,this._token=c,this._hasNext=u,this._isLoading=!1,[2,l];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),Gh={},rh=function(){function e(n){var t=n.dbname,r=n.itemSizeLimit,i=r===void 0?1048576:r,s=n.cacheLimit,a=s===void 0?256:s,o=n.blockHashBase,l=o===void 0?2:o,u=n.blockHashMultiplier,c=u===void 0?10:u,d=n.blockHashConstant,h=d===void 0?11:d,f=n.transactionApplyDelay,p=f===void 0?200:f,m=n.disableLogger,b=m!==void 0&&m;return Gh[t]||(this.itemSizeLimit=i,this.cacheLimit=a,this.blockHashBase=l,this.blockHashMultiplier=c,this.blockHashConstant=h,this.transactionApplyDelay=p,this.disableLogger=b,Gh[t]=this),Gh[t]}return e.get=function(n){return Gh[n]},e}();(function(e){e[e.UNKNOWN_ERROR=6e7]="UNKNOWN_ERROR",e[e.STORE_NOT_DEFINED=61001e3]="STORE_NOT_DEFINED",e[e.STORE_NOT_AVAILABLE=61001001]="STORE_NOT_AVAILABLE",e[e.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING=61001002]="STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING",e[e.STORE_IS_FULL=61001003]="STORE_IS_FULL",e[e.STORE_NOT_INITIALIZED=61001004]="STORE_NOT_INITIALIZED",e[e.STORE_INVALID_KEY_TYPE=61002e3]="STORE_INVALID_KEY_TYPE",e[e.STORE_BROKEN_INTEGRITY=61002001]="STORE_BROKEN_INTEGRITY",e[e.STORE_BROKEN_BLOB=61002002]="STORE_BROKEN_BLOB",e[e.STORE_ENCRYPTION_INVALID=61002003]="STORE_ENCRYPTION_INVALID",e[e.STORE_ITEM_SIZE_LIMIT_EXCEEDED=61017e3]="STORE_ITEM_SIZE_LIMIT_EXCEEDED",e[e.STORE_READ_FAILED=61017001]="STORE_READ_FAILED",e[e.STORE_WRITE_FAILED=61017002]="STORE_WRITE_FAILED",e[e.DATABASE_SCHEMA_NOT_ON_UPGRADE=62002e3]="DATABASE_SCHEMA_NOT_ON_UPGRADE",e[e.COLLECTION_NOT_READY=63001e3]="COLLECTION_NOT_READY",e[e.COLLECTION_KEY_NOT_MATCH=63002e3]="COLLECTION_KEY_NOT_MATCH",e[e.COLLECTION_QUERY_NOT_VALID=63002001]="COLLECTION_QUERY_NOT_VALID",e[e.COLLECTION_KEY_NOT_FOUND=63004e3]="COLLECTION_KEY_NOT_FOUND",e[e.COLLECTION_KEY_NOT_GIVEN=63004001]="COLLECTION_KEY_NOT_GIVEN",e[e.COLLECTION_INSERT_DUPLICATE=63009e3]="COLLECTION_INSERT_DUPLICATE",e[e.COLLECTION_WRITE_FAILED=63017e3]="COLLECTION_WRITE_FAILED",e[e.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED=63017001]="COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED",e[e.INDEX_TABLE_IS_REQUIRED=65001e3]="INDEX_TABLE_IS_REQUIRED",e[e.INDEX_TYPE_NOT_MATCH=65002e3]="INDEX_TYPE_NOT_MATCH",e[e.COMPARE_TYPE_NOT_MATCH=69002001]="COMPARE_TYPE_NOT_MATCH",e[e.CIRCULAR_REFERENCE_FOUND=69002002]="CIRCULAR_REFERENCE_FOUND"})(It||(It={}));var Lo,ot=function(e){function n(t){var r=t.code,i=r===void 0?It.UNKNOWN_ERROR:r,s=t.message,a=s===void 0?"Unknown error occurred.":s,o=e.call(this,a)||this;return o.code=i,Object.setPrototypeOf(o,n.prototype),o}return T(n,e),Object.defineProperty(n,"storeNotDefined",{get:function(){return new n({code:It.STORE_NOT_DEFINED,message:"Store is not defined. Specify the store on NestDB()"})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotAvailable",{get:function(){return new n({code:It.STORE_NOT_AVAILABLE,message:"Store is not available. Check your environment settings."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotAvailableInPrivateBrowsing",{get:function(){return new n({code:It.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING,message:"Store is not available because it is in private browsing."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeIsFull",{get:function(){return new n({code:It.STORE_IS_FULL,message:"Store is full."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotInitialized",{get:function(){return new n({code:It.STORE_NOT_INITIALIZED,message:"Store is not initialized."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeKeyTypeIsInvalid",{get:function(){return new n({code:It.STORE_INVALID_KEY_TYPE,message:"Store key should be string type."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeBrokenIntegrity",{get:function(){return new n({code:It.STORE_BROKEN_INTEGRITY,message:"Data should be in a store but it does not. Integrity is broken."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeBrokenBlob",{get:function(){return new n({code:It.STORE_BROKEN_BLOB,message:"Data should be in a store but it does not. Blob data is broken."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeEncryptionInvalid",{get:function(){return new n({code:It.STORE_ENCRYPTION_INVALID,message:"Encryption algorithm has changed. All the store should reset."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeItemSizeExceeded",{get:function(){return new n({code:It.STORE_ITEM_SIZE_LIMIT_EXCEEDED,message:"The size of the item exceeds the limit that the store allows."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeReadFailed",{get:function(){return new n({code:It.STORE_READ_FAILED,message:"Failed to read from store."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeWriteFailed",{get:function(){return new n({code:It.STORE_WRITE_FAILED,message:"Failed to write to store."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"databaseSchemaNotOnUpgrade",{get:function(){return new n({code:It.DATABASE_SCHEMA_NOT_ON_UPGRADE,message:"Committing schema is not allowed when upgrade is not running."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionNotReady",{get:function(){return new n({code:It.COLLECTION_NOT_READY,message:"Collection is not ready due to an error during initialization."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotMatch",{get:function(){return new n({code:It.COLLECTION_KEY_NOT_MATCH,message:"keyName of collection could not change."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionQueryNotValid",{get:function(){return new n({code:It.COLLECTION_QUERY_NOT_VALID,message:"Query parameter is not a valid format."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionInsertDuplicate",{get:function(){return new n({code:It.COLLECTION_INSERT_DUPLICATE,message:"The key already exists."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotFound",{get:function(){return new n({code:It.COLLECTION_KEY_NOT_FOUND,message:"The key is not found."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotGiven",{get:function(){return new n({code:It.COLLECTION_KEY_NOT_GIVEN,message:"The item should contain [keyName] property."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionWriteFailed",{get:function(){return new n({code:It.COLLECTION_WRITE_FAILED,message:"Failed to write an item."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionItemSizeExceeded",{get:function(){return new n({code:It.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED,message:"The size of the item exceeds the limit that a collection allows."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"indexTableIsRequired",{get:function(){return new n({code:It.INDEX_TABLE_IS_REQUIRED,message:"Index table is required."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"indexTypesNotMatch",{get:function(){return new n({code:It.INDEX_TYPE_NOT_MATCH,message:"Indexed column should have primitive type."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"compareTypesNotMatch",{get:function(){return new n({code:It.COMPARE_TYPE_NOT_MATCH,message:"Values to compare have different types."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circularReferenceFound",{get:function(){return new n({code:It.CIRCULAR_REFERENCE_FOUND,message:"Cannot handle circular referenced object."})},enumerable:!1,configurable:!0}),n}(Error);(function(e){e.INIT="init",e.READY="ready",e.CLOSED="closed"})(Lo||(Lo={}));var kE,$r=function(e,n){if(n===void 0&&(n=new WeakMap),typeof e=="object"&&e!==null){if(n.has(e))throw ot.circularReferenceFound;n.set(e,!0);var t=void 0;if(Array.isArray(e))t=e.map(function(i){return $r(i,n)});else if(e instanceof RegExp)t=e;else if(e instanceof Date)t=e;else for(var r in t={},e)t[r]=$r(e[r],n);return n.delete(e),t}return e},ea=function(e,n){if(n==null)return 1;if(e==null)return-1;if(typeof e!=typeof n)throw ot.compareTypesNotMatch;var t=0;switch(typeof e){case"boolean":case"number":t=e-n;break;case"string":t=e.localeCompare(n)}return t},LE=function(e,n){for(var t=0,r=0;r>>0)%n},zh=function(e){return new Promise(function(n){setTimeout(function(){return n()},e)})},Zo=function(e,n){if(!n)return!1;if(typeof e!="function"){for(var t in e)if(["/and","&&"].includes(t)){if(e[t].some(function(l){return!Zo(l,n)}))return!1}else if(["/or","||"].includes(t)){if(e[t].every(function(l){return!Zo(l,n)}))return!1}else if(t==="/where"){if(!(0,e[t])(n))return!1}else{var r=t;if(typeof e[r]=="object"){var i=e[r];for(var s in i)switch(s){case"/eq":case"=":if((a=n[r])!==(o=i[s]))return!1;break;case"/neq":case"!=":if((a=n[r])===(o=i[s]))return!1;break;case"/gt":case">":var a=n[r],o=i[s];if(!(ea(a,o)>0))return!1;break;case"/gte":case">=":if(a=n[r],o=i[s],!(ea(a,o)>=0))return!1;break;case"/lt":case"<":if(a=n[r],o=i[s],!(ea(a,o)<0))return!1;break;case"/lte":case"<=":if(a=n[r],o=i[s],!(ea(a,o)<=0))return!1;break;case"/in":if(a=n[r],!(o=i[s]).includes(a))return!1;break;case"/nin":if(a=n[r],(o=i[s]).includes(a))return!1;break;case"/contain":if(a=n[r],o=i[s],!a.includes(o))return!1;break;case"/regex":if(a=n[r],!(o=i[s]).test(a))return!1;break;case"/where":if(a=n[r],!(0,i[s])(a))return!1}}else if(typeof e[r]=="function"){if(!e[r](n[r]))return!1}else if(e[r]!==n[r])return!1}return!0}return e(n)},Cc=function(){},DE=function(){return Promise.resolve()},BR=function(e){return e},UE=function(e,n){n()};(function(e){e[e.FORWARD=0]="FORWARD",e[e.BACKWARD=1]="BACKWARD"})(kE||(kE={}));var Xo,gr,Cs,$R=function(){function e(n){var t=n.initialPrevValue,r=t===void 0?null:t,i=n.initialNextValue,s=i===void 0?null:i,a=n.iterator,o=n.map,l=o===void 0?BR:o,u=n.backward,c=u===void 0?DE:u,d=n.forward,h=d===void 0?DE:d,f=n.complete,p=f===void 0?Cc:f;this._prevValue=r,this._nextValue=s,this._error=null,this._map=l,this._backward=c,this._forward=h,this._iterator=a,this._complete=p}return Object.defineProperty(e.prototype,"prevValue",{get:function(){return this._map(this._prevValue)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextValue",{get:function(){return this._map(this._nextValue)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPrevious",{get:function(){return!!this._prevValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNext",{get:function(){return!!this._nextValue},enumerable:!1,configurable:!0}),e.prototype.prev=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:if(!this.hasPrevious)return[3,6];i.label=1;case 1:return i.trys.push([1,3,,4]),n=this._prevValue,t=this,[4,this._backward()];case 2:return t._prevValue=i.sent()||null,this._nextValue=n,[3,4];case 3:return r=i.sent(),this._error=r,[3,4];case 4:return[4,this._iterator(this)];case 5:return[2,i.sent()];case 6:this._complete(),i.label=7;case 7:return[2]}})})},e.prototype.next=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:if(!this.hasNext)return[3,6];i.label=1;case 1:return i.trys.push([1,3,,4]),n=this._nextValue,t=this,[4,this._forward()];case 2:return t._nextValue=i.sent()||null,this._prevValue=n,[3,4];case 3:return r=i.sent(),this._error=r,[3,4];case 4:return[4,this._iterator(this)];case 5:return[2,i.sent()];case 6:this._complete(),i.label=7;case 7:return[2]}})})},e.prototype.stop=function(){this._prevValue=null,this._nextValue=null,this._complete()},e}(),Nv=function(){function e(n){var t=n.condition,r=t===void 0?{}:t,i=n.backward,s=i!==void 0&&i,a=n.blockManager,o=n.indexer;this.condition=r,this.backward=s,this._blockManager=a,this._indexer=o}return e.prototype.findOptimizedStartPosition=function(){var n=this,t=["=","/eq",">",">=","/gt","/gte"],r=["=","/eq","<","<=","/lt","/lte"];if(this.backward){var i=this._indexer.origin.length-1;if(typeof this.condition!="function")for(var s in this._indexer.fields){var a=this._indexer.fields[s],o=1;if(a[0]==="-"&&(a=a.slice(1),o=-1),this.condition[a]){if(typeof this.condition[a]=="object"){var l=o>0?r:t;for(var u in this.condition[a])if(l.includes(u)){for(var c=i;c>=0;c--)if(o*ea(this._indexer.origin[c].columnValues[s],this.condition[a][u])<=0){i=c;break}}}else for(c=i;c>=0;c--)if(o*ea(this._indexer.origin[c].columnValues[s],this.condition[a])<=0){i=c;break}}}return Math.min(i+1,this._indexer.origin.length-1)}var d=0;if(typeof this.condition!="function")for(var h=function(m){var b=f._indexer.fields[m],v=1;if(b[0]==="-"&&(b=b.slice(1),v=-1),f.condition[b]){if(typeof f.condition[b]=="object")Object.keys(f.condition[b]).forEach(function(E){if((v>0?t:r).includes(E)){for(var S=d;S=0){d=S;break}}});else for(var _=d;_=0){d=_;break}}},f=this,s=0;s"u"?[3,4]:[4,fetch(r)]):[3,5];case 2:return[4,d.sent().blob()];case 3:return[2,d.sent()];case 4:for(s=[],a=atob(r.split(",")[1]),o=0;o-1){var i=this._items[r];return t===Cs.PERSISTENT&&(i.state=gr.PERSISTENT),t!==Cs.NO_CACHE&&this.put(i),i}return null},e.prototype.put=function(n){var t,r;if(this._limit>0){var i=this._items.map(function(d){return d.key}).indexOf(n.key);if(i>-1)FE.includes(this._items[i].state)&&FE.includes(n.state)?(this._items.splice(i,1),this._items.push(n)):(this._items[i].state=n.state,this._items[i].value=n.value);else{this._items.push(n);var s=this._items.filter(function(d){return d.state===gr.VOLATILE}),a=s.length-this._limit;if(a>0){var o=[];try{for(var l=ge(this._items),u=l.next();!u.done;u=l.next()){var c=u.value;c.state===gr.VOLATILE&&a>0?a--:o.push(c)}}catch(d){t={error:d}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}this._items=o}}}},e.prototype.remove=function(n){var t=this._items.map(function(r){return r.key}).indexOf(n);t>-1&&this._items.splice(t,1)},e.prototype.clearByCondition=function(n){this._items=this._items.filter(function(t){return!n(t)})},e.prototype.clear=function(n){n===void 0&&(n=!1),this._items=n?[]:this._items.filter(function(t){return t.state!==gr.VOLATILE})},e}(),VR=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.store;this._requests=[],this._onCommit=new Map,this._onWrite=new Map,this._onError=new Map,this.dbname=t,this.collectionName=r,this.metadataKey=function(s,a){return"".concat(ol(s,a),"/trans.metadata")}(t,r),this.recordsetKey=function(s,a){return"".concat(ol(s,a),"/trans.recordset")}(t,r),this._store=i}return Object.defineProperty(e.prototype,"generation",{get:function(){return this._metadata?this._metadata.generation:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"requestCount",{get:function(){return this._requests.length},enumerable:!1,configurable:!0}),e.prototype._getReducedRecordset=function(n){return n===void 0&&(n=[]),y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._store.get(this.recordsetKey)];case 1:return(t=r.sent()||[]).push.apply(t,Fe([],Me(n),!1)),[2,this._reduceRecordSet(t)]}})})},e.prototype._reduceRecordSet=function(n){for(var t=[],r={},i=n.length-1;i>=0;i--){for(var s=n[i],a=[],o=s.requests.length-1;o>=0;o--){var l=s.requests[o],u=l.data;r[u.key]||(a.unshift(l),r[u.key]=!0)}a.length>0&&(s.requests=a,t.unshift(s))}return t},e.prototype._applyRecord=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:r=Fi.get(this.dbname),i=t.generation,s=t.requests,a=null,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this._store.setMany(s.map(function(f){return M(M({},f.data),{generation:i})}))];case 2:for(o=h.sent(),l=0;l0))return[3,4];for(t=[],r={},l=n.length-1;l>=0;l--)i=n[l],c=i.data,r[c.key]||(r[c.key]=!0,t.unshift(i));return s={generation:this.generation,requests:t},[4,this._getReducedRecordset([s])];case 1:return a=p.sent(),[4,this._store.set({key:this.recordsetKey,value:a})];case 2:return p.sent(),this._metadata.generation++,[4,this._store.set({key:this.metadataKey,value:this._metadata})];case 3:for(p.sent(),o=Fi.get(this.dbname),l=0;l0?(i=this.createBlockId(n,r),[4,t.find(this._store,i)]):[3,4];case 2:if((s=o.sent())&&(a=Sf.createFromCacheItem(s),a==null?void 0:a.getItemByKey(n)))return[2,a];o.label=3;case 3:return r--,[3,1];case 4:return[2,null]}})})},e.prototype.getFromBlock=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._findBlock(n)];case 1:return[2,(t=r.sent())?t.getItemByKey(n):null]}})})},e.prototype.putToBlock=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return r=rh.get(this.dbname),i=this.createBlockId(n),s=Math.floor(this._store.itemSizeLimit/r.itemSizeLimit),[4,Fi.get(this.dbname).find(this._store,i)];case 1:return a=l.sent(),(o=a?Sf.createFromCacheItem(a):new Sf({blockId:i,keyName:this.keyName,items:[],limit:s}))!=null&&o.add(t)?(this._transaction.requestWrite({key:o.blockId,value:o.serialize()}),[2,!0]):[2,!1]}})})},e.prototype.removeFromBlock=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._findBlock(n)];case 1:return(t=r.sent())&&t.remove(n)?(this._transaction.requestWrite({key:t.blockId,value:t.serialize()}),[2,!0]):[2,!1]}})})},e.prototype.clearAllBlocks=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=Av(this.dbname,this.collectionName),[4,this._store.getAllKeys()];case 1:return t=i.sent(),r=t.filter(function(s){return s.startsWith(n)}),[4,this._store.removeMany(r)];case 2:return i.sent(),[4,this._transaction.clear()];case 3:return i.sent(),Fi.get(this.dbname).clearByCondition(function(s){return s.key.startsWith(n)}),[2]}})})},e}(),Nl={},pa=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.keyName,s=n.fields,a=n.transaction,o=n.store,l=this;this._origin=[],this._table=[];var u=function(c,d,h){return"".concat(ol(c,d),"/index.").concat(h)}(t,r,s.join(">"));return Nl[u]||(this.dbname=t,this.collectionName=r,this.keyName=i,this.fields=s,this.indexerKey=u,this._transaction=a,this._store=o,this._transaction.on(Xo.COMMIT,this.indexerKey,function(){return l.commit()}),this._transaction.on(Xo.ERROR,this.indexerKey,function(){return l.abort()})),Nl[u]}return e.createKey=function(n){return n.join(">")},e.parseKey=function(n){return n.split(">")},e.clearIndexerMap=function(){for(var n in Nl)delete Nl[n]},e.prototype._addItem=function(n){var t=n[this.keyName],r=this.getColumnValues(n),i=Me(this.indexOf(r),2),s=i[0];return i[1]?!this._table[s].keys.includes(t)&&(this._table[s].keys.push(t),!0):(this._table.splice(s,0,{columnValues:r,keys:[t]}),!0)},e.prototype._removeItem=function(n){var t=n[this.keyName],r=this.getColumnValues(n),i=Me(this.indexOf(r),2),s=i[0];if(i[1]){var a=this._table[s].keys.indexOf(t);if(a>-1)return this._table[s].keys.splice(a,1),this._table[s].keys.length===0&&this._table.splice(s,1),!0}return!1},Object.defineProperty(e.prototype,"origin",{get:function(){return this._origin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"table",{get:function(){return this._table},enumerable:!1,configurable:!0}),e.prototype.getColumnValues=function(n){var t,r,i,s,a=[];try{for(var o=ge(this.fields),l=o.next();!l.done;l=o.next()){var u=l.value;if(u[0]==="-"&&(u=u.slice(1)),i=n[u],s=void 0,s=typeof i,i!==null&&s!=="undefined"&&s!=="boolean"&&s!=="number"&&s!=="string")throw ot.indexTypesNotMatch;a.push(n[u])}}catch(c){t={error:c}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return a},e.prototype.diff=function(n,t){for(var r in this.fields){var i=this.fields[r][0]==="-"?-1:1,s=ea(n[r],t[r]);if(s!==0)return i*s}return 0},e.prototype.indexOf=function(n){if(this._table.length>0){for(var t=0,r=this._table.length-1;t<=r;){var i=Math.floor((t+r)/2),s=this.diff(n,this._table[i].columnValues);if(s>0)t=i+1;else{if(!(s<0))return[i,!0];r=i-1}}return[t,!1]}return[0,!1]},e.prototype.ensure=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v;return g(this,function(_){switch(_.label){case 0:return[4,(n=Fi.get(this.dbname)).find(this._store,this.indexerKey,Cs.PERSISTENT)];case 1:return(t=_.sent())?[3,11]:(r=Av(this.dbname,this.collectionName),[4,this._store.getAllKeys()]);case 2:i=_.sent(),_.label=3;case 3:_.trys.push([3,8,9,10]),s=ge(i),a=s.next(),_.label=4;case 4:return a.done?[3,7]:(o=a.value).startsWith(r)?[4,n.find(this._store,o,Cs.NO_CACHE)]:[3,6];case 5:if(l=_.sent(),u=Sf.createFromCacheItem(l))try{for(b=void 0,c=ge(u.items),d=c.next();!d.done;d=c.next())h=d.value,this._addItem(h)}catch(E){b={error:E}}finally{try{d&&!d.done&&(v=c.return)&&v.call(c)}finally{if(b)throw b.error}}_.label=6;case 6:return a=s.next(),[3,4];case 7:return[3,10];case 8:return f=_.sent(),p={error:f},[3,10];case 9:try{a&&!a.done&&(m=s.return)&&m.call(s)}finally{if(p)throw p.error}return[7];case 10:return this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[3,12];case 11:this._origin=t.value,this._table=$r(this._origin),_.label=12;case 12:return Nl[this.indexerKey]=this,[2]}})})},e.prototype.drop=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return Fi.get(this.dbname).remove(this.indexerKey),[4,this._store.remove(this.indexerKey)];case 1:return n.sent(),delete Nl[this.indexerKey],[2]}})})},e.prototype.addItem=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return this._addItem(n)&&this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.removeItem=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return this._removeItem(n)&&this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this._table=[],this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.commit=function(){this._origin=this._table,this._table=$r(this._origin)},e.prototype.abort=function(){this._table=$r(this._origin)},e}(),g0=function(){return typeof document<"u"&&typeof navigator<"u"&&navigator.product!=="ReactNative"},HE=function(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(n==="x"?t:3&t|8).toString(16)})};(function(e){e[e.PROCESSING=0]="PROCESSING",e[e.DONE=1]="DONE"})(Jc||(Jc={})),function(e){e.NEWNODE="newnode",e.REMOVENODE="removenode",e.CLAIM_HOST="claimhost",e.SYNC_HOST="synchost",e.REQUEST_LOCK="requestlock",e.ACQUIRE_LOCK="acquirelock",e.RELEASE_LOCK="releaselock"}(pr||(pr={}));var Ji,B_={},M2=function(){function e(n,t){t===void 0&&(t={});var r=this;return this._state=Jc.PROCESSING,this._queue=[],this._activationQueue=[],B_[n]&&!t.forceCreate||(this.nodeId=HE(),this.key=n,g0()&&(t.startAsInvisible?this.registerNode():document.visibilityState==="visible"?this.claimHost():this.registerNode(),document.addEventListener("visibilitychange",function(){document.visibilityState==="visible"&&r.claimHost()}),window.addEventListener("message",function(i){var s,a,o=i.data;if(o!=null&&o.isNestDbMessage){var l=o.nodeId,u=o.requestId,c=o.key,d=o.op,h=o.data;if(l!==r.nodeId&&c===r.key)switch(d){case pr.NEWNODE:r._sendSync();break;case pr.CLAIM_HOST:r._sendSync(),r._hostId=l;break;case pr.SYNC_HOST:if(!r.isInSync){r._activationTimeout&&clearTimeout(r._activationTimeout);var f=h,p=f.currentItemRequestId,m=f.queue,b=function(S){var w=r._queue.findIndex(function(N){return N.requestId===S.requestId});w<0&&r._requestLock({isNestDbMessage:!0,nodeId:S.nodeId,requestId:S.requestId,key:r.key,op:pr.REQUEST_LOCK,ts:S.ts})};try{for(var v=ge(m),_=v.next();!_.done;_=v.next())b(_.value)}catch(S){s={error:S}}finally{try{_&&!_.done&&(a=v.return)&&a.call(v)}finally{if(s)throw s.error}}r._currentItem=r._queue.find(function(S){return S.requestId===p}),r._completeSync()}break;case pr.REMOVENODE:r._queue=r._queue.filter(function(S){return S.nodeId!==o.nodeId}),r._currentItem&&r._currentItem.nodeId===o.nodeId&&(r._currentItem=void 0,r._acquire(r._queue[0]));break;case pr.REQUEST_LOCK:r._requestLock(o);break;case pr.ACQUIRE_LOCK:var E=r._queue.find(function(S){return S.requestId===u});r._acquire(E);break;case pr.RELEASE_LOCK:r._release(u)}}}),window.addEventListener("beforeunload",function(){r._send(pr.REMOVENODE)})),B_[n]=this),B_[n]}return Object.defineProperty(e.prototype,"locked",{get:function(){return!!this._currentItem},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isHost",{get:function(){return this._hostId===this.nodeId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInSync",{get:function(){return this._state==Jc.DONE},enumerable:!1,configurable:!0}),e.prototype._send=function(n,t){var r;t===void 0&&(t={});var i={isNestDbMessage:!0,nodeId:this.nodeId,requestId:(r=t==null?void 0:t.requestId)!==null&&r!==void 0?r:HE(),key:this.key,op:n,data:t.data,ts:Date.now()};return g0()&&window.postMessage(i,"*"),i},e.prototype._acquire=function(n){n?(this._currentItem=n,this._currentItem.onAcquired&&this._currentItem.onAcquired(n.requestId)):this._currentItem=void 0},e.prototype._release=function(n){if(this._currentItem&&this._currentItem.requestId===n){var t=this._currentItem;this._currentItem=void 0,t.nodeId===this.nodeId&&this._send(pr.RELEASE_LOCK,{requestId:t.requestId});var r=this._queue.findIndex(function(i){return i.requestId===n});r>-1&&this._queue.splice(r,1),t.onReleased&&t.onReleased(n)}},e.prototype._requestLock=function(n){var t=this;return new Promise(function(r){var i={nodeId:n.nodeId,requestId:n.requestId,ts:n.ts,onAcquired:function(o){t.isHost&&t._send(pr.ACQUIRE_LOCK,{requestId:o}),r()},onReleased:function(){t._acquire(t._queue[0])}},s=!1;for(var a in t._queue)if(t._queue[a].ts>i.ts){t._queue.splice(parseInt(a),0,i),s=!0;break}s||t._queue.push(i),t._currentItem||t._acquire(t._queue[0])})},e.prototype._sendSync=function(){var n;this.isHost&&this._send(pr.SYNC_HOST,{data:{currentItemRequestId:(n=this._currentItem)===null||n===void 0?void 0:n.requestId,queue:this._queue.map(function(t){return{nodeId:t.nodeId,requestId:t.requestId,ts:t.ts}})}})},e.prototype._waitUntilSyncCompleted=function(){return y(this,void 0,void 0,function(){var n=this;return g(this,function(t){return this.isHost&&!this.isInSync?[2,new Promise(function(r){n._activationQueue.push(r)})]:[2]})})},e.prototype._waitSync=function(){var n=this;this.isInSync||(this._activationTimeout=setTimeout(function(){n._completeSync()},8))},e.prototype._completeSync=function(){this.isInSync||(this._state=Jc.DONE,this._activationQueue.forEach(function(n){return n()}),this._activationQueue=[])},e.prototype.registerNode=function(){this._send(pr.NEWNODE),this._waitSync()},e.prototype.claimHost=function(){this._hostId=this.nodeId,this._send(pr.CLAIM_HOST),this._waitSync()},e.prototype.lock=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return[4,this._waitUntilSyncCompleted()];case 1:return t.sent(),n=this._send(pr.REQUEST_LOCK),[4,this._requestLock(n)];case 2:return t.sent(),[2]}})})},e.prototype.unlock=function(){var n;!((n=this._currentItem)===null||n===void 0)&&n.requestId&&this._release(this._currentItem.requestId)},e}(),$_=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.keyName,s=n.keyHash,a=n.indexes,o=n.store,l=this;this._state=Lo.INIT,this._indexers=[],this.dbname=t,this.name=r,this.keyName=i,this.indexes=Fe([[i]],Me(a.filter(function(u){return pa.createKey(u)!==l.keyName})),!1),this._keyHash=s,this._store=o,this._mutex=new M2(function(u,c){return"".concat(ol(u,c),".lock")}(t,r)),this._blobContainer=new zR({dbname:t,collectionName:r,store:o}),this._transaction=new VR({dbname:t,collectionName:r,store:o})}return e.metadataOf=function(n,t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=j_(n,t),[4,r.get(i)];case 1:return[2,s.sent()]}})})},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReady",{get:function(){return this._state===Lo.READY},enumerable:!1,configurable:!0}),e.prototype.init=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o,l,u,c,d,h,f,p,m=this;return g(this,function(b){switch(b.label){case 0:return[4,this._mutex.lock()];case 1:b.sent(),b.label=2;case 2:return b.trys.push([2,9,,10]),n=rh.get(this.dbname),[4,e.metadataOf(this.dbname,this.name,this._store)];case 3:return t=b.sent(),this._metadata=t||{keyName:this.keyName,blockLevel:1,blockHashBase:n.blockHashBase,blockHashMultiplier:n.blockHashMultiplier,blockHashConstant:n.blockHashConstant,indexes:this.indexes},[4,this._transaction.init()];case 4:b.sent(),this._blockManager=new qR({dbname:this.dbname,collectionName:this.name,hashFunction:this._keyHash,metadata:this._metadata,transaction:this._transaction,store:this._store}),r=Fe([],Me(this.indexes),!1),i=[],s=r.map(function(v){return pa.createKey(v)}),a=t?t.indexes.map(function(v){return pa.createKey(v)}):[];try{for(o=ge(a),l=o.next();!l.done;l=o.next())u=l.value,s.includes(u)||i.push(pa.parseKey(u))}catch(v){f={error:v}}finally{try{l&&!l.done&&(p=o.return)&&p.call(o)}finally{if(f)throw f.error}}return(c=[]).push.apply(c,Fe([],Me(r.map(function(v){var _=new pa({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:v,transaction:m._transaction,store:m._store});return m._indexers.push(_),_.ensure()})),!1)),c.push.apply(c,Fe([],Me(i.map(function(v){return new pa({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:v,transaction:m._transaction,store:m._store}).drop()})),!1)),[4,Promise.all(c)];case 5:return b.sent(),[4,this._transaction.commit()];case 6:return b.sent(),s.sort().join(",")===a.sort().join(",")?[3,8]:(d=j_(this.dbname,this.name),this._metadata.indexes=r,[4,this._store.set({key:d,value:this._metadata})]);case 7:b.sent(),b.label=8;case 8:return this._state=Lo.READY,this._mutex.unlock(),[3,10];case 9:throw h=b.sent(),this._mutex.unlock(),h;case 10:return[2]}})})},e.prototype.close=function(){this._state=Lo.CLOSED},e.prototype._hasPropertyOfKeyName=function(n){var t=n[this.keyName];return typeof t=="string"&&!!t},e.prototype._getIndexerBy=function(n){var t,r;n===void 0&&(n=null),n||(n=[this.keyName]);var i=pa.createKey(n);try{for(var s=ge(this._indexers),a=s.next();!a.done;a=s.next()){var o=a.value;if(i===pa.createKey(o.fields))return o}}catch(l){t={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}throw ot.indexTableIsRequired},e.prototype._upgradeBlockLevel=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=j_(this.dbname,this.name),this._metadata.blockLevel++,[4,this._store.set({key:n,value:this._metadata})];case 1:return t.sent(),[2]}})})},e.prototype._requestInsert=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return l.sent()?[3,13]:[4,this._blockManager.putToBlock(t,n)];case 2:return l.sent()?[3,5]:[4,this._upgradeBlockLevel()];case 3:return l.sent(),[4,this._blockManager.putToBlock(t,n)];case 4:l.sent(),l.label=5;case 5:l.trys.push([5,10,11,12]),r=ge(this._indexers),i=r.next(),l.label=6;case 6:return i.done?[3,9]:[4,i.value.addItem(n)];case 7:l.sent(),l.label=8;case 8:return i=r.next(),[3,6];case 9:return[3,12];case 10:return s=l.sent(),a={error:s},[3,12];case 11:try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(a)throw a.error}return[7];case 12:return[3,14];case 13:throw ot.collectionInsertDuplicate;case 14:return[2]}})})},e.prototype._requestUpsert=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d,h,f,p;return g(this,function(m){switch(m.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return(r=m.sent())?[3,13]:[4,this._blockManager.putToBlock(t,n)];case 2:return m.sent()?[3,5]:[4,this._upgradeBlockLevel()];case 3:return m.sent(),[4,this._blockManager.putToBlock(t,n)];case 4:m.sent(),m.label=5;case 5:m.trys.push([5,10,11,12]),i=ge(this._indexers),s=i.next(),m.label=6;case 6:return s.done?[3,9]:[4,(u=s.value).addItem(n)];case 7:m.sent(),m.label=8;case 8:return s=i.next(),[3,6];case 9:return[3,12];case 10:return a=m.sent(),d={error:a},[3,12];case 11:try{s&&!s.done&&(h=i.return)&&h.call(i)}finally{if(d)throw d.error}return[7];case 12:return[3,23];case 13:return[4,this._blockManager.putToBlock(t,n)];case 14:m.sent(),m.label=15;case 15:m.trys.push([15,21,22,23]),o=ge(this._indexers),l=o.next(),m.label=16;case 16:return l.done?[3,20]:(u=l.value).diff(u.getColumnValues(r),u.getColumnValues(n))===0?[3,19]:[4,u.removeItem(r)];case 17:return m.sent(),[4,u.addItem(n)];case 18:m.sent(),m.label=19;case 19:return l=o.next(),[3,16];case 20:return[3,23];case 21:return c=m.sent(),f={error:c},[3,23];case 22:try{l&&!l.done&&(p=o.return)&&p.call(o)}finally{if(f)throw f.error}return[7];case 23:return[2]}})})},e.prototype._requestUpdate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return(r=c.sent())?[4,this._blockManager.putToBlock(t,n)]:[3,11];case 2:c.sent(),c.label=3;case 3:c.trys.push([3,9,10,11]),i=ge(this._indexers),s=i.next(),c.label=4;case 4:return s.done?[3,8]:(a=s.value).diff(a.getColumnValues(r),a.getColumnValues(n))===0?[3,7]:[4,a.removeItem(r)];case 5:return c.sent(),[4,a.addItem(n)];case 6:c.sent(),c.label=7;case 7:return s=i.next(),[3,4];case 8:return[3,11];case 9:return o=c.sent(),l={error:o},[3,11];case 10:try{s&&!s.done&&(u=i.return)&&u.call(i)}finally{if(l)throw l.error}return[7];case 11:return[2]}})})},e.prototype._requestRemove=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return[4,this._blockManager.getFromBlock(n)];case 1:return(t=l.sent())?[4,this._blockManager.removeFromBlock(n)]:[3,10];case 2:l.sent(),l.label=3;case 3:l.trys.push([3,8,9,10]),r=ge(this._indexers),i=r.next(),l.label=4;case 4:return i.done?[3,7]:[4,i.value.removeItem(t)];case 5:l.sent(),l.label=6;case 6:return i=r.next(),[3,4];case 7:return[3,10];case 8:return s=l.sent(),a={error:s},[3,10];case 9:try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(a)throw a.error}return[7];case 10:return[2]}})})},e.prototype._requestClear=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return[4,this._blockManager.clearAllBlocks()];case 1:a.sent(),a.label=2;case 2:a.trys.push([2,7,8,9]),n=ge(this._indexers),t=n.next(),a.label=3;case 3:return t.done?[3,6]:[4,t.value.clear()];case 4:a.sent(),a.label=5;case 5:return t=n.next(),[3,3];case 6:return[3,9];case 7:return r=a.sent(),i={error:r},[3,9];case 8:try{t&&!t.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}return[7];case 9:return[2]}})})},e.prototype.getByKey=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,6];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this._blockManager.getFromBlock(n)];case 3:return t=i.sent(),this._mutex.unlock(),[2,$r(t)];case 4:throw r=i.sent(),this._mutex.unlock(),r;case 5:return[3,7];case 6:throw ot.collectionNotReady;case 7:return[2]}})})},e.prototype.query=function(n){if(n===void 0&&(n={}),this.isReady)return new GR({condition:n.where,mutex:this._mutex,blockManager:this._blockManager,indexer:this._getIndexerBy(n.index),backward:!!n.backward});throw ot.collectionNotReady},e.prototype.insertOne=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw ot.collectionKeyNotGiven;return[4,this._requestInsert($r(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.insertMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u=this;return g(this,function(c){switch(c.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:c.sent(),c.label=2;case 2:if(c.trys.push([2,12,,14]),n.some(function(d){return!u._hasPropertyOfKeyName(d)}))throw ot.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=ge(n),r=t.next(),c.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this._requestInsert($r(i))]);case 5:c.sent(),c.label=6;case 6:return r=t.next(),[3,4];case 7:return[3,10];case 8:return s=c.sent(),o={error:s},[3,10];case 9:try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(o)throw o.error}return[7];case 10:return[4,this._transaction.commit()];case 11:return c.sent(),this._mutex.unlock(),[2,n];case 12:return a=c.sent(),[4,this._transaction.clear()];case 13:throw c.sent(),this._mutex.unlock(),a;case 14:return[3,16];case 15:throw ot.collectionNotReady;case 16:return[2]}})})},e.prototype.upsertOne=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw ot.collectionKeyNotGiven;return[4,this._requestUpsert($r(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.upsertMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u=this;return g(this,function(c){switch(c.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:c.sent(),c.label=2;case 2:if(c.trys.push([2,12,,14]),n.some(function(d){return!u._hasPropertyOfKeyName(d)}))throw ot.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=ge(n),r=t.next(),c.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this._requestUpsert($r(i))]);case 5:c.sent(),c.label=6;case 6:return r=t.next(),[3,4];case 7:return[3,10];case 8:return s=c.sent(),o={error:s},[3,10];case 9:try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(o)throw o.error}return[7];case 10:return[4,this._transaction.commit()];case 11:return c.sent(),this._mutex.unlock(),[2,n];case 12:return a=c.sent(),[4,this._transaction.clear()];case 13:throw c.sent(),this._mutex.unlock(),a;case 14:return[3,16];case 15:throw ot.collectionNotReady;case 16:return[2]}})})},e.prototype.update=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw ot.collectionKeyNotGiven;return[4,this._requestUpdate($r(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.updateIf=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v=this;return g(this,function(_){switch(_.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,16];case 1:_.sent(),_.label=2;case 2:return _.trys.push([2,13,,15]),r=n.where,i=r===void 0?{}:r,s=n.index,a=s===void 0?null:s,o=n.backward,l=o!==void 0&&o,u=[],[4,new Nv({condition:i,blockManager:this._blockManager,backward:l,indexer:this._getIndexerBy(a)}).each(function(E){return y(v,void 0,void 0,function(){var S,w;return g(this,function(N){if(E.error)throw E.stop(),E.error;if(E.hasNext){if(S=E.nextValue,Zo(i,S)&&t.set){if(typeof t.set!="function")for(w in t.set)S[w]=t.set[w];else t.set(S);u.push(S)}E.next()}else E.stop();return[2]})})})];case 3:_.sent(),_.label=4;case 4:_.trys.push([4,9,10,11]),c=ge(u),d=c.next(),_.label=5;case 5:return d.done?[3,8]:(h=d.value,[4,this._requestUpdate($r(h))]);case 6:_.sent(),_.label=7;case 7:return d=c.next(),[3,5];case 8:return[3,11];case 9:return f=_.sent(),m={error:f},[3,11];case 10:try{d&&!d.done&&(b=c.return)&&b.call(c)}finally{if(m)throw m.error}return[7];case 11:return[4,this._transaction.commit()];case 12:return _.sent(),this._mutex.unlock(),[2,u];case 13:return p=_.sent(),[4,this._transaction.clear()];case 14:throw _.sent(),this._mutex.unlock(),p;case 15:return[3,17];case 16:throw this._transaction.clear(),ot.collectionNotReady;case 17:return[2]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,5,,7]),[4,this._requestRemove(n)];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[3,7];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.removeIf=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d,h,f,p,m,b=this;return g(this,function(v){switch(v.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:v.sent(),v.label=2;case 2:return v.trys.push([2,13,,14]),t=n.where,r=t===void 0?{}:t,i=n.index,s=i===void 0?null:i,a=n.backward,o=a!==void 0&&a,l=[],[4,new Nv({condition:r,blockManager:this._blockManager,backward:o,indexer:this._getIndexerBy(s)}).each(function(_){return y(b,void 0,void 0,function(){var E,S;return g(this,function(w){if(_.error)throw _.stop(),_.error;return _.hasNext?(E=_.nextValue,Zo(r,E)&&(S=E[this.keyName],l.push(S)),_.next()):_.stop(),[2]})})})];case 3:v.sent(),v.label=4;case 4:v.trys.push([4,9,10,11]),u=ge(l),c=u.next(),v.label=5;case 5:return c.done?[3,8]:(d=c.value,[4,this._requestRemove(d)]);case 6:v.sent(),v.label=7;case 7:return c=u.next(),[3,5];case 8:return[3,11];case 9:return h=v.sent(),p={error:h},[3,11];case 10:try{c&&!c.done&&(m=u.return)&&m.call(u)}finally{if(p)throw p.error}return[7];case 11:return[4,this._transaction.commit()];case 12:return v.sent(),this._mutex.unlock(),[2,l];case 13:throw f=v.sent(),this._mutex.unlock(),f;case 14:return[3,16];case 15:throw this._transaction.clear(),ot.collectionNotReady;case 16:return[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,5,,7]),[4,this._requestClear()];case 3:return t.sent(),[4,this._transaction.commit()];case 4:return t.sent(),this._mutex.unlock(),[3,7];case 5:return n=t.sent(),[4,this._transaction.clear()];case 6:throw t.sent(),this._mutex.unlock(),n;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.getBlob=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._blobContainer.get(n)];case 1:return[2,t.sent()]}})})},e.prototype.saveBlob=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._blobContainer.save(n,t)];case 1:return[2,r.sent()]}})})},e.prototype.removeBlob=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._blobContainer.remove(n)];case 1:return t.sent(),[2]}})})},e.prototype.removeAllBlobs=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._blobContainer.clear()];case 1:return n.sent(),[2]}})})},e}(),G_="[NESTDB]",qh=!0,vo=function(){function e(){}return e.off=function(){qh=!1},e.log=function(){for(var n=[],t=0;t1?[4,Promise.all(this._generateShardPostfixArray(s==null?void 0:s.shards).map(function(c){return y(l,void 0,void 0,function(){var d,h;return g(this,function(f){switch(f.label){case 0:return c>0?(d=this._getRawKey(n,".".concat(c)),[4,this._getRaw(d)]):[3,2];case 1:if(!(h=f.sent()))throw ot.storeBrokenIntegrity;return[2,h.data];case 2:return[2,i]}})})}))]:[3,4];case 3:return o=u.sent(),[3,5];case 4:o=[i],u.label=5;case 5:return a=o,[2,this.encryption.decrypt(JSON.parse(a.join("")))];case 6:return u.sent(),[2,null];case 7:return[2,null]}})})},e.prototype.set=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return t=this._shardify(n),[4,this._setRaw(t)];case 1:return r.sent(),[2,M({},n.value)]}})})},e.prototype.setMany=function(n){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return t=[],[4,this._setRaw(t.concat.apply(t,Fe([],Me(n.map(function(s){return r._shardify(s)})),!1)))];case 1:return i.sent(),[2,n.map(function(s){return s.value})]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t,r,i,s=this;return g(this,function(a){switch(a.label){case 0:return t=this._getRawKey(n,".0"),[4,this._getRaw(t)];case 1:return(r=a.sent())?(i=r.metadata,[4,this._removeRaw(this._generateShardPostfixArray(i==null?void 0:i.shards).map(function(o){return s._getRawKey(n,".".concat(o))}))]):[3,3];case 2:return a.sent(),[2,!0];case 3:return[2,!1]}})})},e.prototype.removeMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:t=[],r=function(f){var p,m,b;return g(this,function(v){switch(v.label){case 0:return p=i._getRawKey(f,".0"),[4,i._getRaw(p)];case 1:return(m=v.sent())&&(b=m.metadata,t.push.apply(t,Fe([],Me(i._generateShardPostfixArray(b==null?void 0:b.shards).map(function(_){return d._getRawKey(f,".".concat(_))})),!1))),[2]}})},i=this,h.label=1;case 1:h.trys.push([1,6,7,8]),s=ge(n),a=s.next(),h.label=2;case 2:return a.done?[3,5]:(o=a.value,[5,r(o)]);case 3:h.sent(),h.label=4;case 4:return a=s.next(),[3,2];case 5:return[3,8];case 6:return l=h.sent(),u={error:l},[3,8];case 7:try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 8:return t.length>0?[4,this._removeRaw(t)]:[3,10];case 9:h.sent(),h.label=10;case 10:return[2,n]}})})},e}(),Lr={},So=function(e){function n(t){t===void 0&&(t={});var r,i=this;i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:4194304}))||this;var s=t.delay,a=s===void 0?1:s;return i.delay=a,i.observer={},i}return T(n,e),Object.defineProperty(n.prototype,"rawData",{get:function(){return Lr[this.dbname]},set:function(t){Lr[this.dbname]=t},enumerable:!1,configurable:!0}),n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(Lr[this.dbname])return[2,Object.keys(Lr[this.dbname])];throw ot.storeNotAvailable})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Lr[this.dbname]?[4,zh(this.delay)]:[3,2];case 1:return r.sent(),[2,Lr[this.dbname][t]?M({key:t},Lr[this.dbname][t]):null];case 2:throw ot.storeNotAvailable}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:return Lr[this.dbname]?[4,zh(this.delay)]:[3,2];case 1:d.sent();try{for(r=ge(t),i=r.next();!i.done;i=r.next())s=i.value,a=s.key,o=s.data,l=s.metadata,Lr[this.dbname][a]=Object.freeze({data:o,metadata:l})}catch(h){u={error:h}}finally{try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(u)throw u.error}}return[3,3];case 2:throw ot.storeNotAvailable;case 3:return[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return Lr[this.dbname]?[4,zh(this.delay)]:[3,2];case 1:l.sent();try{for(r=ge(t),i=r.next();!i.done;i=r.next())s=i.value,Lr[this.dbname][s]&&delete Lr[this.dbname][s]}catch(u){a={error:u}}finally{try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(a)throw a.error}}return[3,3];case 2:throw ot.storeNotAvailable;case 3:return[2]}})})},n.prototype.observe=function(t,r,i){var s=this;this.observer[t]||(this.observer[t]={}),r.forEach(function(a){return s.observer[t][a]=i})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,Lr[this.dbname]||(Lr[this.dbname]={}),[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.set=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){if((r=this.observer[t.key])&&typeof r.set=="function"&&(i=r.set()))throw i;return[2,e.prototype.set.call(this,t)]})})},n.prototype.setMany=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){try{for(r=ge(t),i=r.next();!i.done;i=r.next())if(s=i.value,(a=this.observer[s.key])&&typeof a.set=="function"&&(o=a.set()))throw o}catch(d){l={error:d}}finally{try{i&&!i.done&&(u=r.return)&&u.call(r)}finally{if(l)throw l.error}}return[2,e.prototype.setMany.call(this,t)]})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,zh(this.delay)];case 1:return t.sent(),Lr[this.dbname]={},[2]}})})},n}(Cp),jE="NestDBStore";(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.OPENING=1]="OPENING",e[e.OPEN=2]="OPEN",e[e.CLOSED=3]="CLOSED"})(Ji||(Ji={}));var Ss,KR=function(e){function n(t){t===void 0&&(t={});var r,i=this;return(i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:104857600}))||this)._storeName=jE,i._state=Ji.UNINITIALIZED,i._openJobQueue=[],i._window=typeof window<"u"?window:void 0,i._indexedDb=i._window?i._window.indexedDB||i._window.mozIndexedDB||i._window.webkitIndexedDB||i._window.msIndexedDB:void 0,i}return T(n,e),Object.defineProperty(n.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),n.prototype.isTransactionInactiveError=function(t){return t instanceof Error&&t.message.includes("The transaction is inactive")},n.prototype._putToObjectStore=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,new Promise(function(s,a){var o=t.put(r);o.addEventListener("success",function(l){s(l.target.result)}),o.addEventListener("error",function(){a("Failed to write.")})})]})})},n.prototype._deleteFromObjectStore=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,new Promise(function(s,a){var o=t.delete(r);o.addEventListener("success",function(){return s(r)}),o.addEventListener("error",function(l){return a(l.target.error)})})]})})},n.prototype._openDatabase=function(t){var r=this;return new Promise(function(i,s){if(r._indexedDb){r._state=Ji.OPENING;var a=r._indexedDb.open(t);a.addEventListener("upgradeneeded",function(o){o.target.result.createObjectStore(jE,{keyPath:"key"})}),a.addEventListener("success",function(o){r._state=Ji.OPEN,r._database=o.target.result,r._openJobQueue.forEach(function(l){return l()}),r._openJobQueue=[],r._database.onclose=function(){r._database=void 0,r._state=Ji.OPENING,setTimeout(function(){r._openDatabase(t)},5)},i(r._database)}),a.addEventListener("error",function(o){r._state=Ji.UNINITIALIZED,s(o.target.error)})}else s(ot.storeNotAvailable)})},n.prototype._getObjectStore=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this._database?[2,this._database.transaction(this._storeName,t).objectStore(this._storeName)]:[3,1];case 1:switch(this._state){case Ji.UNINITIALIZED:case Ji.OPEN:return[3,2];case Ji.OPENING:case Ji.CLOSED:return[3,3]}return[3,4];case 2:throw ot.storeNotInitialized;case 3:return[2,new Promise(function(s){r._openJobQueue.push(function(){return s(r._getObjectStore(t))})})];case 4:return[4,this._getObjectStore(t)];case 5:return[2,i.sent()]}})})},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._getObjectStore("readonly")];case 1:return t=r.sent(),[4,new Promise(function(i,s){var a=t.getAllKeys();a.addEventListener("success",function(o){i(o.target.result)}),a.addEventListener("error",function(o){return s(o.target.error)})})];case 2:return[2,r.sent()]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._getObjectStore("readonly")];case 1:return r=i.sent(),[4,new Promise(function(s,a){var o=r.get(t);o.addEventListener("success",function(l){var u;s((u=l==null?void 0:l.target)===null||u===void 0?void 0:u.result)}),o.addEventListener("error",function(l){return a(l.target.error)})})];case 2:return[2,i.sent()]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:r=h.sent(),h.label=2;case 2:return h.trys.push([2,4,,15]),[4,Promise.all(t.map(function(f){return d._putToObjectStore(r,f)}))];case 3:return h.sent(),[3,15];case 4:if(i=h.sent(),!this.isTransactionInactiveError(i))return[3,13];h.label=5;case 5:h.trys.push([5,10,11,12]),s=ge(t),a=s.next(),h.label=6;case 6:return a.done?[3,9]:(o=a.value,[4,this._putToObjectStore(r,o)]);case 7:h.sent(),h.label=8;case 8:return a=s.next(),[3,6];case 9:return[3,12];case 10:return l=h.sent(),u={error:l},[3,12];case 11:try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 12:return[3,14];case 13:throw i;case 14:return[3,15];case 15:return[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:r=h.sent(),h.label=2;case 2:return h.trys.push([2,4,,15]),[4,Promise.all(t.map(function(f){return d._deleteFromObjectStore(r,f)}))];case 3:return h.sent(),[3,15];case 4:if(i=h.sent(),!this.isTransactionInactiveError(i))return[3,13];h.label=5;case 5:h.trys.push([5,10,11,12]),s=ge(t),a=s.next(),h.label=6;case 6:return a.done?[3,9]:(o=a.value,[4,this._deleteFromObjectStore(r,o)]);case 7:h.sent(),h.label=8;case 8:return a=s.next(),[3,6];case 9:return[3,12];case 10:return l=h.sent(),u={error:l},[3,12];case 11:try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 12:return[3,14];case 13:throw i;case 14:return[3,15];case 15:return[2]}})})},n.prototype._triggerDatabaseClose=function(){this._database&&this._database.onclose&&this._database.onclose(new Event("dummy"))},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:if(!((t=typeof window<"u"?window:null)!=null&&t.indexedDB||t!=null&&t.mozIndexedDB||t!=null&&t.webkitIndexedDB||t!=null&&t.msIndexedDB))return[3,6];if(this._indexedDb=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,!this._window||!g0())return[3,4];if(!(g0()&&navigator.userAgent&&navigator.userAgent.includes("Edge/")))return[3,1];if(!this._window.indexedDB&&(t.PointerEvent||t.MSPointerEvent))throw ot.storeNotAvailableInPrivateBrowsing;return[3,3];case 1:return[4,new Promise(function(s,a){if(r._indexedDb)try{var o=r._indexedDb.open("_testMozilla");o.onerror=function(){return a(ot.storeNotAvailableInPrivateBrowsing)},o.onsuccess=function(l){if(l.target.result.close(),r._indexedDb){var u=r._indexedDb.deleteDatabase("_testMozilla");u.onerror=function(){return s()},u.onsuccess=function(){return s()}}else a(ot.storeNotAvailable)}}catch{a(ot.storeNotAvailableInPrivateBrowsing)}else a(ot.storeNotAvailable)})];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:throw ot.storeNotAvailable;case 5:return[3,7];case 6:throw ot.storeNotAvailable;case 7:return[2]}})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this.checkAvailability()];case 1:return r.sent(),[4,this._openDatabase(t)];case 2:return r.sent(),[4,this._resetIfEncryptionChanged()];case 3:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:return t=r.sent(),[4,new Promise(function(i,s){var a=t.clear();a.addEventListener("success",function(){return i()}),a.addEventListener("error",function(o){return s(o.target.error)})})];case 2:return[2,r.sent()]}})})},n}(Cp),QR=function(e){function n(t){var r=this,i=t.AsyncStorage,s=t.itemSizeLimit,a=s===void 0?2097152:s,o=P6(t,["AsyncStorage","itemSizeLimit"]);return(r=e.call(this,M(M({},o),{itemSizeLimit:a}))||this)._asyncStorage=i,r}return T(n,e),n.prototype._isBelonging=function(t){return t.startsWith("".concat(this.dbname,"/"))},n.prototype._getActualKey=function(t){return"".concat(this.dbname,"/").concat(t)},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.getAllKeys()];case 1:return t=i.sent(),[2,t.filter(function(s){return r._isBelonging(s)}).map(function(s){return s.substring("".concat(r.dbname,"/").length)})]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.getItem(this._getActualKey(t))];case 1:return[2,(r=i.sent())?JSON.parse(r):null]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:r=[];try{for(i=ge(t),s=i.next();!s.done;s=i.next())a=s.value,o=a.key,a.data.length<=this.adjustedItemSizeLimit&&r.push([this._getActualKey(o),JSON.stringify(a)])}catch(d){l={error:d}}finally{try{s&&!s.done&&(u=i.return)&&u.call(i)}finally{if(l)throw l.error}}return[4,this._asyncStorage.multiSet(r)];case 1:return c.sent(),[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.multiRemove(t.map(function(s){return r._getActualKey(s)}))];case 1:return i.sent(),[2]}})})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(!this._asyncStorage)throw ot.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this.getAllKeys()];case 1:return t=r.sent(),[4,this.removeMany(t)];case 2:return r.sent(),[2]}})})},n}(Cp),YR=function(e){function n(t){var r,i=this;return(i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:6291456}))||this)._mmkv=t.MMKV,i}return T(n,e),n.prototype._isBelonging=function(t){return t.startsWith("".concat(this.dbname,"/"))},n.prototype._getActualKey=function(t){return"".concat(this.dbname,"/").concat(t)},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._mmkv.getAllKeys()];case 1:return t=i.sent(),[2,t.filter(function(s){return r._isBelonging(s)}).map(function(s){return s.substring("".concat(r.dbname,"/").length)})]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._mmkv.getString(this._getActualKey(t))];case 1:return[2,(r=i.sent())?JSON.parse(r):null]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){try{for(r=ge(t),i=r.next();!i.done;i=r.next())s=i.value,a=s.key,s.data.length<=this.adjustedItemSizeLimit&&this._mmkv.set(this._getActualKey(a),JSON.stringify(s))}catch(c){o={error:c}}finally{try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(o)throw o.error}}return[2]})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){try{for(r=ge(t),i=r.next();!i.done;i=r.next())s=i.value,this._mmkv.delete(this._getActualKey(s))}catch(u){a={error:u}}finally{try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(a)throw a.error}}return[2]})})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(!this._mmkv)throw ot.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this.getAllKeys()];case 1:return t=r.sent(),[4,this.removeMany(t)];case 2:return r.sent(),[2]}})})},n}(Cp);(function(e){e.INIT="INIT",e.OPENING="OPENING",e.OPENED="OPENED",e.CLOSED="CLOSED"})(Ss||(Ss={}));var Ys,ZR=function(){function e(n){var t=n.name,r=n.version,i=n.store,s=n.config;this.name=t,this._version=r,this._state=Ss.INIT,this._config=s||new rh({dbname:t}),this._store=i,this._event={success:Cc,error:Cc,storeReplaced:Cc,upgrade:UE},this._collections=new Map,this._globalMutex=new M2("".concat(this.name,".lock")),this._config.disableLogger&&vo.off(),new Fi({dbname:t,limit:this._config.cacheLimit})}return Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"store",{get:function(){return this._store},enumerable:!1,configurable:!0}),e.prototype.estimateUsage=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,(t=this._store,y(void 0,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,t.usage()];case 1:return[2,r.sent()]}})}))];case 1:return[2,n.sent()]}var t})})},e.prototype.commitSchema=function(n){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return this._state!==Ss.OPENING?[3,2]:[4,Promise.all(n.map(function(i){return y(t,void 0,void 0,function(){var s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return s=i.collectionName,a=i.keyName,o=i.index,l=o===void 0?[]:o,this._collections.has(s)||this._collections.set(s,new $_({dbname:this.name,collectionName:s,keyName:a,indexes:l,store:this._store})),(u=this._collections.get(s))?[4,u.init()]:[3,2];case 1:c.sent(),c.label=2;case 2:return[2]}})})}))];case 1:return r.sent(),[3,3];case 2:throw ot.databaseSchemaNotOnUpgrade;case 3:return[2]}})})},e.prototype.open=function(){var n;return y(this,void 0,void 0,function(){var t,r,i,s,a=this;return g(this,function(o){switch(o.label){case 0:return[4,this._globalMutex.lock()];case 1:if(o.sent(),this._state===Ss.OPENED)return[3,12];this._state=Ss.OPENING,o.label=2;case 2:return o.trys.push([2,5,,12]),[4,this._store.init(this.name)];case 3:return o.sent(),l=this.name,t="".concat(Iv(l),".metadata"),r={version:0,collectionNames:[]},[4,this._store.get(t)];case 4:return i=(n=o.sent())!==null&&n!==void 0?n:r,[2,new Promise(function(u,c){var d=function(f){i.version0&&!this.customTypesFilter.includes("*")&&!this.customTypesFilter.includes(n.customType)||this.senderUserIdsFilter&&this.senderUserIdsFilter.length>0&&(!(n instanceof Ht)||!this.senderUserIdsFilter.includes(n.sender.userId)))return!1;if(n instanceof vr)switch(this.replyType){case Bn.NONE:if(n.parentMessageId>0)return!1;break;case Bn.ONLY_REPLY_TO_CHANNEL:if(n instanceof Ht&&n.parentMessageId>0&&!n.replyToChannel)return!1}return!0},e}();(function(e){e.CHANNEL_LATEST="channel_latest",e.NEWEST_CHILD_MESSAGE="newest_child_message"})(Yn||(Yn={}));var ed,Os=function(e){switch(e){case Yn.CHANNEL_LATEST:return["channelUrl","-createdAt","-messageId"];case Yn.NEWEST_CHILD_MESSAGE:return["channelUrl","-parentMessageId","-createdAt","-messageId"]}},JR=function(){return["channelUrl","-createdAt","-notificationId"]},ek=M(M({},tw),{scheduledAt:void 0}),tk=function(e){return rw(e)&&k("number",e.scheduledAt,!0)},nk=M(M({},Ep),{scheduledAt:0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),rk=function(e){return bp(e)&&k("number",e.scheduledAt)&&(Er(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||e.thumbnailSizes.every(function(n){return k("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},_w="UnsentMessage",ik="reqId",Wh={},ll=function(e){function n(t){var r=e.call(this,t)||this;return r._mutex=new M2("unsendmessagecache.lock"),Wh[t]=r,r}return T(n,e),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return R.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Wh[t]&&!r||(Wh[t]=new n(t)),Wh[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb,r=t==null?void 0:t.collection(_w);if(!r)throw L.databaseError;return r},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){if(t.messageId>0)throw L.invalidParameters;var r,i=M({},t.serialize());return t instanceof sr?(t.messageParams&&(i.messageParams=EE(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=(r=t.scheduledInfo.scheduledMessageParams,M(M({},EE(r)),{scheduledAt:r.scheduledAt})))):t instanceof nn?(t.messageParams&&(i.messageParams=bE(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=function(s){return M(M({},bE(s)),{scheduledAt:s.scheduledAt})}(t.scheduledInfo.scheduledMessageParams))):t instanceof yi&&t.messageParams&&(i.messageParams=function(s){return be({fileInfoList:s.fileInfoList,isReplyToChannel:s.isReplyToChannel,pushNotificationDeliveryOption:s.pushNotificationDeliveryOption})}(t.messageParams)),i},n.prototype._deserialize=function(t){return t=M(M({},t),{messageId:parseInt(t.messageId)}),Ln.of(this._iid).buildMessageFromSerializedData(t)},n.prototype._deserializeWithMessageCreateParams=function(t){var r,i,s;return y(this,void 0,void 0,function(){var a,o,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:return a=Ln.of(this._iid),o=this._deserialize(t),t.messageParams?o instanceof sr?(u=t.messageParams,o.messageParams=a.buildUserMessageCreateParamsFromSerializedData(u,o),[3,6]):[3,1]:[3,6];case 1:return o instanceof nn?(u=t.messageParams).fileKey&&typeof u.fileKey=="string"&&P_((r=u.fileType)!==null&&r!==void 0?r:"")?(l=u,[4,this.collection.getBlob(u.fileKey)]):[3,3]:[3,4];case 2:l.file=(i=f.sent())!==null&&i!==void 0?i:void 0,f.label=3;case 3:return o.messageParams=a.buildFileMessageCreateParamsFromSerializedData(u,o),[3,6];case 4:return o instanceof yi&&(u=t.messageParams)&&u.fileInfoList?(o.messageParams=a.buildMultipleFilesMessageCreateParamsFromSerializedData(u,o),[4,Promise.all(o.messageParams.fileInfoList.map(function(p){return y(h,void 0,void 0,function(){var m,b,v,_,E;return g(this,function(S){switch(S.label){case 0:return typeof((b=p._uploadedMetaData)===null||b===void 0?void 0:b.fileKey)=="string"&&P_((_=(v=p._uploadedMetaData)===null||v===void 0?void 0:v.fileType)!==null&&_!==void 0?_:"")?(m=p,[4,this.collection.getBlob(p._uploadedMetaData.fileKey)]):[3,2];case 1:m.file=(E=S.sent())!==null&&E!==void 0?E:void 0,S.label=2;case 2:return[2]}})})}))]):[3,6];case 5:f.sent(),f.label=6;case 6:return o.scheduledInfo&&t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams?o instanceof sr?(c=t.scheduledInfo.scheduledMessageParams,o.scheduledInfo.scheduledMessageParams=a.buildScheduledUserMessageCreateParamsFromSerializedData(c,o),[3,10]):[3,7]:[3,10];case 7:return o instanceof nn?(c=t.scheduledInfo.scheduledMessageParams).fileKey&&typeof c.fileKey=="string"&&typeof c.fileType=="string"&&P_(c.fileType)?(d=c,[4,this.collection.getBlob(c.fileKey)]):[3,9]:[3,10];case 8:d.file=(s=f.sent())!==null&&s!==void 0?s:void 0,f.label=9;case 9:o.scheduledInfo.scheduledMessageParams=a.buildScheduledFileMessageCreateParamsFromSerializedData(c,o),f.label=10;case 10:return[2,o]}})})},n.prototype._getFileInfoBlobKey=function(t,r){return"".concat(t,".").concat(r)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey("".concat(t))]:[3,2];case 1:if(r=i.sent())return[2,this._deserializeWithMessageCreateParams(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.filter,s=i===void 0?new Us:i,a=t.order,o=a===void 0?Yn.CHANNEL_LATEST:a,l=t.sendingStatus,u=t.backward,c=u!==void 0&&u,d=t.parentMessageId;return y(this,void 0,void 0,function(){var h,f,p,m,b=this;return g(this,function(v){switch(v.label){case 0:return this.localCacheEnabled?(h=Os(o),f={"/where":function(_){return!!(o!==Yn.NEWEST_CHILD_MESSAGE||d&&_.parentMessageId!==0&&_.parentMessageId===d)&&s.match(b._deserialize(_))}},r&&(f.channelUrl=r),l&&(f.sendingStatus=l),p={where:f,index:h,backward:c},[4,this.collection.query(p)]):[3,3];case 1:return[4,v.sent().fetch({})];case 2:return m=v.sent(),[2,Promise.all(m.map(function(_){return y(b,void 0,void 0,function(){return g(this,function(E){switch(E.label){case 0:return[4,this._deserializeWithMessageCreateParams(_)];case 1:return[2,E.sent()]}})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new Us),y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this.fetch({filter:r,order:Yn.NEWEST_CHILD_MESSAGE,channelUrl:t.channelUrl,backward:!1,parentMessageId:t.messageId})];case 1:return[2,i.sent()]}})})},n.prototype.upsert=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var a;return g(this,function(o){switch(o.label){case 0:return s instanceof nn||s instanceof yi?[4,this._mutex.lock()]:[3,4];case 1:return o.sent(),[4,this.saveBlob(s)];case 2:return o.sent(),[4,this._mutex.unlock()];case 3:o.sent(),o.label=4;case 4:return a=this._serialize(s),[4,this.collection.upsertOne(a)];case 5:return o.sent(),[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.upsertChildMessages=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var a;return g(this,function(o){switch(o.label){case 0:return a=[],s.threadInfo&&s.threadInfo.replyCount>0?[4,this.getAllChildMessages(s)]:[3,2];case 1:a=o.sent(),o.label=2;case 2:return a.length>0?(a.forEach(function(l){return l.applyParentMessage(s)}),[4,this.upsert(a)]):[3,4];case 3:o.sent(),o.label=4;case 4:return[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ge(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove(s)]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return a=u.sent(),o={error:a},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t}})]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.saveBlob=function(t){return y(this,void 0,void 0,function(){var r,i,s,a=this;return g(this,function(o){switch(o.label){case 0:return t instanceof nn?t.messageParams&&(s=t.messageParams).file&&bf(s.file)?[4,this.collection.saveBlob(s.file,t.reqId)]:[3,2]:[3,5];case 1:i=o.sent(),s.fileKey=i,s.fileType=Yo.BLOB,o.label=2;case 2:return t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(r=t.scheduledInfo.scheduledMessageParams).file&&bf(r.file)?[4,this.collection.saveBlob(r.file,t.reqId)]:[3,4];case 3:i=o.sent(),r.fileKey=i,r.fileType=Yo.BLOB,o.label=4;case 4:return[3,7];case 5:return t instanceof yi&&(s=t.messageParams)&&s.fileInfoList&&Array.isArray(s.fileInfoList)?[4,Promise.all(s.fileInfoList.map(function(l,u){return y(a,void 0,void 0,function(){var c;return g(this,function(d){switch(d.label){case 0:return l.file&&bf(l.file)?[4,this.collection.saveBlob(l.file,this._getFileInfoBlobKey(t.reqId,u))]:[3,2];case 1:c=d.sent(),l._uploadedMetaData||(l._uploadedMetaData={}),l._uploadedMetaData.fileKey=c,l._uploadedMetaData.fileType=Yo.BLOB,d.label=2;case 2:return[2]}})})}))]:[3,7];case 6:o.sent(),o.label=7;case 7:return[2]}})})},n}(Jn),Kh={},nu=function(e){function n(t){var r=e.call(this,t)||this;return Kh[t]=r,r}return T(n,e),Object.defineProperty(n.prototype,"_sdkState",{get:function(){return R.of(this._iid).sdkState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return R.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return ll.of(this._iid)},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Kh[t]&&!r||(Kh[t]=new n(t)),Kh[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return Q(!!t).throw(L.databaseError),t.collection(wv)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){return M(M({},t.serialize()),{messageId:"".concat(t.messageId)})},n.prototype._deserialize=function(t){return t=M(M({},t),{messageId:parseInt(t.messageId)}),Ln.of(this._iid).buildMessageFromSerializedData(t)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey("".concat(t))]:[3,2];case 1:if(r=i.sent())return[2,this._deserialize(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.token,s=t.limit,a=s===void 0?100:s,o=t.filter,l=o===void 0?new Us:o,u=t.order,c=u===void 0?Yn.CHANNEL_LATEST:u,d=t.backward,h=d!==void 0&&d,f=t.parentMessageId,p=t.isPollOnly,m=p!==void 0&&p,b=t.exactMatch,v=b!==void 0&&b,_=t.inclusive,E=_===void 0||_;return y(this,void 0,void 0,function(){var S,w,N,I=this;return g(this,function(x){switch(x.label){case 0:return this.localCacheEnabled?(S=Os(c),w={where:{channelUrl:r,"/where":function(A){if(i)switch(c){case Yn.CHANNEL_LATEST:if(v&&A.createdAt!==i)return!1;if(h){if(E&&A.createdAti||!E&&A.createdAt>=i)return!1;break;case Yn.NEWEST_CHILD_MESSAGE:if(!f||A.parentMessageId===0||A.parentMessageId!==f)return!1}return!(m&&!A._poll)&&l.match(I._deserialize(A))}},index:S,backward:h},[4,this.collection.query(w)]):[3,3];case 1:return[4,x.sent().fetch({limit:a??void 0})];case 2:return N=x.sent(),[2,Promise.all(N.map(function(A){return y(I,void 0,void 0,function(){return g(this,function(O){return[2,this._deserialize(A)]})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new Us),y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this.fetch({channelUrl:t.channelUrl,token:Date.now(),limit:null,backward:!1,filter:r,order:Yn.NEWEST_CHILD_MESSAGE,parentMessageId:t.messageId})];case 1:return[2,i.sent()]}})})},n.prototype.upsert=function(t){var r;return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:return this.localCacheEnabled?[4,this.saveBlobs(t)]:[3,13];case 1:f.sent(),f.label=2;case 2:f.trys.push([2,7,8,9]),i=ge(t),s=i.next(),f.label=3;case 3:return s.done?[3,6]:(a=s.value,!((r=a.threadInfo)===null||r===void 0)&&r._isUpdateRequired?[4,this.get(a.messageId)]:[3,5]);case 4:(o=f.sent())!=null&&o.threadInfo&&a.threadInfo._updateFrom(o.threadInfo),f.label=5;case 5:return s=i.next(),[3,3];case 6:return[3,9];case 7:return l=f.sent(),c={error:l},[3,9];case 8:try{s&&!s.done&&(d=i.return)&&d.call(i)}finally{if(c)throw c.error}return[7];case 9:return u=t.map(function(p){return h._serialize(p)}),[4,this.collection.upsertMany(u)];case 10:return f.sent(),[4,this.upsertChildMessages(t)];case 11:return f.sent(),[4,this._unsentMessageCache.upsertChildMessages(t)];case 12:f.sent(),f.label=13;case 13:return[2]}})})},n.prototype.upsertChildMessages=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var a,o;return g(this,function(l){switch(l.label){case 0:return a=[],!((o=s.threadInfo)===null||o===void 0)&&o.replyCount&&s.threadInfo.replyCount>0?[4,this.getAllChildMessages(s)]:[3,2];case 1:a=l.sent(),l.label=2;case 2:return a.length>0?(a.forEach(function(u){return u.applyParentMessage(s)}),[4,this.upsert(a)]):[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ge(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove("".concat(s))]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return a=u.sent(),o={error:a},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:Os(Yn.CHANNEL_LATEST)})]:[3,6];case 1:return i.sent(),[4,(r=this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 2:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 3:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 4:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 5:i.sent(),i.label=6;case 6:return[2]}})})},n.prototype.removeUnderOffset=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:Os(Yn.CHANNEL_LATEST)})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.countBetween=function(t,r,i){return y(this,void 0,void 0,function(){var s,a=this;return g(this,function(o){switch(o.label){case 0:return this.localCacheEnabled?(s=Os(Yn.CHANNEL_LATEST),[4,this.collection.query({where:{channelUrl:t,"/where":function(l){var u=a._deserialize(l);return i.includes(u.createdAt)&&r.match(u)}},index:s}).count()]):[3,2];case 1:return[2,o.sent()];case 2:return[2,0]}})})},n.prototype.saveBlobs=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var a,o;return g(this,function(l){switch(l.label){case 0:return s instanceof nn&&s.messageParams&&(a=s.messageParams).file&&bf(a.file)?[4,this.collection.saveBlob(a.file,s.reqId)]:[3,2];case 1:o=l.sent(),a.fileKey=o,l.label=2;case 2:return[2]}})})}))];case 1:return i.sent(),[2]}})})},n.prototype._getGroupChannelPreferenceSize=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=0,[4,(i=this._cacheContext.preference).get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 1:return s=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 2:return a=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 3:return o=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 4:return l=u.sent(),s&&(r+=JSON.stringify(s).length),a&&(r+=JSON.stringify(a).length),o&&(r+=JSON.stringify(o).length),l&&(r+=JSON.stringify(l).length),[2,r]}})})},n}(Jn),Qh={},sk=function(e){function n(t){var r=e.call(this,t)||this;return Qh[t]=r,r}return T(n,e),Object.defineProperty(n.prototype,"_sdkState",{get:function(){return R.of(this._iid).sdkState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return R.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Qh[t]&&!r||(Qh[t]=new n(t)),Qh[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return Q(!!t).throw(L.databaseError),t.collection(fw)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){return M({},t.serialize())},n.prototype._deserialize=function(t){return Ln.of(this._iid).buildMessageFromSerializedData(t)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey(t)]:[3,2];case 1:if(r=i.sent())return[2,this._deserialize(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.token,s=t.limit,a=s===void 0?100:s,o=t.filter,l=o===void 0?new Us:o,u=t.backward,c=u!==void 0&&u,d=t.exactMatch,h=d!==void 0&&d,f=t.inclusive,p=f===void 0||f;return y(this,void 0,void 0,function(){var m,b=this;return g(this,function(v){switch(v.label){case 0:return this.localCacheEnabled?(m={where:{channelUrl:r,"/where":function(_){if(i){if(h&&_.createdAt!==i)return!1;if(c){if(p&&_.createdAti||!p&&_.createdAt>=i)return!1}return l.match(b._deserialize(_))}},index:["channelUrl","-createdAt","-notificationId"],backward:c},[4,this.collection.query(m)]):[3,3];case 1:return[4,v.sent().fetch({limit:a??void 0})];case 2:return[2,v.sent().map(function(_){return b._deserialize(_)})];case 3:return[2,[]]}})})},n.prototype.upsert=function(t){return y(this,void 0,void 0,function(){var r,i=this;return g(this,function(s){switch(s.label){case 0:return this.localCacheEnabled?(r=t.map(function(a){return i._serialize(a)}),[4,this.collection.upsertMany(r)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ge(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove(s)]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return a=u.sent(),o={error:a},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},n.prototype.markAsReadByTimestamp=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,messageStatus:ko.SENT,createdAt:{"<":r}}},{set:{messageStatus:ko.READ}})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.markAsReadByMessageIds=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,notificationId:{"/in":r},messageStatus:ko.SENT}},{set:{messageStatus:ko.READ}})]:[3,2];case 1:return[2,i.sent().length];case 2:return[2,0]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:["channelUrl","-createdAt","-notificationId"]})]:[3,6];case 1:return i.sent(),[4,(r=this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 2:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 3:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 4:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 5:i.sent(),i.label=6;case 6:return[2]}})})},n.prototype.removeUnderOffset=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:Os(Yn.CHANNEL_LATEST)})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.countBetween=function(t,r,i){return y(this,void 0,void 0,function(){var s,a=this;return g(this,function(o){switch(o.label){case 0:return this.localCacheEnabled?(s=["channelUrl","-createdAt","-notificationId"],[4,this.collection.query({where:{channelUrl:t,"/where":function(l){var u=a._deserialize(l);return i.includes(u.createdAt)&&r.match(u)}},index:s}).count()]):[3,2];case 1:return[2,o.sent()];case 2:return[2,0]}})})},n}(Jn),nc={},mw=function(e){function n(t){var r=e.call(this,t)||this;return r._observers=new Map,r._dispatcherContext=r._dispatcher.on(function(i){return y(r,void 0,void 0,function(){var s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x=this;return g(this,function(A){switch(A.label){case 0:return i instanceof Tt?(s=i.messages,I=i.source,c=i.isWebSocketEventComing,a=s.filter(function(O){return O instanceof vr&&O.channelType!==et.OPEN&&O.messageId>0}),o=s.filter(function(O){return O instanceof vr&&O.channelType!==et.OPEN&&O.messageId===0}),l=s.filter(function(O){return O instanceof al}),a.length>0?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._messageCache.upsert(a)];case 1:return O.sent(),[4,this._unsentMessageCache.remove(a.map(function(U){return U instanceof Ht?U.reqId:null}).filter(function(U){return U!==null}))];case 2:return O.sent(),[2]}})})})]:[3,2]):[3,7];case 1:A.sent(),c||this._broadcastUpdateEvent(a,I),A.label=2;case 2:return o.length>0?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._unsentMessageCache.upsert(o)];case 1:return O.sent(),[2]}})})})]:[3,4];case 3:A.sent(),c||this._broadcastUpdateEvent(o,I),A.label=4;case 4:return l.length>0?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._notificationCache.upsert(l)];case 1:return O.sent(),[2]}})})})]:[3,6];case 5:A.sent(),c||this._broadcastUpdateEvent(l,I),A.label=6;case 6:return[3,24];case 7:return i instanceof T2?(u=i.messageIds,I=i.source,c=i.isWebSocketEventComing,d=u.filter(function(O){return typeof O=="number"}),h=u.filter(function(O){return typeof O=="string"}),[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return d.length>0?[4,this._messageCache.remove(d)]:[3,2];case 1:O.sent(),O.label=2;case 2:return h.length>0?[4,this._notificationCache.remove(h)]:[3,4];case 3:O.sent(),O.label=4;case 4:return[2]}})})})]):[3,9];case 8:return A.sent(),c||this._broadcastRemoveEvent(u,I),[3,24];case 9:return i instanceof FT?(f=i.reqId,I=i.source,[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._unsentMessageCache.remove([f])];case 1:return O.sent(),[2]}})})})]):[3,11];case 10:return A.sent(),this._broadcastRemoveUnsentEvent(f,I),[3,24];case 11:return i instanceof HT?(p=i.polls,I=i.source,this._cacheContext.localCacheEnabled?(m=p.map(function(O){return O.messageId}),[4,Promise.all(m.map(function(O){return x._messageCache.get(O)}))]):[3,14]):[3,15];case 12:return(b=A.sent().filter(function(O){return O})).length>0&&p.forEach(function(O){var U=b.find(function(W){return W.messageId===O.messageId});U&&U.applyPoll(O)}),[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._messageCache.upsert(b)];case 1:return[2,O.sent()]}})})})];case 13:A.sent(),A.label=14;case 14:return this._broadcastPollChangeLogEvent(p,I),[3,24];case 15:return i instanceof jT?(v=i.event,I=i.source,[4,this._messageCache.get(v.messageId)]):[3,19];case 16:return(_=A.sent())&&_.isUserMessage()&&_.poll&&_.poll.applyPollUpdateEvent(v)?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._messageCache.upsert([_])];case 1:return[2,O.sent()]}})})})]:[3,18];case 17:A.sent(),A.label=18;case 18:return this._broadcastPollUpdateEvent(v,I),[3,24];case 19:return i instanceof w2?(E=i.event,I=i.source,[4,this._messageCache.get(E.messageId)]):[3,23];case 20:return(S=A.sent())&&S.isUserMessage()&&S.poll&&S.poll.applyPollVoteEvent(E)?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._messageCache.upsert([S])];case 1:return[2,O.sent()]}})})})]:[3,22];case 21:A.sent(),A.label=22;case 22:return this._broadcastPollVoteEvent(E,I),[3,24];case 23:i instanceof UT?(w=i.event,I=i.source,w.messageId>0&&this._broadcastReactionUpdateEvent(w,I)):i instanceof PT&&(N=i.event,I=i.source,this._broadcastThreadUpdateEvent(N,I)),A.label=24;case 24:return[2]}})})}),r}return T(n,e),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return R.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_dispatcher",{get:function(){return R.of(this._iid).dispatcher},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_messageCache",{get:function(){return nu.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return ll.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_notificationCache",{get:function(){return sk.of(this._iid)},enumerable:!1,configurable:!0}),n.of=function(t,r){var i;return r===void 0&&(r=!1),nc[t]&&!r||(nc[t]&&((i=nc[t]._dispatcherContext)===null||i===void 0||i.close()),nc[t]=new n(t)),nc[t]},n.prototype._broadcastUpdateEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onUpdate&&l.onUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastPollChangeLogEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onPollChangeLogUpdate&&l.onPollChangeLogUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastPollUpdateEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onPollUpdate&&l.onPollUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastPollVoteEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onPollVote&&l.onPollVote(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastRemoveEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onRemove&&l.onRemove(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastRemoveUnsentEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onRemoveUnsent&&l.onRemoveUnsent(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastReactionUpdateEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onReactionUpdate&&l.onReactionUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastThreadUpdateEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onThreadInfoUpdate&&l.onThreadInfoUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype.subscribe=function(t,r){this._observers.set(t,r)},n.prototype.unsubscribe=function(t){this._observers.delete(t)},n.prototype.unsubscribeAll=function(){this._observers.clear()},n}(Jn),ak=function(e){function n(t){var r=this,i=t.reverse,s=i!==void 0&&i,a=t.limit,o=a===void 0?20:a,l=t.keys,u=t.token;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(rT),r.params=be({token:u,limit:o,reverse:s,order:uv.UPDATED_AT,show_ui_template:!0,show_color_variables:!0,keys:l}),r}return T(n,e),n}(Z),ok=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.next,a=r.has_more,o=a!==void 0&&a,l=r.templates;return i.nextToken=s,i.hasMore=o,i.templates=l.map(function(u){return{template:JSON.stringify(u)}}),i}return T(n,e),n}(le),lk=function(e){function n(t){var r=this,i=t.key;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(rT,"/").concat(i),r}return T(n,e),n}(Z),uk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.template=JSON.stringify(r),i}return T(n,e),n}(le),BE={},Ln=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.requestQueue,a=t.onlineDetector,o=t.cacheContext;this._iid=n,this._sdkState=r,this._requestQueue=s,this._dispatcher=i,this._cacheContext=o,nu.of(n),ll.of(n),mw.of(n),this.fileMessageQueue=new sO(n,{sdkState:r,dispatcher:i,requestQueue:s,onlineDetector:a,cacheContext:o}),BE[n]=this}return e.of=function(n){return BE[n]},e.prototype.buildMessageFromSerializedData=function(n){var t=Ko(n);if(t.notificationId)return new al(this._iid,al.payloadify(t));switch(t.messageType){case wt.USER:return new sr(this._iid,sr.payloadify(t));case wt.FILE:return yi._isMultipleFilesMessageSerializedData(t)?new yi(this._iid,yi.payloadify(t)):new nn(this._iid,nn.payloadify(t));case wt.ADMIN:return new Lu(this._iid,Lu.payloadify(t))}throw L.invalidParameters},e.prototype.buildUserMessageCreateParamsFromSerializedData=function(n,t){return be(Ie({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,message:t.message,translationTargetLanguages:Object.keys(t.translations),pollId:n.pollId}))},e.prototype.buildFileMessageCreateParamsFromSerializedData=function(n,t){var r;return be(Ie({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,file:n.file,fileKey:n.fileKey,fileUrl:t.plainUrl,fileName:t.name,fileSize:t.size,mimeType:t.type,thumbnailSizes:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){return{maxWidth:i.width,maxHeight:i.height}}),fileType:n.fileType,requireAuth:t.requireAuth}))},e.prototype.buildMultipleFilesMessageCreateParamsFromSerializedData=function(n,t){var r=this;return be({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,fileInfoList:n.fileInfoList.map(function(i){return new v0(r._iid,i)})})},e.prototype.buildScheduledUserMessageCreateParamsFromSerializedData=function(n,t){return M(M({},this.buildUserMessageCreateParamsFromSerializedData(n,t)),{scheduledAt:n.scheduledAt})},e.prototype.buildScheduledFileMessageCreateParamsFromSerializedData=function(n,t){return M(M({},this.buildFileMessageCreateParamsFromSerializedData(n,t)),{scheduledAt:n.scheduledAt})},e.prototype.buildSenderFromSerializedData=function(n){var t=Ko(n);return new ku(this._iid,ku.payloadify(t))},e.prototype.getMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new aO(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(oO).message]}})})},e.prototype.getScheduledMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new cO(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(dO).message]}})})},e.prototype.getMessagesByMessageId=function(n,t,r,i,s){return s===void 0&&(s=z.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var a,o,l;return g(this,function(u){switch(u.label){case 0:return a=new Bh(M(M({channelType:t,channelUrl:n,token:String(r)},Zc),i)),[4,this._requestQueue.send(a)];case 1:return o=u.sent(),l=o.as($h).messages,this._dispatcher.dispatch(new Tt({messages:l,source:s})),[2,l]}})})},e.prototype.getMessagesByTimestamp=function(n,t,r,i,s){return s===void 0&&(s=z.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var a,o,l;return g(this,function(u){switch(u.label){case 0:return a=new Bh(M(M({channelType:t,channelUrl:n,timestamp:r},Zc),i)),[4,this._requestQueue.send(a)];case 1:return o=u.sent(),l=o.as($h).messages,this._dispatcher.dispatch(new Tt({messages:l,source:s})),[2,l]}})})},e.prototype._getMessagesByTimestampForCollection=function(n,t,r,i,s,a,o){return s===void 0&&(s=z.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return l=new Bh(M(M(M({channelType:t,channelUrl:n,timestamp:r},Zc),i),{checkingHasNext:a,checkingContinuousMessages:o})),[4,this._requestQueue.send(l)];case 1:return u=p.sent(),c=u.as($h),d=c.messages,h=c.isContinuousMessages,f=c.hasNext,this._dispatcher.dispatch(new Tt({messages:d,source:s})),[2,{messages:d,isContinuousMessages:h,hasNext:f}]}})})},e.prototype.getThreadedMessagesByTimestamp=function(n,t,r,i){return i===void 0&&(i=z.REQUEST_THREADED_MESSAGE),y(this,void 0,void 0,function(){var s,a,o,l;return g(this,function(u){switch(u.label){case 0:return s=new Bh(M(M(M({channelUrl:n.channelUrl,channelType:n.channelType,timestamp:t},nh),r),{replyType:Bn.ALL,parentMessageId:n.messageId,includeThreadInfo:!0})),[4,this._requestQueue.send(s)];case 1:return a=u.sent(),o=a.as($h).messages,(l=o.slice(1)).forEach(function(c){c.parentMessage=n}),this._dispatcher.dispatch(new Tt({messages:l,source:i})),[2,{parentMessage:o[0],threadedMessages:l}]}})})},e.prototype.getMessageTemplatesByToken=function(n,t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=new ak(M({token:n},t)),[4,this._requestQueue.send(r)];case 1:return i=u.sent(),s=i.as(ok),a=s.hasMore,o=s.nextToken,l=s.templates,[2,{hasMore:a,token:o,templates:l}]}})})},e.prototype.getMessageTemplate=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new lk({key:n}),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,{template:r.as(uk).template}]}})})},e.prototype.getMessageChangelogs=function(n,t,r,i,s){return s===void 0&&(s=z.REQUEST_MESSAGE_CHANGELOGS),y(this,void 0,void 0,function(){var a,o,l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return a=new lO(be(Ie(M(M({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null},Ev),i)))),[4,this._requestQueue.send(a)];case 1:return o=p.sent(),l=o.as(uO),u=l.updatedMessages,c=l.deletedMessagesInfo,d=l.hasMore,h=l.nextToken,f=c.map(function(m){return m.messageId}),u.length>0&&this._dispatcher.dispatch(new Tt({messages:u,source:s})),f.length>0&&this._dispatcher.dispatch(new T2({messageIds:f,source:s})),[2,{updatedMessages:u,deletedMessageIds:f,hasMore:d,token:h}]}})})},e}(),vw=function(e){function n(t,r){var i=e.call(this,t)||this;i.targetMessageId=0;var s=r.thread_info,a=r.parent_message_id,o=r.channel_url,l=r.channel_type;return s&&k("object",s)&&k("number",a)&&k("string",o)&&k("string",l)&&(i.threadInfo=new m0(t,s),i.targetMessageId=a,i.channelUrl=o,i.channelType=l),i}return T(n,e),n}(Jn),ck={channelUrl:"",channelType:et.BASE,messageId:0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1},dk=function(e){function n(t){var r=t.channelCustomType,i=t.keyword,s=t.limit,a=t.reverse,o=t.exactMatch,l=t.channelUrl,u=t.order,c=t.messageTimestampFrom,d=t.messageTimestampTo,h=t.advancedQuery,f=t.targetFields,p=t.nextToken,m=e.call(this)||this;return m.method=Y.GET,m.path="".concat(Y6,"/messages"),m.params={custom_type:r,query:i,limit:s,reverse:a,exact_match:o,channel_url:l,message_ts_from:c,message_ts_to:d,sort_field:u,advanced_query:h,target_fields:f,after:p},m}return T(n,e),n}(Z),hk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.messages=r.results.map(function(s){return Tr(t,s)}),i.hasNext=r.has_next,i.nextToken=r.end_cursor,i.totalCount=r.total_count,i}return T(n,e),n}(le);(function(e){e.SCORE="score",e.TIMESTAMP="ts"})(ed||(ed={}));var fk=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f=this;return(f=e.call(this,t,r)||this).keyword="",f.reverse=!1,f.exactMatch=!1,f.channelUrl="",f.channelCustomType="",f.messageTimestampFrom=null,f.messageTimestampTo=null,f.order=ed.SCORE,f.advancedQuery=!1,f.targetFields=null,f._nextToken="",f.totalCount=-1,f.keyword=r.keyword,f.reverse=(i=r.reverse)!==null&&i!==void 0&&i,f.exactMatch=(s=r.exactMatch)!==null&&s!==void 0&&s,f.channelUrl=(a=r.channelUrl)!==null&&a!==void 0?a:"",f.channelCustomType=(o=r.channelCustomType)!==null&&o!==void 0?o:"",f.messageTimestampFrom=(l=r.messageTimestampFrom)!==null&&l!==void 0?l:null,f.messageTimestampTo=(u=r.messageTimestampTo)!==null&&u!==void 0?u:null,f.order=(c=r.order)!==null&&c!==void 0?c:ed.SCORE,f.advancedQuery=(d=r.advancedQuery)!==null&&d!==void 0&&d,f.targetFields=(h=r.targetFields)!==null&&h!==void 0?h:null,f}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.keyword)&&this.keyword.length>0&&k("boolean",this.reverse)&&k("boolean",this.exactMatch)&&k("string",this.channelUrl)&&k("string",this.channelCustomType)&&(k("number",this.messageTimestampFrom)||this.messageTimestampFrom===null)&&(k("number",this.messageTimestampTo)||this.messageTimestampTo===null)&&Ve(ed,this.order)&&k("boolean",this.advancedQuery)&&Qe("string",this.targetFields,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new dk(Ie(M(M({},this),{nextToken:this._nextToken?this._nextToken:null}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=c.sent(),s=i.as(hk),a=s.messages,o=s.hasNext,l=s.nextToken,u=s.totalCount,this._nextToken=l,this._hasNext=o,this._isLoading=!1,this.totalCount=u,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),pk=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.limit,a=t.token,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/parent_thread_message"),o.params=be(Ie({limit:s,token:a})),o}return T(n,e),n}(Z),_k=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.next,i.messages=r.messages.map(function(s){return Tr(t,s)}),i}return T(n,e),n}(le),mk=function(e){function n(t,r,i,s){var a=e.call(this,t,r,i,s)||this;return a._edge="",a}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new pk({channelType:this.channelType,channelUrl:this.channelUrl,token:this._edge,limit:this.limit}),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(_k),a=s.messages,o=s.token,this._edge=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),vk={channelUrl:"",scheduledMessageId:0},gk={reverse:!1,limit:20},yk=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="message",t}return T(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,a=r.sessionManager,o=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:a,requestQueue:o,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new Ln(t,{sdkState:i,dispatcher:s,requestQueue:o,onlineDetector:u,cacheContext:c})},n.prototype.buildMessageFromSerializedData=function(t){return this._manager.buildMessageFromSerializedData(t)},n.prototype.buildSenderFromSerializedData=function(t){return this._manager.buildSenderFromSerializedData(t)},n.prototype.getMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return r=M(M({},ck),t),Q(function(a){return k("string",a.channelUrl)&&Ve(et,a.channelType)&&k("number",a.messageId)&&k("boolean",a.includeReactions,!0)&&k("boolean",a.includeMetaArray,!0)&&k("boolean",a.includeParentMessageInfo,!0)&&k("boolean",a.includeThreadInfo,!0)}(r)).throw(L.invalidParameters),[4,this._manager.getMessage(r)];case 1:if((i=s.sent())instanceof vr||i instanceof al||i===null)return[2,i];throw"Unknown message type is given."}})})},n.prototype.getScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},vk),t),Q(function(s){return k("string",s.channelUrl)&&s.channelUrl!==""&&k("number",s.scheduledMessageId)&&s.scheduledMessageId>0}(r)).throw(L.invalidParameters),[2,this._manager.getScheduledMessage(r)]})})},n.prototype.getMessageTemplatesByToken=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){return i=M(M({},gk),r),Q(k("string",t,!0)&&function(a){return k("boolean",a.reverse,!0)&&k("number",a.limit,!0)&&Qe("string",a.keys,!0)}(i)).throw(L.invalidParameters),[2,this._manager.getMessageTemplatesByToken(t,i)]})})},n.prototype.getMessageTemplate=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(k("string",t)).throw(L.invalidParameters),[2,this._manager.getMessageTemplate(t)]})})},n}(S2),Bt,td,Mv;(function(e){e.LATEST_LAST_MESSAGE="latest_last_message",e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"})(Bt||(Bt={})),function(e){e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"}(td||(td={})),function(e){e.CREATED_AT="created_at",e.SCHEDULED_AT="scheduled_at"}(Mv||(Mv={}));var Od,Tf=function(e){switch(e){case Bt.LATEST_LAST_MESSAGE:return["-lastMessageUpdatedAt","-createdAt","syncIndex"];case Bt.CHRONOLOGICAL:return["-createdAt","syncIndex"];case Bt.CHANNEL_NAME_ALPHABETICAL:return["name"];default:return["-lastMessageUpdatedAt","-createdAt","syncIndex"]}},gw=function(e){function n(t){var r=t.message,i=e.call(this)||this;return i.message=r,i}return T(n,e),n}(At),$E={},Sc=function(){function e(n,t){var r=t.localCacheEnabled,i=t.enableAutoResend,s=t.dispatcher,a=t.sdkState,o=t.logger,l=this;this._iid=n,$E[n]=this,this._localCacheEnabled=r,this._enableAutoResend=i,this._isProcessingAutoResend=!1,this._autoResendQueue=[],this._dispatcher=s,this._logger=o,this._sdkState=a,this._localCacheEnabled&&s.on(function(u){if(u instanceof Ii)switch(u.stateType){case lt.CONNECTED:l._isProcessingAutoResend||l.processAutoResendRegisteredPendingMessages().then(function(){return l._processNextAutoResend()});break;case lt.INTERNAL_DISCONNECTED:case lt.EXTERNAL_DISCONNECTED:l._isProcessingAutoResend=!1}})}return e.of=function(n){return $E[n]},e.prototype.processNonAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return this._enableAutoResend?[4,this._fetchAllCachedPendingMessages()]:[2];case 1:n=o.sent();try{for(t=ge(n),r=t.next();!r.done;r=t.next())(i=r.value).errorCode===0&&(this._logger.debug("cached pending message is not auto-resend registered. changing its sending status to failed: ",i.reqId),i.sendingStatus=ht.FAILED,i.errorCode=Ae.ACK_TIMEOUT,this._dispatcher.dispatch(new Tt({messages:[i],source:z.LOCAL_MESSAGE_FAILED})))}catch(l){s={error:l}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(s)throw s.error}}return[2]}})})},e.prototype.processAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:n=u.sent();try{for(t=ge(n),r=t.next();!r.done;r=t.next())i=r.value,this._enableAutoResend&&i.errorCode&&i0(i.errorCode)&&(s=new Date().getTime(),a=i.createdAt+2592e5,this._enableAutoResend&&s<=a?this._autoResendQueue.map(function(c){return c.reqId}).indexOf(i.reqId)<0&&this._autoResendQueue.push(i):(this._logger.debug("auto-resend registered pending messaged expired. expiration date: ",new Date(a).toLocaleString()),i.sendingStatus=ht.FAILED,this._dispatcher.dispatch(new Tt({messages:[i],source:z.LOCAL_MESSAGE_FAILED}))))}catch(c){o={error:c}}finally{try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(o)throw o.error}}return[2]}})})},e.prototype.completeCurrentAndProcessNextAutoResend=function(n){if(this._localCacheEnabled&&this._enableAutoResend&&(n.sendingStatus===ht.SUCCEEDED||n.sendingStatus===ht.FAILED&&!i0(n.errorCode))){var t=this.indexOf(n);t>=0&&this._autoResendQueue.splice(t,1),t===0&&this._processNextAutoResend()}},e.prototype._fetchAllCachedPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t;return g(this,function(r){switch(r.label){case 0:return n=ll.of(this._iid),(t=new Us).replyType=Bn.ALL,[4,n.fetch({sendingStatus:ht.PENDING,backward:!0,filter:t})];case 1:return[2,r.sent()]}})})},e.prototype.indexOf=function(n){return this._autoResendQueue.length>0?this._autoResendQueue.map(function(t){return t.reqId}).indexOf(n.reqId):-1},e.prototype._isNotInQueue=function(n){return this._autoResendQueue.map(function(t){return t.reqId}).indexOf(n.reqId)===-1},e.prototype._processNextAutoResend=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){if(this._localCacheEnabled&&this._enableAutoResend&&this._sdkState.appState==="foreground")try{this._autoResendQueue.length>0?(this._isProcessingAutoResend||(this._logger.debug("auto-resend queue started."),this._isProcessingAutoResend=!0),n=this._autoResendQueue[0],this._dispatcher.dispatch(new gw({message:n})),this._logger.debug("processing auto-resend for message request id: ",n.reqId)):(this._logger.debug("auto-resend queue finished."),this._isProcessingAutoResend=!1)}catch(r){this._logger.warn("process auto-resend error: ",r),this._isProcessingAutoResend=!1}return[2]})})},e}();(function(e){e[e.USER_BLOCK=20001]="USER_BLOCK",e[e.USER_UNBLOCK=2e4]="USER_UNBLOCK",e[e.FRIEND_DISCOVERED=20900]="FRIEND_DISCOVERED"})(Od||(Od={}));var y0=function(){function e(n){this.category=n.cat,this.data=n.data}return e.getDataAsUserBlockEvent=function(n,t){var r=t.data,i=r.blocker,s=r.blockee;return{blocker:new Ze(n,i),blockee:new Ze(n,s)}},e.getDataAsFriendDiscoveredEvent=function(n,t){var r=t.data.friend_discoveries;return{friendDiscoveries:Array.isArray(r)?r.map(function(i){return new Ze(n,i)}):[]}},e}(),yw=function(e){function n(t,r){var i=r.userId,s=e.call(this)||this;return s._iid=t,s.userId=i,s}return T(n,e),n}(At),Ew=function(e){function n(){return e.call(this)||this}return T(n,e),n}(At),bw=function(e){function n(t,r,i){var s=e.call(this,t,"USEV",i)||this;return s.event=new y0(i),s}return T(n,e),n}(Et),Ek=function(e,n){this.pollId=0,this.messageId=0,this.pollId=n.poll.id,this.messageId=n.poll.message_id,this._iid=e,this._payload=n},tn;(function(e){e[e.NONE=0]="NONE",e[e.CHANNEL_ENTER=10102]="CHANNEL_ENTER",e[e.CHANNEL_EXIT=10103]="CHANNEL_EXIT",e[e.USER_CHANNEL_MUTE=10201]="USER_CHANNEL_MUTE",e[e.USER_CHANNEL_UNMUTE=10200]="USER_CHANNEL_UNMUTE",e[e.USER_CHANNEL_BAN=10601]="USER_CHANNEL_BAN",e[e.USER_CHANNEL_UNBAN=10600]="USER_CHANNEL_UNBAN",e[e.CHANNEL_FREEZE=10701]="CHANNEL_FREEZE",e[e.CHANNEL_UNFREEZE=10700]="CHANNEL_UNFREEZE",e[e.TYPING_START=10900]="TYPING_START",e[e.TYPING_END=10901]="TYPING_END",e[e.CHANNEL_JOIN=1e4]="CHANNEL_JOIN",e[e.CHANNEL_LEAVE=10001]="CHANNEL_LEAVE",e[e.CHANNEL_OPERATOR_UPDATE=10002]="CHANNEL_OPERATOR_UPDATE",e[e.CHANNEL_INVITE=10020]="CHANNEL_INVITE",e[e.CHANNEL_ACCEPT_INVITE=10021]="CHANNEL_ACCEPT_INVITE",e[e.CHANNEL_DECLINE_INVITE=10022]="CHANNEL_DECLINE_INVITE",e[e.CHANNEL_PROP_CHANGED=11e3]="CHANNEL_PROP_CHANGED",e[e.CHANNEL_DELETED=12e3]="CHANNEL_DELETED",e[e.CHANNEL_META_DATA_CHANGED=11100]="CHANNEL_META_DATA_CHANGED",e[e.CHANNEL_META_COUNTERS_CHANGED=11200]="CHANNEL_META_COUNTERS_CHANGED",e[e.CHANNEL_HIDE=13e3]="CHANNEL_HIDE",e[e.CHANNEL_UNHIDE=13001]="CHANNEL_UNHIDE",e[e.PINNED_MESSAGE_CHANGED=11300]="PINNED_MESSAGE_CHANGED"})(tn||(tn={}));var bk=function(){function e(n){var t;this.channelUrl=n.channel_url,this.channelType=n.channel_type,this.category=n.cat,this.data=(t=n.data)!==null&&t!==void 0?t:{},this.ts=n.ts}return Object.defineProperty(e.prototype,"isGroupChannelEvent",{get:function(){return this.channelType===et.GROUP},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpenChannelEvent",{get:function(){return this.channelType===et.OPEN},enumerable:!1,configurable:!0}),e}(),$u=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.event=new bk(i),s}return T(n,e),n}(Et),Ck=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,a=i.data.operators,o=a===void 0?[]:a;return s.operators=o.map(function(l){return new Ze(s._iid,l)}),s}return T(n,e),n}($u),Sk=function(e){function n(t,r){var i=e.call(this,t)||this;return i._logger=r.logger,i._sdkState=r.sdkState,i._sessionManager=r.sessionManager,i._requestQueue=r.requestQueue,i._dispatcher=r.dispatcher,i._cacheContext=r.cacheContext,i._channelType=r.channelType,i}return T(n,e),Object.defineProperty(n.prototype,"_messageBroadcast",{get:function(){return mw.of(this._iid)},enumerable:!1,configurable:!0}),n.prototype.subscribeMessageEvent=function(t,r){this._messageBroadcast.subscribe(t,r)},n.prototype.unsubscribeMessageEvent=function(t){this._messageBroadcast.unsubscribe(t)},n.prototype.getMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2,null]})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return g(this,function(s){return[2,[]]})})},n.prototype.getMessagesFromCache=function(t,r,i,s,a,o){return y(this,void 0,void 0,function(){return g(this,function(l){return[2,[]]})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(a){return[2,[]]})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(a){return[2,0]})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,[]]})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},n}(Jn),Tk=function(e){function n(t,r,i){var s,a,o,l,u=this;(u=e.call(this,t,"ADMM",i)||this).message=new Lu(t,i);var c=R.of(t).sdkState;return u.isMentioned=Au(u.message.mentionType,(o=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(a=u.message.mentionedUsers)===null||a===void 0?void 0:a.map(function(d){return d.userId}))!==null&&o!==void 0?o:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return T(n,e),n}(Et),wk=function(e){function n(t,r,i){var s,a,o,l,u,c=this;(c=e.call(this,t,"AEDI",i)||this).message=new Lu(t,i);var d=R.of(t).sdkState;return c.mentionCountChange=_2({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(o=(a=i.old_values)===null||a===void 0?void 0:a.mentioned_user_ids)!==null&&o!==void 0?o:[]},Ie({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return T(n,e),n}(Et),Nk=function(e){function n(t,r,i){var s=e.call(this,t,"MRCT",i)||this;return s.channelUrl=i.channel_url,s.channelType=i.channel_type,s.event=new N2(i),s}return T(n,e),n}(Et),Ik=function(e){function n(t,r,i){var s=e.call(this,t,"MTHD",i)||this;return s.event=new vw(t,i),s}return T(n,e),n}(Et),Ak=function(e){function n(t,r,i){var s=e.call(this,t,"MCNT",i)||this;return s.groupChannelMemberCounts=i.group_channels.map(function(a){return{channelUrl:a.channel_url,memberCount:a.member_count,joinedMemberCount:a.joined_member_count,updatedAt:a.ts}}),s.openChannelMemberCounts=i.open_channels.map(function(a){return{channelUrl:a.channel_url,participantCount:a.participant_count,updatedAt:a.ts}}),s}return T(n,e),n}(Et),Mk=function(e){function n(t,r,i){var s=e.call(this,t,"PEDI",i)||this;return s.event=new Ek(t,i),s.status=vv(i.poll.status)||i.poll.status,s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(Et),qt;(function(e){e.NONE="none",e.JOINED="joined",e.INVITED="invited",e.LEFT="left"})(qt||(qt={}));var Ds,Gr,qr,Xa,ss,E0,na,Rd,mi=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.state=null,i.role=null,i.isMuted=!1,i.isBlockedByMe=!1,i.isBlockingMe=!1,i.state=Ve(qt,r.state)?r.state:null,i.role=Ve(Bi,r.role)?r.role:null,typeof r.is_muted=="boolean"&&(i.isMuted=r.is_muted),typeof r.is_blocked_by_me=="boolean"&&(i.isBlockedByMe=r.is_blocked_by_me),typeof r.is_blocking_me=="boolean"&&(i.isBlockingMe=r.is_blocking_me),i}return T(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{state:t.state,role:t.role,is_muted:t.isMuted,is_blocked_by_me:t.isBlockedByMe,is_blocking_me:t.isBlockingMe})))},n}(ml),xk=function(e){function n(t,r){var i,s,a=this;return(a=e.call(this,t)||this).channelUrl=(i=r.channel_url)!==null&&i!==void 0?i:"",a.channelType=(s=r.channel_type)!==null&&s!==void 0?s:et.GROUP,a.member=new Ze(a._iid,r.user),a.deliveryAt=r.ts,a}return T(n,e),n}(Jn);(function(e){e.ALL="all",e.PUBLIC="public",e.PRIVATE="private"})(Ds||(Ds={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(Gr||(Gr={})),function(e){e.ALL="all",e.SUPER="super",e.NON_SUPER="nonsuper",e.BROADCAST_ONLY="broadcast_only",e.EXCLUSIVE_ONLY="exclusive_only"}(qr||(qr={})),function(e){e.ALL="all",e.UNREAD_MESSAGE="unread_message"}(Xa||(Xa={})),function(e){e.ALL="all",e.UNHIDDEN="unhidden_only",e.HIDDEN="hidden_only",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(ss||(ss={})),function(e){e.ALL="all",e.OPERATOR="operator",e.NONOPERATOR="nonoperator"}(E0||(E0={})),function(e){e.AND="AND",e.OR="OR"}(na||(na={})),function(e){e.MEMBER_NICKNAME="member_nickname",e.CHANNEL_NAME="channel_name"}(Rd||(Rd={}));var xn,Cw=function(){function e(n){var t,r,i,s,a,o,l,u,c,d,h,f,p,m;this._searchFilter=null,this._userIdsFilter=null,this.includeEmpty=(t=n==null?void 0:n.includeEmpty)!==null&&t!==void 0&&t,this.nicknameContainsFilter=(r=n==null?void 0:n.nicknameContainsFilter)!==null&&r!==void 0?r:null,this.nicknameStartsWithFilter=(i=n==null?void 0:n.nicknameStartsWithFilter)!==null&&i!==void 0?i:null,this.nicknameExactMatchFilter=(s=n==null?void 0:n.nicknameExactMatchFilter)!==null&&s!==void 0?s:null,this.channelNameContainsFilter=(a=n==null?void 0:n.channelNameContainsFilter)!==null&&a!==void 0?a:"",this.myMemberStateFilter=(o=n==null?void 0:n.myMemberStateFilter)!==null&&o!==void 0?o:Gr.ALL,this.customTypesFilter=(l=n==null?void 0:n.customTypesFilter)!==null&&l!==void 0?l:null,this.channelUrlsFilter=(u=n==null?void 0:n.channelUrlsFilter)!==null&&u!==void 0?u:null,this.superChannelFilter=(c=n==null?void 0:n.superChannelFilter)!==null&&c!==void 0?c:qr.ALL,this.publicChannelFilter=(d=n==null?void 0:n.publicChannelFilter)!==null&&d!==void 0?d:Ds.ALL,this.customTypeStartsWithFilter=(h=n==null?void 0:n.customTypeStartsWithFilter)!==null&&h!==void 0?h:null,this.unreadChannelFilter=(f=n==null?void 0:n.unreadChannelFilter)!==null&&f!==void 0?f:Xa.ALL,this.hiddenChannelFilter=(p=n==null?void 0:n.hiddenChannelFilter)!==null&&p!==void 0?p:ss.UNHIDDEN,this.includeFrozen=(m=n==null?void 0:n.includeFrozen)===null||m===void 0||m,n!=null&&n.createdAfter&&(this.createdAfter=n.createdAfter),n!=null&&n.createdBefore&&(this.createdBefore=n.createdBefore)}return e.prototype._isFriend=function(n){return!(!n||!n.friendDiscoveryKey&&!n.friendName)},Object.defineProperty(e.prototype,"searchFilter",{get:function(){return this._searchFilter},enumerable:!1,configurable:!0}),e.prototype.setSearchFilter=function(n,t){Array.isArray(n)&&n.length!==0&&typeof t=="string"&&t&&(this._searchFilter={query:t,fields:n})},Object.defineProperty(e.prototype,"userIdsFilter",{get:function(){return this._userIdsFilter},enumerable:!1,configurable:!0}),e.prototype.setUserIdsFilter=function(n,t,r){r===void 0&&(r=na.AND),this._userIdsFilter={userIds:n,includeMode:t,queryType:r}},e.prototype.clone=function(){var n,t=new e;this.searchFilter&&t.setSearchFilter(this.searchFilter.fields,(n=this.searchFilter.query)!==null&&n!==void 0?n:void 0),this.userIdsFilter&&t.setUserIdsFilter(this.userIdsFilter.userIds,this.userIdsFilter.includeMode,this.userIdsFilter.queryType);var r=JSON.parse(JSON.stringify(this));return Object.keys(r).forEach(function(i){t[i]=r[i]}),t},e.prototype.match=function(n,t){if(this._searchFilter){var r=this._searchFilter,i=r.query,s=r.fields;if(i&&s&&s.length>0&&!s.some(function(p){switch(p){case Rd.CHANNEL_NAME:return n.name.toLowerCase().includes(i.toLowerCase());case Rd.MEMBER_NICKNAME:return n.members.some(function(m){return m.nickname.toLowerCase().includes(i.toLowerCase())});default:return!0}}))return!1}if(this._userIdsFilter){var a=this._userIdsFilter,o=a.userIds,l=a.includeMode,u=a.queryType,c=n.members.map(function(p){return p.userId});if(l){if(o.length>0)switch(u){case na.AND:if(o.some(function(p){return!c.includes(p)}))return!1;break;case na.OR:if(o.every(function(p){return!c.includes(p)}))return!1}}else if(o.includes(t)||o.push(t),n.members.length>o.length||!$6(o,c))return!1}if(!this.includeEmpty&&!n.lastMessage||!this.includeFrozen&&n.isFrozen||this.customTypesFilter&&this.customTypesFilter.length>0&&!this.customTypesFilter.includes("*")&&!this.customTypesFilter.includes(n.customType)||this.customTypeStartsWithFilter&&!new RegExp("^".concat(this.customTypeStartsWithFilter)).test(n.customType)||this.channelNameContainsFilter&&!n.name.toLowerCase().includes(this.channelNameContainsFilter.toLowerCase()))return!1;if(this.nicknameContainsFilter){var d=this.nicknameContainsFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase().includes(d)}))return!1}if(this.nicknameStartsWithFilter){var h=this.nicknameStartsWithFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase().startsWith(h)}))return!1}if(this.nicknameExactMatchFilter){var f=this.nicknameExactMatchFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase()!=f}))return!1}if(this.channelUrlsFilter&&this.channelUrlsFilter.length>0&&!this.channelUrlsFilter.includes(n.url))return!1;if(this.myMemberStateFilter)switch(this.myMemberStateFilter){case Gr.ALL:if(n.myMemberState==="none")return!1;break;case Gr.JOINED:if(n.myMemberState!=="joined")return!1;break;case Gr.INVITED:if(n.myMemberState!=="invited")return!1;break;case Gr.INVITED_BY_FRIEND:if(n.myMemberState!=="invited"||!this._isFriend(n.inviter))return!1;break;case Gr.INVITED_BY_NON_FRIEND:if(n.myMemberState!=="invited"||this._isFriend(n.inviter))return!1}if(this.hiddenChannelFilter)switch(this.hiddenChannelFilter){case ss.UNHIDDEN:if(n.isHidden||n.hiddenState!=="unhidden")return!1;break;case ss.HIDDEN:if(!n.isHidden)return!1;break;case ss.HIDDEN_ALLOW_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_allow_auto_unhide")return!1;break;case ss.HIDDEN_PREVENT_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_prevent_auto_unhide")return!1}if(this.unreadChannelFilter&&this.unreadChannelFilter===Xa.UNREAD_MESSAGE&&n.unreadMessageCount===0)return!1;if(this.publicChannelFilter)switch(this.publicChannelFilter){case Ds.PUBLIC:if(!n.isPublic)return!1;break;case Ds.PRIVATE:if(n.isPublic)return!1}if(this.superChannelFilter)switch(this.superChannelFilter){case qr.SUPER:if(!n.isSuper)return!1;break;case qr.NON_SUPER:if(n.isSuper)return!1}return!(this.createdAfter&&n.createdAtthis.createdBefore)},e}(),Ok=function(e){function n(t,r){var i=r.sdkState,s=r.cacheContext,a=e.call(this,t)||this;return a._channels=new Map,a._sdkState=i,a._cacheContext=s,a}return T(n,e),Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return Q(!!t).throw(L.databaseError),t.collection(dw)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t,r){return r===void 0&&(r=0),M(M({},t.serialize()),{lastMessageUpdatedAt:t.lastMessage?t.lastMessage.createdAt:0,syncIndex:r})},n.prototype._deserialize=function(t){return Rn.of(this._iid).buildGroupChannelFromSerializedData(t)},Object.defineProperty(n.prototype,"channels",{get:function(){return Fe([],Me(this._channels.values()),!1)},enumerable:!1,configurable:!0}),n.prototype.isCachedInMemory=function(t){return this._channels.has(t)},n.prototype.filterOffsetChanged=function(t){var r=this;return t.filter(function(i){if(r._channels.has(i.url))return r._channels.get(i.url).messageOffsetTimestamp0||h&&h===E.url)return!1;break;case Bt.CHRONOLOGICAL:if(!o&&E.createdAt>r||o&&E.createdAtr||o&&E.lastMessageUpdatedAtu._messageCollectionLastAccessedAt&&Object.assign(u,{_messageCollectionLastAccessedAt:void 0}),u.cachedMetaData&&r&&(c._updateCachedMetaData(u.cachedMetaData,r),Object.assign(u,{_cachedMetaData:void 0})),c._update(u),i.push(c)}else o._channels.set(u.url,u),i.push(u)}),!this.localCacheEnabled)return[3,2];for(s=[],a=0;a0?[4,this.upsert(s)]:[3,2];case 1:x.sent(),x.label=2;case 2:return[2]}})})},n.prototype.block=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._setBlockStateOfAllChannels(t,r,!0)];case 1:return i.sent(),[2]}})})},n.prototype.unblock=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._setBlockStateOfAllChannels(t,r,!1)];case 1:return i.sent(),[2]}})})},n.prototype.markAsRead=function(t,r){return r===void 0&&(r=Fe([],Me(this._channels.keys()),!1)),y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:i=[],h.label=1;case 1:h.trys.push([1,6,7,8]),s=ge(r),a=s.next(),h.label=2;case 2:return a.done?[3,5]:(o=a.value,[4,this.get(o)]);case 3:(l=h.sent())!=null&&l._updateUnreadMemberState(this._sdkState.userId,t)&&(l._updateUnreadCount(0,0),i.push(l)),h.label=4;case 4:return a=s.next(),[3,2];case 5:return[3,8];case 6:return u=h.sent(),c={error:u},[3,8];case 7:try{a&&!a.done&&(d=s.return)&&d.call(s)}finally{if(c)throw c.error}return[7];case 8:return i.length>0?[4,this.upsert(i)]:[3,10];case 9:h.sent(),h.label=10;case 10:return[2]}})})},n}(Jn),wf={invitedUserIds:void 0,channelUrl:void 0,coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isSuper:void 0,isBroadcast:void 0,isExclusive:void 0,isPublic:void 0,isDiscoverable:void 0,isStrict:void 0,isEphemeral:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},xv=function(e){return Qe("string",e.invitedUserIds,!0)&&k("string",e.channelUrl,!0)&&k("string",e.coverUrl,!0)&&(Er(e.coverImage)||k("string",e.coverImage,!0))&&k("boolean",e.isDistinct,!0)&&k("boolean",e.isSuper,!0)&&k("boolean",e.isBroadcast,!0)&&k("boolean",e.isExclusive,!0)&&k("boolean",e.isPublic,!0)&&k("boolean",e.isStrict,!0)&&k("boolean",e.isDiscoverable,!0)&&k("boolean",e.isEphemeral,!0)&&k("string",e.accessCode,!0)&&k("string",e.name,!0)&&k("string",e.data,!0)&&k("string",e.customType,!0)&&Qe("string",e.operatorUserIds,!0)&&k("number",e.messageSurvivalSeconds,!0)},b0={customTypes:void 0,includeEmpty:!1,includeFrozen:!0,includeChatNotification:!1},Ov=function(e){return Qe("string",e.customTypes,!0)&&k("boolean",e.includeEmpty)&&k("boolean",e.includeFrozen)&&k("boolean",e.includeChatNotification)},Sw={myMemberStateFilter:Gr.ALL},Tw=function(e){return Ve(Gr,e.myMemberStateFilter)};(function(e){e.GROUP_CHANNEL_UNREAD_MENTION_COUNT="group_channel_unread_mention_count",e.NONSUPER_UNREAD_MENTION_COUNT="non_super_group_channel_unread_mention_count",e.SUPER_UNREAD_MENTION_COUNT="super_group_channel_unread_mention_count",e.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT="group_channel_unread_message_count",e.NONSUPER_UNREAD_MESSAGE_COUNT="non_super_group_channel_unread_message_count",e.SUPER_UNREAD_MESSAGE_COUNT="super_group_channel_unread_message_count",e.GROUP_CHANNEL_INVITATION_COUNT="group_channel_invitation_count",e.NONSUPER_INVITATION_COUNT="non_super_group_channel_invitation_count",e.SUPER_INVITATION_COUNT="super_group_channel_invitation_count"})(xn||(xn={}));var Rk={keys:[]},kk={channelCustomTypesFilter:void 0,superChannelFilter:qr.ALL},Lk=function(e){return Qe("string",e.channelCustomTypesFilter,!0)&&Ve(qr,e.superChannelFilter)},Dk={channelUrl:void 0,scheduledStatus:void 0,messageTypeFilter:ar.ALL};M({},z);var Nf=function(e){return e.startsWith("EVENT_")||e===z.SYNC_CHANNEL_CHANGELOGS||e===z.REFRESH_CHANNEL},We=function(e){function n(t){var r=t.channels,i=t.context,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=t.ts,l=e.call(this)||this;return l.channels=r,l.context=i,l.isWebSocketEventComing=a,l.ts=o,l}return T(n,e),n}(At),$s=function(e){function n(t){var r=t.channelUrls,i=t.context,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.channelUrls=r,o.context=i,o.isWebSocketEventComing=a,o}return T(n,e),n}(At),Uk=function(){function e(n){var t=n.groupChannelCache,r=n.messageCache,i=n.unsentMessageCache,s=n.dispatcher,a=this;this._observers=new Map,s.on(function(o){return y(a,void 0,void 0,function(){var l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x,A,O=this;return g(this,function(U){switch(U.label){case 0:if(!(o instanceof We))return[3,19];if(l=o.channels,S=o.context,w=o.isWebSocketEventComing,u=l.filter(function(W){return W instanceof Si}),S.source!==z.EVENT_CHANNEL_RESET_HISTORY&&S.source!==z.EVENT_CHANNEL_HIDDEN)return[3,9];U.label=1;case 1:U.trys.push([1,6,7,8]),c=ge(u),d=c.next(),U.label=2;case 2:return d.done?[3,5]:(b=d.value,[4,r.removeUnderOffset(b.url,b.messageOffsetTimestamp)]);case 3:U.sent(),U.label=4;case 4:return d=c.next(),[3,2];case 5:return[3,8];case 6:return h=U.sent(),N={error:h},[3,8];case 7:try{d&&!d.done&&(I=c.return)&&I.call(c)}finally{if(N)throw N.error}return[7];case 8:return[3,17];case 9:f=t.filterOffsetChanged(u),U.label=10;case 10:U.trys.push([10,15,16,17]),p=ge(f),m=p.next(),U.label=11;case 11:return m.done?[3,14]:(b=m.value,[4,r.removeUnderOffset(b.url,b.messageOffsetTimestamp)]);case 12:U.sent(),U.label=13;case 13:return m=p.next(),[3,11];case 14:return[3,17];case 15:return v=U.sent(),x={error:v},[3,17];case 16:try{m&&!m.done&&(A=p.return)&&A.call(p)}finally{if(x)throw x.error}return[7];case 17:return[4,t.upsert(u,o.ts)];case 18:return _=U.sent(),w||this._broadcastUpdateEvent(_,S),[3,24];case 19:return o instanceof $s?(E=o.channelUrls,S=o.context,w=o.isWebSocketEventComing,[4,t.remove(E)]):[3,22];case 20:return U.sent(),[4,Lt(function(){return y(O,void 0,void 0,function(){var W,P,J,V,H,Te;return g(this,function(q){switch(q.label){case 0:q.trys.push([0,6,7,8]),W=ge(E),P=W.next(),q.label=1;case 1:return P.done?[3,5]:(J=P.value,[4,r.removeMessagesOfChannel(J)]);case 2:return q.sent(),[4,i.removeMessagesOfChannel(J)];case 3:q.sent(),q.label=4;case 4:return P=W.next(),[3,1];case 5:return[3,8];case 6:return V=q.sent(),H={error:V},[3,8];case 7:try{P&&!P.done&&(Te=W.return)&&Te.call(W)}finally{if(H)throw H.error}return[7];case 8:return[2]}})})})];case 21:return U.sent(),w||this._broadcastRemoveEvent(E,S),[3,24];case 22:return o instanceof yw?[4,t.fetch({token:Number.MAX_SAFE_INTEGER,limit:Number.MAX_SAFE_INTEGER})]:[3,24];case 23:U.sent(),U.label=24;case 24:return[2]}})})})}return e.prototype._broadcastUpdateEvent=function(n,t){var r,i;try{for(var s=ge(this._observers.values()),a=s.next();!a.done;a=s.next()){var o=a.value;o.onUpdate&&o.onUpdate(n,t)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype._broadcastRemoveEvent=function(n,t){var r,i;try{for(var s=ge(this._observers.values()),a=s.next();!a.done;a=s.next()){var o=a.value;o.onRemove&&o.onRemove(n,t)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype.subscribe=function(n,t){this._observers.set(n,t)},e.prototype.unsubscribe=function(n){this._observers.delete(n)},e.prototype.unsubscribeAll=function(){this._observers.clear()},e}(),Pk=function(e){function n(t){var r=t.userId,i=t.ts,s=t.token,a=t.filter,o=t.includeChatNotification,l=o!==void 0&&o,u=e.call(this)||this,c=M(M({},b0),a),d=c.customTypes,h=c.includeEmpty,f=c.includeFrozen;return u.method=Y.GET,u.path="".concat(tt,"/").concat(encodeURIComponent(r),"/my_group_channels/changelogs"),u.params=be(Ie({show_delivery_receipt:!0,show_member:!0,show_read_receipt:!0,change_ts:i||null,token:s,custom_types:d,show_empty:h,show_frozen:f,include_chat_notification:l})),u}return T(n,e),n}(Z),Fk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedChannels=r.updated.map(function(s){return new Si(t,Object.assign(s,{ts:r.ts}))}),i.deletedChannelUrls=r.deleted,i.hasMore=r.has_more,i.token=r.next,i.ts=r.ts,i}return T(n,e),n}(le),Rv=function(e){function n(t){var r=t.channelUrl,i=t.isInternalCall,s=e.call(this)||this;return s.method=Y.GET,s.path="".concat(i?K6:cr,"/").concat(encodeURIComponent(r)),s.params={show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0},s}return T(n,e),n}(Z),kv=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i}return T(n,e),n}(le),Il={includeEmpty:!1,includeFrozen:!0,includeMetaData:!0,includeChatNotification:!1,channelUrlsFilter:void 0,customTypesFilter:void 0,customTypeStartsWithFilter:void 0,nicknameContainsFilter:void 0,nicknameStartsWithFilter:void 0,nicknameExactMatchFilter:void 0,channelNameContainsFilter:void 0,myMemberStateFilter:Gr.ALL,unreadChannelFilter:Xa.ALL,superChannelFilter:qr.ALL,publicChannelFilter:Ds.ALL,hiddenChannelFilter:ss.ALL,userIdsFilter:{userIds:[],includeMode:!0,queryType:na.AND},searchFilter:{query:void 0,fields:[]},metadataKey:void 0,metadataValues:void 0,metadataOrderKeyFilter:void 0,metadataValueStartsWith:void 0,order:Bt.LATEST_LAST_MESSAGE,createdAfter:void 0,createdBefore:void 0},Hk=function(e){function n(t){var r=this,i=t.userId,s=t.token,a=t.limit,o=t.order,l=t.includeEmpty,u=t.myMemberStateFilter,c=t.superChannelFilter,d=t.publicChannelFilter,h=t.unreadChannelFilter,f=t.nicknameContainsFilter,p=t.nicknameStartsWithFilter,m=t.nicknameExactMatchFilter,b=t.channelNameContainsFilter,v=t.channelUrlsFilter,_=t.customTypesFilter,E=t.customTypeStartsWithFilter,S=t.hiddenChannelFilter,w=t.metadataOrderKeyFilter,N=t.metadataKey,I=t.metadataValues,x=t.metadataValueStartsWith,A=t.includeFrozen,O=t.includeMetaData,U=t.searchFilter,W=t.userIdsFilter,P=t.includeChatNotification,J=P!==void 0&&P,V=t.includeLeftChannel,H=V!==void 0&&V,Te=t.createdAfter,q=t.createdBefore;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(tt,"/").concat(encodeURIComponent(i),"/my_group_channels"),r.params=be({token:s,limit:a,order:o??Il.order,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:l??Il.includeEmpty,member_state_filter:u??Il.myMemberStateFilter,super_mode:c??Il.superChannelFilter,public_mode:d??Il.publicChannelFilter,unread_filter:h??Il.unreadChannelFilter,members_nickname_contains:f,members_nickname_startswith:p,members_nickname:m,name_contains:b,channel_urls:v,custom_types:_,custom_type_startswith:E,hidden_mode:S,metadata_order_key:w,metadata_key:N,metadata_values:I,metadata_value_startswith:x,show_frozen:A,show_metadata:O,include_chat_notification:J,include_left_channel:H,created_after:Te,created_before:q}),U&&U.query&&U.fields&&(r.params.search_query=U.query,r.params.search_fields=U.fields),W&&W.userIds&&W.userIds.length>0&&(W.includeMode?(r.params.members_include_in=W.userIds,r.params.query_type=W.queryType.toUpperCase()):r.params.members_exactly_in=W.userIds),r}return T(n,e),n}(Z),jk=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.channels=[];var s=r.next,a=r.channels,o=r.ts;return i.token=s,a&&a.length>0&&(i.channels=a.map(function(l){return l.ts=o,new Si(t,l)})),i.ts=o??0,i}return T(n,e),n}(le),Bk=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,a=i.myMemberStateFilter;return s.method=Y.GET,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/group_channel_count"),s.params={state:a??Gr.ALL},s}return T(n,e),n}(Z),$k=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.groupChannelCount=r.group_channel_count,i}return T(n,e),n}(le),Gk=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,a=i.keys;return s.method=Y.GET,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/unread_item_count"),s.params=be({item_keys:a}),s}return T(n,e),n}(Z),zk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return typeof r[xn.GROUP_CHANNEL_UNREAD_MENTION_COUNT]=="number"&&(i.groupChannelUnreadMentionCount=r[xn.GROUP_CHANNEL_UNREAD_MENTION_COUNT]),typeof r[xn.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]=="number"&&(i.groupChannelUnreadMessageCount=r[xn.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]),typeof r[xn.GROUP_CHANNEL_INVITATION_COUNT]=="number"&&(i.groupChannelInvitationCount=r[xn.GROUP_CHANNEL_INVITATION_COUNT]),typeof r[xn.SUPER_UNREAD_MENTION_COUNT]=="number"&&(i.superGroupChannelUnreadMentionCount=r[xn.SUPER_UNREAD_MENTION_COUNT]),typeof r[xn.SUPER_UNREAD_MESSAGE_COUNT]=="number"&&(i.superGroupChannelUnreadMessageCount=r[xn.SUPER_UNREAD_MESSAGE_COUNT]),typeof r[xn.SUPER_INVITATION_COUNT]=="number"&&(i.superGroupChannelInvitationCount=r[xn.SUPER_INVITATION_COUNT]),typeof r[xn.NONSUPER_UNREAD_MENTION_COUNT]=="number"&&(i.nonSuperGroupChannelUnreadMentionCount=r[xn.NONSUPER_UNREAD_MENTION_COUNT]),typeof r[xn.NONSUPER_UNREAD_MESSAGE_COUNT]=="number"&&(i.nonSuperGroupChannelUnreadMessageCount=r[xn.NONSUPER_UNREAD_MESSAGE_COUNT]),typeof r[xn.NONSUPER_INVITATION_COUNT]=="number"&&(i.nonSuperGroupChannelInvitationCount=r[xn.NONSUPER_INVITATION_COUNT]),i}return T(n,e),n}(le),Vk=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/unread_channel_count"),i}return T(n,e),n}(Z),qk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.unreadCount=r.unread_count,i}return T(n,e),n}(le),Wk=function(e){function n(t){var r=t.userId,i=t.filter,s=t.includeFeedChannel,a=s!==void 0&&s,o=e.call(this)||this,l=i.channelCustomTypesFilter,u=i.superChannelFilter;return o.method=Y.GET,o.path="".concat(tt,"/").concat(encodeURIComponent(r),"/unread_message_count"),o.params={super_mode:u??qr.ALL,custom_types:l,include_feed_channel:a},o}return T(n,e),n}(Z),Kk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.unreadCount=r.unread_count,i.unreadFeedCount=r.unread_feed_count,i}return T(n,e),n}(le),Qk=function(e){function n(t){var r=t.channelUrl,i=t.scheduledStatus,s=t.messageTypeFilter,a=e.call(this)||this;return a.method=Y.GET,a.path="".concat(nT,"/count"),a.params={channel_url:r,status:Zk(i)},s&&(a.params.message_type=s),a}return T(n,e),n}(Z),Yk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.count=r.count,i}return T(n,e),n}(le),Zk=function(e){if(!e)return[];var n=[];return e.forEach(function(t){switch(t){case Ua.PENDING:n.push(_i.PENDING);break;case Ua.SENT:n.push(_i.IN_QUEUE),n.push(_i.SENT);break;case Ua.CANCELED:n.push(_i.CANCELED);break;case Ua.FAILED:n.push(_i.FAILED)}}),n},Xk=function(e){function n(t){var r=this,i=t.userId,s=t.channelUrl,a=t.coverUrl,o=t.coverImage,l=t.isDistinct,u=t.isSuper,c=t.isBroadcast,d=t.isPublic,h=t.isExclusive,f=t.isDiscoverable,p=t.isStrict,m=t.isEphemeral,b=t.accessCode,v=t.name,_=t.data,E=t.customType,S=t.messageSurvivalSeconds,w=t.invitedUserIds,N=t.operatorUserIds;return(r=e.call(this)||this).method=Y.POST,r.path=cr,r.params=be({user_ids:Fe([i],Me(w??[]),!1).filter(function(I,x,A){return x===A.indexOf(I)}),channel_url:s,cover_url:a,cover_file:o,is_distinct:l,is_super:u,is_broadcast:c,is_exclusive:h,is_public:d,is_discoverable:f,strict:p,is_ephemeral:m,access_code:b,name:v,data:_,custom_type:E,operator_ids:N,message_survival_seconds:S}),r}return T(n,e),n}(Z),Jk=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).channel=new Si(t,r),s.isCreated=(i=r.is_created)===null||i===void 0||i,s}return T(n,e),n}(le),GE=function(e){function n(t){var r=t.userId,i=t.channelUrls,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/mark_as_read_all"),s.params={channel_urls:i},s}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var eL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,a=t.accessCode;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/join"),r.params={user_id:s,access_code:a},r}return T(n,e),n}(Z),tL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i}return T(n,e),n}(le),nL=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,a=i.data,o=a.member_count,l=o===void 0?0:o,u=a.joined_member_count,c=u===void 0?0:u,d=a.users,h=d===void 0?null:d;return s.memberCount=l,s.joinedMemberCount=c,s.members=Array.isArray(h)?h.map(function(f){return new mi(t,f)}):[new mi(t,i.data)],s}return T(n,e),n}($u),rL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,a=t.shouldRemoveOperatorStatus;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/leave"),r.params={user_id:s,should_remove_operator_status:a},r}return T(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(le);var iL=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,a=i.data,o=a.member_count,l=o===void 0?0:o,u=a.joined_member_count,c=u===void 0?0:u;return s.memberCount=l,s.joinedMemberCount=c,s.member=new mi(s._iid,i.data),s}return T(n,e),n}($u),sL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userIds;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/invite"),r.params={user_ids:s},r}return T(n,e),n}(Z),aL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i}return T(n,e),n}(le),oL=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this;s.inviter=null;var a=i.data,o=a.member_count,l=o===void 0?0:o,u=a.joined_member_count,c=u===void 0?0:u,d=a.inviter,h=a.invitees,f=h===void 0?[]:h;return s.memberCount=l,s.joinedMemberCount=c,d&&Object.keys(d).length>0&&(s.inviter=new Ze(t,d)),s.invitees=f.map(function(p){return new mi(t,p)}),s}return T(n,e),n}($u),lL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/decline"),r.params={user_id:s},r}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i.channel.myMemberState=qt.NONE,i}T(n,e)})(le);var uL=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,a=i.data,o=a.member_count,l=a.joined_member_count,u=a.inviter,c=a.invitee;return s.memberCount=o??0,s.joinedMemberCount=l??0,s.inviter=new Ze(t,u),s.invitee=new mi(t,c),s}return T(n,e),n}($u),Lv={hidePreviousMessages:!1,allowAutoUnhide:!0},cL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,a=t.hidePreviousMessages,o=t.allowAutoUnhide;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/hide"),r.params={user_id:s,hide_previous_messages:a??Lv.hidePreviousMessages,allow_auto_unhide:o??Lv.allowAutoUnhide},r}return T(n,e),n}(Z),dL=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts_message_offset;return i.messageOffsetTimestamp=s,i}return T(n,e),n}(le),hL=function(e){function n(t,r,i){var s,a,o,l=this;return(l=e.call(this,t,"SYEV",i)||this).allowAutoUnhide=null,l.hidePreviousMessages=null,l.messageOffsetTimestamp=null,i.data&&(l.allowAutoUnhide=(s=i.data.allow_auto_unhide)!==null&&s!==void 0?s:null,l.hidePreviousMessages=(a=i.data.hide_previous_messages)!==null&&a!==void 0?a:null),l.messageOffsetTimestamp=(o=i.ts_message_offset)!==null&&o!==void 0?o:null,l}return T(n,e),n}(Et),fL=function(e){function n(t){var r=t.channelUrl,i=t.time;return e.call(this,{code:"TPST",ackRequired:!1,payload:{channel_url:r,time:i}})||this}return T(n,e),n}(Rr),pL=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ze(t,i.data),s}return T(n,e),n}(Et),_L=function(e){function n(t){var r=t.channelUrl,i=t.time;return e.call(this,{code:"TPEN",ackRequired:!1,payload:{channel_url:r,time:i}})||this}return T(n,e),n}(Rr),mL=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ze(t,i.data),s}return T(n,e),n}(Et),vL=function(e){function n(t){var r=t.channelUrl,i=t.messageId;return e.call(this,{code:"MACK",ackRequired:!1,payload:{channel_url:r,msg_id:i}})||this}return T(n,e),n}(Rr),ww=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x,A,O,U=this;return(U=e.call(this,t,r)||this).includeEmpty=!1,U.includeFrozen=!0,U.includeMetaData=!0,U.includeChatNotification=!1,U.channelUrlsFilter=null,U.customTypesFilter=null,U.customTypeStartsWithFilter=null,U.nicknameContainsFilter=null,U.nicknameStartsWithFilter=null,U.nicknameExactMatchFilter=null,U.channelNameContainsFilter="",U.myMemberStateFilter=Gr.ALL,U.unreadChannelFilter=Xa.ALL,U.superChannelFilter=qr.ALL,U.publicChannelFilter=Ds.ALL,U.hiddenChannelFilter=ss.UNHIDDEN,U.searchFilter={fields:[],query:null},U.userIdsFilter={userIds:[],includeMode:!0,queryType:na.AND},U.metadataKey=null,U.metadataValues=null,U.metadataOrderKeyFilter=null,U.metadataValueStartsWith=null,U.order=Bt.LATEST_LAST_MESSAGE,U.includeEmpty=(i=r.includeEmpty)!==null&&i!==void 0&&i,U.includeFrozen=(s=r.includeFrozen)===null||s===void 0||s,U.includeMetaData=(a=r.includeMetaData)===null||a===void 0||a,U.includeChatNotification=(o=r.includeChatNotification)!==null&&o!==void 0&&o,U.channelUrlsFilter=(l=r.channelUrlsFilter)!==null&&l!==void 0?l:null,U.customTypesFilter=(u=r.customTypesFilter)!==null&&u!==void 0?u:null,U.customTypeStartsWithFilter=(c=r.customTypeStartsWithFilter)!==null&&c!==void 0?c:"",U.nicknameContainsFilter=(d=r.nicknameContainsFilter)!==null&&d!==void 0?d:null,U.nicknameStartsWithFilter=(h=r.nicknameStartsWithFilter)!==null&&h!==void 0?h:null,U.nicknameExactMatchFilter=(f=r.nicknameExactMatchFilter)!==null&&f!==void 0?f:null,U.channelNameContainsFilter=(p=r.channelNameContainsFilter)!==null&&p!==void 0?p:"",U.myMemberStateFilter=(m=r.myMemberStateFilter)!==null&&m!==void 0?m:Gr.ALL,U.unreadChannelFilter=(b=r.unreadChannelFilter)!==null&&b!==void 0?b:Xa.ALL,U.superChannelFilter=(v=r.superChannelFilter)!==null&&v!==void 0?v:qr.ALL,U.publicChannelFilter=(_=r.publicChannelFilter)!==null&&_!==void 0?_:Ds.ALL,U.hiddenChannelFilter=(E=r.hiddenChannelFilter)!==null&&E!==void 0?E:ss.UNHIDDEN,U.searchFilter=(S=r.searchFilter)!==null&&S!==void 0?S:{fields:[],query:null},U.userIdsFilter=(w=r.userIdsFilter)!==null&&w!==void 0?w:{userIds:[],includeMode:!0,queryType:na.AND},U.metadataKey=(N=r.metadataKey)!==null&&N!==void 0?N:null,U.metadataValues=(I=r.metadataValues)!==null&&I!==void 0?I:null,U.metadataOrderKeyFilter=(x=r.metadataOrderKeyFilter)!==null&&x!==void 0?x:null,U.metadataValueStartsWith=(A=r.metadataValueStartsWith)!==null&&A!==void 0?A:null,U.order=(O=r.order)!==null&&O!==void 0?O:Bt.LATEST_LAST_MESSAGE,r.createdAfter&&(U.createdAfter=r.createdAfter),r.createdBefore&&(U.createdBefore=r.createdBefore),U}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeEmpty)&&k("boolean",this.includeFrozen)&&k("boolean",this.includeMetaData)&&k("string",this.channelNameContainsFilter)&&Qe("string",this.channelUrlsFilter,!0)&&Qe("string",this.customTypesFilter,!0)&&k("string",this.customTypeStartsWithFilter)&&k("string",this.nicknameContainsFilter,!0)&&k("string",this.nicknameStartsWithFilter,!0)&&k("string",this.nicknameExactMatchFilter,!0)&&Ve(Gr,this.myMemberStateFilter)&&Ve(qr,this.superChannelFilter)&&Ve(Ds,this.publicChannelFilter)&&Ve(Xa,this.unreadChannelFilter)&&Ve(ss,this.hiddenChannelFilter)&&Qe(Rd,this.searchFilter.fields)&&k("string",this.searchFilter.query,!0)&&Qe("string",this.userIdsFilter.userIds)&&k("boolean",this.userIdsFilter.includeMode)&&Ve(na,this.userIdsFilter.queryType)&&Ve(Bt,this.order)&&k("string",this.metadataOrderKeyFilter,!0)&&k("string",this.metadataKey,!0)&&Qe("string",this.metadataValues,!0)&&k("string",this.metadataValueStartsWith,!0)&&Ay(this.createdAfter,!0)&&Ay(this.createdBefore,!0)},n.prototype.serialize=function(){return th(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,Rn.of(this._iid).getMyGroupChannels(this._token,Ie(M({},this)),this.limit,z.REQUEST_CHANNEL,!0)]):[3,2]:[3,5];case 1:return t=s.sent(),r=t.channels,i=t.token,this._token=i,this._hasNext=!!i,this._isLoading=!1,[2,r];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),gL=function(e){function n(t,r,i){var s,a=this;return(a=e.call(this,t,"SYEV",i)||this).pinnedMessageIds=[],a.latestPinnedMessage=null,a.ts=0,i.data&&(a.pinnedMessageIds=(s=i.data.pinned_message_ids)!==null&&s!==void 0?s:[],a.latestPinnedMessage=i.data.latest_pinned_message?Tr(t,M({},i.data.latest_pinned_message)):null),a.ts=i.ts,a}return T(n,e),n}(Et),yL=function(e){function n(t){var r=t.channelUrl,i=t.userId,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(cr,"/").concat(encodeURIComponent(r),"/messages/mark_as_delivered"),s.params=be({userId:i}),s}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var Ws,EL=function(e){function n(t,r,i){var s=e.call(this,t,"DLVR",i)||this;return s.channelUrl=i.channel_url,s.deliveredStateUpdate=i.updated,s}return T(n,e),n}(Et),Ms=function(){function e(n){var t=n.top,r=t===void 0?Number.MAX_SAFE_INTEGER:t,i=n.bottom,s=i===void 0?0:i;this.top=r,this.bottom=s}return e.prototype.includes=function(){for(var n=this,t=[],r=0;r0&&$e.onMentionReceived&&$e.onMentionReceived(m,f)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=6;case 6:return[3,79];case 7:return S=t.as(aM),Ce=S.channelUrl,ze=S.channelType,w=S.messageId,N=S.silent,I=S.messageCreatedAt,x=S.senderId,ze!==et.GROUP?[3,9]:[4,this.getChannel(Ce,!0)];case 8:A=Je.sent(),O=x===this._sdkState.userId,N||O||I>0&&A.myLastRead0&&A._updateUnreadCount(A.unreadMessageCount-1,0),this._dispatcher.dispatch(new T2({messageIds:[w],source:z.EVENT_MESSAGE_DELETED})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onMessageDeleted&&$e.onMessageDeleted(A,w)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=9;case 9:return[3,79];case 10:return(U=t.as(ZT).readStatus).channelType!==et.GROUP?[3,12]:(H=this._groupChannelCache.isCachedInMemory(U.channelUrl),[4,this.getChannel(U.channelUrl,!0)]);case 11:W=Je.sent(),H&&W._updateUnreadMemberState(U.reader.userId,U.readAt),U.reader.userId===this._sdkState.userId?H?(W.unreadMessageCount>0||W.unreadMentionCount>0)&&(W._updateUnreadCount(0,0),this._dispatcher.dispatch(new We({channels:[W],context:{source:z.EVENT_CHANNEL_READ}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onChannelChanged&&$e.onChannelChanged(W)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})):W.unreadMessageCount!==0&&W.unreadMentionCount!==0||(this._dispatcher.dispatch(new We({channels:[W],context:{source:z.EVENT_CHANNEL_READ}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onChannelChanged&&$e.onChannelChanged(W)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})):(this._dispatcher.dispatch(new We({channels:[W],context:{source:z.EVENT_CHANNEL_READ}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onUnreadMemberStatusUpdated&&$e.onUnreadMemberStatusUpdated(W)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})),Je.label=12;case 12:return[3,79];case 13:return P=t.as(EL),Ce=P.channelUrl,J=P.deliveredStateUpdate,V=J===void 0?{}:J,H=this._groupChannelCache.isCachedInMemory(Ce),[4,this.getChannel(Ce,!0)];case 14:return Te=Je.sent(),H&&Object.keys(V).forEach(function(K){Te._updateUndeliveredMemberState(K,V[K])}),Object.keys(V).some(function(K){return K!==dt._sdkState.userId})&&(this._dispatcher.dispatch(new We({channels:[Te],context:{source:z.EVENT_CHANNEL_DELIVERED}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onUndeliveredMemberStatusUpdated&&$e.onUndeliveredMemberStatusUpdated(Te)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})),[3,79];case 15:return q=t.as(Nk),Ce=q.channelUrl,ze=q.channelType,ee=q.event,ze!==et.GROUP?[3,18]:[4,this.getChannel(Ce,!0)];case 16:return ie=Je.sent(),[4,this.getMessageFromCache(ee.messageId)];case 17:(oe=Je.sent())?oe instanceof vr&&(oe.applyReactionEvent(ee),this._dispatcher.dispatch(new Tt({messages:[oe],source:z.EVENT_MESSAGE_REACTION_UPDATED}))):this._dispatcher.dispatch(new UT({event:ee,source:z.EVENT_MESSAGE_REACTION_UPDATED})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onReactionUpdated&&$e.onReactionUpdated(ie,ee)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=18;case 18:return[3,79];case 19:return(Ne=t.as(Ik).event).channelType!==et.GROUP?[3,22]:[4,this.getChannel(Ne.channelUrl,!0)];case 20:return X=Je.sent(),[4,this.getMessageFromCache(Ne.targetMessageId)];case 21:(oe=Je.sent())?oe instanceof vr&&(oe.applyThreadInfoUpdateEvent(Ne),this._dispatcher.dispatch(new Tt({messages:[oe],source:z.EVENT_MESSAGE_THREADINFO_UPDATED}))):this._dispatcher.dispatch(new PT({event:Ne,source:z.EVENT_MESSAGE_THREADINFO_UPDATED})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onThreadInfoUpdated&&$e.onThreadInfoUpdated(X,Ne)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=22;case 22:return[3,79];case 23:te=t.as(Ak).groupChannelMemberCounts,ce=[],Je.label=24;case 24:Je.trys.push([24,29,30,31]),$=ge(te),ke=$.next(),Je.label=25;case 25:return ke.done?[3,28]:(B=ke.value,Ce=B.channelUrl,ln=B.memberCount,un=B.joinedMemberCount,ae=B.updatedAt,[4,this.getChannelFromCache(Ce)]);case 26:(de=Je.sent())&&de._setLatestMemberCount(ln,un,ae)&&ce.push(de),Je.label=27;case 27:return ke=$.next(),[3,25];case 28:return[3,31];case 29:return Ee=Je.sent(),Fp={error:Ee},[3,31];case 30:try{ke&&!ke.done&&(r1=$.return)&&r1.call($)}finally{if(Fp)throw Fp.error}return[7];case 31:return ce.length>0&&(this._dispatcher.dispatch(new We({channels:ce,context:{source:z.EVENT_CHANNEL_MEMBER_COUNT_UPDATED}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onChannelMemberCountChanged&&$e.onChannelMemberCountChanged(ce)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})),[3,79];case 32:return se=t.as(Mk),he=se.event,fe=se.status,Ce=se.channelUrl,ze=se.channelType,Ce&&ze===et.GROUP?[4,this.getChannel(Ce,!0)]:[3,34];case 33:ve=Je.sent(),this._dispatcher.dispatch(new jT({event:he,source:z.EVENT_POLL_UPDATED})),Ue(fe===Ox?function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onPollDeleted&&$e.onPollDeleted(ve,he.pollId)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}:function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onPollUpdated&&$e.onPollUpdated(ve,he)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=34;case 34:return[3,79];case 35:return me=t.as(uw),pe=me.event,Ce=me.channelUrl,ze=me.channelType,Ce&&ze===et.GROUP?[4,this.getChannel(Ce,!0)]:[3,37];case 36:ue=Je.sent(),this._dispatcher.dispatch(new w2({event:pe,source:z.EVENT_POLL_VOTED})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onPollVoted&&$e.onPollVoted(ue,pe)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=37;case 37:return[3,79];case 38:if(!(ne=t.as($u).event).isGroupChannelEvent)return[3,77];switch(ne.category){case tn.CHANNEL_JOIN:return[3,39];case tn.CHANNEL_LEAVE:return[3,41];case tn.CHANNEL_OPERATOR_UPDATE:return[3,45];case tn.CHANNEL_INVITE:return[3,47];case tn.CHANNEL_DECLINE_INVITE:return[3,49];case tn.TYPING_START:case tn.TYPING_END:return[3,51];case tn.USER_CHANNEL_MUTE:case tn.USER_CHANNEL_UNMUTE:return[3,53];case tn.USER_CHANNEL_BAN:return[3,55];case tn.USER_CHANNEL_UNBAN:return[3,59];case tn.CHANNEL_FREEZE:case tn.CHANNEL_UNFREEZE:return[3,61];case tn.CHANNEL_HIDE:return[3,63];case tn.CHANNEL_UNHIDE:return[3,65];case tn.CHANNEL_DELETED:return[3,67];case tn.CHANNEL_PROP_CHANGED:return[3,69];case tn.CHANNEL_META_DATA_CHANGED:return[3,71];case tn.CHANNEL_META_COUNTERS_CHANGED:return[3,73];case tn.PINNED_MESSAGE_CHANGED:return[3,75]}return[3,77];case 39:return[4,this.getChannel(ne.channelUrl,!0)];case 40:return xe=Je.sent(),Le=t.as(nL),re=Le.memberCount,Re=Le.joinedMemberCount,st=Le.members,Xe=!1,st.forEach(function(K){xe.isExclusive||xe.isSuper||xe.isBroadcast?Xe=Xe||xe._setLatestMemberCount(re,Re,ne.ts):(K.state=qt.JOINED,xe.addMember(K,ne.ts),dt._updateJoinedMemberCount(xe)),K.userId===dt._sdkState.userId&&(xe.myMemberState=qt.JOINED)}),this._dispatcher.dispatch(new We({channels:[xe],context:{source:z.EVENT_CHANNEL_JOINED,users:st}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){var $e,De;try{for(var Ge=ge(st),Ft=Ge.next();!Ft.done;Ft=Ge.next()){var ft=Ft.value;j.onUserJoined&&j.onUserJoined(xe,ft)}}catch(cI){$e={error:cI}}finally{try{Ft&&!Ft.done&&(De=Ge.return)&&De.call(Ge)}finally{if($e)throw $e.error}}xe.isBroadcast&&Xe&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([xe])}),[2]})})}),[3,77];case 41:return(Vn=this._leftChannels.get(ne.channelUrl))?(ct=Vn.channel,[3,44]):[3,42];case 42:return[4,this.getChannel(ne.channelUrl,!0)];case 43:ct=Je.sent(),Je.label=44;case 44:return He=ct,$t=t.as(iL),ln=$t.memberCount,un=$t.joinedMemberCount,yt=$t.member,_n=!1,Ut=R.of(this._iid).appInfo,He.isExclusive||He.isSuper||He.isBroadcast?_n=He._setLatestMemberCount(ln,un,ne.ts):(Ut!=null&&Ut.enabledChannelMemberShipHistory?((Xt=He.members.find(function(K){return K.userId===yt.userId}))&&(Xt.state=qt.LEFT),He.memberCount=ln):He.removeMember(yt),this._updateJoinedMemberCount(He)),yt.userId===this._sdkState.userId?(He.myMemberState=qt.NONE,He.invitedAt=0,He.joinedAt=0,He._updateUnreadCount(0,0),He.isPublic?this._dispatcher.dispatch(new We({channels:[He],context:{source:z.EVENT_CHANNEL_LEFT,user:yt}})):(this._markAsLeave(He),this._dispatcher.dispatch(new $s({channelUrls:[He.url],context:{source:z.EVENT_CHANNEL_LEFT,user:yt}})))):this._dispatcher.dispatch(new We({channels:[He],context:{source:z.EVENT_CHANNEL_LEFT,user:yt}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserLeft&&j.onUserLeft(He,yt),He.isBroadcast&&_n&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([He])}),[2]})})}),[3,77];case 45:return[4,this.getChannel(ne.channelUrl,!0)];case 46:sn=Je.sent(),Nt=t.as(Ck).operators,an=Nt.map(function(K){return K.userId});try{for(on=ge(sn.members),Un=on.next();!Un.done;Un=on.next())(Jt=Un.value).role=an.includes(Jt.userId)?Bi.OPERATOR:Bi.NONE}catch(K){Hp={error:K}}finally{try{Un&&!Un.done&&(i1=on.return)&&i1.call(on)}finally{if(Hp)throw Hp.error}}return sn.myRole=an.includes(this._sdkState.userId)?Bi.OPERATOR:Bi.NONE,this._dispatcher.dispatch(new We({channels:[sn],context:{source:z.EVENT_CHANNEL_OPERATOR_UPDATED,operators:Nt}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onOperatorUpdated&&j.onOperatorUpdated(sn,Nt)}),[2]})})}),[3,77];case 47:return[4,this.getChannel(ne.channelUrl,!0)];case 48:Gt=Je.sent(),mt=t.as(oL),ln=mt.memberCount,un=mt.joinedMemberCount,mn=mt.inviter,($n=mt.invitees).forEach(function(K){return K.state=qt.INVITED});try{for(Gn=ge($n),Tn=Gn.next();!Tn.done;Tn=Gn.next())zn=Tn.value,Gt.isExclusive||Gt.isSuper||Gt.isBroadcast?Gt._setLatestMemberCount(ln,un,ne.ts):Gt.addMember(zn,ne.ts),this._sdkState.userId===zn.userId&&(Gt.hiddenState=mr.UNHIDDEN,Gt.myMemberState!==qt.JOINED&&(Gt.myMemberState=qt.INVITED),Gt.invitedAt=ne.ts)}catch(K){jp={error:K}}finally{try{Tn&&!Tn.done&&(s1=Gn.return)&&s1.call(Gn)}finally{if(jp)throw jp.error}}return this._dispatcher.dispatch(new We({channels:[Gt],context:{source:z.EVENT_CHANNEL_INVITED,inviter:mn,invitees:$n}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserReceivedInvitation&&j.onUserReceivedInvitation(Gt,mn,$n)}),[2]})})}),[3,77];case 49:return[4,this.getChannel(ne.channelUrl,!0)];case 50:return kt=Je.sent(),Pn=t.as(uL),ln=Pn.memberCount,un=Pn.joinedMemberCount,Fn=Pn.inviter,wn=Pn.invitee,kt.isExclusive||kt.isSuper||kt.isBroadcast?kt._setLatestMemberCount(ln,un,ne.ts):kt.removeMember(wn),this._sdkState.userId===wn.userId?(kt.invitedAt=0,kt.myMemberState=qt.NONE,kt.isPublic?this._dispatcher.dispatch(new We({channels:[kt],context:{source:z.EVENT_CHANNEL_DECLINED_INVITE,inviter:Fn,invitee:wn}})):this._dispatcher.dispatch(new $s({channelUrls:[kt.url],context:{source:z.EVENT_CHANNEL_DECLINED_INVITE,inviter:Fn,invitee:wn}}))):this._dispatcher.dispatch(new We({channels:[kt],context:{source:z.EVENT_CHANNEL_DECLINED_INVITE,inviter:Fn,invitee:wn}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserDeclinedInvitation&&j.onUserDeclinedInvitation(kt,Fn,wn)}),[2]})})}),[3,77];case 51:return[4,this.getChannel(ne.channelUrl,!0)];case 52:return Mt=Je.sent(),Hn=ne.category===tn.TYPING_START,dr=t.as(Hn?pL:mL).user,Mt._updateTypingStatus(dr,Hn?ne.ts:0),this._dispatcher.dispatch(new We({channels:[Mt],context:{source:z.EVENT_CHANNEL_TYPING_STATUS_UPDATE}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onTypingStatusUpdated&&j.onTypingStatusUpdated(Mt)}),[2]})})}),[3,77];case 53:return[4,this.getChannel(ne.channelUrl,!0)];case 54:vn=Je.sent(),Nn=ne.category===tn.USER_CHANNEL_MUTE,(In=t.as(Nn?$O:zO).user).userId===this._sdkState.userId&&(vn.myMutedState=Nn?Ns.MUTED:Ns.UNMUTED,vn._myMutedRemainingTime=In.restrictionInfo.remainingDuration);try{for(Pt=ge(vn.members),An=Pt.next();!An.done;An=Pt.next())if((Jt=An.value).userId===In.userId){Jt.isMuted=Nn;break}}catch(K){Bp={error:K}}finally{try{An&&!An.done&&(a1=Pt.return)&&a1.call(Pt)}finally{if(Bp)throw Bp.error}}return this._dispatcher.dispatch(new We({channels:[vn],context:{source:Nn?z.EVENT_CHANNEL_MUTED:z.EVENT_CHANNEL_UNMUTED,user:In}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){Nn?j.onUserMuted&&j.onUserMuted(vn,In):j.onUserUnmuted&&j.onUserUnmuted(vn,In)}),[2]})})}),[3,77];case 55:return(Vn=this._leftChannels.get(ne.channelUrl))?(hr=Vn.channel,[3,58]):[3,56];case 56:return[4,this.getChannel(ne.channelUrl,!0)];case 57:hr=Je.sent(),Je.label=58;case 58:return qn=hr,this._markAsLeave(qn),Pe=t.as(qO).user,Pe.userId===this._sdkState.userId&&this._dispatcher.dispatch(new $s({channelUrls:[qn.url],context:{source:z.EVENT_CHANNEL_BANNED,user:Pe}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserBanned&&j.onUserBanned(qn,Pe)}),[2]})})}),[3,77];case 59:return[4,this.getChannel(ne.channelUrl,!0)];case 60:return F=Je.sent(),_e=t.as(KO).user,_e.userId===this._sdkState.userId&&this._dispatcher.dispatch(new $s({channelUrls:[F.url],context:{source:z.EVENT_CHANNEL_UNBANNED,user:_e}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserUnbanned&&j.onUserUnbanned(F,_e)}),[2]})})}),[3,77];case 61:return[4,this.getChannel(ne.channelUrl,!0)];case 62:return Oe=Je.sent(),qe=t.as(QO).freeze,Oe.isFrozen=qe,this._dispatcher.dispatch(new We({channels:[Oe],context:{source:qe?z.EVENT_CHANNEL_FROZEN:z.EVENT_CHANNEL_UNFROZEN}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){qe?j.onChannelFrozen&&j.onChannelFrozen(Oe):j.onChannelUnfrozen&&j.onChannelUnfrozen(Oe)}),[2]})})}),[3,77];case 63:return[4,this.getChannel(ne.channelUrl,!0)];case 64:return bt=Je.sent(),gn=t.as(hL),er=gn.allowAutoUnhide,tr=gn.hidePreviousMessages,Fs=gn.messageOffsetTimestamp,er!==null&&(bt.hiddenState=er?mr.HIDDEN_ALLOW_AUTO_UNHIDE:mr.HIDDEN_PREVENT_AUTO_UNHIDE),tr!==null&&tr&&bt._updateUnreadCount(0,0),Fs!==null&&(bt.messageOffsetTimestamp=Fs),this._dispatcher.dispatch(new We({channels:[bt],context:{source:z.EVENT_CHANNEL_HIDDEN}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onChannelHidden&&j.onChannelHidden(bt)}),[2]})})}),[3,77];case 65:return[4,this.getChannel(ne.channelUrl,!0)];case 66:return(Wn=Je.sent()).hiddenState=mr.UNHIDDEN,this._dispatcher.dispatch(new We({channels:[Wn],context:{source:z.EVENT_CHANNEL_UNHIDDEN}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(Wn)}),[2]})})}),[3,77];case 67:return[4,this.getChannel(ne.channelUrl,!0)];case 68:return yl=Je.sent(),this._dispatcher.dispatch(new $s({channelUrls:[ne.channelUrl],context:{source:z.EVENT_CHANNEL_DELETED}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onChannelDeleted&&j.onChannelDeleted(yl.url,yl.channelType)}),[2]})})}),[3,77];case 69:return[4,this.getChannelWithoutCache(ne.channelUrl,!0)];case 70:return El=Je.sent(),this._dispatcher.dispatch(new We({channels:[El],context:{source:z.EVENT_CHANNEL_UPDATED}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(El)}),[2]})})}),[3,77];case 71:return[4,this.getChannel(ne.channelUrl,!0)];case 72:return fs=Je.sent(),ah=t.as(OO),bl=ah.created,Cl=ah.updated,Sl=ah.deleted,bl&&(fs._upsertCachedMetaData(bl,ne.ts),this._dispatcher.dispatch(new We({channels:[fs],context:{source:z.EVENT_CHANNEL_METADATA_CREATED,metaData:bl}}))),Cl&&(fs._upsertCachedMetaData(Cl,ne.ts),this._dispatcher.dispatch(new We({channels:[fs],context:{source:z.EVENT_CHANNEL_METADATA_UPDATED,metaData:Cl}}))),Sl&&(fs._removeFromCachedMetaData(Sl,ne.ts),this._dispatcher.dispatch(new We({channels:[fs],context:{source:z.EVENT_CHANNEL_METADATA_DELETED,metaDataKeys:Sl}}))),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){bl&&j.onMetaDataCreated&&j.onMetaDataCreated(fs,bl),Cl&&j.onMetaDataUpdated&&j.onMetaDataUpdated(fs,Cl),Sl&&j.onMetaDataDeleted&&j.onMetaDataDeleted(fs,Sl)}),[2]})})}),[3,77];case 73:return[4,this.getChannel(ne.channelUrl,!0)];case 74:return uo=Je.sent(),oh=t.as(FO),zu=oh.created,Vu=oh.updated,qu=oh.deleted,zu&&this._dispatcher.dispatch(new We({channels:[uo],context:{source:z.EVENT_CHANNEL_METACOUNTER_CREATED,metaCounters:zu}})),Vu&&this._dispatcher.dispatch(new We({channels:[uo],context:{source:z.EVENT_CHANNEL_METACOUNTER_UPDATED,metaCounters:Vu}})),qu&&this._dispatcher.dispatch(new We({channels:[uo],context:{source:z.EVENT_CHANNEL_METACOUNTER_DELETED,metaCounterKeys:qu}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){zu&&j.onMetaCounterCreated&&j.onMetaCounterCreated(uo,zu),Vu&&j.onMetaCounterUpdated&&j.onMetaCounterUpdated(uo,Vu),qu&&j.onMetaCounterDeleted&&j.onMetaCounterDeleted(uo,qu)}),[2]})})}),[3,77];case 75:return[4,this.getChannel(ne.channelUrl,!0)];case 76:return ha=Je.sent(),lh=t.as(gL),J2=lh.pinnedMessageIds,e1=lh.latestPinnedMessage,(t1=lh.ts)>ha._pinnedMessagesUpdatedAt&&(ha.pinnedMessageIds=J2,ha.lastPinnedMessage=e1,ha._pinnedMessagesUpdatedAt=t1,this._dispatcher.dispatch(new We({channels:[ha],context:{source:z.EVENT_PINNED_MESSAGE_UPDATED}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onChannelChanged&&$e.onChannelChanged(ha)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onPinnedMessageUpdated&&j.onPinnedMessageUpdated(ha)}),[2]})})})),[3,77];case 77:return[3,79];case 78:switch((kp=t.as(bw).event).category){case Od.USER_BLOCK:Lp=y0.getDataAsUserBlockEvent(this._iid,kp),uh=Lp.blocker,ch=Lp.blockee,this._groupChannelCache.block(uh.userId,ch.userId);break;case Od.USER_UNBLOCK:Dp=y0.getDataAsUserBlockEvent(this._iid,kp),uh=Dp.blocker,ch=Dp.blockee,this._groupChannelCache.unblock(uh.userId,ch.userId)}return[3,79];case 79:return[3,81];case 80:if(Up=Je.sent(),zr(Up))throw Up;return[3,81];case 81:return[2]}})})},n.prototype._markAsLeave=function(t){var r,i=this,s=(r=this._leftChannels.get(t.url))!==null&&r!==void 0?r:{channel:t,ref:0};s.ref++,this._leftChannels.set(t.url,s),setTimeout(function(){s.ref--,s.ref===0&&i._leftChannels.delete(t.url)},1e4)},n.prototype.addHandler=function(t,r){this._groupChannelHandlers.set(t,r)},n.prototype.removeHandler=function(t){this._groupChannelHandlers.delete(t)},n.prototype.clearHandler=function(){this._groupChannelHandlers.clear()},n.prototype.subscribeChannelEvent=function(t,r){this._groupChannelBroadcast.subscribe(t,r)},n.prototype.unsubscribeChannelEvent=function(t){this._groupChannelBroadcast.unsubscribe(t)},n.prototype._updateJoinedMemberCount=function(t){t.joinedMemberCount=t.members.filter(function(r){return r.state===qt.JOINED}).length},n.prototype.getChannel=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:Q(k("string",t)).throw(L.invalidParameters),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.getChannelFromCache(t)];case 2:return(i=s.sent())?[2,i]:[3,4];case 3:return s.sent(),[3,4];case 4:return[4,this.getChannelWithoutCache(t,r)];case 5:return[2,s.sent()]}})})},n.prototype.getChannelWithoutCache=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(k("string",t)).throw(L.invalidParameters),i=new Rv({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(i)];case 1:switch(s=u.sent(),a=s.as(kv).channel,o=a.unreadMessageCount,l=a.unreadMentionCount,a.myCountPreference){case fi.UNREAD_MESSAGE_COUNT_ONLY:l=0;break;case fi.UNREAD_MENTION_COUNT_ONLY:o=0;break;case fi.OFF:o=0,l=0}return a._updateUnreadCount(o,l),[4,this.upsertChannelsToCache([a])];case 2:return[2,u.sent()[0]]}})})},n.prototype.refreshChannel=function(t,r,i){return r===void 0&&(r=!0),i===void 0&&(i=z.REFRESH_CHANNEL),y(this,void 0,void 0,function(){var s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),s=new Rv({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(s)];case 1:return a=c.sent(),(o=a.as(kv).channel).myMemberState!==qt.NONE?[3,2]:(this._dispatcher.dispatch(new $s({channelUrls:[o.url],context:{source:i}})),[3,4]);case 2:return[4,this.upsertChannelsToCache([o])];case 3:l=c.sent(),this._dispatcher.dispatch(new We({channels:l,context:{source:i}})),c.label=4;case 4:return[3,6];case 5:return(u=c.sent()).code!==Ae.NON_AUTHORIZED&&u.code!==Ae.NOT_FOUND_IN_DATABASE||this._dispatcher.dispatch(new $s({channelUrls:[t],context:{source:i}})),[3,6];case 6:return[2]}})})},n.prototype.getMyGroupChannels=function(t,r,i,s,a){return s===void 0&&(s=z.REQUEST_CHANNEL),a===void 0&&(a=!1),y(this,void 0,void 0,function(){var o,l,u,c,d,h,f,p,m;return g(this,function(b){switch(b.label){case 0:return r.createdAfter&&(r.createdAfter=Math.floor(r.createdAfter/1e3)),r.createdBefore&&(r.createdBefore=Math.floor(r.createdBefore/1e3)),o=!1,a&&(l=R.of(this._iid),u=l.appInfo,(c=l.cacheContext)&&!c.localCacheEnabled&&(u!=null&&u.enabledChannelMemberShipHistory)&&(u!=null&&u.applicationAttributes.includes("left_user_view_support"))&&(o=!0)),d=new Hk(M(M({},r),{userId:this._sdkState.userId,token:t,limit:i,includeLeftChannel:a&&o})),[4,this._requestQueue.send(d)];case 1:return h=b.sent(),f=h.as(jk),p=f.channels,m=f.token,this._dispatcher.dispatch(new We({channels:p,context:{source:s}})),[2,{channels:p,token:m}]}})})},n.prototype.getMyGroupChannelChangeLogs=function(t,r,i){return i===void 0&&(i=z.REQUEST_CHANNEL_CHANGELOGS),y(this,void 0,void 0,function(){var s,a,o,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return s=M(M({},b0),r),Q((k("string",t)||k("number",t))&&Ov(s)).throw(L.invalidParameters),a=new Pk(Ie({userId:this._sdkState.userId,ts:typeof t=="number"?t:null,token:typeof t=="string"?t:null,filter:s})),[4,this._requestQueue.send(a)];case 1:return o=f.sent(),l=o.as(Fk),u=l.updatedChannels,c=l.deletedChannelUrls,d=l.hasMore,h=l.ts,u.length>0&&this._dispatcher.dispatch(new We({channels:u,context:{source:i},ts:h})),c.length>0&&this._dispatcher.dispatch(new $s({channelUrls:c,context:{source:i}})),[2,{updatedChannels:u,deletedChannelUrls:c,hasMore:d,token:l.token}]}})})},n.prototype.getGroupChannelCount=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(a){switch(a.label){case 0:return r=M(M({},Sw),t),Q(Tw(r)).throw(L.invalidParameters),i=new Bk({userId:this._sdkState.userId,filter:r}),[4,this._requestQueue.send(i)];case 1:return s=a.sent(),[2,s.as($k).groupChannelCount]}})})},n.prototype.getUnreadItemCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_;return g(this,function(E){switch(E.label){case 0:return r=M(M({},Rk),t),Q(function(S){return Qe(xn,S.keys)}(r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new Gk({userId:s.userId,filter:r}),[4,a.send(o)];case 1:return l=E.sent(),u=l.as(zk),c=u.groupChannelUnreadMentionCount,d=u.groupChannelUnreadMessageCount,h=u.groupChannelInvitationCount,f=u.superGroupChannelUnreadMentionCount,p=u.superGroupChannelUnreadMessageCount,m=u.superGroupChannelInvitationCount,b=u.nonSuperGroupChannelUnreadMentionCount,v=u.nonSuperGroupChannelUnreadMessageCount,_=u.nonSuperGroupChannelInvitationCount,[2,be({groupChannelUnreadMentionCount:c,groupChannelUnreadMessageCount:d,groupChannelInvitationCount:h,superGroupChannelUnreadMentionCount:f,superGroupChannelUnreadMessageCount:p,superGroupChannelInvitationCount:m,nonSuperGroupChannelUnreadMentionCount:b,nonSuperGroupChannelUnreadMessageCount:v,nonSuperGroupChannelInvitationCount:_})]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new Vk({userId:r.userId}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(qk).unreadCount]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=M(M({},kk),t),Q(Lk(r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new Wk({userId:s.userId,filter:r}),[4,a.send(o)];case 1:return l=u.sent(),[2,l.as(Kk).unreadCount]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=M(M({},Dk),t),Q(function(l){return k("string",l.channelUrl,!0)&&Qe(Ua,l.scheduledStatus,!0)&&Ve(ar,l.messageTypeFilter)}(r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new Qk(r),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(Yk).count]}})})},n.prototype.getSubscribedTotalUnreadMessageCount=function(){var t=R.of(this._iid).subscribedUnreadMessageCount;return t.all>=0?t.all:0},n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){var t=0,r=R.of(this._iid).subscribedUnreadMessageCount;return Object.keys(r.customTypes).forEach(function(i){t+=r.customTypes[i]}),t},n.prototype.getSubscribedCustomTypeUnreadMessageCount=function(t){var r;return(r=R.of(this._iid).subscribedUnreadMessageCount.customTypes[t])!==null&&r!==void 0?r:0},n.prototype.createChannel=function(t){return y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=M(M({},wf),t),Q(xv(r)).throw(L.invalidParameters),r.isPublic||(r.accessCode=void 0),i=new Xk(M({userId:this._sdkState.userId},r)),[4,this._requestQueue.send(i)];case 1:return s=o.sent(),a=s.as(Jk).channel,[4,this.upsertChannelsToCache([a])];case 2:return o.sent(),[2,a]}})})},n.prototype.markAsReadAll=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return t=Date.now(),Q(t-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=t,r=new GE({userId:this._sdkState.userId}),[4,this._requestQueue.send(r)];case 1:c.sent(),i=this._groupChannelCache.channels;try{for(s=ge(i),a=s.next();!a.done;a=s.next())(o=a.value)._updateUnreadMemberState(this._sdkState.userId,t),o._updateUnreadCount(0,0)}catch(d){l={error:d}}finally{try{a&&!a.done&&(u=s.return)&&u.call(s)}finally{if(l)throw l.error}}return i.length>0?[4,this.upsertChannelsToCache(i)]:[3,3];case 2:c.sent(),c.label=3;case 3:return[2]}})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return r=Date.now(),Q(Qe("string",t)&&r-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=r,i=new GE({userId:this._sdkState.userId,channelUrls:t}),[4,this._requestQueue.send(i)];case 1:h.sent(),s=this._groupChannelCache.channels,a=[];try{for(o=ge(s),l=o.next();!l.done;l=o.next())u=l.value,t.includes(u.url)&&(u._updateUnreadMemberState(this._sdkState.userId,r),u._updateUnreadCount(0,0),a.push(u))}catch(f){c={error:f}}finally{try{l&&!l.done&&(d=o.return)&&d.call(o)}finally{if(c)throw c.error}}return a.length>0?[4,this.upsertChannelsToCache(a)]:[3,3];case 2:h.sent(),h.label=3;case 3:return[2]}})})},n.prototype.markAsDelivered=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n.prototype.getMessageFromCache=function(t){var r;return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._messageCache.get(t)];case 1:return[2,(r=i.sent())!==null&&r!==void 0?r:null]}})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return g(this,function(s){switch(s.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,filter:i,exactMatch:!0})];case 1:return[2,s.sent()]}})})},n.prototype.getMessagesFromCache=function(t,r,i,s,a,o){return a===void 0&&(a=hw),o===void 0&&(o=!0),y(this,void 0,void 0,function(){return g(this,function(l){switch(l.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,limit:a,filter:s,backward:i==="next",inclusive:o})];case 1:return[2,l.sent()]}})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(a){switch(a.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,limit:s,filter:i,backward:!1,isPollOnly:!0})];case 1:return[2,a.sent()]}})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(a){switch(a.label){case 0:return[4,this._messageCache.countBetween(t,r,new Ms({top:i,bottom:s}))];case 1:return[2,a.sent()]}})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._unsentMessageCache.fetch({channelUrl:t,filter:r})];case 1:return[2,i.sent()]}})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._unsentMessageCache.remove([t])];case 1:return r.sent(),[2]}})})},n}(Sk),li=function(e,n){return n instanceof Ht?e.findIndex(function(t){return t instanceof Ht&&n.isIdentical(t)}):e.findIndex(function(t){return t.isIdentical(n)})},rc=function(e,n){return e.findIndex(function(t){return t instanceof vr?t.messageId===n:t instanceof al?t.notificationId===n:void 0})},z_=function(e,n){if(e.length>0){for(var t=0,r=e.length-1,i=Math.floor((t+r)/2);t0)r=i,i=Math.floor((t+r)/2);else{if(!(s<0))return i;t=i+1,i=Math.floor((t+r)/2)}}return e[i].createdAt>n.createdAt?i:i+1}return e.length};(function(e){e[e.IDLE=0]="IDLE",e[e.RUNNING=1]="RUNNING",e[e.END=2]="END"})(Ws||(Ws={}));var C0,io=function(e){function n(t,r,i,s){var a=e.call(this)||this;return a._state=Ws.IDLE,a._retryCount=0,a._retryLimit=3,a.priority=0,a._worker=r,a}return T(n,e),Object.defineProperty(n.prototype,"isIdle",{get:function(){return this._state===Ws.IDLE},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRunning",{get:function(){return this._state===Ws.RUNNING},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isDone",{get:function(){return this._state===Ws.END},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"retryCount",{get:function(){return this._retryCount},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"retryLimit",{get:function(){return this._retryLimit},enumerable:!1,configurable:!0}),n.prototype._run=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:if(!this.isRunning)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._worker(t)];case 2:return r=s.sent(),this._retryCount=0,this.dispatch("progress",r),r.hasNext?this._run(r.nextToken):this.end(),[3,4];case 3:return i=s.sent(),this.dispatch("error",i),this._retryCount0&&(E=_.map(function(J){return J.createdAt}),!((O=this._metadata)===null||O===void 0)&&(w=O.range).intersect.apply(w,Fe([],Me(E),!1))?this.extendRange(_):this._metadata={range:new Ms({top:Math.min.apply(Math,Fe([],Me(E),!1)),bottom:Math.max.apply(Math,Fe([],Me(E),!1))}),previousComplete:!1}),v.hasNext=_.length>=this._limit&&this._prevSyncLoopCount<1,this._metadata&&(v.nextToken=this._metadata.range.top,this._metadata.previousComplete=_.length0&&(E=_.map(function(P){return P.createdAt}),!((A=this._metadata)===null||A===void 0)&&(w=A.range).intersect.apply(w,Fe([],Me(E),!1))?this.extendRange(_):this._metadata={range:new Ms({top:Math.min.apply(Math,Fe([],Me(E),!1)),bottom:Math.max.apply(Math,Fe([],Me(E),!1))}),previousComplete:!1}),v.hasNext=_.length>=this._limit,this._metadata&&(v.nextToken=this._metadata.range.bottom),f.debug("message background next sync progress",v),[4,this.saveMetadata()];case 4:return W.sent(),[3,7];case 5:throw S=W.sent(),f.debug("message background next sync error",S),S;case 6:return p.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:r.url,measured_on:"back_sync",event:"cache_fetch",max_db_size:(U=(O=d.localCacheConfig)===null||O===void 0?void 0:O.maxSize)!==null&&U!==void 0?U:0,use_local_cache:d.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[2,v]}})})}),this._connectionEventContext=h.on(function(b){b instanceof Ii&&(b.stateType===lt.CONNECTED?a.resume():a.pause())})}return e.of=function(n,t){return Yi[n]||(Yi[n]={}),Yi[n][t.url]||(Yi[n][t.url]=new e({_iid:n,channel:t})),Yi[n][t.url].ref++,Yi[n][t.url]},e.clear=function(n,t){Yi[n]&&Yi[n][t]&&(Yi[n][t].close(),delete Yi[n])},Object.defineProperty(e.prototype,"range",{get:function(){var n,t;return(t=(n=this._metadata)===null||n===void 0?void 0:n.range)!==null&&t!==void 0?t:new Ms({})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousComplete",{get:function(){var n;return!!(!((n=this._metadata)===null||n===void 0)&&n.previousComplete)},enumerable:!1,configurable:!0}),e.prototype.isWrappingMessages=function(n){var t;return(t=this.range)===null||t===void 0?void 0:t.includes.apply(t,Fe([],Me(n.map(function(r){return r.createdAt})),!1))},e.prototype.extendRange=function(n){var t;this._metadata&&(t=this._metadata.range).extends.apply(t,Fe([],Me(n.map(function(r){return r.createdAt})),!1))},e.prototype.loadMetadata=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this._metadata?[3,2]:[4,R.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:t=r.sent(),this._metadata=t?{range:new Ms(t.range),previousComplete:t.previousComplete}:{range:new Ms({}),previousComplete:!1},r.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(n){var t,r,i,s;n===void 0&&(n=Date.now());var a=R.of(this._iid),o=a.logger;a.sessionManager.session.hasSession&&(o.debug("message background sync resume()"),this._prevSyncLoopCount=0,this._metadata&&this._metadata.previousComplete||this._prevSync.start((r=(t=this._metadata)===null||t===void 0?void 0:t.range.top)!==null&&r!==void 0?r:n),this._nextSync.start((s=(i=this._metadata)===null||i===void 0?void 0:i.range.bottom)!==null&&s!==void 0?s:n))},e.prototype.pause=function(){R.of(this._iid).logger.debug("message background sync stop()"),this._prevSync.stop(),this._nextSync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Yi[this._iid][this._channel.url])},e}(),Zi={},CL=function(){function e(n){var t=n._iid,r=n.channel,i=n.includeParams,s=this;this.ref=0,this._iid=t,this._channel=r,this._includeParams=i;var a,o,l=R.of(this._iid),u=l.logger,c=l.sdkState,d=l.dispatcher;this._metadataKey=(a=c.userId,o=r.url,"sendbird:".concat(a,"@groupchannel/").concat(o,"/message/changelogs.meta"));var h=function(f,p){return"sendbird:".concat(f,"@groupchannel/").concat(p,"/message/changelogs")}(c.userId,this._channel.url);this._sync=new io(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S;return g(this,function(w){switch(w.label){case 0:return f={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:w.sent(),u.debug("message changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),w.label=2;case 2:return w.trys.push([2,5,,8]),[4,Ln.of(this._iid).getMessageChangelogs(this._channel.url,this._channel.channelType,this._metadata.token,M({replyType:Bn.ALL},this._includeParams),z.SYNC_MESSAGE_CHANGELOGS)];case 3:return p=w.sent(),m=p.updatedMessages,b=p.deletedMessageIds,v=p.hasMore,_=p.token,f.hasNext=v,f.nextToken=_,(m.length>0||b.length>0)&&this._metadata&&(this._metadata.token=_),u.debug("message changelog sync progress",f),[4,this.saveMetadata()];case 4:return w.sent(),[3,8];case 5:return E=w.sent(),u.debug("message changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,7];case 6:w.sent(),w.label=7;case 7:throw E;case 8:return[2,f]}})})}),this._connectionEventContext=d.on(function(f){f instanceof Ii&&(f.stateType===lt.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return Zi[n]||(Zi[n]={}),Zi[n][t.url]||(Zi[n][t.url]=new e({_iid:n,channel:t,includeParams:r})),Zi[n][t.url].ref++,Zi[n][t.url]},e.clear=function(n,t){Zi[n]&&Zi[n][t]&&(Zi[n][t].close(),delete Zi[n])},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return this._metadata?[3,2]:(n=R.of(this._iid),t=n.cacheContext,r=n.firstConnectedAt,[4,t.preference.get(this._metadataKey)]);case 1:i=s.sent(),this._metadata={token:i?i.token:r},s.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){var n=R.of(this._iid),t=n.logger;n.sessionManager.session.hasSession&&(t.debug("message changelog sync resume()"),this._sync.start(0))},e.prototype.pause=function(){R.of(this._iid).logger.debug("message changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Zi[this._iid][this._channel.url])},e}(),fo={},SL=function(){function e(n){var t=n._iid,r=n.channel,i=n.hasPollMessage,s=this;this.ref=0,this._iid=t,this._channel=r;var a,o,l=R.of(this._iid),u=l.logger,c=l.sdkState,d=l.dispatcher;this._metadataKey=(a=c.userId,o=r.url,"sendbird:".concat(a,"@groupchannel/").concat(o,"/poll/changelogs.meta"));var h=function(f,p){return"sendbird:".concat(f,"@groupchannel/").concat(p,"/poll/changelogs")}(c.userId,this._channel.url);this._sync=new io(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S;return g(this,function(w){switch(w.label){case 0:return f={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:return w.sent(),u.debug("poll changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),(p=!this._metadata||!this._metadata.token)?[4,i()]:[3,3];case 2:p=!w.sent(),w.label=3;case 3:if(p)return[2,{hasNext:!1,nextToken:0}];this._metadata||(m=R.of(this._iid).firstConnectedAt,this._metadata={token:m}),w.label=4;case 4:return w.trys.push([4,7,,10]),[4,f0.of(this._iid).getPollChangeLogs(this._channel.url,this._channel.channelType,this._metadata.token)];case 5:return b=w.sent(),v=b.hasMore,_=b.token,f.hasNext=v,f.nextToken=_,this._metadata.token=_,u.debug("poll changelog sync progress",f),[4,this.saveMetadata()];case 6:return w.sent(),[3,10];case 7:return E=w.sent(),u.debug("poll changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,9];case 8:w.sent(),w.label=9;case 9:throw E;case 10:return[2,f]}})})}),this._connectionEventContext=d.on(function(f){f instanceof Ii&&(f.stateType===lt.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return fo[n]||(fo[n]={}),fo[n][t.url]||(fo[n][t.url]=new e({_iid:n,channel:t,hasPollMessage:r})),fo[n][t.url].ref++,fo[n][t.url]},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,R.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:n=t.sent(),this._metadata=n?{token:n.token}:void 0,t.label=2;case 2:return[2]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){R.of(this._iid).logger.debug("poll changelog sync resume()"),this._sync.start(0)},e.prototype.pause=function(){R.of(this._iid).logger.debug("poll changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete fo[this._iid][this._channel.url])},e}(),TL=function(e){function n(t){var r,i,s,a,o,l,u,c,d,h,f=this;return(f=e.call(this)||this).method=Y.GET,f.path="".concat(nt(t.channelType),"/").concat(t.channelUrl,"/messages_gap"),f.params=be({prev_start_ts:t.prevStart,prev_end_ts:t.prevEnd,prev_cache_count:t.prevCount,next_start_ts:t.nextStart,next_end_ts:t.nextEnd,next_cache_count:t.nextCount,huge_gap_threshold:(r=t.threshold)!==null&&r!==void 0?r:null,reverse:!0,custom_types:(i=t.customTypes)!==null&&i!==void 0?i:["*"],message_type:(s=t.messageType)!==null&&s!==void 0?s:null,include_reply_type:(a=t.replyType)!==null&&a!==void 0?a:Bn.NONE,include_reactions:(o=t.includeReactions)===null||o===void 0||o,include_meta_array:(l=t.includeMetaArray)===null||l===void 0||l,include_thread_info:(u=t.includeThreadInfo)===null||u===void 0||u,include_parent_message_info:(c=t.includeParentMessageInfo)===null||c===void 0||c,with_sorted_meta_array:(d=t.includeMetaArray)===null||d===void 0||d,show_subchannel_messages_only:(h=t.showSubchannelMessagesOnly)!==null&&h!==void 0&&h,include_poll_details:!0,checking_continuous_messages:t.checkingContinuousMessages}),f}return T(n,e),n}(Z),wL=function(e){function n(t,r){var i,s,a,o,l,u,c=this;return(c=e.call(this,t,r)||this).isHugeGap=r.is_huge_gap,c.prevMessages=((i=r.prev_messages)!==null&&i!==void 0?i:[]).map(function(d){return Tr(t,d)}),c.prevHasMore=(s=r.prev_hasmore)!==null&&s!==void 0&&s,c.isContinuousPrevMessages=(a=r.is_continuous_prev_messages)!==null&&a!==void 0&&a,c.nextMessages=((o=r.next_messages)!==null&&o!==void 0?o:[]).map(function(d){return Tr(t,d)}),c.nextHasmore=(l=r.next_hasmore)!==null&&l!==void 0&&l,c.isContinuousNextMessages=(u=r.is_continuous_next_messages)!==null&&u!==void 0&&u,c}return T(n,e),n}(le),zE={includeMetaArray:!0,includeReactions:!0,includeThreadInfo:!0,includeParentMessageInfo:!0};(function(e){e.CACHE_AND_REPLACE_BY_API="cache_and_replace_by_api"})(C0||(C0={}));var nd,rd,id,NL=function(){function e(){this._onCacheResult=Ke,this._onApiResult=Ke}return e.prototype._invokeResponse=function(n,t,r){var i=this;Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(s){switch(n){case"local":this._onCacheResult(t,r);break;case"remote":this._onApiResult(t,r)}return[2]})})})},e.prototype.onCacheResult=function(n){return this._onCacheResult=n,this},e.prototype.onApiResult=function(n){return this._onApiResult=n,this},e}(),IL=function(){function e(n,t){var r=t.filter,i=t.startingPoint,s=t.limit,a=t.prevResultLimit,o=t.nextResultLimit,l=t.channel,u=t.channelManager,c=t.disableBackgroundSync,d=c!==void 0&&c,h=this;this._messages=[],this._unsentMessages=[],this._isLoadingPrevious=!1,this._isLoadingNext=!1,this._iid=n,this._key="mc-".concat(la()),this._isDisposed=!1,this.filter=r??new Us,this._channel=l,this._syncRange=new Ms({}),this._hasPrevious=!0,this._hasNext=!0,this._startingPoint=typeof i=="number"&&Number.isFinite(i)?i:Number.MAX_SAFE_INTEGER,this._limit=s||hw,this._prevResultLimit=a??Math.floor(this._limit/2),this._nextResultLimit=o??Math.floor(this._limit/2),this._channelManager=u,this._channelManager.subscribeChannelEvent(this._key,{onUpdate:function(v,_){var E=_.source,S=v.findIndex(function(w){return w.isIdentical(h.channel)});S>=0&&(h._replaceChannelOfCollection(v[S]),h.channel._runIfHandleableWithGroupChannel(function(w){switch(E){case z.EVENT_CHANNEL_UPDATED:for(var N=!1,I=0;I=w.messageOffsetTimestamp){N=!0;var x=I;if(x>0){var A=h._messages.splice(0,x);h._removeMessagesFromView(A.map(function(W){return h.keyOf(W)}),z.EVENT_MESSAGE_OFFSET_UPDATED)}break}!N&&h._messages.length>0&&h._removeMessagesFromView(h._messages.map(function(W){return h.keyOf(W)}),z.EVENT_MESSAGE_OFFSET_UPDATED);break;case z.EVENT_CHANNEL_UNMUTED:var O=R.of(h._iid).sdkState,U=_.user;O.userId===U.userId&&h._clearCheckMyMutedTimer();break;case z.EVENT_CHANNEL_MUTED:O=R.of(h._iid).sdkState,U=_.user,O.userId===U.userId&&w._myMutedRemainingTime!==-1&&h._startCheckMyMutedTimer(w._myMutedRemainingTime);break;case z.EVENT_CHANNEL_LEFT:w.isPublic&&h._clearCheckMyMutedTimer()}Ue(function(){return y(h,void 0,void 0,function(){var W;return g(this,function(P){return Nf(E)&&(!((W=this._handler)===null||W===void 0)&&W.onChannelUpdated)&&this._handler.onChannelUpdated(_,this.channel),[2]})})})}),h._postprocessChannelUpdateEvent(v[S],E))},onRemove:function(v,_){var E=v.indexOf(h.channel.url);E>=0&&(h._clearCheckMyMutedTimer(),Ue(function(){return y(h,void 0,void 0,function(){var S;return g(this,function(w){return!((S=this._handler)===null||S===void 0)&&S.onChannelDeleted&&this._handler.onChannelDeleted(_,this.channel.url),[2]})})}),h._postprocessChannelRemoveEvent(v[E]))}}),this._channelManager.subscribeMessageEvent(this._key,{onUpdate:function(v,_){var E,S,w=[],N=[];try{for(var I=ge(v),x=I.next();!x.done;x=I.next()){var A=x.value;A.channelUrl===h._channel.url&&(h.filter.match(A)?w.push(A):N.push(h.keyOf(A)))}}catch(O){E={error:O}}finally{try{x&&!x.done&&(S=I.return)&&S.call(I)}finally{if(E)throw E.error}}if(qs(_)){if(w.length>0)switch(_){case z.LOCAL_MESSAGE_CANCELED:case z.LOCAL_MESSAGE_RESEND_STARTED:case z.EVENT_MESSAGE_SENT_FAILED:case z.EVENT_MESSAGE_SENT_SUCCESS:case z.EVENT_MESSAGE_UPDATED:case z.EVENT_MESSAGE_THREADINFO_UPDATED:case z.EVENT_MESSAGE_REACTION_UPDATED:case z.EVENT_MESSAGE_FEEDBACK_ADDED:case z.EVENT_MESSAGE_FEEDBACK_UPDATED:case z.EVENT_MESSAGE_FEEDBACK_DELETED:case z.SYNC_MESSAGE_CHANGELOGS:h._updateMessagesToView(w,_);break;case z.EVENT_MESSAGE_SENT_PENDING:h._addMessagesToView(w,_);break;case z.EVENT_MESSAGE_RECEIVED:h.hasNext||h._addMessagesToView(w,_);break;case z.SYNC_MESSAGE_FILL:h._addMessagesToView(w,_)}N.length>0&&h._removeMessagesFromView(N,_)}h._postprocessMessageUpdateEvent(v,_)},onRemove:function(v,_){h._removeMessagesFromView(v,_),h._postprocessMessageRemoveEvent(v)},onRemoveUnsent:function(v,_){h._removeUnsentMessageFromView(v,_)},onPollChangeLogUpdate:function(v,_){h._updatePollsToView(v,_)},onPollUpdate:function(v,_){h._applyPollUpdateEventToView(v,_)},onPollVote:function(v,_){h._applyPollVoteEventToView(v,_)},onReactionUpdate:function(v,_){h._applyReactionEventToView(v,_)},onThreadInfoUpdate:function(v,_){h._applyThreadInfoEventToView(v,_)}});var f=R.of(this._iid),p=f.cacheContext,m=f.dispatcher;this._channel._updateMessageCollectionLastAccessedAt(),m.dispatch(new We({channels:[this._channel],context:{source:z.CHANNEL_LASTACCESSEDAT_UPDATED}})),!d&&this._shouldStartBackgroundSync()&&(this._backgroundSync=bL.of(this._iid,this._channel),this._backgroundSync.resume(this._startingPoint)),this._changelogSync=CL.of(this._iid,this._channel,this.changelogIncludeParams),this._changelogSync.resume(),this._pollChangelogSync=SL.of(this._iid,this._channel,this._hasPollMessage.bind(this)),this._pollChangelogSync.resume(),this._prevFill=new io(this._key,function(v){return y(h,void 0,void 0,function(){var _,E,S,w,N,I,x;return g(this,function(A){switch(A.label){case 0:return[4,this._getRemoteMessages(v,{prevLimit:this._prevResultLimit,source:z.SYNC_MESSAGE_FILL,checkingContinuousMessages:p.localCacheEnabled})];case 1:return _=A.sent(),E=_.messages,S=_.isContinuousMessages,E.length>0?(w=Math.min.apply(Math,Fe([],Me(E.map(function(O){return O.createdAt})),!1)),this._syncRange.extends(w),S&&((N=this._backgroundSync)===null||N===void 0||N.range.extends(w)),[2,{hasNext:E.length>=this._prevResultLimit&&this.viewTop0?(w=Math.max.apply(Math,Fe([],Me(E.map(function(O){return O.createdAt})),!1)),this._syncRange.extends(w),S&&((N=this._backgroundSync)===null||N===void 0||N.range.extends(w)),[2,{hasNext:!(E.length>=this._nextResultLimit&&this._hasNext)||this.viewBottom>w,nextToken:this._syncRange.bottom}]):(b.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(x=(I=p.localCacheConfig)===null||I===void 0?void 0:I.maxSize)!==null&&x!==void 0?x:0,use_local_cache:p.localCacheEnabled,starting_point:0,message_init_policy:""}})),[2,{hasNext:!1,nextToken:0}])}})})}),this._connectionEventContext=m.on(function(v){if(v instanceof Ii)switch(v.stateType){case lt.CONNECTED:Lt(function(){return y(h,void 0,void 0,function(){return g(this,function(_){return this._activate(),[2]})})});break;case lt.LOGOUT:h.dispose();break;default:h._clearCheckMyMutedTimer(),h._prevFill.stop(),h._nextFill.stop()}});var b=R.of(this._iid).statManager;b.put(new Ou({type:St.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{message:!0}}}))}return e.prototype.keyOf=function(n){return 0},Object.defineProperty(e.prototype,"changelogIncludeParams",{get:function(){return{includeReactions:!0,includeThreadInfo:!0,includeMetaArray:!0,includeParentMessageInfo:!0}},enumerable:!1,configurable:!0}),e.prototype._postprocessChannelUpdateEvent=function(n,t){},e.prototype._postprocessChannelRemoveEvent=function(n){},e.prototype._postprocessMessageUpdateEvent=function(n,t){},e.prototype._postprocessMessageRemoveEvent=function(n){},Object.defineProperty(e.prototype,"channel",{get:function(){return this._channel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"succeededMessages",{get:function(){return Fe([],Me(this._messages),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"failedMessages",{get:function(){return this._unsentMessages.filter(function(n){return n.sendingStatus===ht.FAILED})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pendingMessages",{get:function(){return this._unsentMessages.filter(function(n){return n.sendingStatus===ht.PENDING})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPrevious",{get:function(){return this._hasPrevious},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewTop",{get:function(){return Math.min.apply(Math,Fe(Fe([],Me(this._messages.map(function(n){return n.createdAt})),!1),[Number.MAX_SAFE_INTEGER],!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewBottom",{get:function(){return Math.max.apply(Math,Fe(Fe([],Me(this._messages.map(function(n){return n.createdAt})),!1),[0],!1))},enumerable:!1,configurable:!0}),e.prototype._activate=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return R.of(this._iid).logger.debug("check huge gap"),this._checkHugeGap(),[4,this._refreshChannel(z.SYNC_CHANNEL_CHANGELOGS)];case 1:return n.sent(),[2]}})})},e.prototype._replaceChannelOfCollection=function(n){this._channel.isGroupChannel()?this._channel=n:this._channel.isFeedChannel()&&(this._channel._groupChannel=n._groupChannel)},e.prototype._shouldStartBackgroundSync=function(){var n=R.of(this._iid).cacheContext;return this.channel.isGroupChannel()?n.localCacheEnabled&&!this.channel.isSuper:n.localCacheEnabled},e.prototype._setBaseMessageCollectionHandler=function(n){this._handler=n},e.prototype._filterUnderOffsetMessage=function(n){return n},e.prototype._updateChildMessagesInView=function(n){var t=[];return this._messages.forEach(function(r){r instanceof vr&&r.parentMessageId===n.messageId&&r.applyParentMessage(n)&&t.push(r)}),t},e.prototype._updatePollsToView=function(n,t){var r,i,s=this,a=[];try{for(var o=ge(n),l=o.next();!l.done;l=o.next()){var u=l.value,c=rc(this._messages,u.messageId);if(c>=0){var d=this._messages[c];d.isUserMessage()&&d.applyPoll(u),a.push(d)}}}catch(h){r={error:h}}finally{try{l&&!l.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a.length>0&&qs(t)&&Ue(function(){return y(s,void 0,void 0,function(){var h,f,p;return g(this,function(m){return h={source:t},a.length>0&&((p=(f=this._handler).onMessagesUpdated)===null||p===void 0||p.call(f,h,this.channel,a)),[2]})})}),a},e.prototype._applyPollUpdateEventToView=function(n,t){var r=this,i=rc(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollUpdateEvent(n)&&qs(t)&&Ue(function(){return y(r,void 0,void 0,function(){var a,o,l;return g(this,function(u){return a={source:t},(l=(o=this._handler)===null||o===void 0?void 0:o.onMessagesUpdated)===null||l===void 0||l.call(o,a,this.channel,[s]),[2]})})})}},e.prototype._applyPollVoteEventToView=function(n,t){var r=this,i=rc(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollVoteEvent(n)&&qs(t)&&Ue(function(){return y(r,void 0,void 0,function(){var a,o,l;return g(this,function(u){return a={source:t},(l=(o=this._handler)===null||o===void 0?void 0:o.onMessagesUpdated)===null||l===void 0||l.call(o,a,this.channel,[s]),[2]})})})}},e.prototype._applyReactionEventToView=function(n,t){var r=this,i=rc(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&qs(t)&&(s.applyReactionEvent(n),Ue(function(){return y(r,void 0,void 0,function(){var a,o,l;return g(this,function(u){return a={source:t},(l=(o=this._handler)===null||o===void 0?void 0:o.onMessagesUpdated)===null||l===void 0||l.call(o,a,this.channel,[s]),[2]})})}))}},e.prototype._applyThreadInfoEventToView=function(n,t){var r=this,i=rc(this._messages,n.targetMessageId);if(i>=0){var s=this._messages[i];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&qs(t)&&(s.applyThreadInfoUpdateEvent(n),Ue(function(){return y(r,void 0,void 0,function(){var a,o,l;return g(this,function(u){return a={source:t},(l=(o=this._handler)===null||o===void 0?void 0:o.onMessagesUpdated)===null||l===void 0||l.call(o,a,this.channel,[s]),[2]})})}))}},e.prototype._removeMessagesFromView=function(n,t){var r,i,s=this,a=[],o=[],l=function(h){var f=u._messages.findIndex(function(m){return s.keyOf(m)===h});if(f>=0){var p=u._messages[f];a.push(u.keyOf(p)),o.push(p),u._messages.splice(f,1)}},u=this;try{for(var c=ge(n),d=c.next();!d.done;d=c.next())l(d.value)}catch(h){r={error:h}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return qs(t)&&o.length>0&&Ue(function(){return y(s,void 0,void 0,function(){var h,f,p;return g(this,function(m){return h={source:t},(p=(f=this._handler)===null||f===void 0?void 0:f.onMessagesDeleted)===null||p===void 0||p.call(f,h,this.channel,a,o),[2]})})}),a},e.prototype._removeUnsentMessageFromView=function(n,t){var r=this._unsentMessages.findIndex(function(i){return i.reqId===n});r>=0&&this._unsentMessages.splice(r,1)},e.prototype._getLocalMessages=function(n,t){var r=t.prevLimit,i=r===void 0?0:r,s=t.nextLimit,a=s===void 0?0:s,o=t.inclusive,l=o===void 0||o;return y(this,void 0,void 0,function(){var u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return u=[],l?[4,this._channelManager.getExactlyMatchingMessagesForTokenFromCache(this._channel.url,n,this.filter)]:[3,2];case 1:u=p.sent(),p.label=2;case 2:return i>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,n,"prev",this.filter,i,!1)]:[3,4];case 3:return d=p.sent(),[3,5];case 4:d=[],p.label=5;case 5:return c=d,a>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,n,"next",this.filter,a,!1)]:[3,7];case 6:return f=p.sent(),[3,8];case 7:f=[],p.label=8;case 8:return h=f,[2,Fe(Fe(Fe([],Me(u),!1),Me(c),!1),Me(h),!1).sort(function(m,b){return b.createdAt-m.createdAt})]}})})},e.prototype._getRemoteMessages=function(n,t){var r=t.prevLimit,i=r===void 0?0:r,s=t.nextLimit,a=s===void 0?0:s,o=t.source,l=o===void 0?z.REQUEST_MESSAGE:o,u=t.reverse,c=u!==void 0&&u,d=t.checkingHasNext,h=d!==void 0&&d,f=t.checkingContinuousMessages,p=f!==void 0&&f;return y(this,void 0,void 0,function(){var m,b;return g(this,function(v){switch(v.label){case 0:return m=Ln.of(this._iid),i>0||a>0?[4,m._getMessagesByTimestampForCollection(this._channel.url,this._channel.channelType,n,Ie(M(M(M({},this.filter),zE),{isInclusive:!0,reverse:c,prevResultSize:i,nextResultSize:a})),l,h,p)]:[3,2];case 1:return b=v.sent(),[3,3];case 2:b={messages:[],isContinuousMessages:!1},v.label=3;case 3:return[2,b]}})})},e.prototype._checkHugeGap=function(){var n,t,r,i,s;return y(this,void 0,void 0,function(){var a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x,A,O,U,W,P,J,V=this;return g(this,function(H){switch(H.label){case 0:return a=R.of(this._iid),o=a.dispatcher,l=a.requestQueue,u=a.cacheContext,c=a.statManager,d=a.logger,this._messages.length>0?(h=this._syncRange.top,f=this.viewTop,p=this._syncRange.bottom,m=this.hasNext?this.viewBottom:Number.MAX_SAFE_INTEGER,[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,f,h)]):[3,8];case 1:return b=H.sent(),[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,p,m)];case 2:v=H.sent(),H.label=3;case 3:return H.trys.push([3,5,6,7]),[4,vp(function(){return y(V,void 0,void 0,function(){var Te,q,ee,ie,Ne,X,oe,te,ce,$,ke,B,ae,de,Ee,se,he,fe=this;return g(this,function(ve){switch(ve.label){case 0:return Te=new TL(M(M({channelUrl:this._channel.url,channelType:this._channel.channelType,prevStart:f,prevEnd:h,prevCount:b,nextStart:p,nextEnd:m,nextCount:v,checkingContinuousMessages:u.localCacheEnabled},this.filter),zE)),[4,l.send(Te)];case 1:return q=ve.sent(),ee=q.as(wL),ie=ee.isHugeGap,Ne=ee.prevMessages,X=Ne===void 0?[]:Ne,oe=ee.prevHasMore,te=ee.isContinuousPrevMessages,ce=ee.nextMessages,$=ce===void 0?[]:ce,ke=ee.nextHasmore,B=ee.isContinuousNextMessages,ie?Ue(function(){return y(fe,void 0,void 0,function(){var me;return g(this,function(pe){return!((me=this._handler)===null||me===void 0)&&me.onHugeGapDetected&&this._handler.onHugeGapDetected(),[2]})})}):(ae=this.viewTop,de=this.viewBottom,Ee=Math.min.apply(Math,Fe([Number.MAX_SAFE_INTEGER,ae],Me(X.map(function(me){return me.createdAt})),!1)),se=Math.max.apply(Math,Fe([0,de],Me($.map(function(me){return me.createdAt})),!1)),o.dispatch(new Tt({messages:X,source:z.SYNC_MESSAGE_FILL})),o.dispatch(new Tt({messages:$,source:z.SYNC_MESSAGE_FILL})),this._syncRange.extends(Ee,se),(te||B)&&((he=this._backgroundSync)===null||he===void 0||he.range.extends(Ee,se)),oe&&this._prevFill.start(Ee),ke&&this._nextFill.start(se)),[2]}})})},1)];case 4:return H.sent(),[3,7];case 5:return _=H.sent(),d.debug("Failed HugeGap Check ",_),[3,7];case 6:return c.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(t=(n=u.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:u.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[3,13];case 8:E=Date.now(),H.label=9;case 9:return H.trys.push([9,11,12,13]),[4,this._getRemoteMessages(E,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit,source:z.SYNC_MESSAGE_FILL,checkingHasNext:!0,checkingContinuousMessages:u.localCacheEnabled})];case 10:if(S=H.sent(),w=S.messages,N=S.isContinuousMessages,I=S.hasNext,w.length>0){for(x=w.map(function(Te){return Te.createdAt}),A=0,O=0,U=0;U=E&&O++;this._hasPrevious=A>=this._prevResultLimit,this._hasNext=I??O>=this._nextResultLimit,(J=this._syncRange).extends.apply(J,Fe([],Me(x),!1)),N&&((r=this._backgroundSync)===null||r===void 0||r.range.extends(this._syncRange.top,this._syncRange.bottom)),this._addMessagesToView(w,z.SYNC_MESSAGE_FILL)}else this._hasPrevious=!1,this._hasNext=!1;return[3,13];case 11:return(P=H.sent())instanceof L&&P.code===Ae.NOT_FOUND_IN_DATABASE&&(this._hasPrevious=!1,this._hasNext=!1),[3,13];case 12:return c.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(s=(i=u.localCacheConfig)===null||i===void 0?void 0:i.maxSize)!==null&&s!==void 0?s:0,use_local_cache:u.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 13:return[2]}})})},e.prototype._loadUnsentMessages=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=this,[4,this._channelManager.getUnsentMessagesFromCache(this._channel.url,this.filter)];case 1:return n._unsentMessages=t.sent(),[2]}})})},e.prototype._hasPollMessage=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._channelManager.getPollMessagesFromCache(this._channel.url,Date.now()+6e5,this.filter,1)];case 1:return n.sent().length>0?[2,!0]:[2,!1]}})})},e.prototype._refreshChannel=function(n){var t=this;Lt(function(){return y(t,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._channelManager.refreshChannel(this.channel.url,!0,n)];case 1:return r.sent(),[2]}})})})},e.prototype._startCheckMyMutedTimer=function(n){var t=this;this._clearCheckMyMutedTimer(),this._checkMyMutedStateTimer=setTimeout(function(){return y(t,void 0,void 0,function(){var r,i,s,a=this;return g(this,function(o){switch(o.label){case 0:this._checkMyMutedStateTimer=void 0,r=!0,o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,this._channel.getMyMutedInfo()];case 2:return i=o.sent(),r=!i.isMuted,[3,5];case 3:return o.sent(),r=!0,[3,5];case 4:return r&&(s=R.of(this._iid).sessionManager,this.channel._runIfHandleableWithGroupChannel(function(l){var u,c;l.myMutedState=Ns.UNMUTED;var d={source:z.EVENT_CHANNEL_UNMUTED,user:s.currentUser};(c=(u=a._handler)===null||u===void 0?void 0:u.onChannelUpdated)===null||c===void 0||c.call(u,d,a.channel)})),[7];case 5:return[2]}})})},n+1e3)},e.prototype._clearCheckMyMutedTimer=function(){this._checkMyMutedStateTimer&&(clearTimeout(this._checkMyMutedStateTimer),this._checkMyMutedStateTimer=void 0)},e.prototype.initialize=function(n){var t=this,r=new NL;this._messages=[],this._unsentMessages=[],this._syncRange=new Ms({}),this._hasNext=!0,this._hasPrevious=!0,this._refreshChannel(z.REFRESH_CHANNEL);var i=R.of(this._iid),s=i.cacheContext,a=i.statManager;return n===C0.CACHE_AND_REPLACE_BY_API&&this._getLocalMessages(this._startingPoint,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit}).then(function(o){return y(t,void 0,void 0,function(){var l;return g(this,function(u){switch(u.label){case 0:return l=this._filterUnderOffsetMessage(o),this._addMessagesToView(l,z.REQUEST_MESSAGE),[4,this._loadUnsentMessages()];case 1:return u.sent(),r._invokeResponse("local",null,l),[2]}})})}).catch(function(o){if(zr(o))throw o;r._invokeResponse("local",o,null)}).finally(function(){var o=R.of(t._iid).cacheContext;t._getRemoteMessages(t._startingPoint,{prevLimit:t._prevResultLimit,nextLimit:t._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:o.localCacheEnabled}).then(function(l){var u,c,d,h,f,p,m=l.messages,b=l.isContinuousMessages,v=l.hasNext,_=t._filterUnderOffsetMessage(m),E=!0;if(t._messages.length===_.length){for(var S=t._messages.map(function(O){return t.keyOf(O)}),w=0;w<_.length;w++)if(!S.includes(t.keyOf(_[w]))){E=!1;break}}else E=!1;if(t._messages=[],_.length>0){var N=_.map(function(O){return O.createdAt}),I=0,x=0;for(w=0;wt._startingPoint&&x++}t._hasPrevious=I>=t._prevResultLimit,t._hasNext=v??x>=t._nextResultLimit,(u=t._syncRange).extends.apply(u,Fe([],Me(_.map(function(O){return O.createdAt})),!1)),b&&((c=t._backgroundSync)===null||c===void 0||c.range.extends(t._syncRange.top,t._syncRange.bottom)),t._addMessagesToView(_,z.REQUEST_MESSAGE)}else t._hasPrevious=!1,t._hasNext=!1;a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:t.channel.url,starting_point:t._startingPoint,measured_on:"initial_load",event:E?"cache_hit":"cache_miss",max_db_size:(h=(d=o.localCacheConfig)===null||d===void 0?void 0:d.maxSize)!==null&&h!==void 0?h:0,message_init_policy:n,use_local_cache:o.localCacheEnabled,collection_id:t._key}})),a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:t.channel.url,starting_point:t._startingPoint,measured_on:"initial_load",event:"cache_fetch",max_db_size:(p=(f=o.localCacheConfig)===null||f===void 0?void 0:f.maxSize)!==null&&p!==void 0?p:0,message_init_policy:n,use_local_cache:o.localCacheEnabled,collection_id:t._key}})),r._invokeResponse("remote",null,_)}).catch(function(l){if(zr(l))throw l;r._invokeResponse("remote",l,null)})}),a.put(new Ou({type:St.FEATURE_LOCALCACHE,data:{use_local_cache:s.localCacheEnabled,collection_interface:{message_init_policy:n}}})),r},e.prototype.loadPrevious=function(){var n,t,r;return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Ae.COLLECTION_DISPOSED,message:"Collection has been disposed."});return i=R.of(this._iid),s=i.cacheContext,a=i.statManager,o=i.logger,this._hasPrevious?this._isLoadingPrevious?(o.warn("Messages are already fetching."),[2,[]]):(this._isLoadingPrevious=!0,l=this.viewTop,u=[],[4,Lt(function(){return y(h,void 0,void 0,function(){var p;return g(this,function(m){switch(m.label){case 0:return p=this._filterUnderOffsetMessage,[4,this._getLocalMessages(l,{prevLimit:this._prevResultLimit,inclusive:!1})];case 1:return u=p.apply(this,[m.sent()]),[2]}})})})]):[2,[]];case 1:return f.sent(),c=u.length>=this._prevResultLimit,a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:s.localCacheEnabled&&c?"cache_hit":"cache_miss",max_db_size:(t=(n=s.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),c&&(!((r=this._backgroundSync)===null||r===void 0)&&r.isWrappingMessages(u))?[3,3]:(d=!1,[4,Lt(function(){return y(h,void 0,void 0,function(){var p,m,b,v,_,E,S,w=this;return g(this,function(N){switch(N.label){case 0:return p=R.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{prevLimit:this._prevResultLimit,reverse:!0,checkingContinuousMessages:p.localCacheEnabled})];case 1:return m=N.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,Fe([],Me(u.map(function(I){return I.createdAt})),!1)),!((v=this._backgroundSync)===null||v===void 0)&&v.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.top))),u=u.filter(function(I){return li(w._messages,I)<0}),this._hasPrevious=u.length>=this._prevResultLimit,d&&a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:"cache_fetch",max_db_size:(S=(E=p.localCacheConfig)===null||E===void 0?void 0:E.maxSize)!==null&&S!==void 0?S:0,use_local_cache:p.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(u,z.REQUEST_MESSAGE),[3,4];case 3:this._hasPrevious=u.length>=this._prevResultLimit,u.length>0&&this._addMessagesToView(u,z.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingPrevious=!1,[2,u]}})})},e.prototype.loadNext=function(){var n,t,r;return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Ae.COLLECTION_DISPOSED,message:"Collection has been disposed."});return i=R.of(this._iid),s=i.cacheContext,a=i.statManager,o=i.logger,this._hasNext?this._isLoadingNext?(o.warn("Messages are already fetching."),[2,[]]):(this._isLoadingNext=!0,l=this.viewBottom,u=[],[4,Lt(function(){return y(h,void 0,void 0,function(){var p;return g(this,function(m){switch(m.label){case 0:return p=this._filterUnderOffsetMessage,[4,this._getLocalMessages(l,{nextLimit:this._nextResultLimit,inclusive:!1})];case 1:return u=p.apply(this,[m.sent()]),[2]}})})})]):[2,[]];case 1:return f.sent(),c=u.length>=this._nextResultLimit,a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:s.localCacheEnabled&&c?"cache_hit":"cache_miss",max_db_size:(t=(n=s.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),c&&(!((r=this._backgroundSync)===null||r===void 0)&&r.isWrappingMessages(u))?[3,3]:(d=!1,[4,Lt(function(){return y(h,void 0,void 0,function(){var p,m,b,v,_,E,S,w,N=this;return g(this,function(I){switch(I.label){case 0:return p=R.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{nextLimit:this._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:p.localCacheEnabled})];case 1:return m=I.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,Fe([],Me(u.map(function(x){return x.createdAt})),!1)),!((v=this._backgroundSync)===null||v===void 0)&&v.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.bottom))),u=u.filter(function(x){return li(N._messages,x)<0}),this._hasNext=(E=m.hasNext)!==null&&E!==void 0?E:u.length>=this._nextResultLimit,d&&a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:"cache_fetch",max_db_size:(w=(S=p.localCacheConfig)===null||S===void 0?void 0:S.maxSize)!==null&&w!==void 0?w:0,use_local_cache:p.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(u,z.REQUEST_MESSAGE),[3,4];case 3:this._hasNext=u.length>=this._nextResultLimit,u.length>0&&this._addMessagesToView(u,z.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingNext=!1,[2,u]}})})},e.prototype.removeFailedMessage=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:if(this._isDisposed)throw new L({code:Ae.COLLECTION_DISPOSED,message:"Collection has been disposed."});return[4,this._channelManager.removeFailedMessageFromCache(n)];case 1:return r.sent(),(t=this._unsentMessages.findIndex(function(i){return i.reqId===n}))>-1&&this._unsentMessages.splice(t,1),[2]}})})},e.prototype.dispose=function(){var n,t,r,i=this;if(!this._isDisposed){this._isDisposed=!0;var s=R.of(this._iid),a=s.cacheContext,o=s.dispatcher;this._messages=[],this._clearCheckMyMutedTimer(),this._channel._runIfHandleableWithGroupChannel(function(l){l.myMemberState!==qt.NONE&&(i._channel._updateMessageCollectionLastAccessedAt(),o.dispatch(new We({channels:[i._channel],context:{source:z.CHANNEL_LASTACCESSEDAT_UPDATED}})))}),a.localCacheEnabled&&(this._prevFill.stop(),this._nextFill.stop()),(n=this._backgroundSync)===null||n===void 0||n.close(),(t=this._changelogSync)===null||t===void 0||t.close(),(r=this._pollChangelogSync)===null||r===void 0||r.close(),this._channelManager.unsubscribeChannelEvent(this._key),this._channelManager.unsubscribeMessageEvent(this._key),this._connectionEventContext&&this._connectionEventContext.close()}},e}(),AL=function(e){function n(t,r){return e.call(this,t,M(M({},r),{channelManager:Rn.of(t)}))||this}return T(n,e),n.prototype.keyOf=function(t){return t.messageId},n.prototype.initialize=function(t){var r=this;return Lt(function(){return y(r,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return[4,this.channel.getMyMutedInfo()];case 1:return(i=s.sent()).isMuted&&i.remainingDuration!==-1&&this._startCheckMyMutedTimer(i.remainingDuration),[2]}})})}),e.prototype.initialize.call(this,t)},n.prototype.setMessageCollectionHandler=function(t){this._setBaseMessageCollectionHandler(t)},n.prototype._activate=function(){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return[4,e.prototype._activate.call(this)];case 1:return r.sent(),[4,Lt(function(){return y(t,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return[4,this.channel.getMyMutedInfo()];case 1:return(i=s.sent()).isMuted&&i.remainingDuration!==-1&&this._startCheckMyMutedTimer(i.remainingDuration),[2]}})})})];case 2:return r.sent(),[2]}})})},n.prototype._addMessagesToView=function(t,r){var i,s,a=this,o=this._filterUnderOffsetMessage(t),l=[],u=[];try{for(var c=ge(o),d=c.next();!d.done;d=c.next()){var h=d.value;if(r===z.SYNC_MESSAGE_FILL)if(h.messageId>0){if((b=li(this._messages,h))<0){li(this._unsentMessages,h)<0&&l.push(h);var f=z_(this._messages,h);this._messages.splice(f,0,h)}}else h instanceof Ht&&(b=li(this._unsentMessages,h))<0&&li(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h));else if(h.messageId>0){if((b=li(this._messages,h))<0){var p=li(this._unsentMessages,h);p<0?l.push(h):(this._unsentMessages.splice(p,1),u.push(h)),f=z_(this._messages,h),this._messages.splice(f,0,h)}else u.push(h),this._messages[b]=h;if(h.updatedAt>0){var m=this._updateChildMessagesInView(h);u.push.apply(u,Fe([],Me(m),!1))}}else if(h instanceof Ht){var b;(b=li(this._unsentMessages,h))<0?li(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h)):(u.push(h),this._unsentMessages[b]=h)}}}catch(v){i={error:v}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}qs(r)&&Ue(function(){return y(a,void 0,void 0,function(){var v,_,E,S,w;return g(this,function(N){return v={source:r},l.length>0&&((E=(_=this._handler)===null||_===void 0?void 0:_.onMessagesAdded)===null||E===void 0||E.call(_,v,this.channel,l)),u.length>0&&((w=(S=this._handler)===null||S===void 0?void 0:S.onMessagesUpdated)===null||w===void 0||w.call(S,v,this.channel,u)),[2]})})})},n.prototype._updateMessagesToView=function(t,r){var i,s,a=this,o=[],l=[],u=[];try{for(var c=ge(t),d=c.next();!d.done;d=c.next()){var h,f=d.value;if(f.messageId>0)if((h=li(this._messages,f))>=0)l.push(f),this._messages[h]=f;else{var p=li(this._unsentMessages,f);if(p>=0){var m=Me(this._unsentMessages.splice(p,1),1)[0];if(this.hasNext&&m)u.push(m);else{l.push(f);var b=z_(this._messages,f);this._messages.splice(b,0,f)}}else{var v=this._messages.map(function(_){return _.createdAt});(f.createdAtMath.max.apply(Math,Fe([],Me(v),!1))&&!this._hasNext)&&o.push(f)}}else f instanceof Ht&&(h=li(this._unsentMessages,f))>=0&&(l.push(f),this._unsentMessages[h]=f)}}catch(_){i={error:_}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}return qs(r)&&Ue(function(){return y(a,void 0,void 0,function(){var _,E,S,w,N;return g(this,function(I){return _={source:r},l.length>0?(S=(E=this._handler)===null||E===void 0?void 0:E.onMessagesUpdated)===null||S===void 0||S.call(E,_,this.channel,l):u.length>0?(N=(w=this._handler)===null||w===void 0?void 0:w.onMessagesDeleted)===null||N===void 0||N.call(w,_,this.channel,[],u):o.length>0&&this._addMessagesToView(o,r),[2]})})}),l},n}(IL),ML={coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isPublic:void 0,isDiscoverable:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},xL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.token,a=t.limit,o=t.order,l=t.mutedMemberFilter,u=t.memberStateFilter,c=t.nicknameStartsWithFilter,d=t.operatorFilter;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/members"),r.params={token:s,limit:a,order:o,muted_member_filter:l,member_state_filter:u,nickname_startswith:c,operator_filter:d,show_member_is_muted:!0,show_read_receipt:!0,show_delivery_receipt:!0},r}return T(n,e),n}(Z),OL=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.members=[];var s=r.next,a=r.members;return i.token=s,a&&a.length>0&&(i.members=a.map(function(o){return new mi(t,o)})),i}return T(n,e),n}(le);(function(e){e.ALL="all",e.MUTED="muted",e.UNMUTED="unmuted"})(nd||(nd={})),function(e){e.MEMBER_NICKNAME_ALPHABETICAL="member_nickname_alphabetical",e.OPERATOR_THEN_MEMBER_ALPHABETICAL="operator_then_member_alphabetical"}(rd||(rd={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(id||(id={}));var RL=function(e){function n(t,r,i){var s,a,o,l,u=this;return(u=e.call(this,t,r,et.GROUP,i)||this).mutedMemberFilter=nd.ALL,u.memberStateFilter=id.ALL,u.nicknameStartsWithFilter=null,u.operatorFilter=E0.ALL,u.order=rd.MEMBER_NICKNAME_ALPHABETICAL,u.mutedMemberFilter=(s=i.mutedMemberFilter)!==null&&s!==void 0?s:nd.ALL,u.memberStateFilter=(a=i.memberStateFilter)!==null&&a!==void 0?a:id.ALL,u.nicknameStartsWithFilter=(o=i.nicknameStartsWithFilter)!==null&&o!==void 0?o:null,u.order=(l=i.order)!==null&&l!==void 0?l:rd.MEMBER_NICKNAME_ALPHABETICAL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&Ve(nd,this.mutedMemberFilter)&&Ve(id,this.memberStateFilter)&&(k("string",this.nicknameStartsWithFilter)||this.nicknameStartsWithFilter===null)&&Ve(E0,this.operatorFilter)&&Ve(rd,this.order)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new xL(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(OL),a=s.members,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),kL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,a=t.accessCode;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/accept"),r.params={user_id:s,access_code:a},r}return T(n,e),n}(Z),LL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i.channel.myMemberState=qt.JOINED,i}return T(n,e),n}(le),DL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.isDistinct,a=t.isPublic,o=t.isDiscoverable,l=t.coverUrl,u=t.coverImage,c=t.accessCode,d=t.name,h=t.data,f=t.customType,p=t.operatorUserIds,m=t.messageSurvivalSeconds;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i)),r.params=be({is_distinct:s,is_public:a,is_discoverable:o,name:d,data:h,custom_type:f,cover_url:l,cover_file:u,access_code:c,operator_ids:p,message_survival_seconds:m}),r}return T(n,e),n}(Z),UL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i}return T(n,e),n}(le),PL=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(cr,"/").concat(encodeURIComponent(i)),r}return T(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(le);var FL=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/hide"),r}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var HL=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.countPreference,a=e.call(this)||this;return a.method=Y.PUT,a.path="".concat(tt,"/").concat(encodeURIComponent(r),"/count_preference/").concat(encodeURIComponent(i)),a.params={count_preference:s},a}return T(n,e),n}(Z),jL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.countPreference=r.count_preference,i}return T(n,e),n}(le),BL=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/reset_user_history"),r}return T(n,e),n}(Z),$L=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts_message_offset;return i.messageOffsetTimestamp=s,i}return T(n,e),n}(le),GL=M(M({},I2),{scheduledAt:void 0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),zL=M(M({},sw),{scheduledAt:void 0}),VL=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var a=[];t.mentionType===lr.USERS&&(t.mentionedUserIds?a=t.mentionedUserIds:t.mentionedUsers&&(a=t.mentionedUsers.map(function(c){return c.userId})));var o=t.channelType,l=t.channelUrl,u=t.scheduledMessageId;return s.method=Y.PUT,s.path="".concat(nt(o),"/").concat(encodeURIComponent(l),"/scheduled_messages/").concat(encodeURIComponent(u)),s.params=be(Ie({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Iu.FILE,url:t.fileUrl,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(c){return da.payloadify(c)}),custom_type:t.customType,data:t.data,require_auth:t.requireAuth,mention_type:t.mentionType,mentioned_user_ids:a,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(c){return br.payloadify(c)}),apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption})),s}return T(n,e),n}(Z),qL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new nn(t,r),i}return T(n,e),n}(le),WL=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===lr.USERS&&(t.mentionedUserIds?s=t.mentionedUserIds:t.mentionedUsers&&(s=t.mentionedUsers.map(function(u){return u.userId})));var a=t.channelType,o=t.channelUrl,l=t.scheduledMessageId;return i.method=Y.PUT,i.path="".concat(nt(a),"/").concat(encodeURIComponent(o),"/scheduled_messages/").concat(encodeURIComponent(l)),i.params=be(Ie({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Iu.USER,message:t.message,custom_type:t.customType,data:t.data,mention_type:t.mentionType,mentioned_user_ids:s,sorted_metaarray:(r=t.metaArrays)===null||r===void 0?void 0:r.map(function(u){return br.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new sr(t,r),i}T(n,e)})(le);var KL=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,a=t.scheduledMessageId;return r.method=Y.DELETE,r.path="".concat(nt(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(a)),r}return T(n,e),n}(Z),QL=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,a=t.scheduledMessageId;return r.method=Y.POST,r.path="".concat(nt(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(a),"/send_now"),r}return T(n,e),n}(Z),YL=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.pushTriggerOption,a=e.call(this)||this;return a.method=Y.PUT,a.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),a.params={push_trigger_option:s},a}return T(n,e),n}(Z),ZL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i.enabled=r.enable,i}return T(n,e),n}(le),XL=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=e.call(this)||this;return s.method=Y.GET,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Z),JL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i.enabled=r.enable,i}return T(n,e),n}(le),eD=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=e.call(this)||this;return a.method=Y.POST,a.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),a}return T(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(le);var tD=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=e.call(this)||this;return a.method=Y.DELETE,a.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),a}return T(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(le);var fi,mr,nD=function(e){function n(t,r){var i=e.call(this,t)||this;return i.message=null,i.message=Tr(t,r.message),i}return T(n,e),n}(Jn),rD=function(e){function n(t){var r=this,i=t.channelType,s=t.channelUrl,a=t.limit,o=t.token,l=t.includeReactions,u=t.includeMetaArray,c=t.includeParentMessageInfo,d=t.includeThreadInfo,h=t.includePollDetails;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(i),"/").concat(encodeURIComponent(s),"/pinned_messages"),r.params=be({limit:a,token:o,include_reactions:l,with_sorted_meta_array:u,include_thread_info:d,include_parent_message_info:c,include_poll_details:h}),r}return T(n,e),n}(Z),iD=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.pinned_messages,a=r.has_more,o=r.next;return i.pinnedMessages=s.map(function(l){return new nD(t,l)}),i.hasMore=a,i.token=o,i}return T(n,e),n}(le),sD=function(e){function n(t,r,i,s){var a=e.call(this,t,r,i,s)||this;return a.includeMetaArray=s.includeMetaArray,a.includeReactions=s.includeReactions,a.includeParentMessageInfo=s.includeParentMessageInfo,a.includeThreadInfo=s.includeThreadInfo,a.includePollDetails=s.includePollDetails,a}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeMetaArray,!0)&&k("boolean",this.includeReactions,!0)&&k("boolean",this.includeParentMessageInfo,!0)&&k("boolean",this.includeThreadInfo,!0)&&k("boolean",this.includePollDetails,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new rD(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=u.sent(),s=i.as(iD),a=s.pinnedMessages,o=s.hasMore,l=s.token,this._token=l,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca);(function(e){e.ALL="all",e.UNREAD_MESSAGE_COUNT_ONLY="unread_message_count_only",e.UNREAD_MENTION_COUNT_ONLY="unread_mention_count_only",e.OFF="off"})(fi||(fi={})),function(e){e.UNHIDDEN="unhidden",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(mr||(mr={}));var Si=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x,A=this;return(A=e.call(this,t,r)||this)._unreadMemberStateMap=new Map,A._undeliveredMemberStateMap=new Map,A._typingStatus=new Map,A._lastMemberCountUpdated=0,A._typingStarted=0,A._typingEnded=0,A.isDistinct=!1,A.isSuper=!1,A.isBroadcast=!1,A.isExclusive=!1,A.isPublic=!1,A.isDiscoverable=!0,A.isChatNotification=!1,A.isAccessCodeRequired=!1,A.isPushEnabled=!1,A.unreadMessageCount=0,A.unreadMentionCount=0,A.totalUnreadReplyCount=0,A.members=[],A.memberCount=0,A.joinedMemberCount=0,A.hiddenState=mr.UNHIDDEN,A.lastMessage=null,A.messageOffsetTimestamp=0,A.messageSurvivalSeconds=-1,A.myMemberState=qt.NONE,A.myRole=Bi.NONE,A.myMutedState=Ns.UNMUTED,A.myLastRead=0,A.myCountPreference=fi.ALL,A.myPushTriggerOption=Ao.DEFAULT,A.inviter=null,A.invitedAt=0,A.joinedAt=0,A.pinnedMessageIds=[],A.lastPinnedMessage=null,A._pinnedMessagesUpdatedAt=0,A._myMutedRemainingTime=-1,A.channelType=et.GROUP,A.isDistinct=(s=r.is_distinct)!==null&&s!==void 0&&s,A.isSuper=(a=r.is_super)!==null&&a!==void 0&&a,A.isBroadcast=(o=r.is_broadcast)!==null&&o!==void 0&&o,A.isExclusive=(l=r.is_exclusive)!==null&&l!==void 0&&l,A.isPublic=(u=r.is_public)!==null&&u!==void 0&&u,A.isDiscoverable=(c=r.is_discoverable)!==null&&c!==void 0?c:A.isPublic,A.isChatNotification=(d=r.is_chat_notification)!==null&&d!==void 0&&d,A.isAccessCodeRequired=(h=r.is_access_code_required)!==null&&h!==void 0&&h,A.isPushEnabled=(f=r.is_push_enabled)!==null&&f!==void 0&&f,Array.isArray(r.members)&&(i=A.members).push.apply(i,Fe([],Me(r.members.map(function(O){return new mi(A._iid,O)})),!1)),A.memberCount=(p=r.member_count)!==null&&p!==void 0?p:0,A.joinedMemberCount=(m=r.joined_member_count)!==null&&m!==void 0?m:0,A.hiddenState=Ve(mr,r.hidden_state)?r.hidden_state:mr.UNHIDDEN,A.messageOffsetTimestamp=(b=r.ts_message_offset)!==null&&b!==void 0?b:0,A.messageSurvivalSeconds=(v=r.message_survival_seconds)!==null&&v!==void 0?v:-1,A.lastMessage=r.last_message?Tr(A._iid,M({channel_type:A.channelType},r.last_message)):null,r.read_receipt&&Object.keys(r.read_receipt).forEach(function(O){k("number",r.read_receipt[O])&&A._updateUnreadMemberState(O,r.read_receipt[O])}),r.delivery_receipt&&Object.keys(r.delivery_receipt).forEach(function(O){k("number",r.delivery_receipt[O])&&A._updateUndeliveredMemberState(O,r.delivery_receipt[O])}),A.myMemberState=Ve(qt,r.member_state)?r.member_state:qt.NONE,A.myRole=Ve(Bi,r.my_role)?r.my_role:Bi.NONE,Ve(Ns,r.is_muted)?A.myMutedState=r.is_muted:k("boolean",r.is_muted)?A.myMutedState=r.is_muted?Ns.MUTED:Ns.UNMUTED:A.myMutedState=Ns.UNMUTED,A.myCountPreference=Ve(fi,r.count_preference)?r.count_preference:fi.ALL,A.myPushTriggerOption=Ve(Ao,r.push_trigger_option)?r.push_trigger_option:Ao.ALL,A.myLastRead=(_=r.user_last_read)!==null&&_!==void 0?_:0,A.inviter=r.inviter?new Ze(A._iid,r.inviter):null,A.invitedAt=(E=r.invited_at)!==null&&E!==void 0?E:0,A.joinedAt=(S=r.joined_ts)!==null&&S!==void 0?S:0,A._updateUnreadCount((w=r.unread_message_count)!==null&&w!==void 0?w:0,(N=r.unread_mention_count)!==null&&N!==void 0?N:0),A.totalUnreadReplyCount=(I=r.total_unread_thread_message_count)!==null&&I!==void 0?I:0,A.pinnedMessageIds=(x=r.pinned_message_ids)!==null&&x!==void 0?x:[],A.lastPinnedMessage=r.latest_pinned_message?Tr(A._iid,M({channel_type:A.channelType},r.latest_pinned_message)):null,A}return T(n,e),Object.defineProperty(n.prototype,"isHidden",{get:function(){return this.hiddenState!==mr.UNHIDDEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isTyping",{get:function(){return this._typingStatus.size>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cachedUnreadMemberState",{get:function(){var t,r,i={};try{for(var s=ge(this._unreadMemberStateMap),a=s.next();!a.done;a=s.next()){var o=Me(a.value,2),l=o[0],u=o[1];i[l]=u}}catch(c){t={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cachedUndeliveredMemberState",{get:function(){var t,r,i={};try{for(var s=ge(this._undeliveredMemberStateMap),a=s.next();!a.done;a=s.next()){var o=Me(a.value,2),l=o[0],u=o[1];i[l]=u}}catch(c){t={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},enumerable:!1,configurable:!0}),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{is_access_code_required:t.isAccessCodeRequired,is_distinct:t.isDistinct,is_super:t.isSuper,is_broadcast:t.isBroadcast,is_exclusive:t.isExclusive,is_public:t.isPublic,is_discoverable:t.isDiscoverable,is_muted:t.myMutedState,is_push_enabled:t.isPushEnabled,unread_message_count:t.unreadMessageCount,unread_mention_count:t.unreadMentionCount,total_unread_thread_message_count:t.totalUnreadReplyCount,push_trigger_option:t.myPushTriggerOption,count_preference:t.myCountPreference,hidden_state:t.hiddenState,member_count:t.memberCount,joined_member_count:t.joinedMemberCount,member_state:t.myMemberState,my_role:t.myRole,user_last_read:t.myLastRead,ts_message_offset:t.messageOffsetTimestamp,message_survival_seconds:t.messageSurvivalSeconds,read_receipt:t.cachedUnreadMemberState,delivery_receipt:t.cachedUndeliveredMemberState,members:t.members.map(function(r){return mi.payloadify(r)}),last_message:t.lastMessage?mE(t.lastMessage):null,inviter:t.inviter?Ze.payloadify(t.inviter):null,invited_at:t.invitedAt,joined_ts:t.joinedAt,pinned_message_ids:t.pinnedMessageIds,latest_pinned_message:t.lastPinnedMessage?mE(t.lastPinnedMessage):null})))},n.prototype._shouldUpdateLastMessageWith=function(t){if(t.silent)return!1;var r=R.of(this._iid).appInfo;switch(r==null?void 0:r.lastMessageThreadingPolicy){case Ro.NONE:case Ro.INCLUDE_REPLY:break;case Ro.EXCLUDE_REPLY:if(t.parentMessageId>0)return!1;break;case Ro.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Ht&&t.parentMessageId>0&&!t.replyToChannel)return!1}return!this.lastMessage||this.lastMessage.createdAt0)return!1;break;case Oo.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Ht&&t.parentMessageId>0&&!t.replyToChannel)return!1}return!0},n.prototype._updateLastMessage=function(t){return!!this._shouldUpdateLastMessageWith(t)&&(this.lastMessage=t,!0)},n.prototype._updateUnreadCount=function(t,r){if(typeof t=="number"&&t>=0)if(this.myCountPreference===fi.ALL||this.myCountPreference===fi.UNREAD_MESSAGE_COUNT_ONLY)if(this.isExclusive||this.isSuper||this.isBroadcast){var i=R.of(this._iid).maxSuperGroupChannelUnreadCount;this.unreadMessageCount=i&&t>=i?i:t}else this.unreadMessageCount=t;else this.unreadMessageCount=0;else this.unreadMessageCount=0;typeof r=="number"&&r>=0&&(this.myCountPreference===fi.ALL||this.myCountPreference===fi.UNREAD_MENTION_COUNT_ONLY)?this.unreadMentionCount=r:this.unreadMentionCount=0},n.prototype._updateUnreadMemberState=function(t,r){var i=this._unreadMemberStateMap.get(t);return(!i||i0?this._typingStatus.set(t.userId,{user:t,ts:r}):this._typingStatus.delete(t.userId)},n.prototype._clearTypingStatus=function(){this._typingStatus.clear(),this._typingStarted=0,this._typingEnded=0},n.prototype._setLatestMemberCount=function(t,r,i){var s=!1;return i>=this._lastMemberCountUpdated&&(this._lastMemberCountUpdated=i,s=t!==this.memberCount||r!==this.joinedMemberCount,this.memberCount=t,this.joinedMemberCount=r),s},n.prototype.isReadMessage=function(t){var r=R.of(this._iid).sdkState,i=this._unreadMemberStateMap.get(r.userId);return!!i&&i>=t.createdAt},n.prototype.serialize=function(){var t=this;return th(this,function(r){r.cachedUnreadMemberState=t.cachedUnreadMemberState,r.cachedUndeliveredMemberState=t.cachedUndeliveredMemberState})},n.prototype.createMessageCollection=function(t){return t===void 0&&(t={}),new AL(this._iid,M(M({},t),{channel:this}))},n.prototype.createMemberListQuery=function(t){return t===void 0&&(t={}),new RL(this._iid,this.url,t)},n.prototype.createThreadedParentMessageListQuery=function(t){return t===void 0&&(t={}),new mk(this._iid,this.url,this.channelType,t)},n.prototype.createPinnedMessageListQuery=function(t){return t===void 0&&(t={}),new sD(this._iid,this.url,this.channelType,t)},n.prototype.addMember=function(t,r){if(r===void 0&&(r=0),!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var i=this.members.findIndex(function(a){return a.userId===t.userId});if(i>-1){var s=this.members[i];s.state===qt.JOINED&&(t.state=s.state),this.members.splice(i,1),this.memberCount--}this.members.push(t),this.memberCount++,this._updateUnreadMemberState(t.userId,r),this._updateUndeliveredMemberState(t.userId,r)}},n.prototype.removeMember=function(t){if(!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var r=t instanceof mi?t.userId:t,i=this.members.findIndex(function(s){return s.userId===r});if(i>-1)return this.members.splice(i,1),this.memberCount--,!0}return!1},n.prototype.getUnreadMemberCount=function(t){var r,i;if(t instanceof Ht&&!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var s=R.of(this._iid).sdkState,a=t.createdAt,o=0;try{for(var l=ge(this.members),u=l.next();!u.done;u=l.next()){var c=u.value;s.userId!==c.userId&&c.state===qt.JOINED&&t.sender.userId!==c.userId&&(this.cachedUnreadMemberState[c.userId]||0)=t.createdAt&&o.push(l)}}),o},n.prototype.getUnreadMembers=function(t,r){var i=this;r===void 0&&(r=!1);var s=R.of(this._iid).sdkState;if(!s.userId||this.isExclusive||this.isSuper||this.isBroadcast)return[];var a=t instanceof Ht?t.sender:null,o=[];return this.members.forEach(function(l){if(r||l.userId!==s.userId&&l.userId!==(a==null?void 0:a.userId)){var u=i._unreadMemberStateMap.get(l.userId);u&&u=r&&(t._typingStatus.delete(o),s=!0)}),s},n.prototype.refresh=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this._refresh()]})})},n.prototype._refresh=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=R.of(this._iid),i=r.requestQueue,s=r.dispatcher,a=new Rv({channelUrl:this.url}),[4,i.send(a)];case 1:return o=u.sent(),l=o.as(kv).channel,this._update(l),t||s.dispatch(new We({channels:[l],context:{source:z.REFRESH_CHANNEL}})),[2,this]}})})},n.prototype.freeze=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,e.prototype.freeze.call(this)];case 1:return t.sent(),R.of(this._iid).dispatcher.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_FROZEN},isWebSocketEventComing:!0})),[2]}})})},n.prototype.unfreeze=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,e.prototype.unfreeze.call(this)];case 1:return t.sent(),R.of(this._iid).dispatcher.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_UNFROZEN},isWebSocketEventComing:!0})),[2]}})})},n.prototype.updateChannel=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return r=M(M({},ML),t),Q(function(d){return k("string",d.coverUrl,!0)&&(Er(d.coverImage)||k("string",d.coverImage,!0))&&k("boolean",d.isDistinct,!0)&&k("boolean",d.isPublic,!0)&&k("boolean",d.isDiscoverable,!0)&&k("string",d.accessCode,!0)&&k("string",d.name,!0)&&k("string",d.data,!0)&&k("string",d.customType,!0)&&Qe("string",d.operatorUserIds,!0)&&k("number",d.messageSurvivalSeconds,!0)}(r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.dispatcher,a=i.requestQueue,o=new DL(M({channelUrl:this.url},r)),[4,a.send(o)];case 1:return l=c.sent(),u=l.as(UL).channel,this._update(u),s.dispatch(new We({channels:[u],context:{source:z.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.invite=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(t.every(function(i){return i instanceof Ze})).throw(L.invalidParameters),[2,this.inviteWithUserIds(t.map(function(i){return i.userId}))]})})},n.prototype.inviteWithUserIds=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(Qe("string",t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.requestQueue,a=r.sessionManager,o=new sL({channelUrl:this.url,userIds:t}),[4,s.send(o)];case 1:return l=c.sent(),u=l.as(aL).channel,this._update(u),i.dispatch(new We({channels:[u],context:{source:z.EVENT_CHANNEL_INVITED,inviter:a.currentUser,invitees:[]},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.join=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(k("string",t,!0)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.sdkState,a=r.requestQueue,o=new eL({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,a.send(o)];case 1:return l=c.sent(),(u=l.as(tL).channel).myMemberState=this.myMemberState=qt.JOINED,this._update(u),i.dispatch(new We({channels:[u],context:{source:z.EVENT_CHANNEL_JOINED,users:[]},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.leave=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=new rL({channelUrl:this.url,userId:i.userId,shouldRemoveOperatorStatus:t}),[4,s.send(a)];case 1:return o.sent(),this.myMemberState=qt.NONE,[2]}})})},n.prototype.acceptInvitation=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(k("string",t,!0)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.sdkState,a=r.requestQueue,o=new kL({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,a.send(o)];case 1:return l=c.sent(),(u=l.as(LL).channel).myMemberState=this.myMemberState=qt.JOINED,this._update(u),i.dispatch(new We({channels:[u],context:{source:z.EVENT_CHANNEL_ACCEPTED_INVITE},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.declineInvitation=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new lL({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return a.sent(),this.myMemberState=qt.NONE,[2,this]}})})},n.prototype.sendUserMessage=function(t){var r=this,i=new Xr,s=R.of(this._iid).dispatcher,a=Sc.of(this._iid);return e.prototype.sendUserMessage.call(this,t).onPending(function(o){a.completeCurrentAndProcessNextAutoResend(o),i._trigger(o)}).onFailed(function(o,l){l&&a.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(o,l)}).onSucceeded(function(o){r.hiddenState===mr.HIDDEN_ALLOW_AUTO_UNHIDE&&(r.hiddenState=mr.UNHIDDEN),a.completeCurrentAndProcessNextAutoResend(o),r._updateLastMessage(o),Rn.of(r._iid).handlers.map(function(l){l.onChannelChanged&&l.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(o)}),i},n.prototype.updateUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o,l=this;return g(this,function(u){switch(u.label){case 0:return i=R.of(this._iid).dispatcher,[4,e.prototype.updateUserMessage.call(this,t,r)];case 1:return s=u.sent(),a=this._updateLastMessage(s),o=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,a=!0,o=!0),a&&(Rn.of(this._iid).handlers.map(function(c){c.onChannelChanged&&c.onChannelChanged(l)}),i.dispatch(new We({channels:[this],context:{source:o?z.EVENT_PINNED_MESSAGE_UPDATED:z.EVENT_MESSAGE_UPDATED}}))),o&&Rn.of(this._iid).handlers.map(function(c){c.onPinnedMessageUpdated&&c.onPinnedMessageUpdated(l)}),i.dispatch(new Tt({messages:[s],source:z.EVENT_MESSAGE_UPDATED})),[2,s]}})})},n.prototype._autoResendUserMessage=function(t){var r=this,i=new Xr,s=R.of(this._iid).dispatcher,a=Sc.of(this._iid);return e.prototype._autoResendUserMessage.call(this,t).onPending(function(o){a.completeCurrentAndProcessNextAutoResend(o),i._trigger(o)}).onFailed(function(o,l){a.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(o,l)}).onSucceeded(function(o){var l=Rn.of(r._iid);a.completeCurrentAndProcessNextAutoResend(o),r._updateLastMessage(o),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(o)}),i},n.prototype.sendFileMessage=function(t){var r=this,i=new Xr,s=R.of(this._iid).dispatcher,a=Sc.of(this._iid);return e.prototype.sendFileMessage.call(this,t).onPending(function(o){a.completeCurrentAndProcessNextAutoResend(o),i._trigger(o)}).onFailed(function(o,l){l&&a.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(o,l)}).onSucceeded(function(o){var l=Rn.of(r._iid);a.completeCurrentAndProcessNextAutoResend(o),r._updateLastMessage(o),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(o)}),i},n.prototype.sendMultipleFilesMessage=function(t){var r=this,i=new Cf,s=R.of(this._iid).dispatcher;return e.prototype.sendMultipleFilesMessage.call(this,t).onPending(function(a){i._trigger(a)}).onFailed(function(a,o){i._triggerFailed(a,o)}).onSucceeded(function(a){var o=Rn.of(r._iid);r._updateLastMessage(a),o.handlers.map(function(l){l.onChannelChanged&&l.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(a)}).onFileUploaded(function(a,o,l,u){i._triggerOnFileUploaded(a,o,l,u)}),i},n.prototype.updateFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o,l=this;return g(this,function(u){switch(u.label){case 0:return i=R.of(this._iid).dispatcher,[4,e.prototype.updateFileMessage.call(this,t,r)];case 1:return s=u.sent(),a=this._updateLastMessage(s),o=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,a=!0,o=!0),a&&(Rn.of(this._iid).handlers.map(function(c){c.onChannelChanged&&c.onChannelChanged(l)}),i.dispatch(new We({channels:[this],context:{source:o?z.EVENT_PINNED_MESSAGE_UPDATED:z.EVENT_MESSAGE_UPDATED}}))),o&&Rn.of(this._iid).handlers.map(function(c){c.onPinnedMessageUpdated&&c.onPinnedMessageUpdated(l)}),i.dispatch(new Tt({messages:[s],source:z.EVENT_MESSAGE_UPDATED})),[2,s]}})})},n.prototype._autoResendFileMessage=function(t){var r=this,i=new Xr,s=R.of(this._iid).dispatcher,a=Sc.of(this._iid);return e.prototype._autoResendFileMessage.call(this,t).onPending(function(o){a.completeCurrentAndProcessNextAutoResend(o),i._trigger(o)}).onFailed(function(o,l){a.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(o,l)}).onSucceeded(function(o){var l=Rn.of(r._iid);a.completeCurrentAndProcessNextAutoResend(o),r._updateLastMessage(o),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(o)}),i},n.prototype.deleteMessage=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.deleteMessage.call(this,t)];case 1:return r.sent(),t.messageId===0&&t instanceof Ht&&R.of(this._iid).dispatcher.dispatch(new FT({reqId:t.reqId,source:z.EVENT_MESSAGE_DELETED})),[2]}})})},n.prototype.hide=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:return r=M(M({},Lv),t),Q(function(h){return k("boolean",h.hidePreviousMessages,!0)&&k("boolean",h.allowAutoUnhide,!0)}(r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.dispatcher,a=i.sdkState,o=i.requestQueue,l=new cL(M({channelUrl:this.url,userId:a.userId},r)),[4,o.send(l)];case 1:return u=d.sent(),c=u.as(dL).messageOffsetTimestamp,this.hiddenState=r.allowAutoUnhide?mr.HIDDEN_ALLOW_AUTO_UNHIDE:mr.HIDDEN_PREVENT_AUTO_UNHIDE,r.hidePreviousMessages&&this._updateUnreadCount(0,0),c&&(this.messageOffsetTimestamp=c),s.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_HIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.unhide=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return t=R.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new FL({channelUrl:this.url}),[4,i.send(s)];case 1:return a.sent(),this.hiddenState=mr.UNHIDDEN,r.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_UNHIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.delete=function(){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=R.of(this._iid).requestQueue,r=new PL({channelUrl:this.url}),[4,t.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.markAsRead=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u=this;return g(this,function(c){switch(c.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.dispatcher,s=t.requestQueue,a=new Kx({channelUrl:this.url}),[4,s.send(a)];case 1:return o=c.sent(),l=o.as(ZT).readStatus,this._updateUnreadMemberState(r.userId,l.readAt),(this.unreadMessageCount>0||this.unreadMentionCount>0)&&(this._updateUnreadCount(0,0),Rn.of(this._iid).handlers.map(function(d){d.onChannelChanged&&d.onChannelChanged(u)})),i.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_READ}})),[2]}})})},n.prototype.markAsDelivered=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new yL({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},n.prototype.startTyping=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.requestQueue,i=t.typingIndicatorThrottle,(s=new Date().getTime())-this._typingStarted>=i?(this._typingStarted=s,this._typingEnded=0,a=new fL({channelUrl:this.url,time:this._typingStarted}),[4,r.send(a)]):[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})},n.prototype.endTyping=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.requestQueue,i=t.typingIndicatorThrottle,(s=new Date().getTime())-this._typingEnded>=i?(this._typingStarted=0,this._typingEnded=s,a=new _L({channelUrl:this.url,time:this._typingStarted}),[4,r.send(a)]):[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})},n.prototype.createScheduledUserMessage=function(t){t=M(M({},ek),t),Q(tk(t)).throw(L.invalidParameters);var r=new Xr;return this._createScheduledUserMessage(t,r),r},n.prototype.updateScheduledUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return i=M(M({},zL),r),Q(function(u){return aw(u)&&k("number",u.scheduledAt,!0)}(i)).throw(L.invalidParameters),s=R.of(this._iid).requestQueue,a=new WL(M({reqId:this._generateRequestId(),scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url},i)),[4,s.send(a)];case 1:return o=l.sent(),[2,o.as(lw).message]}})})},n.prototype.createScheduledFileMessage=function(t){var r=this;t=M(M({},nk),t),Q(rk(t)).throw(L.invalidParameters);var i=Date.now(),s=this._generateRequestId(),a=new Xr;return Br(xR).then(function(){var o=r._createPendingScheduledFileMessage(t,s,i);Ue(function(){return y(r,void 0,void 0,function(){return g(this,function(l){return[2,a._trigger(o)]})})})}),Er(t.file)?this._uploadFileAndUpdateParams(t).then(function(){return r._createScheduledFileMessage(t,a,s,i)}):this._createScheduledFileMessage(t,a,s,i),a},n.prototype.updateScheduledFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return i=M(M({},GL),r),Q(function(l){return A2(l)&&k("number",l.scheduledAt,!0)&&(Er(l.file)||k("string",l.fileUrl))&&k("string",l.fileName,!0)&&k("string",l.mimeType,!0)&&k("number",l.fileSize,!0)&&(l.thumbnailSizes===null||l.thumbnailSizes===void 0||l.thumbnailSizes.every(function(u){return k("object",u)&&u.maxWidth>0&&u.maxHeight>0}))}(i)).throw(L.invalidParameters),Er(i.file)?[4,this._uploadFileAndUpdateParams(i)]:[3,2];case 1:o.sent(),o.label=2;case 2:return s=new VL(M({reqId:this._generateRequestId(),scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url},i)),[4,R.of(this._iid).requestQueue.send(s)];case 3:return a=o.sent(),[2,a.as(qL).message]}})})},n.prototype.cancelScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=new KL({scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url}),[4,R.of(this._iid).requestQueue.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.sendScheduledMessageNow=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=new QL({scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url}),[4,R.of(this._iid).requestQueue.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.getMyPushTriggerOption=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new XL({userId:r.userId,channelUrl:this.url}),[4,i.send(s)];case 1:return a=l.sent(),o=a.as(JL).pushTriggerOption,this.myPushTriggerOption=o,[2,o]}})})},n.prototype.setMyPushTriggerOption=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(Ve(Ao,t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.sdkState,a=r.requestQueue,o=new YL({userId:s.userId,channelUrl:this.url,pushTriggerOption:t}),[4,a.send(o)];case 1:return l=c.sent(),u=l.as(ZL).pushTriggerOption,this.myPushTriggerOption=u,i.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,u]}})})},n.prototype.setMyCountPreference=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(Ve(fi,t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.sdkState,a=r.requestQueue,o=new HL({channelUrl:this.url,userId:s.userId,countPreference:t}),[4,a.send(o)];case 1:return l=c.sent(),u=l.as(jL).countPreference,this.myCountPreference=u,this._updateUnreadCount(this.unreadMessageCount,this.unreadMentionCount),i.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,u]}})})},n.prototype.resetMyHistory=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return t=R.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new BL({channelUrl:this.url}),[4,i.send(s)];case 1:return a=l.sent(),o=a.as($L).messageOffsetTimestamp,this.messageOffsetTimestamp=o,this.lastMessage&&this.lastMessage.createdAt0).throw(L.invalidParameters),r=R.of(this._iid).requestQueue,i=new eD({channelType:this.channelType,channelUrl:this.url,messageId:t}),[4,r.send(i)];case 1:return s.sent(),[2]}})})},n.prototype.unpinMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return Q(k("number",t)&&t>0).throw(L.invalidParameters),r=R.of(this._iid).requestQueue,i=new tD({channelType:this.channelType,channelUrl:this.url,messageId:t}),[4,r.send(i)];case 1:return s.sent(),[2]}})})},n.prototype._uploadFileAndUpdateParams=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return Er(t.file)?(r=R.of(this._iid).requestQueue,i=new p0({file:t.file,channelUrl:this.url,thumbnailSizes:t.thumbnailSizes,requestId:this._generateRequestId()}),[4,r.send(i)]):[3,2];case 1:s=f.sent(),a=s.as(_0),o=a.url,l=a.fileSize,u=l===void 0?t.fileSize:l,c=a.thumbnails,d=a.requireAuth,h=d!==void 0&&d,t.fileUrl=o,t.fileSize=u,t.requireAuth=h,t._thumbnails=c,f.label=2;case 2:return[2]}})})},n.prototype.resendMessage=function(t,r){var i,s=this;if(Q(t instanceof Ht&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var a=(i=t.messageParams)!==null&&i!==void 0?i:bv(t),o=new Xr;return this._sendUserMessage(a,nr.RESEND,t.reqId).onPending(function(d){o._trigger(d)}).onFailed(function(d,h){o._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),o._trigger(d)}),o}if(t.isFileMessage()){var l=this._validateFailedFileMessageHasFile(t,r);Q(l).throw(L.invalidParameters),a=Cv(t,r);var u=new Xr;return this._sendFileMessage(a,nr.RESEND,t.reqId).onPending(function(d){u._trigger(d)}).onFailed(function(d,h){u._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),u._trigger(d)}),u}if(t.isMultipleFilesMessage()){a=t.messageParams;var c=new Cf;return this._sendMultipleFilesMessage(a,nr.RESEND,t.reqId).onPending(function(d){c._trigger(d)}).onFailed(function(d,h){c._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),c._trigger(d)}).onFileUploaded(function(d,h,f,p){c._triggerOnFileUploaded(d,h,f,p)}),c}},n.prototype.copyMessage=function(t,r){var i=this;if(Q(t instanceof OE&&r instanceof Ht&&r.sendingStatus===ht.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),r.isUserMessage()){Q(!r.poll).throw(L.notSupportedError);var s=nw(r),a=new Xr;return t._sendUserMessage(s).onPending(function(u){a._trigger(u)}).onFailed(function(u,c){a._triggerFailed(u,c)}).onSucceeded(function(u){t.isGroupChannel()&&i._tryUpdateLastMessageAndCallEvents(t,u),a._trigger(u)}),a}if(r.isFileMessage()){s=iw(r);var o=new Xr;return t._sendFileMessage(s).onPending(function(u){o._trigger(u)}).onFailed(function(u,c){o._triggerFailed(u,c)}).onSucceeded(function(u){t.isGroupChannel()&&i._tryUpdateLastMessageAndCallEvents(t,u),o._trigger(u)}),o}if(r.isMultipleFilesMessage()){if(t.isGroupChannel()){s=IR(r);var l=new Cf;return t._sendMultipleFilesMessage(s,nr.COPY).onPending(function(u){l._trigger(u)}).onFailed(function(u,c){l._triggerFailed(u,c)}).onSucceeded(function(u){i._tryUpdateLastMessageAndCallEvents(t,u),l._trigger(u)}).onFileUploaded(function(u,c,d,h){l._triggerOnFileUploaded(u,c,d,h)}),l}throw L.channelTypeNotSupportedError}},n}(OE),aD=function(){this.onUserMuted=Ke,this.onUserUnmuted=Ke,this.onUserBanned=Ke,this.onUserUnbanned=Ke,this.onChannelChanged=Ke,this.onChannelDeleted=Ke,this.onChannelFrozen=Ke,this.onChannelUnfrozen=Ke,this.onOperatorUpdated=Ke,this.onChannelMemberCountChanged=Ke,this.onMetaDataCreated=Ke,this.onMetaDataUpdated=Ke,this.onMetaDataDeleted=Ke,this.onMetaCounterCreated=Ke,this.onMetaCounterUpdated=Ke,this.onMetaCounterDeleted=Ke,this.onMessageReceived=Ke,this.onMessageUpdated=Ke,this.onMessageDeleted=Ke,this.onMentionReceived=Ke,this.onReactionUpdated=Ke,this.onThreadInfoUpdated=Ke},sd,_a={},oD=function(){function e(n){var t=n._iid,r=n.limit,i=r===void 0?100:r,s=this;this.ref=0,this._iid=t,this._limit=i;var a,o=R.of(this._iid),l=o.sdkState,u=o.dispatcher,c=o.logger,d=o.cacheContext;this._metadataKey=(a=l.userId,"sendbird:".concat(a,"@groupchannel/sync.meta"));var h=function(f){return"sendbird:".concat(f,"@groupchannel/sync")}(l.userId);this._sync=new io(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S,w,N,I,x;return g(this,function(A){switch(A.label){case 0:return f={hasNext:!0,nextToken:""},[4,this.loadMetadata()];case 1:if(A.sent(),c.debug("channel background sync from",(w=this._metadata)===null||w===void 0?void 0:w.token),(N=this._metadata)===null||N===void 0?void 0:N.completed)return[3,13];A.label=2;case 2:if(A.trys.push([2,9,,12]),(p={includeEmpty:!0,order:Bt.CHRONOLOGICAL}).order!==Bt.LATEST_LAST_MESSAGE)return[3,6];A.label=3;case 3:return A.trys.push([3,5,,6]),[4,d.preference.get(E2(l.appId))];case 4:return m=A.sent(),p.includeChatNotification=!!m,[3,6];case 5:return A.sent(),p.includeChatNotification=!1,[3,6];case 6:return[4,Rn.of(this._iid).getMyGroupChannels((x=(I=this._metadata)===null||I===void 0?void 0:I.token)!==null&&x!==void 0?x:"",p,this._limit,z.SYNC_CHANNEL_BACKGROUND)];case 7:return b=A.sent(),v=b.channels,_=b.token,f.hasNext=v.length>=this._limit&&!!_,f.nextToken=_,this._metadata&&(this._metadata.token=_,(S=this._metadata.range).extends.apply(S,Fe([],Me(v.map(function(O){return O.createdAt})),!1)),this._metadata.completed=!f.hasNext),c.debug("channel background sync progress",f),[4,this.saveMetadata()];case 8:return A.sent(),[3,12];case 9:return E=A.sent(),c.debug("channel background sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetaData()]:[3,11];case 10:A.sent(),A.label=11;case 11:throw E;case 12:return[3,14];case 13:f.hasNext=!1,f.nextToken="",A.label=14;case 14:return[2,f]}})})}),this._connectionEventContext=u.on(function(f){f instanceof Ii&&(f.stateType===lt.CONNECTED?s.resume():s.pause())})}return e.of=function(n){return _a[n]||(_a[n]=new e({_iid:n})),_a[n].ref++,_a[n]},e.clear=function(n){_a[n]&&(_a[n].close(),delete _a[n])},Object.defineProperty(e.prototype,"range",{get:function(){var n,t;return(t=(n=this._metadata)===null||n===void 0?void 0:n.range)!==null&&t!==void 0?t:new Ms({})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"completed",{get:function(){var n;return!!(!((n=this._metadata)===null||n===void 0)&&n.completed)},enumerable:!1,configurable:!0}),e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,R.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:n=t.sent(),this._metadata={token:n?n.token:"",range:new Ms(n?n.range:{top:Number.MAX_SAFE_INTEGER,bottom:0}),completed:!!n&&n.completed},t.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetaData=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){var n,t,r=R.of(this._iid),i=r.logger;r.sessionManager.session.hasSession&&(i.debug("channel background sync resume()"),this._sync.start((t=(n=this._metadata)===null||n===void 0?void 0:n.token)!==null&&t!==void 0?t:""))},e.prototype.pause=function(){R.of(this._iid).logger.debug("channel background sync stop()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete _a[this._iid])},e}(),ma={},lD=function(){function e(n){var t=n._iid,r=this;this.ref=0,this._iid=t;var i,s=R.of(this._iid),a=s.logger,o=s.sdkState,l=s.dispatcher,u=s.cacheContext;this._metadataKey=(i=o.userId,"sendbird:".concat(i,"@groupchannel/changelogs.meta")),this._subscribers=new fl;var c=function(d){return"sendbird:".concat(d,"@groupchannel/changelogs")}(o.userId);this._sync=new io(c,function(){return y(r,void 0,void 0,function(){var d,h,f,p,m,b,v,_,E,S,w,N;return g(this,function(I){switch(I.label){case 0:return d={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:I.sent(),a.debug("channel changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),I.label=2;case 2:I.trys.push([2,9,,12]),h={includeEmpty:!0},I.label=3;case 3:return I.trys.push([3,5,,6]),[4,u.preference.get(E2(o.appId))];case 4:return f=I.sent(),h.includeChatNotification=!!f,[3,6];case 5:return I.sent(),h.includeChatNotification=!1,[3,6];case 6:return[4,Rn.of(this._iid).getMyGroupChannelChangeLogs((N=(w=this._metadata)===null||w===void 0?void 0:w.token)!==null&&N!==void 0?N:"",h,z.SYNC_CHANNEL_CHANGELOGS)];case 7:return p=I.sent(),m=p.updatedChannels,b=p.deletedChannelUrls,v=p.hasMore,_=p.token,this._subscribers.dispatch("progress",{updatedChannels:m,deletedChannelUrls:b,hasMore:v,token:_}),d.hasNext=v,d.nextToken=_,this._metadata&&(this._metadata.token=_),a.debug("channel changelog sync progress",d),[4,this.saveMetadata()];case 8:return I.sent(),[3,12];case 9:return E=I.sent(),a.debug("channel changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,11];case 10:I.sent(),I.label=11;case 11:throw E;case 12:return[2,d]}})})}),this._sync.on("stop",function(){r._subscribers.dispatch("pause")}),this._connectionEventContext=l.on(function(d){d instanceof Ii&&(d.stateType===lt.CONNECTED?r.resume():r.pause())})}return e.of=function(n){return ma[n]||(ma[n]=new e({_iid:n})),ma[n].ref++,ma[n]},e.clear=function(n){ma[n]&&(ma[n].close(),delete ma[n])},Object.defineProperty(e.prototype,"isRunning",{get:function(){return this._sync.isRunning},enumerable:!1,configurable:!0}),e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return this._metadata?[3,2]:(n=R.of(this._iid),t=n.cacheContext,r=n.firstConnectedAt,[4,t.preference.get(this._metadataKey)]);case 1:i=s.sent(),this._metadata={token:i?i.token:r},s.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.on=function(n,t){return this._subscribers.on(n,t)},e.prototype.resume=function(){R.of(this._iid).sessionManager.session.hasSession&&this._sync.start(0)},e.prototype.pause=function(){this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete ma[this._iid])},e}(),If=function(e,n){return e.findIndex(function(t){return t.isIdentical(n)})},VE=function(e,n,t){if(e.length>0){for(var r=If(e,n),i=0,s=e.length-1,a=Math.floor((i+s)/2);i0)s=a,a=Math.floor((i+s)/2);else{if(!(o<0))return{place:a,oldPosition:r};i=a+1,a=Math.floor((i+s)/2)}}return{place:qE(e[a],n,t)>=0?a:a+1,oldPosition:r}}return{place:e.length,oldPosition:-1}},qE=function(e,n,t){switch(t){case Bt.LATEST_LAST_MESSAGE:return e.lastMessage&&n.lastMessage?n.lastMessage.createdAt-e.lastMessage.createdAt:e.lastMessage?-1:n.lastMessage?1:n.createdAt-e.createdAt;case Bt.CHRONOLOGICAL:return n.createdAt-e.createdAt;case Bt.CHANNEL_NAME_ALPHABETICAL:var r=e.name.localeCompare(n.name);return r===0?e.createdAt-n.createdAt:r;default:return 0}},uD=function(){function e(n,t){var r=t.filter,i=r===void 0?new Cw:r,s=t.order,a=s===void 0?Bt.LATEST_LAST_MESSAGE:s,o=t.limit,l=o===void 0?cw:o,u=t.includeChangesOnInitialLoad,c=u!==void 0&&u,d=this;this.channels=[],this._iid=n,this._key="gcc-".concat(la()),this._isDisposed=!1,this._isGetRemoteChannelsSucceeded=!0,this._includeChangesOnInitialLoad=c,this.filter=i,this.order=a,this._hasMore=!0,this._token="",this._limit=l;var h=R.of(this._iid),f=h.sdkState,p=h.cacheContext,m=h.dispatcher;p.localCacheEnabled&&(this._backgroundSync=oD.of(n),this._backgroundSync.resume()),this._changelogSync=lD.of(n),this._changelogSync.resume(),Rn.of(this._iid).subscribeChannelEvent(this._key,{onUpdate:function(b,v){var _=v.source;if(Nf(_)){var E=b.filter(function(w){return d.filter.match(w,f.userId)}),S=b.filter(function(w){return!d.filter.match(w,f.userId)}).map(function(w){return w.url});E.length>0&&d._addChannelsToView(E,v),S.length>0&&d._removeChannelsFromView(S,v)}},onRemove:function(b,v){d._removeChannelsFromView(b,v)}}),R.of(this._iid).statManager.put(new Ou({type:St.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{group_channel:!0}}})),m.on(function(b){b instanceof Ii&&(b.stateType===lt.CONNECTED?d._isGetRemoteChannelsSucceeded||y(d,void 0,void 0,function(){return g(this,function(v){switch(v.label){case 0:return[4,this._revokeLoadMore()];case 1:return v.sent(),[2]}})}):b.stateType===lt.LOGOUT&&d.dispose())})}return Object.defineProperty(e.prototype,"hasMore",{get:function(){return!this._isDisposed&&this._hasMore},enumerable:!1,configurable:!0}),e.prototype.setGroupChannelCollectionHandler=function(n){this._handler=n},e.prototype._addChannelsToView=function(n,t,r){var i,s,a,o,l=this;r===void 0&&(r=!1);var u=[],c=[],d=[];try{for(var h=ge(n),f=h.next();!f.done;f=h.next()){var p=f.value,m=If(this.channels,p);m>=0&&this.channels.splice(m,1);var b=VE(this.channels,p,this.order).place;if(m<0)b===this.channels.length?!r&&this._hasMore||(u.push(p),this.channels.push(p)):(u.push(p),this.channels.splice(b,0,p));else switch(t.source){case z.EVENT_CHANNEL_UPDATED:case z.EVENT_MESSAGE_RECEIVED:case z.SYNC_CHANNEL_CHANGELOGS:case z.EVENT_MESSAGE_SENT:this.order===Bt.CHANNEL_NAME_ALPHABETICAL&&this._hasMore&&b===this.channels.length?d.push(p):(this.channels.splice(b,0,p),c.push(p));break;default:this.channels.splice(b,0,p),c.push(p)}}}catch(S){i={error:S}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}if(d.length>0)try{for(var v=ge(d),_=v.next();!_.done;_=v.next()){p=_.value;var E=If(this.channels,p);E!==-1&&this.channels.splice(E,1)}}catch(S){a={error:S}}finally{try{_&&!_.done&&(o=v.return)&&o.call(v)}finally{if(a)throw a.error}}Nf(t.source)&&Ue(function(){return y(l,void 0,void 0,function(){var S,w,N;return g(this,function(I){return u.length>0&&(!((S=this._handler)===null||S===void 0)&&S.onChannelsAdded)&&this._handler.onChannelsAdded(t,u),c.length>0&&(!((w=this._handler)===null||w===void 0)&&w.onChannelsUpdated)&&this._handler.onChannelsUpdated(t,c),d.length>0&&(!((N=this._handler)===null||N===void 0)&&N.onChannelsDeleted)&&this._handler.onChannelsDeleted(t,d.map(function(x){return x.url})),[2]})})})},e.prototype._removeChannelsFromView=function(n,t){var r,i,s=this,a=[],o=function(d){var h=l.channels.findIndex(function(f){return f.url===d});h>=0&&(a.push(l.channels[h].url),l.channels.splice(h,1))},l=this;try{for(var u=ge(n),c=u.next();!c.done;c=u.next())o(c.value)}catch(d){r={error:d}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return Nf(t.source)&&a.length>0&&Ue(function(){return y(s,void 0,void 0,function(){var d;return g(this,function(h){return!((d=this._handler)===null||d===void 0)&&d.onChannelsDeleted&&this._handler.onChannelsDeleted(t,a),[2]})})}),a},e.prototype._getLocalChannels=function(){return y(this,void 0,void 0,function(){var n,t;return g(this,function(r){switch(r.label){case 0:return n=Rn.of(this._iid),t=this.channels.length>0?function(i,s){var a,o,l,u;switch(s){case Bt.LATEST_LAST_MESSAGE:return(o=(a=i.lastMessage)===null||a===void 0?void 0:a.createdAt)!==null&&o!==void 0?o:i.createdAt;case Bt.CHRONOLOGICAL:return i.createdAt;case Bt.CHANNEL_NAME_ALPHABETICAL:return i.name;default:return(u=(l=i.lastMessage)===null||l===void 0?void 0:l.createdAt)!==null&&u!==void 0?u:i.createdAt}}(this.channels[this.channels.length-1],this.order):null,[4,n.getChannelsFromCache(t,this.filter,this.order,this._limit,t?this.channels[this.channels.length-1].url:void 0)];case 1:return[2,r.sent()]}})})},e.prototype._getRemoteChannels=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return[4,Rn.of(this._iid).getMyGroupChannels(this._token,Ie(M(M({},this.filter),{order:this.order})),this._limit)];case 1:return n=i.sent(),t=n.channels,r=n.token,this._token=r,this._hasMore=!!r,[2,t]}})})},e.prototype._revokeLoadMore=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:if(this._isDisposed)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._getRemoteChannels()];case 2:return n=t.sent(),this._isGetRemoteChannelsSucceeded=!0,this._addChannelsToView(n,{source:z.REQUEST_CHANNEL},!0),[3,4];case 3:return t.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,4];case 4:return[2]}})})},e.prototype.loadMore=function(){var n;return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S=this;return g(this,function(w){switch(w.label){case 0:if(this._isDisposed)throw new L({code:Ae.COLLECTION_DISPOSED,message:"Collection has been disposed."});return t=null,this._includeChangesOnInitialLoad&&this.channels.length===0&&this._changelogSync.isRunning?[4,new Promise(function(N){S._changelogSyncSubscriberContext=S._changelogSync.on("progress",function(I){return N(I)}).on("pause",function(){return N(null)})})]:[3,2];case 1:t=w.sent(),(n=this._changelogSyncSubscriberContext)===null||n===void 0||n.close(),w.label=2;case 2:return r=[],this._hasMore?(i=R.of(this._iid),s=i.cacheContext,a=i.connectionManager,!s.localCacheEnabled||a.isConnected&&!this._backgroundSync.completed?[3,4]:[4,Lt(function(){return y(S,void 0,void 0,function(){return g(this,function(N){switch(N.label){case 0:return[4,this._getLocalChannels()];case 1:return r=N.sent(),[2]}})})})]):[3,8];case 3:return w.sent(),this._hasMore=r.length>=this._limit,[3,7];case 4:return w.trys.push([4,6,,7]),[4,this._getRemoteChannels()];case 5:return r=w.sent(),this._isGetRemoteChannelsSucceeded=!0,[3,7];case 6:return w.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,7];case 7:this._addChannelsToView(r,{source:z.REQUEST_CHANNEL},!0),w.label=8;case 8:if(t){try{for(o=ge(t.updatedChannels),l=o.next();!l.done;l=o.next())u=l.value,(m=If(r,u))>=0?r[m]=u:(c=VE(r,u,this.order).place,r.splice(c,0,u))}catch(N){b={error:N}}finally{try{l&&!l.done&&(v=o.return)&&v.call(o)}finally{if(b)throw b.error}}d=r.map(function(N){return N.url});try{for(h=ge(t.deletedChannelUrls),f=h.next();!f.done;f=h.next())p=f.value,(m=d.indexOf(p))>=0&&(r.splice(m,1),d.splice(m,1))}catch(N){_={error:N}}finally{try{f&&!f.done&&(E=h.return)&&E.call(h)}finally{if(_)throw _.error}}}return[2,r]}})})},e.prototype.dispose=function(){var n,t,r;this._isDisposed||(this._isDisposed=!0,this.channels.length>0&&this.channels.splice(0,this.channels.length),(n=this._backgroundSync)===null||n===void 0||n.close(),(t=this._changelogSync)===null||t===void 0||t.close(),(r=this._changelogSyncSubscriberContext)===null||r===void 0||r.close(),Rn.of(this._iid).unsubscribeChannelEvent(this._key))},e}(),cD=function(e){function n(t){var r=this,i=t.token,s=t.limit,a=t.order,o=t.includeEmpty,l=t.membershipFilter,u=t.channelNameContainsFilter,c=t.channelUrlsFilter,d=t.customTypesFilter,h=t.customTypeStartsWithFilter,f=t.superChannelFilter,p=t.metadataOrderKeyFilter,m=t.metadataKey,b=t.metadataValues,v=t.metadataValueStartsWith,_=t.includeFrozen,E=t.includeMetaData;return(r=e.call(this)||this).method=Y.GET,r.path=cr,r.params=be(Ie({token:i,limit:s,order:a,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:o,public_mode:Ds.PUBLIC,public_membership_mode:l,name_contains:u,channel_urls:c,custom_types:d,custom_type_startswith:h,super_mode:f,metadata_order_key:p,metadata_key:m,metadata_values:b,metadata_value_startswith:v,show_frozen:_,show_metadata:E})),r}return T(n,e),n}(Z),dD=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.channels=[];var s=r.next,a=r.channels,o=r.ts;return i.token=s,a&&a.length>0&&(i.channels=a.map(function(l){return l.ts=o,new Si(t,l)})),i.ts=typeof o=="number"?o:0,i}return T(n,e),n}(le);(function(e){e.ALL="all",e.JOINED="joined"})(sd||(sd={}));var hD=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_=this;return(_=e.call(this,t,r)||this).includeEmpty=!1,_.includeFrozen=!0,_.includeMetaData=!0,_.channelUrlsFilter=null,_.customTypesFilter=null,_.customTypeStartsWithFilter=null,_.channelNameContainsFilter=null,_.membershipFilter=sd.ALL,_.superChannelFilter=qr.ALL,_.metadataKey=null,_.metadataValues=null,_.metadataOrderKeyFilter=null,_.metadataValueStartsWith=null,_.order=td.CHRONOLOGICAL,_.includeEmpty=(i=r.includeEmpty)!==null&&i!==void 0&&i,_.includeFrozen=(s=r.includeFrozen)===null||s===void 0||s,_.includeMetaData=(a=r.includeMetaData)===null||a===void 0||a,_.channelUrlsFilter=(o=r.channelUrlsFilter)!==null&&o!==void 0?o:null,_.customTypesFilter=(l=r.customTypesFilter)!==null&&l!==void 0?l:null,_.customTypeStartsWithFilter=(u=r.customTypeStartsWithFilter)!==null&&u!==void 0?u:null,_.channelNameContainsFilter=(c=r.channelNameContainsFilter)!==null&&c!==void 0?c:null,_.membershipFilter=(d=r.membershipFilter)!==null&&d!==void 0?d:sd.ALL,_.superChannelFilter=(h=r.superChannelFilter)!==null&&h!==void 0?h:qr.ALL,_.metadataKey=(f=r.metadataKey)!==null&&f!==void 0?f:null,_.metadataValues=(p=r.metadataValues)!==null&&p!==void 0?p:null,_.metadataOrderKeyFilter=(m=r.metadataOrderKeyFilter)!==null&&m!==void 0?m:null,_.metadataValueStartsWith=(b=r.metadataValueStartsWith)!==null&&b!==void 0?b:null,_.order=(v=r.order)!==null&&v!==void 0?v:td.CHRONOLOGICAL,_}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeEmpty)&&k("boolean",this.includeFrozen)&&k("boolean",this.includeMetaData)&&k("string",this.channelNameContainsFilter,!0)&&Qe("string",this.channelUrlsFilter,!0)&&Qe("string",this.customTypesFilter,!0)&&k("string",this.customTypeStartsWithFilter,!0)&&Ve(sd,this.membershipFilter)&&Ve(qr,this.superChannelFilter)&&Ve(td,this.order)&&k("string",this.metadataOrderKeyFilter,!0)&&k("string",this.metadataKey,!0)&&Qe("string",this.metadataValues,!0)&&k("string",this.metadataValueStartsWith,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:(t=[],this._hasNext?(this._isLoading=!0,r=R.of(this._iid).requestQueue,i=new cD(Ie(M(M({},this),{token:this._token}))),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),a=s.as(dD),o=a.channels,l=a.token,this._token=l,this._hasNext=!!l,this._isLoading=!1,[2,o];case 2:return[2,t];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),x2=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.onUserJoined=Ke,t.onUserLeft=Ke,t.onUserReceivedInvitation=Ke,t.onUserDeclinedInvitation=Ke,t.onChannelHidden=Ke,t.onUnreadMemberStatusUpdated=Ke,t.onUndeliveredMemberStatusUpdated=Ke,t.onTypingStatusUpdated=Ke,t.onPollUpdated=Ke,t.onPollVoted=Ke,t.onPollDeleted=Ke,t.onPinnedMessageUpdated=Ke,t}return T(n,e),n}(aD)),fD=function(e){function n(t){var r=this,i=t.token,s=t.limit,a=t.order,o=t.reverse,l=t.channelUrl,u=t.messageTypeFilter,c=t.scheduledStatus;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nT),r.params=be(Ie({token:i,limit:s,reverse:o,channel_url:l,order:a,message_type:u,status:c})),r}return T(n,e),n}(Z),pD=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.scheduledMessages=[];var s=r.next,a=r.scheduled_messages;return i.token=s,i.scheduledMessages=a.map(function(o){return Tr(t,o)}),i}return T(n,e),n}(le),_D=function(e){function n(t,r){var i,s,a,o,l,u=this;return(u=e.call(this,t,r)||this).channelUrl=null,u.order=null,u.reverse=!1,u.scheduledStatus=null,u.messageTypeFilter=ar.ALL,u.channelUrl=(i=r.channelUrl)!==null&&i!==void 0?i:null,u.order=(s=r.order)!==null&&s!==void 0?s:null,u.reverse=(a=r.reverse)!==null&&a!==void 0&&a,u.scheduledStatus=(o=r.scheduledStatus)!==null&&o!==void 0?o:null,u.messageTypeFilter=(l=r.messageTypeFilter)!==null&&l!==void 0?l:ar.ALL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.channelUrl,!0)&&(Ve(Mv,this.order)||this.order===null)&&k("boolean",this.reverse)&&(Qe(Ua,this.scheduledStatus)||this.scheduledStatus===null)&&Ve(ar,this.messageTypeFilter)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new fD(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(pD),a=s.scheduledMessages,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),mD=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="groupChannel",t}return T(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,a=r.sessionManager,o=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:a,requestQueue:o,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new Rn(t,{sdkState:i,cacheContext:c,dispatcher:s,sessionManager:a,requestQueue:o,logger:l})},n.prototype.createGroupChannelCollection=function(t){return t===void 0&&(t={}),new uD(this._iid,t)},n.prototype.createMyGroupChannelListQuery=function(t){return t===void 0&&(t={}),new ww(this._iid,t)},n.prototype.createPublicGroupChannelListQuery=function(t){return t===void 0&&(t={}),new hD(this._iid,t)},n.prototype.createScheduledMessageListQuery=function(t){return t===void 0&&(t={}),new _D(this._iid,t)},n.prototype.addGroupChannelHandler=function(t,r){Q(k("string",t)&&r instanceof x2).throw(L.invalidParameters),this._manager.addHandler(t,r)},n.prototype.removeGroupChannelHandler=function(t){Q(k("string",t)).throw(L.invalidParameters),this._manager.removeHandler(t)},n.prototype.removeAllGroupChannelHandlers=function(){this._manager.clearHandler()},n.prototype.buildGroupChannelFromSerializedData=function(t){return this._manager.buildGroupChannelFromSerializedData(t)},n.prototype.buildGroupChannelListQueryFromSerializedData=function(t){return this._manager.buildGroupChannelListQueryFromSerializedData(t)},n.prototype.buildMemberFromSerializedData=function(t){return this._manager.buildMemberFromSerializedData(t)},n.prototype.getChannel=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(k("string",t)).throw(L.invalidParameters),[2,this._manager.getChannel(t)]})})},n.prototype.getChannelWithoutCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(k("string",t)).throw(L.invalidParameters),[2,this._manager.getChannelWithoutCache(t)]})})},n.prototype.getMyGroupChannelChangeLogsByToken=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},b0),r),Q(k("string",t)&&Ov(i)).throw(L.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,i)];case 1:return[2,s.sent()]}})})},n.prototype.getMyGroupChannelChangeLogsByTimestamp=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},b0),r),Q(k("number",t)&&Ov(i)).throw(L.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,i)];case 1:return[2,s.sent()]}})})},n.prototype.getGroupChannelCount=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},Sw),t),Q(Tw(r)).throw(L.invalidParameters),[2,this._manager.getGroupChannelCount(r)]})})},n.prototype.getUnreadItemCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getUnreadItemCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._manager.getTotalUnreadChannelCount()];case 1:return[2,t.sent()]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getTotalUnreadMessageCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getTotalScheduledMessageCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getSubscribedTotalUnreadMessageCount=function(){return this._manager.getSubscribedTotalUnreadMessageCount()},n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){return this._manager.getSubscribedCustomTypeTotalUnreadMessageCount()},n.prototype.getSubscribedCustomTypeUnreadMessageCount=function(t){return this._manager.getSubscribedCustomTypeUnreadMessageCount(t)},n.prototype.createChannel=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},wf),t),Q(xv(r)).throw(L.invalidParameters),[2,this._manager.createChannel(r)]})})},n.prototype.createDistinctChannelIfNotExist=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},wf),t),Q(xv(r)).throw(L.invalidParameters),r&&(r.isDistinct=!0),[2,this.createChannel(r)]})})},n.prototype.createChannelWithUserIds=function(t,r,i,s,a,o){return r===void 0&&(r=!1),a===void 0&&(a=""),o===void 0&&(o=""),y(this,void 0,void 0,function(){var l;return g(this,function(u){return l=M(M({},wf),{invitedUserIds:t,isDistinct:r,name:i,data:a,customType:o}),typeof s=="string"?l.coverUrl=s:l.coverImage=s,[2,this.createChannel(l)]})})},n.prototype.markAsReadAll=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return this._manager.markAsReadAll(),[2]})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(Qe("string",t)).throw(L.invalidParameters),this._manager.markAsReadWithChannelUrls(t),[2]})})},n.prototype.markAsDelivered=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Q(k("string",t)).throw(L.invalidParameters),[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n}(S2);const ic={reactions:"reactions",message_search_v3:"message_search_v3",enable_og_tag:"enable_og_tag",enable_message_threading:"enable_message_threading",allow_broadcast_channel:"allow_broadcast_channel",allow_super_group_channel:"allow_super_group_channel"},S0={collection:{groupChannel:{defaultLimit:20,defaultOrder:Bt.LATEST_LAST_MESSAGE,defaultIncludeEmpty:!1},message:{defaultLimit:{next:25,prev:25},searchLimit:{next:10,prev:10}}}};var vD=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):i(c.value).then(o,l)}u((r=r.apply(e,n||[])).next())})};const gD=(e,n)=>{D.useEffect(Nw(e),n)},yD=(e,n)=>{D.useLayoutEffect(Nw(e),n)},V_=e=>e(),Nw=e=>()=>{const n=V_(e);return()=>{n&&(n instanceof Promise?V_(()=>vD(void 0,void 0,void 0,function*(){const t=yield n;t&&t()})):V_(n))}};let ED=0;function bD(){return D.useState(()=>`${ED++}`)[0]}const Iw=(e,n,t)=>{const r=D.useRef(n),s=bD();r.current=n,D.useEffect(()=>{var a;const o=l=>(Object.keys(l).forEach(c=>{l[c]=(...d)=>{var h,f;return(f=(h=r.current)===null||h===void 0?void 0:h[c])===null||f===void 0?void 0:f.call(h,...d)}}),l);return(a=e==null?void 0:e.groupChannel)===null||a===void 0||a.addGroupChannelHandler(s,o(new x2)),()=>{var l;(l=e==null?void 0:e.groupChannel)===null||l===void 0||l.removeGroupChannelHandler(s)}},[e==null?void 0:e.groupChannel,s])};function En(e){const n=D.useRef(e);return n.current=e,D.useCallback((...t)=>n.current(...t),[n])}var CD=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="poll",t}return T(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,a=r.sessionManager,o=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:a,requestQueue:o,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new f0(t,{sdkState:i,dispatcher:s,sessionManager:a,requestQueue:o,logger:l,onlineDetector:u,cacheContext:c})},n.prototype.create=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},Bx),t),Q($T(r)).throw(L.invalidParameters),[2,this._manager.create(r)]})})},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},Gx),t),Q(zT(r)).throw(L.invalidParameters),[2,this._manager.get(r)]})})},n.prototype.getOption=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},$x),t),Q(GT(r)).throw(L.invalidParameters),[2,this._manager.getOption(r)]})})},n.prototype.buildPollFromSerializedData=function(t){return this._manager.buildPollFromSerializedData(t)},n}(S2),SD=function(e){return["-lastMessageUpdatedAt","-createdAt","syncIndex"]},WE=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(At),Aw=function(e){this.key=e.key,this.url=e.url},Mw=function(e){this.id=e.id,this.name=e.name,this.url=e.url,this.emojis=e.emojis?e.emojis.map(function(n){return new Aw(n)}):[]},TD=function(e){this.emojiHash=e.emoji_hash||"",this.emojiCategories=e.emoji_categories?e.emoji_categories.map(function(n){return new Mw(n)}):[]},wD={profileImage:void 0,profileUrl:void 0,nickname:void 0},KE=function(e){return function(n,t){return y(void 0,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:switch(n){case 1:case 2:case 3:case 4:return[3,1];case 5:return[3,2];case 6:return[3,4]}return[3,11];case 1:return t(),[3,12];case 2:return[4,e.store.clear()];case 3:return o.sent(),t(),[3,12];case 4:return o.trys.push([4,9,,10]),r=function(l){return{v2:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:dw,keyName:ER,index:[Tf(Bt.LATEST_LAST_MESSAGE),Tf(Bt.CHRONOLOGICAL),Tf(Bt.CHANNEL_NAME_ALPHABETICAL)]},{collectionName:wv,keyName:bR,index:[Os(Yn.CHANNEL_LATEST),Os(Yn.NEWEST_CHILD_MESSAGE)]},{collectionName:_w,keyName:ik,index:[Os(Yn.CHANNEL_LATEST),Os(Yn.NEWEST_CHILD_MESSAGE)]},{collectionName:SR,keyName:TR}])];case 1:return[2,u.sent()]}})})},v3:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:wR,keyName:NR,index:[SD()]}])];case 1:return[2,u.sent()]}})})},v4:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:fw,keyName:CR,index:[JR()]}])];case 1:return[2,u.sent()]}})})}}}(e),i=r.v2,s=r.v3,a=r.v4,[4,i()];case 5:return o.sent(),[4,s()];case 6:return o.sent(),[4,a()];case 7:return o.sent(),[4,e.collection(wv).removeIf({where:{channelType:et.OPEN}})];case 8:case 9:return o.sent(),[3,10];case 10:return t(),[3,12];case 11:t(),o.label=12;case 12:return[2]}})})}},ND=function(){return typeof document<"u"?document.visibilityState:"visible"},ID=function(e){function n(t){var r=t.getVisibilityState,i=r===void 0?ND:r,s=t.initialState,a=s===void 0?"visible":s,o=t.isEnabled,l=o===void 0||o,u=t.pauseCheckDelay,c=u===void 0?3e4:u,d=e.call(this)||this;return d._pauseCheckDelay=3e4,d._currentState="visible",d._getVisibilityState=i,d._pauseCheckDelay=c,d._currentState=a,d._isEnabled=l,d._boundToggleState=d._toggleState.bind(d),d}return T(n,e),Object.defineProperty(n.prototype,"currentState",{get:function(){return this._currentState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isAvailable",{get:function(){return typeof window<"u"&&!!window.addEventListener&&!!window.removeEventListener},enumerable:!1,configurable:!0}),n.prototype._toggleState=function(){var t=this,r=this._getVisibilityState();r!=="hidden"?this._currentState==="hidden"&&(this._pauseDelayTimer&&(clearTimeout(this._pauseDelayTimer),this._pauseDelayTimer=void 0),this.dispatch("resume")):this._currentState!=="hidden"&&(this._pauseDelayTimer=setTimeout(function(){t._pauseDelayTimer=void 0,t.dispatch("pause")},this._pauseCheckDelay)),this._currentState=r},n.prototype.start=function(){this._isEnabled&&this.isAvailable&&(this._boundToggleState=this._toggleState.bind(this),window.addEventListener("visibilitychange",this._boundToggleState,{capture:!0}))},n.prototype.stop=function(){this._isEnabled&&this.isAvailable&&this._boundToggleState&&window.removeEventListener("visibilitychange",this._boundToggleState,{capture:!0})},n}(fl),AD=function(){function e(n){var t=n.logger,r=n.connectionDelegate,i=r===void 0?null:r,s=this;this._onlineWorker=function(){var a;return(a=s.connectionDelegate)===null||a===void 0?void 0:a.reconnect()},this._offlineWorker=function(){var a;return(a=s.connectionDelegate)===null||a===void 0?void 0:a.disconnect()},this.unsubscribes=[],this._onlineListener=function(a){if(s.isAvailableOnWeb)return window.addEventListener("online",a),function(){return window.removeEventListener("online",a,!1)}},this._offlineListener=function(a){if(s.isAvailableOnWeb)return window.addEventListener("offline",a),function(){return window.removeEventListener("offline",a,!1)}},this.logger=t,i&&(this.connectionDelegate=i)}return Object.defineProperty(e.prototype,"isAvailableOnWeb",{get:function(){return typeof window<"u"&&!!window.addEventListener&&"ononline"in window&&"onoffline"in window&&typeof navigator<"u"&&navigator.onLine!==void 0},enumerable:!1,configurable:!0}),e.prototype.setOnlineListener=function(n){n&&typeof n=="function"&&(this._onlineListener=n)},e.prototype.setOfflineListener=function(n){n&&typeof n=="function"&&(this._offlineListener=n)},e.prototype.start=function(){this.unsubscribes=[this._onlineListener(this._onlineWorker),this._offlineListener(this._offlineWorker)]},e.prototype.stop=function(){var n=this;this.unsubscribes.forEach(function(t){try{t==null||t()}catch(r){n.logger.warn(r.message)}}),this.unsubscribes=[]},e.prototype.isOnline=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this.isAvailableOnWeb?[2,navigator.onLine]:[2,new Promise(function(t){fetch("https://www.google.com",{method:Y.GET,mode:"no-cors"}).then(function(){return t(!0)}).catch(function(){return t(!1)})})]})})},e}(),QE=function(e){function n(t){var r=t.userId,i=t.nickname,s=t.profileUrl,a=t.profileImage,o=t.preferredLanguages,l=e.call(this)||this;return l.method=Y.PUT,l.path="".concat(tt,"/").concat(encodeURIComponent(r)),l.params=be(Ie({nickname:i,profile_url:s,profile_file:a,preferred_languages:o})),l}return T(n,e),n}(Z),YE=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.user=new Ze(t,M({},r)),i}return T(n,e),n}(le),MD=function(e){function n(t){var r=t.userId,i=t.token,s=t.deviceOS,a=t.deviceManufacturer,o=t.systemPushEnabled,l=e.call(this)||this;return l.method=Y.POST,l.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/apns"),l.params=be({apns_device_token:i,always_push:!0,device_os:s,device_manufacturer:a,system_push_enabled:o}),l}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.type=r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,i.user=new Ze(t,r.user),i}T(n,e)})(le);var xD=function(e){function n(t){var r=t.userId,i=t.token,s=t.deviceOS,a=t.deviceManufacturer,o=t.systemPushEnabled,l=e.call(this)||this;return l.method=Y.POST,l.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/gcm"),l.params=be({gcm_reg_token:i,always_push:!0,device_os:s,device_manufacturer:a,system_push_enabled:o}),l}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.type=r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,i.user=new Ze(t,r.user),i}T(n,e)})(le);var OD=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/apns/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.user=new Ze(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(le);var RD=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/gcm/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.user=new Ze(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(le);var kD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.DELETE,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/apns"),i}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.type=r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,i.user=new Ze(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(le);var LD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.DELETE,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/gcm"),i}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.type=r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,i.user=new Ze(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(le);var DD=function(e){function n(t){var r=t.userId,i=t.type,s=t.token,a=t.ts,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/").concat(encodeURIComponent(i),"/device_tokens"),o.params={created_ts:a,token:s},o}return T(n,e),n}(Z),UD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTokens={type:r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,deviceTokens:r.device_tokens,hasMore:r.has_more,token:r.token},i}return T(n,e),n}(le),PD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),i}return T(n,e),n}(Z),FD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.autoAccept=r.auto_accept,i}return T(n,e),n}(le),HD=function(e){function n(t){var r=t.userId,i=t.willAutoAccept,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),s.params={auto_accept:i},s}return T(n,e),n}(Z),jD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.autoAccept=r.auto_accept,i}return T(n,e),n}(le),BD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(Z),$D=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.preference={doNotDisturbOn:r.do_not_disturb,startHour:r.start_hour,startMin:r.start_min,endHour:r.end_hour,endMin:r.end_min,timezone:r.timezone},i}return T(n,e),n}(le),GD=function(e){function n(t){var r=t.userId,i=t.doNotDisturbOn,s=t.startHour,a=t.startMin,o=t.endHour,l=t.endMin,u=t.timezone,c=e.call(this)||this;return c.method=Y.PUT,c.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),c.params={do_not_disturb:i,start_hour:s,start_min:a,end_hour:o,end_min:l,timezone:u},c}return T(n,e),n}(Z),zD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.preference={doNotDisturbOn:r.do_not_disturb,startHour:r.start_hour,startMin:r.start_min,endHour:r.end_hour,endMin:r.end_min,timezone:r.timezone},i}return T(n,e),n}(le),VD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(Z),qD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.snoozePeriod={isSnoozeOn:r.snooze_enabled},typeof r.snooze_start_ts=="number"&&(i.snoozePeriod.startTs=r.snooze_start_ts),typeof r.snooze_end_ts=="number"&&(i.snoozePeriod.endTs=r.snooze_end_ts),i}return T(n,e),n}(le),WD=function(e){function n(t){var r=t.userId,i=t.snoozeOn,s=t.startTs,a=t.endTs,o=e.call(this)||this;return o.method=Y.PUT,o.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),o.params={snooze_enabled:i,snooze_start_ts:s,snooze_end_ts:a},o}return T(n,e),n}(Z),KD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.snoozePeriod={isSnoozeOn:r.snooze_enabled},typeof r.snooze_start_ts=="number"&&(i.snoozePeriod.startTs=r.snooze_start_ts),typeof r.snooze_end_ts=="number"&&(i.snoozePeriod.endTs=r.snooze_end_ts),i}return T(n,e),n}(le),QD=function(e){function n(t){var r=t.userId,i=t.blockedUserId,s=e.call(this)||this;return s.method=Y.POST,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/block"),s.params={target_id:i},s}return T(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.user=new Ze(t,r),i}T(n,e)})(le);var YD=function(e){function n(t){var r=t.userId,i=t.unblockedUserId,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/block/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var ZD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(Z),XD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i}return T(n,e),n}(le),JD=function(e){function n(t){var r=t.userId,i=t.pushTriggerOption,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),s.params={push_trigger_option:i},s}return T(n,e),n}(Z),e5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i}return T(n,e),n}(le),t5=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/template"),i}return T(n,e),n}(Z),n5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.name=r.name,i}return T(n,e),n}(le),r5=function(e){function n(t){var r=t.userId,i=t.templateName,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/template"),s.params={name:i},s}return T(n,e),n}(Z),i5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.name=r.name,i}return T(n,e),n}(le),s5=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Y.GET,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friends/changelogs"),s.params={token:i},s}return T(n,e),n}(Z),a5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.changelogs={addedUsers:r.added.map(function(s){return new Ze(t,s)}),updatedUsers:r.updated.map(function(s){return new Ze(t,s)}),deletedUserIds:r.deleted,hasMore:r.has_more,token:r.next},i}return T(n,e),n}(le),o5=function(e){function n(t){var r=t.userId,i=t.discoveries,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discoveries:i.map(function(a){return{friend_discovery_key:a.friendDiscoveryKey,friend_name:a.friendName}})},s}return T(n,e),n}(Z),l5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.friendDiscoveryRequestId=r.friend_discovery_request_id,i}return T(n,e),n}(le),u5=function(e){function n(t){var r=t.userId,i=t.discoveryKeys,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discovery_keys:i},s}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var c5=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Y.POST,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(Z),d5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ze(t,s)}),i}return T(n,e),n}(le),h5=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var f5=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(r,"/allow_friend_discovery"),i.params={},i}return T(n,e),n}(Z),p5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.allowFriendDiscovery=r.allow_friend_discovery,i}return T(n,e),n}(le),_5=function(e){function n(t){var r=t.userId,i=t.allowFriendDiscovery,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(r,"/allow_friend_discovery"),s.params={allow_friend_discovery:i},s}return T(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(le);var T0,m5=function(e){function n(){var t=e.call(this)||this;return t.method=Y.GET,t.path=tT,t}return T(n,e),n}(Z),v5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiContainer=new TD(r),i}return T(n,e),n}(le),g5=function(e){function n(t){var r=t.categoryId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tT,"/").concat(r),i}return T(n,e),n}(Z),y5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiCategory=new Mw(r),i}return T(n,e),n}(le),E5=function(e){function n(t){var r=t.key,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(Z6,"/").concat(r),i}return T(n,e),n}(Z),b5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emoji=new Aw(r),i}return T(n,e),n}(le),C5=function(e){function n(){var t=e.call(this)||this;return t.method=Y.GET,t.path="".concat(X6),t}return T(n,e),n}(Z),S5=function(e){function n(t,r){var i,s=this,a=r??{};return(s=e.call(this,t,r)||this).uikitConfiguration={string:JSON.stringify(a),json:a},s.updatedAt=(i=r==null?void 0:r.updated_at)!==null&&i!==void 0?i:0,s}return T(n,e),n}(le);(function(e){e.DELIVERED="DELIVERED",e.CLICKED="CLICKED"})(T0||(T0={}));var sc,ZE=function(e){function n(t){var r=t.deviceToken,i=t.pushTrackingId,s=t.messageId,a=t.allowedPushNotification,o=t.channelKey,l=t.templateKey,u=t.eventType,c=t.notificationEventDeadline,d=e.call(this)||this;return d.method=Y.POST,d.path=eM,d.params=be({device_token:r,push_tracking_id:i,message_id:s,allowed_push_notification:a,channel_key:o,template_key:l,event_type:u,notification_event_deadline:c}),d}return T(n,e),n}(Z),T5=function(){function e(n,t,r){var i=this;this._storeInitialized=!1,this._iid=n,this.options=t;var s=R.of(n),a=s.sdkState,o=s.cacheContext,l=s.dispatcher,u=s.sessionManager,c=s.requestQueue,d=s.logger,h=s.userEventHandlers,f=s.appStateToggleEnabled;this._onlineDetector=new AD({logger:d,connectionDelegate:{reconnect:function(){return y(i,void 0,void 0,function(){var m,b,v,_,E,S;return g(this,function(w){switch(w.label){case 0:if(m=R.of(n),b=m.sdkState,v=m.connectionManager,(_=m.sessionManager).session.hasSession)return[3,5];w.label=1;case 1:return w.trys.push([1,3,,4]),[4,v.connect(_.session.authToken)];case 2:return w.sent(),[3,4];case 3:if(E=w.sent(),zr(E))throw E;return d.debug("connect failed by reconnect event = ",E),[3,4];case 4:return[3,9];case 5:if(b.appState!=="foreground")return[3,9];w.label=6;case 6:return w.trys.push([6,8,,9]),[4,v.resetAndReconnect()];case 7:return w.sent(),[3,9];case 8:if(S=w.sent(),zr(S))throw S;return d.debug("resetAndReconnect failed by reconnect event = ",S),[3,9];case 9:return l.dispatch(new WE),[2]}})})},disconnect:function(){Lt(function(){return y(i,void 0,void 0,function(){return g(this,function(m){switch(m.label){case 0:return[4,R.of(n).connectionManager.disconnect()];case 1:return m.sent(),[2]}})})})}}});var p=new Sc(n,{localCacheEnabled:o.localCacheEnabled,enableAutoResend:o.localCacheConfig.enableAutoResend,dispatcher:l,sdkState:a,logger:d});r.forEach(function(m){m.init(n,{sdkState:a,cacheContext:o,dispatcher:l,sessionManager:u,requestQueue:c,logger:d,onlineDetector:i._onlineDetector}),i[m.name]=m}),this._appStateChangeDetector=new ID({isEnabled:f}),this._appStateChangeDetector.on("resume",function(){d.debug("the page resumes from freeze"),i.setForegroundState()}).on("pause",function(){d.debug("the page freezes"),i.setBackgroundState()}),l.on(function(m){var b;if(m instanceof Ii)m.stateType===lt.CONNECTED&&p.processNonAutoResendRegisteredPendingMessages();else if(m instanceof Et){if(m.code==="USEV"){var v=m.as(bw).event;if(v.category===Od.FRIEND_DISCOVERED){var _=y0.getDataAsFriendDiscoveredEvent(n,v).friendDiscoveries;Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(N){return[2,h.forEach(function(I){I.onFriendsDiscovered&&I.onFriendsDiscovered(_)})]})})})}}}else if(m instanceof NT){var E=R.of(i._iid).subscribedUnreadMessageCount,S=!1,w=m.ts;typeof w=="number"&&w>E.ts&&(E.all!==m.all&&(S=!0),E.all=m.all>=0?m.all:0,m.customTypes&&Object.keys(m.customTypes).forEach(function(N){E.customTypes[N]!==m.customTypes[N]&&(S=!0),E.customTypes[N]=m.customTypes[N]}),S=S&&E.ts>0,E.ts=w),S&&Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(N){return[2,h.forEach(function(I){I.onTotalUnreadMessageCountChanged&&I.onTotalUnreadMessageCountChanged({groupChannelCount:E.all,feedChannelCount:E.feed,customTypeUnreadCount:E.customTypes}),I.onTotalUnreadMessageCountUpdated&&I.onTotalUnreadMessageCountUpdated(E.all,E.customTypes)})]})})})}else m instanceof MT?(o.preference.set(i._getUserProfileCacheKey(a.userId),mv.payloadify(m.userProfile)),!((b=m.userProfile.appInfo.notificationInfo)===null||b===void 0)&&b.isEnabled&&o.preference.set(E2(i.appId),{value:!0})):m instanceof Mu&&m.error&&m.error.isSessionInvalidatedError&&(d.debug("session revoked."),i.disconnect())})}return e.init=function(n){var t=n.appId,r=n.appVersion,i=n.modules,s=i===void 0?[]:i,a=n.options,o=a===void 0?new XS:a,l=n.debugMode,u=l!==void 0&&l,c=n.customApiHost,d=n.customWebSocketHost,h=n.newInstance,f=h!==void 0&&h,p=n.logLevel,m=n.localCacheEnabled,b=m!==void 0&&m,v=n.localCacheConfig,_=v===void 0?new eT:v,E=n.localCacheEncryption,S=n.useAsyncStorageStore,w=S===void 0?null:S,N=n.useMMKVStorageStore,I=N===void 0?null:N,x=n.appStateToggleEnabled,A=x===void 0||x;if(!sc||f){var O="su-".concat(la()),U=E??{encrypt:function(H){return H},decrypt:function(H){return H}},W=new XR;W.level=p??Ys.WARN;var P=new So({encryption:U});u||(dv()?I?P=new YR({MMKV:I,encryption:U}):w&&(P=new QR({AsyncStorage:w,encryption:U}),W.warn("AsyncStorage store is deprecated due to the small size limit. Please use MMKVStorage store instead.")):P=new KR({encryption:U})),new R(O,{appId:t,appVersion:r,options:o,apiHost:c??"https://api-".concat(t,".sendbird.com"),websocketHost:d??"wss://ws-".concat(t,".sendbird.com"),store:P,encryption:U,logger:W,localCacheEnabled:b,localCacheConfig:_,debugMode:u,appStateToggleEnabled:A});var J=[new yk,new CD],V=new e(O,o,Fe(Fe([],Me(s),!1),Me(J),!1));return sc||(sc=V),V}return sc},Object.defineProperty(e,"instance",{get:function(){return sc},enumerable:!1,configurable:!0}),Object.defineProperty(e,"version",{get:function(){return YS},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appId",{get:function(){return R.of(this._iid).sdkState.appId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appInfo",{get:function(){var n=R.of(this._iid).appInfo;return n??null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appVersion",{get:function(){var n;return(n=R.of(this._iid).sdkState.appVersion)!==null&&n!==void 0?n:""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debugMode",{get:function(){return!!R.of(this._iid).debugMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"logLevel",{get:function(){return R.of(this._iid).logger.level},set:function(n){R.of(this._iid).logger.level=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCacheEnabled",{get:function(){return R.of(this._iid).cacheContext.localCacheEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCacheConfig",{get:function(){var n=R.of(this._iid).cacheContext;return n.localCacheEnabled?n.localCacheConfig:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ekey",{get:function(){return R.of(this._iid).sessionManager.ekey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentUser",{get:function(){var n;return(n=R.of(this._iid).sessionManager.currentUser)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectionState",{get:function(){var n=R.of(this._iid).connectionManager;return n.isConnected?As.OPEN:n.isConnecting?As.CONNECTING:As.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastConnectedAt",{get:function(){var n=R.of(this._iid),t=n.connectedAt;return n.connectionManager.isConnected?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fcmPushToken",{get:function(){var n;return(n=this._fcmPushToken)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apnsPushToken",{get:function(){var n;return(n=this._apnsPushToken)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),e.prototype._getNestDBVersion=function(){return 7},e.prototype._getPreferenceCacheKey=function(n){return"sendbird@".concat(this.appId,"/").concat(n,".pref")},e.prototype._getUserProfileCacheKey=function(n){return"sendbird@".concat(this.appId,"/").concat(n,".profile")},e.prototype.getMemoryStoreForDebugging=function(){var n=R.of(this._iid),t=n.debugMode,r=n.cacheContext;if(t)return r.store instanceof So?r.store:null;throw L.debugModeRequired},e.prototype.addExtension=function(n,t){var r=R.of(this._iid).sdkState;["sb_uikit","sb_syncmanager","device-os-platform"].indexOf(n)>-1&&r.extensions&&(r.extensions[n]=t)},e.prototype.addSendbirdExtensions=function(n,t,r){var i,s,a=R.of(this._iid),o=a.logger,l=a.sdkState,u=new RegExp(sM);if(n.length===0)return o.debug("sb.addSendbirdExtensions() has failed because the given sendbirdExtensions is empty."),!1;if(n.find(function(m){return!u.test(m.version)}))return o.debug("sb.addSendbirdExtensions() has failed because the given version did not satisfy the SemVer specification."),!1;if(r)try{for(var c=ge(Object.entries(r)),d=c.next();!d.done;d=c.next()){var h=Me(d.value,2),f=h[0],p=h[1];if(/&|=/.test(f)||/&|=/.test(p))return o.debug("sb.addSendbirdExtensions() has failed because the given customData includes at least one invalid character: = or &."),!1}}catch(m){i={error:m}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}return l.sendbirdRuntimeEnvironment={sendbirdExtensions:n,deviceOS:t,customData:r},!0},e.prototype.setOnlineListener=function(n){this._onlineDetector.setOnlineListener(n)},e.prototype.setOfflineListener=function(n){this._onlineDetector.setOfflineListener(n)},e.prototype._safeInitializeStore=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:t=R.of(this._iid).cacheContext,r.label=1;case 1:return r.trys.push([1,3,,5]),[4,t.store.init(n)];case 2:return r.sent(),this._storeInitialized=!0,[3,5];case 3:return r.sent(),t.replaceStore(new So),[4,this._safeInitializeStore(n)];case 4:return r.sent(),[3,5];case 5:return[2]}})})},e.prototype.initializeCache=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:if(t=R.of(this._iid),r=t.sdkState,i=t.cacheContext,s=t.dispatcher,a=t.logger,r.userId&&r.userId===n)return[3,11];if(o="sendbird@".concat(r.appId,"/").concat(n,".db"),!i.localCacheEnabled)return[3,9];d.label=1;case 1:return d.trys.push([1,6,,8]),i.nestdb&&i.nestdb.state!==Ss.CLOSED&&i.nestdb.name===o?[3,3]:(l="sendbird@".concat(r.appId,"/").concat(n,".db"),(u=i.nestdb=new ZR({name:l,version:this._getNestDBVersion(),store:i.store,config:new rh({dbname:l,itemSizeLimit:61440})})).on("upgrade",KE(u)),u.on("storeReplaced",function(h){i.replaceStore(h),i.localCacheEnabled=!1,u.on("upgrade",KE(u))}),[4,u.open()]);case 2:return d.sent(),this._storeInitialized=!0,s.dispatch(new yw(this._iid,{userId:n})),[3,5];case 3:return[4,this._safeInitializeStore(o)];case 4:d.sent(),d.label=5;case 5:return r.userId=n,[3,8];case 6:return c=d.sent(),a.warn("Nest DB Open Failed. ",c),i.store instanceof So||(i.replaceStore(new So),i.localCacheEnabled=!1),[4,this._safeInitializeStore(o)];case 7:throw d.sent(),r.userId=n,L.databaseError;case 8:return[3,11];case 9:return[4,this._safeInitializeStore(o)];case 10:d.sent(),r.userId=n,d.label=11;case 11:return[2]}})})},e.prototype.getCacheDataSize=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return(n=R.of(this._iid).cacheContext).localCacheEnabled&&n.nestdb?[4,n.nestdb.estimateUsage()]:[3,2];case 1:return[2,t.sent()];case 2:return[2,0]}})})},e.prototype.clearCachedData=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return(n=R.of(this._iid).cacheContext).localCacheEnabled&&n.nestdb?[4,n.nestdb.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._storeInitialized?[4,n.preference.clear()]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}})})},e.prototype.clearCachedMessages=function(n){return y(this,void 0,void 0,function(){var t,r,i=this;return g(this,function(s){switch(s.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),t=nu.of(this._iid),r=ll.of(this._iid),t&&r?[4,Promise.all(n.map(function(a){return y(i,void 0,void 0,function(){return g(this,function(o){switch(o.label){case 0:return[4,t.removeMessagesOfChannel(a)];case 1:return o.sent(),[4,r.removeMessagesOfChannel(a)];case 2:return o.sent(),[2]}})})}))]:[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},e.prototype._setupPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.cacheContext,s=t.statManager,[4,i.preference.init(this._getPreferenceCacheKey(n),this._getNestDBVersion())];case 1:return o.sent(),[4,i.preference.get(this._getUserProfileCacheKey(n))];case 2:return(a=o.sent())&&new mv(this._iid,a).apply(),[4,s.init("sendbird@".concat(r.appId,"/").concat(n,".statlog"))];case 3:return o.sent(),[2]}})})},e.prototype._ready=function(n,t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(k("string",n)&&k("string",t,!0)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.cacheContext,o=i.connectionManager,l=r.errorForOtherUser,s.userId&&s.userId!==n?l?[3,2]:[4,o.logout()]:[3,3];case 1:return c.sent(),[3,3];case 2:throw l;case 3:return c.trys.push([3,5,6,8]),[4,this.initializeCache(n)];case 4:return c.sent(),R.of(this._iid).dispatcher.dispatch(new Ew),[3,8];case 5:return c.sent(),u=R.of(this._iid).logger,a.localCacheEnabled=!1,u.warn("Cache initialization failed - cache is not available."),[3,8];case 6:return[4,this._setupPreference(n)];case 7:return c.sent(),[7];case 8:return[2]}})})},e.prototype.authenticateFeed=function(n,t){var r;return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return i=R.of(this._iid),s=i.sessionManager,a=i.connectionManager,[4,this._ready(n,t,{errorForOtherUser:a.isConnected?L.alreadyConnectedAsAnotherUser:void 0})];case 1:return l.sent(),!((r=s.session.services)===null||r===void 0)&&r.includes(wd.CHAT)?[3,3]:(t||s.handler||(o=new RE,this.setSessionHandler(o)),[4,s.authenticateFeed(n,t)]);case 2:l.sent(),l.label=3;case 3:return[2,this.currentUser]}})})},e.prototype.connect=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._ready(n,t)];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,R.of(this._iid).connectionManager.connect(t)];case 3:return r.sent(),[3,5];case 4:return this._onlineDetector.start(),this._appStateChangeDetector.start(),[7];case 5:return[2,this.currentUser]}})})},e.prototype.reconnect=function(){var n=R.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.sessionManager.session.hasSession;return i&&(this._appStateChangeDetector.start(),this._onlineDetector.start(),t.resetAndReconnect().then(function(){r.appState="foreground"}).catch(function(){})),i},e.prototype.disconnect=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=R.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),i.cancelAll(),[4,t.logout()];case 1:return s.sent(),[4,this.clearCachedData()];case 2:return s.sent(),r.appState="foreground",[2]}})})},e.prototype.disconnectWebSocket=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=R.of(this._iid),t=n.connectionManager,r=n.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),r.cancelAll(),[4,t.disconnectWebSocket(!0)];case 1:return i.sent(),[2]}})})},e.prototype.setBackgroundState=function(){var n=R.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.logger;r.appState==="foreground"&&(r.appState="background",i.debug("going background state"),t.background().catch(function(s){i.debug("setBackgroundState error = ",s)}))},e.prototype.setForegroundState=function(){var n=R.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.dispatcher,s=n.logger;r.appState==="background"&&(r.appState="foreground",s.debug("going foreground state"),t.resetAndReconnect().catch(function(a){s.debug("setForgroundState error = ",a)}),i.dispatch(new WE))},e.prototype.setSessionHandler=function(n){Q(n instanceof RE).throw(L.invalidParameters),R.of(this._iid).sessionManager.handler=n},e.prototype.addUserEventHandler=function(n,t){Q(k("string",n)&&t instanceof OR).throw(L.invalidParameters),R.of(this._iid).userEventHandlers.set(n,t)},e.prototype.removeUserEventHandler=function(n){R.of(this._iid).userEventHandlers.delete(n)},e.prototype.removeAllUserEventHandler=function(){R.of(this._iid).userEventHandlers.clear()},e.prototype.addConnectionHandler=function(n,t){Q(k("string",n)&&t instanceof pw).throw(L.invalidParameters),R.of(this._iid).connectionHandlers.set(n,t)},e.prototype.removeConnectionHandler=function(n){R.of(this._iid).connectionHandlers.delete(n)},e.prototype.removeAllConnectionHandler=function(){R.of(this._iid).connectionHandlers.clear()},e.prototype.createApplicationUserListQuery=function(n){return n===void 0&&(n={}),new LR(this._iid,n)},e.prototype.createBlockedUserListQuery=function(n){return n===void 0&&(n={}),new PR(this._iid,n)},e.prototype.createFriendListQuery=function(n){return n===void 0&&(n={}),new jR(this._iid,n)},e.prototype.createMessageSearchQuery=function(n){return new fk(this._iid,n)},e.prototype.createPollListQuery=function(n){return new VT(this._iid,M({},n))},e.prototype.createPollVoterListQuery=function(n){return new qT(this._iid,M({},n))},e.prototype.buildUserFromSerializedData=function(n){var t=Ko(n);return new Ze(this._iid,Ze.payloadify(t))},e.prototype.updateCurrentUserInfo=function(n){return n===void 0&&(n={}),y(this,void 0,void 0,function(){var t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return t=M(M({},wD),n),Q(function(c){return Er(c.profileImage,!0)&&k("string",c.profileUrl,!0)&&k("string",c.nickname,!0)}(t)).throw(L.invalidParameters),this.currentUser?(r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=new QE(M({userId:i.userId},t)),[4,s.send(a)]):[3,2];case 1:return o=u.sent(),l=o.as(YE).user,this.currentUser&&(t.nickname&&(this.currentUser.nickname=l.nickname),(t.profileUrl||t.profileImage)&&(this.currentUser.plainProfileUrl=l.profileUrl)),[2,l];case 2:throw L.connectionRequired}})})},e.prototype.updateCurrentUserInfoWithPreferredLanguages=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),this.currentUser?(t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new QE({userId:r.userId,preferredLanguages:n}),[4,i.send(s)]):[3,2];case 1:return a=l.sent(),o=a.as(YE).user,this.currentUser&&(this.currentUser.preferredLanguages=o.preferredLanguages),[2,o];case 2:throw L.connectionRequired}})})},e.prototype.registerFCMPushTokenForCurrentUser=function(n,t){var r,i;return y(this,void 0,void 0,function(){var s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:if(Q(k("string",n)&&k("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&Q(Ve(Ui,t.deviceOS.platform,!0)&&k("string",t.deviceOS.version,!0)).throw(L.invalidParameters),!this.currentUser)return[3,6];s={deviceOS:"".concat(((r=t==null?void 0:t.deviceOS)===null||r===void 0?void 0:r.platform)||Ui.ANDROID,"-").concat(((i=t==null?void 0:t.deviceOS)===null||i===void 0?void 0:i.version)||"unknown"),deviceManufacturer:t==null?void 0:t.deviceManufacturer,systemPushEnabled:t==null?void 0:t.systemPushEnabled},h.label=1;case 1:return h.trys.push([1,4,,5]),a=R.of(this._iid),o=a.sessionManager,l=a.sdkState,u=a.requestQueue,o.hasDeviceToken(kn.FCM,n)?[2,Mr.SUCCESS]:(c=new xD({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,Lt(function(){return y(d,void 0,void 0,function(){return g(this,function(f){switch(f.label){case 0:return o.setDeviceToken(kn.FCM,n,s),[4,o.saveDeviceToken()];case 1:return f.sent(),[2]}})})})];case 3:return h.sent(),this._fcmPushToken="",[2,Mr.SUCCESS];case 4:return h.sent(),[2,Mr.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=n,[2,Mr.PENDING];case 7:return[2]}})})},e.prototype.unregisterFCMPushTokenForCurrentUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l=this;return g(this,function(u){switch(u.label){case 0:if(Q(k("string",n)).throw(L.invalidParameters),!this.currentUser)return[3,6];u.label=1;case 1:return u.trys.push([1,4,,5]),t=R.of(this._iid),r=t.sessionManager,i=t.sdkState,s=t.requestQueue,a=new RD({userId:i.userId,token:n}),[4,s.send(a)];case 2:return o=u.sent().lastDeletedAt,[4,Lt(function(){return y(l,void 0,void 0,function(){return g(this,function(c){switch(c.label){case 0:return r.unsetDeviceToken(kn.FCM,n),r.setDeviceTokenDeletedAt(o),[4,r.saveDeviceToken()];case 1:return c.sent(),[2]}})})})];case 3:return u.sent(),this._fcmPushToken="",[2,Mr.SUCCESS];case 4:return u.sent(),[2,Mr.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=n,[2,Mr.PENDING];case 7:return[2]}})})},e.prototype.unregisterFCMPushTokenAllForCurrentUser=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o=this;return g(this,function(l){switch(l.label){case 0:return this.currentUser?(n=R.of(this._iid),t=n.sessionManager,r=n.sdkState,i=n.requestQueue,s=new LD({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return a=l.sent().lastDeletedAt,[4,Lt(function(){return y(o,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return t.unsetDeviceTokens(kn.FCM),t.setDeviceTokenDeletedAt(a),[4,t.saveDeviceToken()];case 1:return u.sent(),[2]}})})})];case 2:l.sent(),l.label=3;case 3:return[2]}})})},e.prototype.registerAPNSPushTokenForCurrentUser=function(n,t){var r,i;return y(this,void 0,void 0,function(){var s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:if(Q(k("string",n)&&k("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&Q(Ve(Ui,t.deviceOS.platform,!0)&&k("string",t.deviceOS.version,!0)).throw(L.invalidParameters),!this.currentUser)return[3,6];s={deviceOS:"".concat(((r=t==null?void 0:t.deviceOS)===null||r===void 0?void 0:r.platform)||Ui.IOS,"-").concat(((i=t==null?void 0:t.deviceOS)===null||i===void 0?void 0:i.version)||"unknown"),deviceManufacturer:t==null?void 0:t.deviceManufacturer,systemPushEnabled:t==null?void 0:t.systemPushEnabled},h.label=1;case 1:return h.trys.push([1,4,,5]),a=R.of(this._iid),o=a.sessionManager,l=a.sdkState,u=a.requestQueue,o.hasDeviceToken(kn.APNS,n)?[2,Mr.SUCCESS]:(c=new MD({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,Lt(function(){return y(d,void 0,void 0,function(){return g(this,function(f){switch(f.label){case 0:return o.setDeviceToken(kn.APNS,n,s),[4,o.saveDeviceToken()];case 1:return f.sent(),[2]}})})})];case 3:return h.sent(),this._apnsPushToken="",[2,Mr.SUCCESS];case 4:return h.sent(),[2,Mr.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=n,[2,Mr.PENDING];case 7:return[2]}})})},e.prototype.unregisterAPNSPushTokenForCurrentUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l=this;return g(this,function(u){switch(u.label){case 0:if(Q(k("string",n)).throw(L.invalidParameters),!this.currentUser)return[3,6];u.label=1;case 1:return u.trys.push([1,4,,5]),t=R.of(this._iid),r=t.sessionManager,i=t.sdkState,s=t.requestQueue,a=new OD({userId:i.userId,token:n}),[4,s.send(a)];case 2:return o=u.sent().lastDeletedAt,[4,Lt(function(){return y(l,void 0,void 0,function(){return g(this,function(c){switch(c.label){case 0:return r.unsetDeviceToken(kn.APNS,n),r.setDeviceTokenDeletedAt(o),[4,r.saveDeviceToken()];case 1:return c.sent(),[2]}})})})];case 3:return u.sent(),this._apnsPushToken="",[2,Mr.SUCCESS];case 4:return u.sent(),[2,Mr.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=n,[2,Mr.PENDING];case 7:return[2]}})})},e.prototype.unregisterAPNSPushTokenAllForCurrentUser=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o=this;return g(this,function(l){switch(l.label){case 0:return this.currentUser?(n=R.of(this._iid),t=n.sessionManager,r=n.sdkState,i=n.requestQueue,s=new kD({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return a=l.sent().lastDeletedAt,[4,Lt(function(){return y(o,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return t.unsetDeviceTokens(kn.APNS),t.setDeviceTokenDeletedAt(a),[4,t.saveDeviceToken()];case 1:return u.sent(),[2]}})})})];case 2:l.sent(),l.label=3;case 3:return[2]}})})},e.prototype.markPushNotificationAsDelivered=function(n,t){var r;return t===void 0&&(t=!0),y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N;return g(this,function(I){switch(I.label){case 0:if(i=R.of(this._iid),s=i.logger,a=i.sessionManager,o=i.requestQueue,l=i.pushNotificationAckManager,s.debug("markPushNotificationAsDelivered:",n),u=T0.DELIVERED,c=l.parseData(n),d=c.pushTrackingId,h=c.sessionTopics,f=c.sessionKey,p=c.messageId,m=c.channelKey,b=c.templateKey,v=c.notificationEventDeadline,!f||!h.includes(h0.PUSH_ACKNOWLEDGEMENT))throw s.info("Can't use markPushNotificationAsDelivered() feature."),L.malformedDataError;if(l.isAcked(d,u))return s.info("already delivered push notification:",d),[2];_=!!m,E=t&&_,S=(r=a.deviceTokens[0])===null||r===void 0?void 0:r.token,w=new ZE({deviceToken:S??"",pushTrackingId:d,eventType:u,messageId:p,channelKey:m,templateKey:b,notificationEventDeadline:v,allowedPushNotification:E}),f&&(w.headers["Session-Key"]=f),I.label=1;case 1:return I.trys.push([1,3,,4]),[4,o.send(w)];case 2:return I.sent(),l.markAsAcked(d,u),[3,4];case 3:throw N=I.sent(),s.debug("failed to mark push notification as delivered. push tracking id: ".concat(d,". error: ").concat(N)),N;case 4:return[2]}})})},e.prototype.markPushNotificationAsClicked=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E;return g(this,function(S){switch(S.label){case 0:if(r=R.of(this._iid),i=r.logger,s=r.sessionManager,a=r.requestQueue,o=r.pushNotificationAckManager,i.debug("markPushNotificationAsClicked:",n),l=T0.CLICKED,u=o.parseData(n),c=u.pushTrackingId,d=u.sessionTopics,h=u.sessionKey,f=u.messageId,p=u.channelKey,m=u.templateKey,b=u.notificationEventDeadline,!h||!d.includes(h0.PUSH_ACKNOWLEDGEMENT))throw i.info("Can't use markPushNotificationAsDelivered() feature."),L.malformedDataError;if(o.isAcked(c,l))return i.info("already clicked push notification:",c),[2];v=(t=s.deviceTokens[0])===null||t===void 0?void 0:t.token,_=new ZE({deviceToken:v??"",pushTrackingId:c,eventType:l,messageId:f,channelKey:p,templateKey:m,notificationEventDeadline:b}),h&&(_.headers["Session-Key"]=h),S.label=1;case 1:return S.trys.push([1,3,,4]),[4,a.send(_)];case 2:return S.sent(),o.markAsAcked(c,l),[3,4];case 3:throw E=S.sent(),i.debug("failed to mark push notification as clicked. push tracking id: ".concat(c,". error: ").concat(E)),E;case 4:return[2]}})})},e.prototype.getChannelInvitationPreference=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new PD({userId:t.userId}),[4,r.send(i)];case 1:return s=a.sent(),[2,{autoAccept:s.as(FD).autoAccept}]}})})},e.prototype.setChannelInvitationPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(k("boolean",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new HD({userId:r.userId,willAutoAccept:n}),[4,i.send(s)];case 1:return a=o.sent(),[2,{autoAccept:a.as(jD).autoAccept}]}})})},e.prototype.getDoNotDisturb=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new BD({userId:t.userId}),[4,r.send(i)];case 1:return s=a.sent(),[2,s.as($D).preference]}})})},e.prototype.setDoNotDisturb=function(n,t,r,i,s,a){return t===void 0&&(t=0),r===void 0&&(r=0),i===void 0&&(i=0),s===void 0&&(s=0),a===void 0&&(a=""),y(this,void 0,void 0,function(){var o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return Q(k("boolean",n)&&k("number",t)&&k("number",r)&&k("number",i)&&k("number",s)&&k("string",a)).throw(L.invalidParameters),o=R.of(this._iid),l=o.sdkState,u=o.requestQueue,c=new GD({userId:l.userId,doNotDisturbOn:n,startHour:t,startMin:r,endHour:i,endMin:s,timezone:a}),[4,u.send(c)];case 1:return d=h.sent(),[2,d.as(zD).preference]}})})},e.prototype.getSnoozePeriod=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new VD({userId:t.userId}),[4,r.send(i)];case 1:return s=a.sent(),[2,s.as(qD).snoozePeriod]}})})},e.prototype.setSnoozePeriod=function(n,t,r){return t===void 0&&(t=0),r===void 0&&(r=0),y(this,void 0,void 0,function(){var i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(k("boolean",n)&&k("number",t)&&k("number",r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new WD({userId:s.userId,snoozeOn:n,startTs:t,endTs:r}),[4,a.send(o)];case 1:return l=u.sent(),[2,l.as(KD).snoozePeriod]}})})},e.prototype.getMyPushTokensByToken=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p;return g(this,function(m){switch(m.label){case 0:return Q(k("string",n)&&Ve(kn,t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=r.sessionManager,o=new DD({userId:i.userId,type:t,token:n}),[4,s.send(o)];case 1:l=m.sent(),u=l.as(UD).pushTokens;try{for(c=ge(u.deviceTokens),d=c.next();!d.done;d=c.next())h=d.value,a.setDeviceToken(u.type,h)}catch(b){f={error:b}}finally{try{d&&!d.done&&(p=c.return)&&p.call(c)}finally{if(f)throw f.error}}return[4,a.saveDeviceToken()];case 2:return m.sent(),[2,u]}})})},e.prototype.getPushTriggerOption=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new ZD({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(XD).pushTriggerOption]}})})},e.prototype.setPushTriggerOption=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(Ve(Ao,n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new JD({userId:r.userId,pushTriggerOption:n}),[4,i.send(s)];case 1:return[2,a.sent().as(e5).pushTriggerOption]}})})},e.prototype.getPushTemplate=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new t5({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(n5).name]}})})},e.prototype.setPushTemplate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(Ve(ov,n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new r5({userId:r.userId,templateName:n}),[4,i.send(s)];case 1:return[2,a.sent().as(i5).name]}})})},e.prototype.blockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(n instanceof Ze||k("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new QD({userId:r.userId,blockedUserId:n instanceof Ze?n.userId:n}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},e.prototype.blockUserWithUserId=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.blockUser(n)]})})},e.prototype.unblockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(n instanceof Ze||k("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new YD({userId:r.userId,unblockedUserId:n instanceof Ze?n.userId:n}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},e.prototype.unblockUserWithUserId=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.unblockUser(n)]})})},e.prototype.getFriendChangeLogsByToken=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(k("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new s5({userId:r.userId,token:n}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(a5).changelogs]}})})},e.prototype.getAllowFriendDiscovery=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new f5({userId:t.userId}),[4,r.send(i)];case 1:return s=a.sent(),[2,s.as(p5).allowFriendDiscovery]}})})},e.prototype.setAllowFriendDiscovery=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(k("boolean",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new _5({userId:r.userId,allowFriendDiscovery:n}),[4,i.send(s)];case 1:return a.sent(),[2,n]}})})},e.prototype.uploadFriendDiscoveries=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new o5({userId:r.userId,discoveries:n}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(l5).friendDiscoveryRequestId]}})})},e.prototype.deleteFriendDiscovery=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteFriendDiscoveries([n])]})})},e.prototype.deleteFriendDiscoveries=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new u5({userId:r.userId,discoveryKeys:n}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},e.prototype.addFriends=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new c5({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(d5).users]}})})},e.prototype.deleteFriend=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteFriends([n])]})})},e.prototype.deleteFriends=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new h5({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},e.prototype.getAllEmoji=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=R.of(this._iid).requestQueue,t=new m5,[4,n.send(t)];case 1:return r=i.sent(),[2,r.as(v5).emojiContainer]}})})},e.prototype.getEmojiCategory=function(n){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return t=R.of(this._iid).requestQueue,r=new g5({categoryId:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(y5).emojiCategory]}})})},e.prototype.getEmoji=function(n){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return t=R.of(this._iid).requestQueue,r=new E5({key:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(b5).emoji]}})})},e.prototype.getUIKitConfiguration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=R.of(this._iid),Q(n.hasExtension("sb_uikit")).throw(L.notSupportedError),t=n.requestQueue,r=new C5,[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(S5).uikitConfiguration]}})})},e}();function w5(e,n){return!e||!n?!0:e.url!==n.url}function ul(e){return e!=null&&"sendingStatus"in e}function w0(e,n="##__USER_ID_IS_NOT_PROVIDED__##"){var t;return ul(e)?((t=e.sender)===null||t===void 0?void 0:t.userId)===n:!1}function N5(e,n){return w0(e,n)||e.isAdminMessage()?!1:e.updatedAt===0}function XE(e){return"sendingStatus"in e?e.sendingStatus==="succeeded"?String(e.messageId):e.reqId:String(e.messageId)}function rt(e){return typeof e=="boolean"}function Al(e,n){return n.includes(e)}function I5(e){return e instanceof Set}function JE(e){return!e||!Array.isArray(e)?!1:e.length!==0}function A5(e,n){return Object.prototype.toString.call(e)===Object.prototype.toString.call(n)}const M5=()=>{const[,e]=D.useState(0);return D.useCallback(()=>e(n=>n+1),[])};function Dv(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.map(t=>Dv(t));const n={};return Object.keys(e).forEach(t=>{const r=t.replace(/_\w/g,i=>i[1].toUpperCase());n[r]=Dv(e[t])}),n}function e3(e,n){return e.reduce((t,r)=>{const i=n(r);return t[i]=r,t},{})}var x5=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var t=x5(e,[]);switch(n.type){case"update_initialized":return t.initialized=n.value.status,t;case"update_refreshing":return t.refreshing=n.value.status,t;case"update_loading":return t.loading=n.value.status,t;case"update_messages":{const r=n.value.currentUserId;if(n.value.clearBeforeAction)t.messageMap=t3(n.value.messages);else{const i=n.value.messages.filter(a=>{var o;if(w0(a,r)){const l=(o=t.messageMap[a.reqId])!==null&&o!==void 0?o:t.messageMap[a.messageId];if(w0(l,r)){const u=R5(l,a);return u&&(delete t.messageMap[l.reqId],delete t.messageMap[l.messageId]),u}}return!0}),s=t3(i);t.messageMap=Object.assign(Object.assign({},t.messageMap),s)}return t}case"update_new_messages":{const r=n.value.currentUserId,i=n.value.messages.filter(s=>N5(s,r));return n.value.clearBeforeAction?t.newMessageMap=e3(i,XE):(i.map(a=>a.messageId).forEach(a=>delete t.newMessageMap[a]),t.newMessageMap=Object.assign(Object.assign({},t.newMessageMap),e3(i,XE))),t}case"delete_messages":case"delete_new_messages":{const r=n.type==="delete_messages"?"messageMap":"newMessageMap";return t[r]=Object.assign({},t[r]),n.value.messageIds.forEach(i=>{const s=t[r][i];s&&(ul(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),n.value.reqIds.forEach(i=>{const s=t[r][i];s&&(ul(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),t}}},t3=e=>e.reduce((n,t)=>(ul(t)?(n[t.reqId]=t,t.sendingStatus===ht.SUCCEEDED&&(n[t.messageId]=t)):n[t.messageId]=t,n),{}),R5=(e,n)=>e.sendingStatus===ht.SUCCEEDED?n.sendingStatus===ht.SUCCEEDED:e.sendingStatus!==n.sendingStatus,k5=(e=L5)=>{const[{initialized:n,loading:t,refreshing:r,messageMap:i,newMessageMap:s},a]=D.useReducer(O5,{initialized:!1,loading:!0,refreshing:!1,messageMap:{},newMessageMap:{}}),o=(b,v,_)=>{a({type:"update_messages",value:{messages:b,clearBeforeAction:v,currentUserId:_}})},l=(b,v)=>{a({type:"delete_messages",value:{messageIds:b,reqIds:v}})},u=(b,v,_)=>{a({type:"update_new_messages",value:{messages:b,clearBeforeAction:v,currentUserId:_}})},c=(b,v)=>{a({type:"delete_new_messages",value:{messageIds:b,reqIds:v}})},d=b=>{a({type:"update_initialized",value:{status:b}})},h=b=>{a({type:"update_loading",value:{status:b}})},f=b=>{a({type:"update_refreshing",value:{status:b}})},p=Object.values(s),m=D.useMemo(()=>Array.from(new Set(Object.values(i))).sort(e),[i]);return{updateInitialized:d,updateLoading:h,updateRefreshing:f,updateMessages:o,deleteMessages:l,initialized:n,loading:t,refreshing:r,messages:m,newMessages:p,updateNewMessages:u,deleteNewMessages:c}},n3=Math.floor(Number.MAX_SAFE_INTEGER/10);function L5(e,n){let t=0,r=0;return ul(e)&&e.sendingStatus!=="succeeded"&&(t=n3),ul(n)&&n.sendingStatus!=="succeeded"&&(r=n3),e.createdAt+t-(n.createdAt+r)}var Xi=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):i(c.value).then(o,l)}u((r=r.apply(e,n||[])).next())})};const D5=(e,n,t)=>{var r;const i={prevResultLimit:n.prev,nextResultLimit:n.next,startingPoint:t==null?void 0:t.startingPoint,replyType:t==null?void 0:t.replyType},s=(r=t==null?void 0:t.collectionCreator)===null||r===void 0?void 0:r.call(t,i);return s||e.createMessageCollection(Object.assign(Object.assign({},i),{filter:new Us(i)}))};function r3(e){return e{var r,i,s;const a=D.useRef(t);a.current=t;const o=D.useRef(n);o.current=n;const l=a.current.logger,u=(r=a.current.startingPoint)!==null&&r!==void 0?r:Number.MAX_SAFE_INTEGER,c=r3(u),d=D.useRef({prev:!1,next:!1}),h=M5(),f=D.useRef({initialized:!1,apiInitialized:!1,instance:null}),{initialized:p,loading:m,refreshing:b,messages:v,newMessages:_,updateMessages:E,updateNewMessages:S,deleteNewMessages:w,deleteMessages:N,updateInitialized:I,updateLoading:x,updateRefreshing:A}=k5(t==null?void 0:t.sortComparator),O=En(B=>{var ae,de,Ee,se;if(!o.current||!o.current.url)return(ae=l==null?void 0:l.error)===null||ae===void 0?void 0:ae.call(l,"[useGroupChannelMessages] channel is required");try{switch(B){case z.EVENT_MESSAGE_RECEIVED:case z.EVENT_MESSAGE_SENT_SUCCESS:case z.SYNC_MESSAGE_FILL:case void 0:(Ee=(de=a.current).markAsRead)===null||Ee===void 0||Ee.call(de,[o.current]);break}}catch(he){(se=l==null?void 0:l.warn)===null||se===void 0||se.call(l,"[useGroupChannelMessages/markAsReadBySource]",he)}}),U=En((B,ae)=>{var de,Ee,se,he,fe;const ve=ae.filter(me=>{var pe;return!w0(me,(pe=e.currentUser)===null||pe===void 0?void 0:pe.userId)});if(ve.length>0)switch(B){case z.EVENT_MESSAGE_RECEIVED:case z.SYNC_MESSAGE_FILL:{!((Ee=(de=a.current).shouldCountNewMessages)===null||Ee===void 0)&&Ee.call(de)&&S(ve,!1,(se=e.currentUser)===null||se===void 0?void 0:se.userId),(fe=(he=a.current).onMessagesReceived)===null||fe===void 0||fe.call(he,ve);break}}}),W=En((B,ae)=>Xi(void 0,void 0,void 0,function*(){return new Promise(de=>{var Ee,se;if(!o.current||!o.current.url)return(Ee=l==null?void 0:l.error)===null||Ee===void 0?void 0:Ee.call(l,"[useGroupChannelMessages] channel is required");f.current.instance&&f.current.instance.dispose(),O(),S([],!0,(se=e.currentUser)===null||se===void 0?void 0:se.userId);const he=()=>{var ve,me,pe;const{pendingMessages:Ce,failedMessages:ze}=(ve=f.current.instance)!==null&&ve!==void 0?ve:{};JE(Ce)&&E(Ce,!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),JE(ze)&&E(ze,!1,(pe=e.currentUser)===null||pe===void 0?void 0:pe.userId)},fe=D5(o.current,ae,Object.assign(Object.assign({},a.current),{startingPoint:B}));f.current={apiInitialized:!1,initialized:!1,instance:fe},fe.setMessageCollectionHandler({onMessagesAdded:(ve,me,pe)=>{var Ce;O(ve.source),U(ve.source,pe),E(pe,!1,(Ce=e.currentUser)===null||Ce===void 0?void 0:Ce.userId)},onMessagesUpdated:(ve,me,pe)=>{var Ce,ze,ue;O(ve.source),U(ve.source,pe),E(pe,!1,(Ce=e.currentUser)===null||Ce===void 0?void 0:Ce.userId),ve.source===z.EVENT_MESSAGE_UPDATED&&((ue=(ze=a.current).onMessagesUpdated)===null||ue===void 0||ue.call(ze,pe))},onMessagesDeleted:(ve,me,pe,Ce)=>{const ze=Ce.map(ne=>ne.messageId),ue=Ce.filter(ul).map(ne=>ne.reqId);N(ze,ue),w(ze,ue)},onChannelDeleted:(ve,me)=>{var pe,Ce;(Ce=(pe=a.current).onChannelDeleted)===null||Ce===void 0||Ce.call(pe,me)},onChannelUpdated:(ve,me)=>{var pe,Ce;h(),(Ce=(pe=a.current).onChannelUpdated)===null||Ce===void 0||Ce.call(pe,me)},onHugeGapDetected:()=>{W(Number.MAX_SAFE_INTEGER,S0.collection.message.defaultLimit)}}),fe.initialize(C0.CACHE_AND_REPLACE_BY_API).onCacheResult((ve,me)=>{var pe,Ce,ze;ve?e.isCacheEnabled&&((pe=l==null?void 0:l.error)===null||pe===void 0||pe.call(l,"[useGroupChannelMessages/onCacheResult]",ve)):me&&((Ce=l==null?void 0:l.debug)===null||Ce===void 0||Ce.call(l,"[useGroupChannelMessages/onCacheResult]","message length:",me.length),E(me,!0,(ze=e.currentUser)===null||ze===void 0?void 0:ze.userId),he(),me.length>0&&(f.current.initialized=!0,de()))}).onApiResult((ve,me)=>{var pe,Ce,ze,ue,ne;ve?(pe=l==null?void 0:l.warn)===null||pe===void 0||pe.call(l,"[useGroupChannelMessages/onApiResult]",ve):me&&((Ce=l==null?void 0:l.debug)===null||Ce===void 0||Ce.call(l,"[useGroupChannelMessages/onApiResult]","message length:",me.length),E(me,!0,(ze=e.currentUser)===null||ze===void 0?void 0:ze.userId),a.current.startingPoint||(ne=(ue=a.current).onMessagesReceived)===null||ne===void 0||ne.call(ue,me),e.isCacheEnabled&&he()),f.current.initialized=!0,f.current.apiInitialized=!0,de()})})}));Iw(e,{onUserBanned(B,ae){var de,Ee,se;B.isGroupChannel()&&!w5(B,o.current)&&(ae.userId===((de=e.currentUser)===null||de===void 0?void 0:de.userId)?(se=(Ee=a.current).onCurrentUserBanned)===null||se===void 0||se.call(Ee):h())}}),D.useLayoutEffect(()=>{const B=setTimeout(()=>Xi(void 0,void 0,void 0,function*(){e.currentUser&&o.current&&(I(!1),x(!0),yield W(u,c),x(!1),I(!0))}));return()=>clearTimeout(B)},[e,(i=e.currentUser)===null||i===void 0?void 0:i.userId,(s=o.current)===null||s===void 0?void 0:s.url,a.current.replyType]),D.useEffect(()=>()=>{f.current.instance&&f.current.instance.dispose()},[]);const P=En(()=>Xi(void 0,void 0,void 0,function*(){e.currentUser&&o.current&&(A(!0),yield W(Number.MAX_SAFE_INTEGER,S0.collection.message.defaultLimit),A(!1))})),J=En(()=>Xi(void 0,void 0,void 0,function*(){var B;const ae=f.current.instance;if(ae!=null&&ae.hasPrevious&&!d.current.prev)try{d.current.prev=!0;const de=yield ae.loadPrevious();E(de,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.prev=!1}})),V=En(()=>{const{initialized:B,instance:ae}=f.current;return B&&ae?ae.hasPrevious:!1}),H=En(()=>Xi(void 0,void 0,void 0,function*(){var B;const ae=f.current.instance;if(ae!=null&&ae.hasNext&&!d.current.next)try{d.current.next=!0;const de=yield ae.loadNext();E(de,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.next=!1}})),Te=En(()=>{const{initialized:B,apiInitialized:ae,instance:de}=f.current;return ae&&B&&de?de.hasNext:!1}),q=En((B,ae)=>{var de;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((Ee,se)=>{o.current.sendUserMessage(B).onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),ae==null||ae(he)}).onSucceeded(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),Ee(he)}).onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url&&E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),se(he)})})}),ee=En((B,ae)=>{var de;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((Ee,se)=>{o.current.sendFileMessage(B).onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),ae==null||ae(he)}).onSucceeded(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),Ee(he)}).onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url&&E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),se(he)})})}),ie=En((B,ae)=>Xi(void 0,void 0,void 0,function*(){var de;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise(Ee=>{const se=[];o.current.sendFileMessages(B).onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),ae==null||ae(he)}).onSucceeded(he=>{var fe;he.isFileMessage()&&he.channelUrl===o.current.url&&(E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),se.push(he)),se.length===B.length&&Ee(se)}).onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url?(E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),se.push(fe)):se.push(null),se.length===B.length&&Ee(se)})})})),Ne=En((B,ae)=>{var de;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((Ee,se)=>{o.current.sendMultipleFilesMessage(B).onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),ae==null||ae(he)}).onFileUploaded(()=>{h()}).onSucceeded(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),Ee(he)}).onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url&&E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),se(he)})})}),X=En((B,ae)=>Xi(void 0,void 0,void 0,function*(){var de,Ee;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const se=yield o.current.updateUserMessage(B,ae);return se.channelUrl===o.current.url&&E([se],!1,(Ee=e.currentUser)===null||Ee===void 0?void 0:Ee.userId),se})),oe=En((B,ae)=>Xi(void 0,void 0,void 0,function*(){var de,Ee;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const se=yield o.current.updateFileMessage(B,ae);return se.channelUrl===o.current.url&&E([se],!1,(Ee=e.currentUser)===null||Ee===void 0?void 0:Ee.userId),se})),te=En(B=>Xi(void 0,void 0,void 0,function*(){var ae;if(!o.current||!o.current.url)throw(ae=l==null?void 0:l.error)===null||ae===void 0||ae.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((de,Ee)=>{let se;B.isUserMessage()&&(se=o.current.resendMessage(B)),B.isFileMessage()&&(se=o.current.resendMessage(B)),B.isMultipleFilesMessage()&&(se=o.current.resendMessage(B)),se&&("onPending"in se&&se.onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId)}),"onFileUploaded"in se&&se.onFileUploaded(()=>{h()}),"onSucceeded"in se&&se.onSucceeded(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),de(he)}),"onFailed"in se&&se.onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url&&E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),Ee(he)}))})})),ce=En(B=>Xi(void 0,void 0,void 0,function*(){var ae,de;if(!o.current||!o.current.url)throw(ae=l==null?void 0:l.error)===null||ae===void 0||ae.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");if(B.sendingStatus==="succeeded")B.isUserMessage()&&(yield o.current.deleteMessage(B)),B.isFileMessage()&&(yield o.current.deleteMessage(B)),B.isMultipleFilesMessage()&&(yield o.current.deleteMessage(B));else try{yield(de=f.current.instance)===null||de===void 0?void 0:de.removeFailedMessage(B.reqId)}finally{N([B.messageId],[B.reqId])}})),$=En(()=>{var B;S([],!0,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}),ke=En(B=>Xi(void 0,void 0,void 0,function*(){var ae;if(e.currentUser&&o.current){const de=r3(B);x(!0),E([],!0,(ae=e.currentUser)===null||ae===void 0?void 0:ae.userId),yield W(B,de),x(!1)}}));return{initialized:p,loading:m,refreshing:b,messages:v,newMessages:_,resetNewMessages:$,refresh:P,loadPrevious:J,hasPrevious:V,loadNext:H,hasNext:Te,sendUserMessage:q,sendFileMessage:ee,sendFileMessages:ie,sendMultipleFilesMessage:Ne,updateUserMessage:X,updateFileMessage:oe,resendMessage:te,deleteMessage:ce,resetWithStartingPoint:ke,_dangerous_reducer_updateMessages:E,_dangerous_reducer_deleteMessages:N}},O2=e=>P5(e),P5=e=>e();function xw(e,n){const t=Object.assign({},e);return Object.keys(n).forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&A5(t[r],n[r])&&(typeof n[r]=="object"&&!Array.isArray(n[r])?t[r]=xw(t[r],n[r]):t[r]=n[r])}),t}const R2=()=>({common:{enableUsingDefaultUserProfile:!1},groupChannel:{channel:{enableMention:!1,enableOgtag:!0,enableReactions:!0,enableReactionsSupergroup:!1,enableTypingIndicator:!0,enableVoiceMessage:!1,input:{camera:{enablePhoto:!0,enableVideo:!0},enableDocument:!0,gallery:{enablePhoto:!0,enableVideo:!0}},replyType:"quote_reply",threadReplySelectType:"thread",typingIndicatorTypes:new Set(["text"]),enableFeedback:!1,enableSuggestedReplies:!1,showSuggestedRepliesFor:"last_message_only",suggestedRepliesDirection:"vertical"},channelList:{enableMessageReceiptStatus:!1,enableTypingIndicator:!1},setting:{enableMessageSearch:!1}},openChannel:{channel:{enableOgtag:!0,input:{camera:{enablePhoto:!0,enableVideo:!0},enableDocument:!0,gallery:{enablePhoto:!0,enableVideo:!0}}}}});function F5(e){return delete e.groupChannel.channel.typingIndicatorTypes,delete e.groupChannel.channel.enableFeedback,delete e.groupChannel.channel.enableSuggestedReplies,delete e.groupChannel.channel.showSuggestedRepliesFor,delete e.groupChannel.channel.suggestedRepliesDirection,e}const Ow=()=>{const e=R2();return F5(e)},i3=R2(),H5=Ow();var N0=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):i(c.value).then(o,l)}u((r=r.apply(e,n||[])).next())})};const Uv={items:{},getItem(e){var n;return N0(this,void 0,void 0,function*(){return(n=Uv.items[e])!==null&&n!==void 0?n:null})},setItem(e,n){return N0(this,void 0,void 0,function*(){Uv.items[e]=n})}};class j5{constructor(n){this.storage=n??Uv}init(n){return this.key=`sbu@${n}.uikitConfiguration`,this.get()}get safeKey(){if(!this.key)throw new Error("Please UIKitConfigManager.init() first");return this.key}update(n){return N0(this,void 0,void 0,function*(){const t=yield this.get(),r={updatedAt:n.updatedAt,configuration:xw(t.configuration,n.configuration)};return yield this.storage.setItem(this.safeKey,JSON.stringify(r)),r})}get(){return N0(this,void 0,void 0,function*(){const n={updatedAt:0,configuration:H5};try{const t=yield this.storage.getItem(this.safeKey);return t?JSON.parse(t):n}catch{return n}})}}function B5(e,n,t){var r,i;t.common&&rt((r=t.common)===null||r===void 0?void 0:r.enableUsingDefaultUserProfile)&&(e.enableUsingDefaultUserProfile=t.common.enableUsingDefaultUserProfile),n.common&&rt((i=n.common)===null||i===void 0?void 0:i.enableUsingDefaultUserProfile)&&(e.enableUsingDefaultUserProfile=n.common.enableUsingDefaultUserProfile)}function $5(e,n,t){G5(e,n,t),z5(e,n,t),V5(e,n,t),q5(e,n,t)}function G5(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x,A,O,U,W,P,J,V,H,Te,q,ee,ie,Ne,X,oe,te,ce,$,ke,B,ae,de,Ee,se,he,fe,ve,me,pe,Ce,ze,ue,ne,xe,Le,re,Re,st,Xe,He,ct,$t,yt,_n,Ut,Xt,sn,Nt,an,on,Un,Gt,mt,mn,$n,Gn,Tn,zn,kt,Pn,ln,un,Fn,wn,Mt,Hn,dr,vn,Nn,In,Pt,An,Jt,Vn,qn,hr,Pe,F,_e,Oe,qe;!((r=t.groupChannel)===null||r===void 0)&&r.channel&&rt((s=(i=t.groupChannel)===null||i===void 0?void 0:i.channel)===null||s===void 0?void 0:s.enableOgtag)&&(e.channel.enableOgtag=t.groupChannel.channel.enableOgtag),!((a=n.groupChannel)===null||a===void 0)&&a.channel&&rt((l=(o=n.groupChannel)===null||o===void 0?void 0:o.channel)===null||l===void 0?void 0:l.enableOgtag)&&(e.channel.enableOgtag=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.channel)===null||c===void 0?void 0:c.enableOgtag),!((d=t.groupChannel)===null||d===void 0)&&d.channel&&rt((f=(h=t.groupChannel)===null||h===void 0?void 0:h.channel)===null||f===void 0?void 0:f.enableTypingIndicator)&&(e.channel.enableTypingIndicator=(m=(p=t.groupChannel)===null||p===void 0?void 0:p.channel)===null||m===void 0?void 0:m.enableTypingIndicator),!((b=n.groupChannel)===null||b===void 0)&&b.channel&&rt((_=(v=n.groupChannel)===null||v===void 0?void 0:v.channel)===null||_===void 0?void 0:_.enableTypingIndicator)&&(e.channel.enableTypingIndicator=(S=(E=n.groupChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.enableTypingIndicator),!((w=t.groupChannel)===null||w===void 0)&&w.channel&&rt((I=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.enableReactions)&&(e.channel.enableReactions=(A=(x=t.groupChannel)===null||x===void 0?void 0:x.channel)===null||A===void 0?void 0:A.enableReactions),!((O=n.groupChannel)===null||O===void 0)&&O.channel&&rt((W=(U=n.groupChannel)===null||U===void 0?void 0:U.channel)===null||W===void 0?void 0:W.enableReactions)&&(e.channel.enableReactions=(J=(P=n.groupChannel)===null||P===void 0?void 0:P.channel)===null||J===void 0?void 0:J.enableReactions),!((V=t.groupChannel)===null||V===void 0)&&V.channel&&rt((Te=(H=t.groupChannel)===null||H===void 0?void 0:H.channel)===null||Te===void 0?void 0:Te.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(ee=(q=t.groupChannel)===null||q===void 0?void 0:q.channel)===null||ee===void 0?void 0:ee.enableReactionsSupergroup),!((ie=n.groupChannel)===null||ie===void 0)&&ie.channel&&rt((X=(Ne=n.groupChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(te=(oe=n.groupChannel)===null||oe===void 0?void 0:oe.channel)===null||te===void 0?void 0:te.enableReactionsSupergroup),!((ce=t.groupChannel)===null||ce===void 0)&&ce.channel&&rt((ke=($=t.groupChannel)===null||$===void 0?void 0:$.channel)===null||ke===void 0?void 0:ke.enableMention)&&(e.channel.enableMention=(ae=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||ae===void 0?void 0:ae.enableMention),!((de=n.groupChannel)===null||de===void 0)&&de.channel&&rt((se=(Ee=n.groupChannel)===null||Ee===void 0?void 0:Ee.channel)===null||se===void 0?void 0:se.enableMention)&&(e.channel.enableMention=(fe=(he=n.groupChannel)===null||he===void 0?void 0:he.channel)===null||fe===void 0?void 0:fe.enableMention),!((ve=t.groupChannel)===null||ve===void 0)&&ve.channel&&Al((pe=(me=t.groupChannel)===null||me===void 0?void 0:me.channel)===null||pe===void 0?void 0:pe.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(ze=(Ce=t.groupChannel)===null||Ce===void 0?void 0:Ce.channel)===null||ze===void 0?void 0:ze.replyType),!((ue=n.groupChannel)===null||ue===void 0)&&ue.channel&&Al((xe=(ne=n.groupChannel)===null||ne===void 0?void 0:ne.channel)===null||xe===void 0?void 0:xe.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(re=(Le=n.groupChannel)===null||Le===void 0?void 0:Le.channel)===null||re===void 0?void 0:re.replyType),!((Re=t.groupChannel)===null||Re===void 0)&&Re.channel&&Al((Xe=(st=t.groupChannel)===null||st===void 0?void 0:st.channel)===null||Xe===void 0?void 0:Xe.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(ct=(He=t.groupChannel)===null||He===void 0?void 0:He.channel)===null||ct===void 0?void 0:ct.threadReplySelectType),!(($t=n.groupChannel)===null||$t===void 0)&&$t.channel&&Al((_n=(yt=n.groupChannel)===null||yt===void 0?void 0:yt.channel)===null||_n===void 0?void 0:_n.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(Xt=(Ut=n.groupChannel)===null||Ut===void 0?void 0:Ut.channel)===null||Xt===void 0?void 0:Xt.threadReplySelectType),!((sn=t.groupChannel)===null||sn===void 0)&&sn.channel&&rt((an=(Nt=t.groupChannel)===null||Nt===void 0?void 0:Nt.channel)===null||an===void 0?void 0:an.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(Un=(on=t.groupChannel)===null||on===void 0?void 0:on.channel)===null||Un===void 0?void 0:Un.enableVoiceMessage),!((Gt=n.groupChannel)===null||Gt===void 0)&&Gt.channel&&rt((mn=(mt=n.groupChannel)===null||mt===void 0?void 0:mt.channel)===null||mn===void 0?void 0:mn.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(Gn=($n=n.groupChannel)===null||$n===void 0?void 0:$n.channel)===null||Gn===void 0?void 0:Gn.enableVoiceMessage),!((Tn=n.groupChannel)===null||Tn===void 0)&&Tn.channel&&I5((kt=(zn=n.groupChannel)===null||zn===void 0?void 0:zn.channel)===null||kt===void 0?void 0:kt.typingIndicatorTypes)&&(e.channel.typingIndicatorTypes=(ln=(Pn=n.groupChannel)===null||Pn===void 0?void 0:Pn.channel)===null||ln===void 0?void 0:ln.typingIndicatorTypes),!((un=n.groupChannel)===null||un===void 0)&&un.channel&&rt((wn=(Fn=n.groupChannel)===null||Fn===void 0?void 0:Fn.channel)===null||wn===void 0?void 0:wn.enableFeedback)&&(e.channel.enableFeedback=(Hn=(Mt=n.groupChannel)===null||Mt===void 0?void 0:Mt.channel)===null||Hn===void 0?void 0:Hn.enableFeedback),!((dr=n.groupChannel)===null||dr===void 0)&&dr.channel&&rt((Nn=(vn=n.groupChannel)===null||vn===void 0?void 0:vn.channel)===null||Nn===void 0?void 0:Nn.enableSuggestedReplies)&&(e.channel.enableSuggestedReplies=(Pt=(In=n.groupChannel)===null||In===void 0?void 0:In.channel)===null||Pt===void 0?void 0:Pt.enableSuggestedReplies),!((An=n.groupChannel)===null||An===void 0)&&An.channel&&Al((Vn=(Jt=n.groupChannel)===null||Jt===void 0?void 0:Jt.channel)===null||Vn===void 0?void 0:Vn.showSuggestedRepliesFor,["all_messages","last_message_only"])&&(e.channel.showSuggestedRepliesFor=(hr=(qn=n.groupChannel)===null||qn===void 0?void 0:qn.channel)===null||hr===void 0?void 0:hr.showSuggestedRepliesFor),!((Pe=n.groupChannel)===null||Pe===void 0)&&Pe.channel&&Al((_e=(F=n.groupChannel)===null||F===void 0?void 0:F.channel)===null||_e===void 0?void 0:_e.suggestedRepliesDirection,["vertical","horizontal"])&&(e.channel.suggestedRepliesDirection=(qe=(Oe=n.groupChannel)===null||Oe===void 0?void 0:Oe.channel)===null||qe===void 0?void 0:qe.suggestedRepliesDirection)}function z5(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x,A,O,U,W,P,J,V,H,Te,q,ee,ie,Ne,X,oe,te,ce,$,ke,B,ae,de,Ee,se,he,fe,ve,me,pe,Ce,ze,ue,ne,xe,Le,re,Re,st,Xe,He,ct,$t,yt,_n,Ut,Xt,sn,Nt,an,on,Un,Gt,mt,mn,$n,Gn,Tn,zn,kt,Pn,ln,un,Fn,wn,Mt,Hn,dr,vn,Nn,In,Pt,An,Jt,Vn,qn,hr,Pe,F,_e,Oe,qe,bt;!((i=(r=t.groupChannel)===null||r===void 0?void 0:r.channel)===null||i===void 0)&&i.input&&rt((o=(a=(s=t.groupChannel)===null||s===void 0?void 0:s.channel)===null||a===void 0?void 0:a.input)===null||o===void 0?void 0:o.enableDocument)&&(e.channel.input.enableDocument=(c=(u=(l=t.groupChannel)===null||l===void 0?void 0:l.channel)===null||u===void 0?void 0:u.input)===null||c===void 0?void 0:c.enableDocument),!((h=(d=n.groupChannel)===null||d===void 0?void 0:d.channel)===null||h===void 0)&&h.input&&rt((m=(p=(f=n.groupChannel)===null||f===void 0?void 0:f.channel)===null||p===void 0?void 0:p.input)===null||m===void 0?void 0:m.enableDocument)&&(e.channel.input.enableDocument=(_=(v=(b=n.groupChannel)===null||b===void 0?void 0:b.channel)===null||v===void 0?void 0:v.input)===null||_===void 0?void 0:_.enableDocument),!((w=(S=(E=t.groupChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.input)===null||w===void 0)&&w.camera&&rt((A=(x=(I=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.input)===null||x===void 0?void 0:x.camera)===null||A===void 0?void 0:A.enablePhoto)&&(e.channel.input.camera.enablePhoto=(P=(W=(U=(O=t.groupChannel)===null||O===void 0?void 0:O.channel)===null||U===void 0?void 0:U.input)===null||W===void 0?void 0:W.camera)===null||P===void 0?void 0:P.enablePhoto),!((H=(V=(J=n.groupChannel)===null||J===void 0?void 0:J.channel)===null||V===void 0?void 0:V.input)===null||H===void 0)&&H.camera&&rt((ie=(ee=(q=(Te=n.groupChannel)===null||Te===void 0?void 0:Te.channel)===null||q===void 0?void 0:q.input)===null||ee===void 0?void 0:ee.camera)===null||ie===void 0?void 0:ie.enablePhoto)&&(e.channel.input.camera.enablePhoto=(te=(oe=(X=(Ne=n.groupChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.input)===null||oe===void 0?void 0:oe.camera)===null||te===void 0?void 0:te.enablePhoto),!((ke=($=(ce=t.groupChannel)===null||ce===void 0?void 0:ce.channel)===null||$===void 0?void 0:$.input)===null||ke===void 0)&&ke.camera&&rt((Ee=(de=(ae=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||ae===void 0?void 0:ae.input)===null||de===void 0?void 0:de.camera)===null||Ee===void 0?void 0:Ee.enableVideo)&&(e.channel.input.camera.enableVideo=(ve=(fe=(he=(se=t.groupChannel)===null||se===void 0?void 0:se.channel)===null||he===void 0?void 0:he.input)===null||fe===void 0?void 0:fe.camera)===null||ve===void 0?void 0:ve.enableVideo),!((Ce=(pe=(me=n.groupChannel)===null||me===void 0?void 0:me.channel)===null||pe===void 0?void 0:pe.input)===null||Ce===void 0)&&Ce.camera&&rt((xe=(ne=(ue=(ze=n.groupChannel)===null||ze===void 0?void 0:ze.channel)===null||ue===void 0?void 0:ue.input)===null||ne===void 0?void 0:ne.camera)===null||xe===void 0?void 0:xe.enableVideo)&&(e.channel.input.camera.enableVideo=(st=(Re=(re=(Le=n.groupChannel)===null||Le===void 0?void 0:Le.channel)===null||re===void 0?void 0:re.input)===null||Re===void 0?void 0:Re.camera)===null||st===void 0?void 0:st.enableVideo),!((ct=(He=(Xe=t.groupChannel)===null||Xe===void 0?void 0:Xe.channel)===null||He===void 0?void 0:He.input)===null||ct===void 0)&&ct.gallery&&rt((Ut=(_n=(yt=($t=t.groupChannel)===null||$t===void 0?void 0:$t.channel)===null||yt===void 0?void 0:yt.input)===null||_n===void 0?void 0:_n.gallery)===null||Ut===void 0?void 0:Ut.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(an=(Nt=(sn=(Xt=t.groupChannel)===null||Xt===void 0?void 0:Xt.channel)===null||sn===void 0?void 0:sn.input)===null||Nt===void 0?void 0:Nt.gallery)===null||an===void 0?void 0:an.enablePhoto),!((Gt=(Un=(on=n.groupChannel)===null||on===void 0?void 0:on.channel)===null||Un===void 0?void 0:Un.input)===null||Gt===void 0)&&Gt.gallery&&rt((Gn=($n=(mn=(mt=n.groupChannel)===null||mt===void 0?void 0:mt.channel)===null||mn===void 0?void 0:mn.input)===null||$n===void 0?void 0:$n.gallery)===null||Gn===void 0?void 0:Gn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(Pn=(kt=(zn=(Tn=n.groupChannel)===null||Tn===void 0?void 0:Tn.channel)===null||zn===void 0?void 0:zn.input)===null||kt===void 0?void 0:kt.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto),!((Fn=(un=(ln=t.groupChannel)===null||ln===void 0?void 0:ln.channel)===null||un===void 0?void 0:un.input)===null||Fn===void 0)&&Fn.gallery&&rt((dr=(Hn=(Mt=(wn=t.groupChannel)===null||wn===void 0?void 0:wn.channel)===null||Mt===void 0?void 0:Mt.input)===null||Hn===void 0?void 0:Hn.gallery)===null||dr===void 0?void 0:dr.enableVideo)&&(e.channel.input.gallery.enableVideo=(Pt=(In=(Nn=(vn=t.groupChannel)===null||vn===void 0?void 0:vn.channel)===null||Nn===void 0?void 0:Nn.input)===null||In===void 0?void 0:In.gallery)===null||Pt===void 0?void 0:Pt.enableVideo),!((Vn=(Jt=(An=n.groupChannel)===null||An===void 0?void 0:An.channel)===null||Jt===void 0?void 0:Jt.input)===null||Vn===void 0)&&Vn.gallery&&rt((F=(Pe=(hr=(qn=n.groupChannel)===null||qn===void 0?void 0:qn.channel)===null||hr===void 0?void 0:hr.input)===null||Pe===void 0?void 0:Pe.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(bt=(qe=(Oe=(_e=n.groupChannel)===null||_e===void 0?void 0:_e.channel)===null||Oe===void 0?void 0:Oe.input)===null||qe===void 0?void 0:qe.gallery)===null||bt===void 0?void 0:bt.enableVideo)}function V5(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S;!((r=t.groupChannel)===null||r===void 0)&&r.channelList&&rt((s=(i=t.groupChannel)===null||i===void 0?void 0:i.channelList)===null||s===void 0?void 0:s.enableTypingIndicator)&&(e.channelList.enableTypingIndicator=t.groupChannel.channelList.enableTypingIndicator),!((a=n.groupChannel)===null||a===void 0)&&a.channelList&&rt((l=(o=n.groupChannel)===null||o===void 0?void 0:o.channelList)===null||l===void 0?void 0:l.enableTypingIndicator)&&(e.channelList.enableTypingIndicator=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.channelList)===null||c===void 0?void 0:c.enableTypingIndicator),!((d=t.groupChannel)===null||d===void 0)&&d.channelList&&rt((f=(h=t.groupChannel)===null||h===void 0?void 0:h.channelList)===null||f===void 0?void 0:f.enableMessageReceiptStatus)&&(e.channelList.enableMessageReceiptStatus=(m=(p=t.groupChannel)===null||p===void 0?void 0:p.channelList)===null||m===void 0?void 0:m.enableMessageReceiptStatus),!((b=n.groupChannel)===null||b===void 0)&&b.channelList&&rt((_=(v=n.groupChannel)===null||v===void 0?void 0:v.channelList)===null||_===void 0?void 0:_.enableMessageReceiptStatus)&&(e.channelList.enableMessageReceiptStatus=(S=(E=n.groupChannel)===null||E===void 0?void 0:E.channelList)===null||S===void 0?void 0:S.enableMessageReceiptStatus)}function q5(e,n,t){var r,i,s,a,o,l,u,c;!((r=t.groupChannel)===null||r===void 0)&&r.setting&&rt((s=(i=t.groupChannel)===null||i===void 0?void 0:i.setting)===null||s===void 0?void 0:s.enableMessageSearch)&&(e.setting.enableMessageSearch=t.groupChannel.setting.enableMessageSearch),!((a=n.groupChannel)===null||a===void 0)&&a.setting&&rt((l=(o=n.groupChannel)===null||o===void 0?void 0:o.setting)===null||l===void 0?void 0:l.enableMessageSearch)&&(e.setting.enableMessageSearch=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.setting)===null||c===void 0?void 0:c.enableMessageSearch)}function W5(e,n,t){K5(e,n,t),Q5(e,n,t)}function K5(e,n,t){var r,i,s,a,o,l,u,c;!((r=t.openChannel)===null||r===void 0)&&r.channel&&rt((s=(i=t.openChannel)===null||i===void 0?void 0:i.channel)===null||s===void 0?void 0:s.enableOgtag)&&(e.channel.enableOgtag=t.openChannel.channel.enableOgtag),!((a=n.openChannel)===null||a===void 0)&&a.channel&&rt((l=(o=n.openChannel)===null||o===void 0?void 0:o.channel)===null||l===void 0?void 0:l.enableOgtag)&&(e.channel.enableOgtag=(c=(u=n.openChannel)===null||u===void 0?void 0:u.channel)===null||c===void 0?void 0:c.enableOgtag)}function Q5(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,x,A,O,U,W,P,J,V,H,Te,q,ee,ie,Ne,X,oe,te,ce,$,ke,B,ae,de,Ee,se,he,fe,ve,me,pe,Ce,ze,ue,ne,xe,Le,re,Re,st,Xe,He,ct,$t,yt,_n,Ut,Xt,sn,Nt,an,on,Un,Gt,mt,mn,$n,Gn,Tn,zn,kt,Pn,ln,un,Fn,wn,Mt,Hn,dr,vn,Nn,In,Pt,An,Jt,Vn,qn,hr,Pe,F,_e,Oe,qe,bt;!((i=(r=t.openChannel)===null||r===void 0?void 0:r.channel)===null||i===void 0)&&i.input&&rt((o=(a=(s=t.openChannel)===null||s===void 0?void 0:s.channel)===null||a===void 0?void 0:a.input)===null||o===void 0?void 0:o.enableDocument)&&(e.channel.input.enableDocument=(c=(u=(l=t.openChannel)===null||l===void 0?void 0:l.channel)===null||u===void 0?void 0:u.input)===null||c===void 0?void 0:c.enableDocument),!((h=(d=n.openChannel)===null||d===void 0?void 0:d.channel)===null||h===void 0)&&h.input&&rt((m=(p=(f=n.openChannel)===null||f===void 0?void 0:f.channel)===null||p===void 0?void 0:p.input)===null||m===void 0?void 0:m.enableDocument)&&(e.channel.input.enableDocument=(_=(v=(b=n.openChannel)===null||b===void 0?void 0:b.channel)===null||v===void 0?void 0:v.input)===null||_===void 0?void 0:_.enableDocument),!((w=(S=(E=t.openChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.input)===null||w===void 0)&&w.camera&&rt((A=(x=(I=(N=t.openChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.input)===null||x===void 0?void 0:x.camera)===null||A===void 0?void 0:A.enablePhoto)&&(e.channel.input.camera.enablePhoto=(P=(W=(U=(O=t.openChannel)===null||O===void 0?void 0:O.channel)===null||U===void 0?void 0:U.input)===null||W===void 0?void 0:W.camera)===null||P===void 0?void 0:P.enablePhoto),!((H=(V=(J=n.openChannel)===null||J===void 0?void 0:J.channel)===null||V===void 0?void 0:V.input)===null||H===void 0)&&H.camera&&rt((ie=(ee=(q=(Te=n.openChannel)===null||Te===void 0?void 0:Te.channel)===null||q===void 0?void 0:q.input)===null||ee===void 0?void 0:ee.camera)===null||ie===void 0?void 0:ie.enablePhoto)&&(e.channel.input.camera.enablePhoto=(te=(oe=(X=(Ne=n.openChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.input)===null||oe===void 0?void 0:oe.camera)===null||te===void 0?void 0:te.enablePhoto),!((ke=($=(ce=t.openChannel)===null||ce===void 0?void 0:ce.channel)===null||$===void 0?void 0:$.input)===null||ke===void 0)&&ke.camera&&rt((Ee=(de=(ae=(B=t.openChannel)===null||B===void 0?void 0:B.channel)===null||ae===void 0?void 0:ae.input)===null||de===void 0?void 0:de.camera)===null||Ee===void 0?void 0:Ee.enableVideo)&&(e.channel.input.camera.enableVideo=(ve=(fe=(he=(se=t.openChannel)===null||se===void 0?void 0:se.channel)===null||he===void 0?void 0:he.input)===null||fe===void 0?void 0:fe.camera)===null||ve===void 0?void 0:ve.enableVideo),!((Ce=(pe=(me=n.openChannel)===null||me===void 0?void 0:me.channel)===null||pe===void 0?void 0:pe.input)===null||Ce===void 0)&&Ce.camera&&rt((xe=(ne=(ue=(ze=n.openChannel)===null||ze===void 0?void 0:ze.channel)===null||ue===void 0?void 0:ue.input)===null||ne===void 0?void 0:ne.camera)===null||xe===void 0?void 0:xe.enableVideo)&&(e.channel.input.camera.enableVideo=(st=(Re=(re=(Le=n.openChannel)===null||Le===void 0?void 0:Le.channel)===null||re===void 0?void 0:re.input)===null||Re===void 0?void 0:Re.camera)===null||st===void 0?void 0:st.enableVideo),!((ct=(He=(Xe=t.openChannel)===null||Xe===void 0?void 0:Xe.channel)===null||He===void 0?void 0:He.input)===null||ct===void 0)&&ct.gallery&&rt((Ut=(_n=(yt=($t=t.openChannel)===null||$t===void 0?void 0:$t.channel)===null||yt===void 0?void 0:yt.input)===null||_n===void 0?void 0:_n.gallery)===null||Ut===void 0?void 0:Ut.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(an=(Nt=(sn=(Xt=t.openChannel)===null||Xt===void 0?void 0:Xt.channel)===null||sn===void 0?void 0:sn.input)===null||Nt===void 0?void 0:Nt.gallery)===null||an===void 0?void 0:an.enablePhoto),!((Gt=(Un=(on=n.openChannel)===null||on===void 0?void 0:on.channel)===null||Un===void 0?void 0:Un.input)===null||Gt===void 0)&&Gt.gallery&&rt((Gn=($n=(mn=(mt=n.openChannel)===null||mt===void 0?void 0:mt.channel)===null||mn===void 0?void 0:mn.input)===null||$n===void 0?void 0:$n.gallery)===null||Gn===void 0?void 0:Gn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(Pn=(kt=(zn=(Tn=n.openChannel)===null||Tn===void 0?void 0:Tn.channel)===null||zn===void 0?void 0:zn.input)===null||kt===void 0?void 0:kt.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto),!((Fn=(un=(ln=t.openChannel)===null||ln===void 0?void 0:ln.channel)===null||un===void 0?void 0:un.input)===null||Fn===void 0)&&Fn.gallery&&rt((dr=(Hn=(Mt=(wn=t.openChannel)===null||wn===void 0?void 0:wn.channel)===null||Mt===void 0?void 0:Mt.input)===null||Hn===void 0?void 0:Hn.gallery)===null||dr===void 0?void 0:dr.enableVideo)&&(e.channel.input.gallery.enableVideo=(Pt=(In=(Nn=(vn=t.openChannel)===null||vn===void 0?void 0:vn.channel)===null||Nn===void 0?void 0:Nn.input)===null||In===void 0?void 0:In.gallery)===null||Pt===void 0?void 0:Pt.enableVideo),!((Vn=(Jt=(An=n.openChannel)===null||An===void 0?void 0:An.channel)===null||Jt===void 0?void 0:Jt.input)===null||Vn===void 0)&&Vn.gallery&&rt((F=(Pe=(hr=(qn=n.openChannel)===null||qn===void 0?void 0:qn.channel)===null||hr===void 0?void 0:hr.input)===null||Pe===void 0?void 0:Pe.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(bt=(qe=(Oe=(_e=n.openChannel)===null||_e===void 0?void 0:_e.channel)===null||Oe===void 0?void 0:Oe.input)===null||qe===void 0?void 0:qe.gallery)===null||bt===void 0?void 0:bt.enableVideo)}function Y5(e,n){const t=R2();return B5(t.common,e,n),$5(t.groupChannel,e,n),W5(t.openChannel,e,n),t}function Z5(e){return typeof e=="object"&&"configuration"in e&&"updated_at"in e}var X5=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):i(c.value).then(o,l)}u((r=r.apply(e,n||[])).next())})};function ac(e){var n,t;return(t=(n=e.appInfo)===null||n===void 0?void 0:n.applicationAttributes)!==null&&t!==void 0?t:[]}const Rw=D.createContext({initDashboardConfigs:()=>Promise.resolve(),configs:i3,configsWithAppAttr:()=>i3}),J5=({storage:e,children:n,localConfigs:t={}})=>{const[r,i]=D.useState(Ow),[s]=D.useState(()=>new j5(e)),a=D.useCallback(u=>X5(void 0,void 0,void 0,function*(){const c=yield s.init(u.appId);if(u.appInfo&&u.appInfo.uikitConfigInfo.lastUpdatedAt===c.updatedAt)i(c.configuration);else try{const d=yield u.getUIKitConfiguration();if(Z5(d.json)){const h=Dv(d.json),f=yield s.update(h);i(f.configuration)}}catch{i(c.configuration)}}),[s]),o=Y5(t,r),l=En(u=>({groupChannel:{channel:{get enableReactions(){return o.groupChannel.channel.enableReactions&&ac(u).includes(ic.reactions)},get enableReactionsSupergroup(){return o.groupChannel.channel.enableReactionsSupergroup&&ac(u).includes(ic.reactions)},get enableOgtag(){return o.groupChannel.channel.enableOgtag&&ac(u).includes(ic.enable_og_tag)}},setting:{get enableMessageSearch(){return o.groupChannel.setting.enableMessageSearch&&ac(u).includes(ic.message_search_v3)}}},openChannel:{channel:{get enableOgtag(){return o.openChannel.channel.enableOgtag&&ac(u).includes(ic.enable_og_tag)}}}}));return Dt.createElement(Rw.Provider,{value:{initDashboardConfigs:a,configs:o,configsWithAppAttr:l}},n)},eU=()=>D.useContext(Rw),tU=Dt.createContext({disableUserProfile:!0,isOpenChannel:!1}),nU=({isOpenChannel:e=!1,disableUserProfile:n=!1,renderUserProfile:t,onUserProfileMessage:r,children:i})=>C.jsx(tU.Provider,{value:{isOpenChannel:e,disableUserProfile:n,renderUserProfile:t,onUserProfileMessage:r},children:i}),kw=Dt.createContext(null),rU="No sendbird state value available. Make sure you are rendering `` at the top of your app.";function fn(){const e=D.useContext(kw);if(!e)throw new Error(rU);return e}const oc="useToggleReactionCallback:";function iU(e,n){return D.useCallback((t,r,i)=>{if(!e){n==null||n.warning(`${oc} currentChannel doesn't exist`,e);return}i?e.deleteReaction(t,r).then(s=>{n==null||n.info(`${oc} Delete reaction success`,s)}).catch(s=>{n==null||n.warning(`${oc} Delete reaction failed`,s)}):e.addReaction(t,r).then(s=>{n==null||n.info(`${oc} Add reaction success`,s)}).catch(s=>{n==null||n.warning(`${oc} Add reaction failed`,s)})},[e])}function k2(e){return{lowerCase:e.toLowerCase(),upperCase:e.toUpperCase()}}function sU(e){return{lowerCase:e.toLowerCase(),upperCase:e.toUpperCase()}}function aU(e){return"sendingStatus"in e?e.sendingStatus==="succeeded"?String(e.messageId):e.reqId:String(e.messageId)}function oU(){var e,n;return((e=document.getElementById("sendbird-dropdown-portal"))==null?void 0:e.childElementCount)===0&&((n=document.getElementById("sendbird-emoji-list-portal"))==null?void 0:n.childElementCount)===0}function s3(e){var t;const n=(t=document.querySelectorAll(`[data-sb-created-at="${e}"]`))==null?void 0:t[0];return n instanceof HTMLElement?n.offsetTop:null}const I0=e=>e?e.isFrozen&&e.myRole!=="operator":!1,A0=e=>e?e.myMutedState==="muted":!1,M0=10,lU=1e3,uU=6e5,cU="Voice_message.mp3",dU="audio/mp3;sbu_type=voice",hU="KEY_VOICE_MESSAGE_DURATION",fU="KEY_INTERNAL_MESSAGE_TYPE",pU="voice/mp3",_U=10,mU=25*1024*1024,q_="sendbird_message_templates_token_key",Ml="sendbird_message_templates_key";function x0(e){"@babel/helpers - typeof";return x0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},x0(e)}function wr(e,n){if(n.length1?"s":"")+" required, but only "+n.length+" present")}function vU(e){return wr(1,arguments),e instanceof Date||x0(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function hs(e){wr(1,arguments);var n=Object.prototype.toString.call(e);return e instanceof Date||x0(e)==="object"&&n==="[object Date]"?new Date(e.getTime()):typeof e=="number"||n==="[object Number]"?new Date(e):((typeof e=="string"||n==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function gU(e){if(wr(1,arguments),!vU(e)&&typeof e!="number")return!1;var n=hs(e);return!isNaN(Number(n))}function cl(e){if(e===null||e===!0||e===!1)return NaN;var n=Number(e);return isNaN(n)?n:n<0?Math.ceil(n):Math.floor(n)}function yU(e,n){wr(2,arguments);var t=hs(e).getTime(),r=cl(n);return new Date(t+r)}function EU(e,n){wr(2,arguments);var t=cl(n);return yU(e,-t)}var bU=864e5;function CU(e){wr(1,arguments);var n=hs(e),t=n.getTime();n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0);var r=n.getTime(),i=t-r;return Math.floor(i/bU)+1}function O0(e){wr(1,arguments);var n=1,t=hs(e),r=t.getUTCDay(),i=(r=i.getTime()?t+1:n.getTime()>=a.getTime()?t:t-1}function SU(e){wr(1,arguments);var n=Lw(e),t=new Date(0);t.setUTCFullYear(n,0,4),t.setUTCHours(0,0,0,0);var r=O0(t);return r}var TU=6048e5;function wU(e){wr(1,arguments);var n=hs(e),t=O0(n).getTime()-SU(n).getTime();return Math.round(t/TU)+1}var NU={};function Sp(){return NU}function R0(e,n){var t,r,i,s,a,o,l,u;wr(1,arguments);var c=Sp(),d=cl((t=(r=(i=(s=n==null?void 0:n.weekStartsOn)!==null&&s!==void 0?s:n==null||(a=n.locale)===null||a===void 0||(o=a.options)===null||o===void 0?void 0:o.weekStartsOn)!==null&&i!==void 0?i:c.weekStartsOn)!==null&&r!==void 0?r:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&t!==void 0?t:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=hs(e),f=h.getUTCDay(),p=(f=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(d+1,0,f),p.setUTCHours(0,0,0,0);var m=R0(p,n),b=new Date(0);b.setUTCFullYear(d,0,f),b.setUTCHours(0,0,0,0);var v=R0(b,n);return c.getTime()>=m.getTime()?d+1:c.getTime()>=v.getTime()?d:d-1}function IU(e,n){var t,r,i,s,a,o,l,u;wr(1,arguments);var c=Sp(),d=cl((t=(r=(i=(s=n==null?void 0:n.firstWeekContainsDate)!==null&&s!==void 0?s:n==null||(a=n.locale)===null||a===void 0||(o=a.options)===null||o===void 0?void 0:o.firstWeekContainsDate)!==null&&i!==void 0?i:c.firstWeekContainsDate)!==null&&r!==void 0?r:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&t!==void 0?t:1),h=Dw(e,n),f=new Date(0);f.setUTCFullYear(h,0,d),f.setUTCHours(0,0,0,0);var p=R0(f,n);return p}var AU=6048e5;function MU(e,n){wr(1,arguments);var t=hs(e),r=R0(t,n).getTime()-IU(t,n).getTime();return Math.round(r/AU)+1}function xt(e,n){for(var t=e<0?"-":"",r=Math.abs(e).toString();r.length0?r:1-r;return xt(t==="yy"?i%100:i,t.length)},M:function(n,t){var r=n.getUTCMonth();return t==="M"?String(r+1):xt(r+1,2)},d:function(n,t){return xt(n.getUTCDate(),t.length)},a:function(n,t){var r=n.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(n,t){return xt(n.getUTCHours()%12||12,t.length)},H:function(n,t){return xt(n.getUTCHours(),t.length)},m:function(n,t){return xt(n.getUTCMinutes(),t.length)},s:function(n,t){return xt(n.getUTCSeconds(),t.length)},S:function(n,t){var r=t.length,i=n.getUTCMilliseconds(),s=Math.floor(i*Math.pow(10,r-3));return xt(s,t.length)}},xl={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},xU={G:function(n,t,r){var i=n.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(i,{width:"abbreviated"});case"GGGGG":return r.era(i,{width:"narrow"});case"GGGG":default:return r.era(i,{width:"wide"})}},y:function(n,t,r){if(t==="yo"){var i=n.getUTCFullYear(),s=i>0?i:1-i;return r.ordinalNumber(s,{unit:"year"})}return va.y(n,t)},Y:function(n,t,r,i){var s=Dw(n,i),a=s>0?s:1-s;if(t==="YY"){var o=a%100;return xt(o,2)}return t==="Yo"?r.ordinalNumber(a,{unit:"year"}):xt(a,t.length)},R:function(n,t){var r=Lw(n);return xt(r,t.length)},u:function(n,t){var r=n.getUTCFullYear();return xt(r,t.length)},Q:function(n,t,r){var i=Math.ceil((n.getUTCMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return xt(i,2);case"Qo":return r.ordinalNumber(i,{unit:"quarter"});case"QQQ":return r.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,r){var i=Math.ceil((n.getUTCMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return xt(i,2);case"qo":return r.ordinalNumber(i,{unit:"quarter"});case"qqq":return r.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,r){var i=n.getUTCMonth();switch(t){case"M":case"MM":return va.M(n,t);case"Mo":return r.ordinalNumber(i+1,{unit:"month"});case"MMM":return r.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,r){var i=n.getUTCMonth();switch(t){case"L":return String(i+1);case"LL":return xt(i+1,2);case"Lo":return r.ordinalNumber(i+1,{unit:"month"});case"LLL":return r.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,r,i){var s=MU(n,i);return t==="wo"?r.ordinalNumber(s,{unit:"week"}):xt(s,t.length)},I:function(n,t,r){var i=wU(n);return t==="Io"?r.ordinalNumber(i,{unit:"week"}):xt(i,t.length)},d:function(n,t,r){return t==="do"?r.ordinalNumber(n.getUTCDate(),{unit:"date"}):va.d(n,t)},D:function(n,t,r){var i=CU(n);return t==="Do"?r.ordinalNumber(i,{unit:"dayOfYear"}):xt(i,t.length)},E:function(n,t,r){var i=n.getUTCDay();switch(t){case"E":case"EE":case"EEE":return r.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(i,{width:"short",context:"formatting"});case"EEEE":default:return r.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,r,i){var s=n.getUTCDay(),a=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return xt(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,r,i){var s=n.getUTCDay(),a=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return xt(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,r){var i=n.getUTCDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return xt(s,t.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(i,{width:"short",context:"formatting"});case"iiii":default:return r.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,r){var i=n.getUTCHours(),s=i/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,t,r){var i=n.getUTCHours(),s;switch(i===12?s=xl.noon:i===0?s=xl.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,r){var i=n.getUTCHours(),s;switch(i>=17?s=xl.evening:i>=12?s=xl.afternoon:i>=4?s=xl.morning:s=xl.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,r){if(t==="ho"){var i=n.getUTCHours()%12;return i===0&&(i=12),r.ordinalNumber(i,{unit:"hour"})}return va.h(n,t)},H:function(n,t,r){return t==="Ho"?r.ordinalNumber(n.getUTCHours(),{unit:"hour"}):va.H(n,t)},K:function(n,t,r){var i=n.getUTCHours()%12;return t==="Ko"?r.ordinalNumber(i,{unit:"hour"}):xt(i,t.length)},k:function(n,t,r){var i=n.getUTCHours();return i===0&&(i=24),t==="ko"?r.ordinalNumber(i,{unit:"hour"}):xt(i,t.length)},m:function(n,t,r){return t==="mo"?r.ordinalNumber(n.getUTCMinutes(),{unit:"minute"}):va.m(n,t)},s:function(n,t,r){return t==="so"?r.ordinalNumber(n.getUTCSeconds(),{unit:"second"}):va.s(n,t)},S:function(n,t){return va.S(n,t)},X:function(n,t,r,i){var s=i._originalDate||n,a=s.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return o3(a);case"XXXX":case"XX":return go(a);case"XXXXX":case"XXX":default:return go(a,":")}},x:function(n,t,r,i){var s=i._originalDate||n,a=s.getTimezoneOffset();switch(t){case"x":return o3(a);case"xxxx":case"xx":return go(a);case"xxxxx":case"xxx":default:return go(a,":")}},O:function(n,t,r,i){var s=i._originalDate||n,a=s.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+a3(a,":");case"OOOO":default:return"GMT"+go(a,":")}},z:function(n,t,r,i){var s=i._originalDate||n,a=s.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+a3(a,":");case"zzzz":default:return"GMT"+go(a,":")}},t:function(n,t,r,i){var s=i._originalDate||n,a=Math.floor(s.getTime()/1e3);return xt(a,t.length)},T:function(n,t,r,i){var s=i._originalDate||n,a=s.getTime();return xt(a,t.length)}};function a3(e,n){var t=e>0?"-":"+",r=Math.abs(e),i=Math.floor(r/60),s=r%60;if(s===0)return t+String(i);var a=n;return t+String(i)+a+xt(s,2)}function o3(e,n){if(e%60===0){var t=e>0?"-":"+";return t+xt(Math.abs(e)/60,2)}return go(e,n)}function go(e,n){var t=n||"",r=e>0?"-":"+",i=Math.abs(e),s=xt(Math.floor(i/60),2),a=xt(i%60,2);return r+s+t+a}var l3=function(n,t){switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Uw=function(n,t){switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},OU=function(n,t){var r=n.match(/(P+)(p+)?/)||[],i=r[1],s=r[2];if(!s)return l3(n,t);var a;switch(i){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",l3(i,t)).replace("{{time}}",Uw(s,t))},RU={p:Uw,P:OU};function kU(e){var n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),e.getTime()-n.getTime()}var LU=["D","DD"],DU=["YY","YYYY"];function UU(e){return LU.indexOf(e)!==-1}function PU(e){return DU.indexOf(e)!==-1}function u3(e,n,t){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(n,"`) for formatting years to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(n,"`) for formatting years to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(n,"`) for formatting days of the month to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(n,"`) for formatting days of the month to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var FU={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},HU=function(n,t,r){var i,s=FU[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+i:i+" ago":i};function W_(e){return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=n.width?String(n.width):e.defaultWidth,r=e.formats[t]||e.formats[e.defaultWidth];return r}}var jU={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},BU={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},$U={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},GU={date:W_({formats:jU,defaultWidth:"full"}),time:W_({formats:BU,defaultWidth:"full"}),dateTime:W_({formats:$U,defaultWidth:"full"})},zU={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},VU=function(n,t,r,i){return zU[n]};function lc(e){return function(n,t){var r=t!=null&&t.context?String(t.context):"standalone",i;if(r==="formatting"&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,a=t!=null&&t.width?String(t.width):s;i=e.formattingValues[a]||e.formattingValues[s]}else{var o=e.defaultWidth,l=t!=null&&t.width?String(t.width):e.defaultWidth;i=e.values[l]||e.values[o]}var u=e.argumentCallback?e.argumentCallback(n):n;return i[u]}}var qU={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},WU={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},KU={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},QU={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},YU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},ZU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},XU=function(n,t){var r=Number(n),i=r%100;if(i>20||i<10)switch(i%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},JU={ordinalNumber:XU,era:lc({values:qU,defaultWidth:"wide"}),quarter:lc({values:WU,defaultWidth:"wide",argumentCallback:function(n){return n-1}}),month:lc({values:KU,defaultWidth:"wide"}),day:lc({values:QU,defaultWidth:"wide"}),dayPeriod:lc({values:YU,defaultWidth:"wide",formattingValues:ZU,defaultFormattingWidth:"wide"})};function uc(e){return function(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=n.match(i);if(!s)return null;var a=s[0],o=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(o)?t7(o,function(d){return d.test(a)}):e7(o,function(d){return d.test(a)}),u;u=e.valueCallback?e.valueCallback(l):l,u=t.valueCallback?t.valueCallback(u):u;var c=n.slice(a.length);return{value:u,rest:c}}}function e7(e,n){for(var t in e)if(e.hasOwnProperty(t)&&n(e[t]))return t}function t7(e,n){for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},r=n.match(e.matchPattern);if(!r)return null;var i=r[0],s=n.match(e.parsePattern);if(!s)return null;var a=e.valueCallback?e.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;var o=n.slice(i.length);return{value:a,rest:o}}}var r7=/^(\d+)(th|st|nd|rd)?/i,i7=/\d+/i,s7={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},a7={any:[/^b/i,/^(a|c)/i]},o7={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},l7={any:[/1/i,/2/i,/3/i,/4/i]},u7={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},c7={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},d7={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},h7={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},f7={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},p7={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},_7={ordinalNumber:n7({matchPattern:r7,parsePattern:i7,valueCallback:function(n){return parseInt(n,10)}}),era:uc({matchPatterns:s7,defaultMatchWidth:"wide",parsePatterns:a7,defaultParseWidth:"any"}),quarter:uc({matchPatterns:o7,defaultMatchWidth:"wide",parsePatterns:l7,defaultParseWidth:"any",valueCallback:function(n){return n+1}}),month:uc({matchPatterns:u7,defaultMatchWidth:"wide",parsePatterns:c7,defaultParseWidth:"any"}),day:uc({matchPatterns:d7,defaultMatchWidth:"wide",parsePatterns:h7,defaultParseWidth:"any"}),dayPeriod:uc({matchPatterns:f7,defaultMatchWidth:"any",parsePatterns:p7,defaultParseWidth:"any"})},Pw={code:"en-US",formatDistance:HU,formatLong:GU,formatRelative:VU,localize:JU,match:_7,options:{weekStartsOn:0,firstWeekContainsDate:1}},m7=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,v7=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,g7=/^'([^]*?)'?$/,y7=/''/g,E7=/[a-zA-Z]/;function L2(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S;wr(2,arguments);var w=String(n),N=Sp(),I=(r=(i=t==null?void 0:t.locale)!==null&&i!==void 0?i:N.locale)!==null&&r!==void 0?r:Pw,x=cl((s=(a=(o=(l=t==null?void 0:t.firstWeekContainsDate)!==null&&l!==void 0?l:t==null||(u=t.locale)===null||u===void 0||(c=u.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&o!==void 0?o:N.firstWeekContainsDate)!==null&&a!==void 0?a:(d=N.locale)===null||d===void 0||(h=d.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&s!==void 0?s:1);if(!(x>=1&&x<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var A=cl((f=(p=(m=(b=t==null?void 0:t.weekStartsOn)!==null&&b!==void 0?b:t==null||(v=t.locale)===null||v===void 0||(_=v.options)===null||_===void 0?void 0:_.weekStartsOn)!==null&&m!==void 0?m:N.weekStartsOn)!==null&&p!==void 0?p:(E=N.locale)===null||E===void 0||(S=E.options)===null||S===void 0?void 0:S.weekStartsOn)!==null&&f!==void 0?f:0);if(!(A>=0&&A<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!I.localize)throw new RangeError("locale must contain localize property");if(!I.formatLong)throw new RangeError("locale must contain formatLong property");var O=hs(e);if(!gU(O))throw new RangeError("Invalid time value");var U=kU(O),W=EU(O,U),P={firstWeekContainsDate:x,weekStartsOn:A,locale:I,_originalDate:O},J=w.match(v7).map(function(V){var H=V[0];if(H==="p"||H==="P"){var Te=RU[H];return Te(V,I.formatLong)}return V}).join("").match(m7).map(function(V){if(V==="''")return"'";var H=V[0];if(H==="'")return b7(V);var Te=xU[H];if(Te)return!(t!=null&&t.useAdditionalWeekYearTokens)&&PU(V)&&u3(V,n,String(e)),!(t!=null&&t.useAdditionalDayOfYearTokens)&&UU(V)&&u3(V,n,String(e)),Te(W,V,I.localize,P);if(H.match(E7))throw new RangeError("Format string contains an unescaped latin alphabet character `"+H+"`");return V}).join("");return J}function b7(e){var n=e.match(g7);return n?n[1].replace(y7,"'"):e}const c3=(e,n,t)=>Math.abs(e-n)<=t;function C7(e,n,t={leading:!0,trailing:!1}){let r=null,i=null;return(...s)=>{if(r){i=s;return}t.leading?e(...s):i=s;const a=()=>{t.trailing&&i?(e(...i),i=null,r=setTimeout(a,n)):r=null};r=setTimeout(a,n)}}const S7=100;function Fw(e,n){const t=D.useRef(n);t.current=n,D.useLayoutEffect(()=>{const r=e.current;if(r){const i=C7(()=>{const{scrollTop:s,scrollHeight:a,clientHeight:o}=r,l={distanceFromBottom:a-s-o};t.current.onReachedTop&&c3(s,0,M0)?t.current.onReachedTop(l):t.current.onReachedBottom&&c3(a,o+s,M0)?t.current.onReachedBottom(l):t.current.onInBetween&&t.current.onInBetween(l)},S7,{trailing:!0});return r.addEventListener("scroll",i),()=>r.removeEventListener("scroll",i)}},[e.current])}const Hw=()=>{const e={};return{__getTopics:()=>e,subscribe:(n,t)=>(e[n]??(e[n]=new Set),e[n].add(t),{remove:()=>{e[n].delete(t)}}),publish:(n,t)=>{e[n]&&e[n].forEach(r=>{setTimeout(()=>r(t!==void 0?t:{}),0)})}}};function d3(e,n=!0){n?setTimeout(()=>{e()}):e()}function h3(e,n){return typeof n=="boolean"?n?"smooth":"auto":e}function T7(e){const n=D.useRef(null),t=D.useRef(0),[r]=D.useState(()=>Hw()),[i,s]=D.useState(!1);return i===!1&&n.current&&n.current.scrollHeight<=n.current.clientHeight&&(t.current=0,s(!0)),D.useLayoutEffect(()=>{const a=[];return a.push(r.subscribe("scrollToBottom",({resolve:o,animated:l})=>{d3(()=>{n.current&&(n.current.scroll?n.current.scroll({top:n.current.scrollHeight,behavior:h3(e,l)}):n.current.scrollTop=n.current.scrollHeight,t.current=0,s(!0),o&&o())})})),a.push(r.subscribe("scroll",({top:o,animated:l,lazy:u,resolve:c})=>{d3(()=>{if(!n.current)return;const{scrollTop:d,scrollHeight:h,clientHeight:f}=n.current;n.current.scroll?n.current.scroll({top:o,behavior:h3(e,l)}):typeof o=="number"&&(n.current.scrollTop=o),t.current=Math.max(0,h-d-f),s(t.current===0),c&&c()},u)})),()=>{a.forEach(({remove:o})=>o())}},[e]),Fw(n,{onReachedTop({distanceFromBottom:a}){s(!1),t.current=a},onInBetween({distanceFromBottom:a}){s(!1),t.current=a},onReachedBottom({distanceFromBottom:a}){s(!0),t.current=a}}),{scrollRef:n,scrollPubSub:r,isScrollBottomReached:i,setIsScrollBottomReached:s,scrollDistanceFromBottomRef:t}}var Pv=(e=>(e.USER_UPDATED="USER_UPDATED",e.SEND_MESSAGE_START="SEND_MESSAGE_START",e.SEND_MESSAGE_FAILED="SEND_MESSAGE_FAILED",e.SEND_USER_MESSAGE="SEND_USER_MESSAGE",e.SEND_FILE_MESSAGE="SEND_FILE_MESSAGE",e.ON_FILE_INFO_UPLOADED="ON_FILE_INFO_UPLOADED",e.UPDATE_USER_MESSAGE="UPDATE_USER_MESSAGE",e.DELETE_MESSAGE="DELETE_MESSAGE",e.LEAVE_CHANNEL="LEAVE_CHANNEL",e.CREATE_CHANNEL="CREATE_CHANNEL",e.UPDATE_OPEN_CHANNEL="UPDATE_OPEN_CHANNEL",e))(Pv||{});const cc=e=>e;function w7(e){const{onBeforeSendUserMessage:n=cc,onBeforeSendFileMessage:t=cc,onBeforeUpdateUserMessage:r=cc,onBeforeSendVoiceMessage:i=cc,onBeforeSendMultipleFilesMessage:s=cc,sendFileMessage:a,sendMultipleFilesMessage:o,sendUserMessage:l,updateUserMessage:u,scrollToBottom:c,quoteMessage:d,replyType:h}=e,f=D.useCallback(p=>{const m={...p};return e.quoteMessage&&h!=="NONE"&&(m.isReplyToChannel=!0,m.parentMessageId=d==null?void 0:d.messageId),m},[h,d]);return{sendUserMessage:D.useCallback(async p=>{const m=f(p),b=await n(m);return l(b,()=>c())},[f,l,c]),sendFileMessage:D.useCallback(async p=>{const m=f(p),b=await t(m);return a(b,()=>c())},[f,a,c]),sendMultipleFilesMessage:D.useCallback(async p=>{const m=f(p),b=await s(m);return o(b,()=>c())},[f,o,c]),sendVoiceMessage:D.useCallback(async(p,m)=>{const b=f({...p,fileName:cU,mimeType:dU,metaArrays:[new br({key:hU,value:[`${m}`]}),new br({key:fU,value:[pU]})]}),v=await i(b);return a(v,()=>c())},[f,a,c]),updateUserMessage:D.useCallback(async(p,m)=>{const b=f(m),v=await r(b);return u(p,v)},[f,u])}}const N7=()=>{const e=D.useRef({locked:!1,count:0}).current;return{lock(){e.locked=!0},async run(n){if(!(e.locked&&e.count>0))try{e.count++,await n()}catch{}},release(){e.locked=!1,e.count=0}}};function I7({channel:e,config:n,moduleLevel:t}){return!e||e.isBroadcast||e.isEphemeral?!1:e.isSuper?t??n.groupChannel.enableReactionsSupergroup:t??n.groupChannel.enableReactions}const jw=Dt.createContext(null),A7=e=>{const{channelUrl:n,children:t,isReactionEnabled:r,replyType:i,threadReplySelectType:s,isMessageGroupingEnabled:a=!0,isMultipleFilesMessageEnabled:o,showSearchIcon:l,disableMarkAsRead:u=!1,scrollBehavior:c="auto",startingPoint:d,animatedMessageId:h,messageListQueryParams:f,onBeforeSendUserMessage:p,onBeforeSendFileMessage:m,onBeforeSendVoiceMessage:b,onBeforeSendMultipleFilesMessage:v,onBeforeUpdateUserMessage:_,onBeforeDownloadFileMessage:E,onMessageAnimated:S,onBackClick:w,onChatHeaderActionClick:N,onReplyInThreadClick:I,onSearchClick:x,onQuoteMessageClick:A,renderUserMentionItem:O}=e,{config:U,stores:W}=fn(),{sdkStore:P}=W,{markAsReadScheduler:J,logger:V}=U,[H,Te]=D.useState(null),[q,ee]=D.useState(null),[ie,Ne]=D.useState(null),[X,oe]=D.useState(null),{scrollRef:te,scrollPubSub:ce,scrollDistanceFromBottomRef:$,isScrollBottomReached:ke,setIsScrollBottomReached:B}=T7(c),ae=D.useRef(null),de=iU(ie,V),Ee=k2(i??U.groupChannel.replyType).upperCase,se=sU(s??U.groupChannel.threadReplySelectType).upperCase,he=O2(()=>Ee==="NONE"?Bn.NONE:Bn.ONLY_REPLY_TO_CHANNEL),fe=I7({channel:ie,config:U,moduleLevel:r}),ve=D.useMemo(()=>new Map(((ie==null?void 0:ie.members)??[]).map(({userId:ne,nickname:xe})=>[ne,xe])),[ie==null?void 0:ie.members]),me=N7(),pe=U5(P.sdk,ie,{startingPoint:d,replyType:he,collectionCreator:M7(ie,f),shouldCountNewMessages:()=>!ke,markAsRead:ne=>{!u&&$.current<=M0&&ne.forEach(xe=>J.push(xe))},onMessagesReceived:()=>{ke&&oU()&&ce.publish("scrollToBottom",{})},onChannelDeleted:()=>{Ne(null),oe(null)},onCurrentUserBanned:()=>{Ne(null),oe(null)},onChannelUpdated:ne=>Ne(ne),logger:V});Fw(te,{async onReachedTop(){me.lock(),await me.run(async()=>{var xe,Le;if(!pe.hasPrevious())return;const ne={scrollTop:(xe=te.current)==null?void 0:xe.scrollTop,scrollHeight:(Le=te.current)==null?void 0:Le.scrollHeight};await pe.loadPrevious(),setTimeout(()=>{var Re;const re={scrollHeight:(Re=te.current)==null?void 0:Re.scrollHeight};if(ne.scrollHeight&&re.scrollHeight&&ne.scrollHeight{var xe,Le;if(!pe.hasNext())return;const ne={scrollTop:(xe=te.current)==null?void 0:xe.scrollTop,scrollHeight:(Le=te.current)==null?void 0:Le.scrollHeight};await pe.loadNext(),setTimeout(()=>{var Re;const re={scrollHeight:(Re=te.current)==null?void 0:Re.scrollHeight};ne.scrollHeight&&re.scrollHeight&&ne.scrollHeight{var ne;if(P.initialized&&n)try{const xe=await P.sdk.groupChannel.getChannel(n);Ne(xe),oe(null)}catch(xe){Ne(null),oe(xe),(ne=V==null?void 0:V.error)==null||ne.call(V,"GroupChannelProvider: error when fetching channel",xe)}finally{Te(null),ee(null)}},[P.initialized,P.sdk,n]),yD(async()=>{pe.initialized&&(me.lock(),await me.run(()=>new Promise(Le=>{ce.publish("scrollToBottom",{resolve:Le,animated:!1})})),me.release());const ne=Le=>{Le.channel.url===n&&ce.publish("scrollToBottom",{})},xe=[U.pubSub.subscribe(Pv.SEND_USER_MESSAGE,ne),U.pubSub.subscribe(Pv.SEND_FILE_MESSAGE,ne)];return()=>{xe.forEach(Le=>Le.remove()),ce.publish("scrollToBottom",{animated:!1})}},[pe.initialized,n]),D.useEffect(()=>{typeof d=="number"&&ze(d,0,!1,!1)},[d]),D.useEffect(()=>{h&&ee(h)},[h]);const Ce=En(async ne=>{te.current&&(ee(null),B(!0),U.isOnline&&pe.hasNext()?(await pe.resetWithStartingPoint(Number.MAX_SAFE_INTEGER),ce.publish("scrollToBottom",{animated:ne})):ce.publish("scrollToBottom",{animated:ne}),ie&&!pe.hasNext()&&(pe.resetNewMessages(),u||J.push(ie)))}),ze=En(async(ne,xe,Le,re)=>{const Re=te.current,st=Re==null?void 0:Re.parentNode,Xe={activate(){!Re||!st||(Re.style.pointerEvents="auto",st.style.cursor="auto")},deactivate(){!Re||!st||(Re.style.pointerEvents="none",st.style.cursor="wait")}};Xe.deactivate(),ee(null);const He=pe.messages.find(ct=>ct.messageId===xe||ct.createdAt===ne);if(He){const ct=s3(He.createdAt);ct&&ce.publish("scroll",{top:ct,animated:re}),(Le??!0)&&ee(xe)}else await pe.resetWithStartingPoint(ne),setTimeout(()=>{const ct=s3(ne);ct&&ce.publish("scroll",{top:ct,lazy:!1,animated:re}),(Le??!0)&&ee(xe)});Xe.activate()}),ue=w7({...e,...pe,scrollToBottom:Ce,quoteMessage:H,replyType:Ee});return C.jsx(jw.Provider,{value:{channelUrl:n,isReactionEnabled:fe,isMessageGroupingEnabled:a,isMultipleFilesMessageEnabled:o,showSearchIcon:l??U.groupChannelSettings.enableMessageSearch,replyType:Ee,threadReplySelectType:se,disableMarkAsRead:u,scrollBehavior:c,messageListQueryParams:f,onBeforeSendUserMessage:p,onBeforeSendFileMessage:m,onBeforeSendVoiceMessage:b,onBeforeSendMultipleFilesMessage:v,onBeforeUpdateUserMessage:_,onBeforeDownloadFileMessage:E,onMessageAnimated:S,onBackClick:w,onChatHeaderActionClick:N,onReplyInThreadClick:I,onSearchClick:x,onQuoteMessageClick:A,renderUserMentionItem:O,currentChannel:ie,fetchChannelError:X,nicknamesMap:ve,scrollRef:te,scrollDistanceFromBottomRef:$,scrollPubSub:ce,messageInputRef:ae,quoteMessage:H,setQuoteMessage:Te,animatedMessageId:q,setAnimatedMessageId:ee,isScrollBottomReached:ke,setIsScrollBottomReached:B,scrollToBottom:Ce,scrollToMessage:ze,toggleReaction:de,...pe,...ue},children:C.jsx(nU,{disableUserProfile:(e==null?void 0:e.disableUserProfile)??(U==null?void 0:U.disableUserProfile),renderUserProfile:(e==null?void 0:e.renderUserProfile)??(U==null?void 0:U.renderUserProfile),onUserProfileMessage:(e==null?void 0:e.onUserProfileMessage)??(U==null?void 0:U.onUserProfileMessage),children:t})})},Ai=()=>{const e=D.useContext(jw);if(!e)throw new Error("GroupChannelContext not found. Use within the GroupChannel module.");return e};function M7(e,n){return t=>{const r={...t,prevResultLimit:30,nextResultLimit:30,...n};return e.createMessageCollection({...r,filter:new Us(r)})}}function f3(e){wr(1,arguments);var n=hs(e);return n.setHours(0,0,0,0),n}function Bw(e,n){wr(2,arguments);var t=f3(e),r=f3(n);return t.getTime()===r.getTime()}const oi={H_1:"H_1",H_2:"H_2",SUBTITLE_1:"SUBTITLE_1",SUBTITLE_2:"SUBTITLE_2",BODY_1:"BODY_1",BODY_2:"BODY_2",BUTTON_1:"BUTTON_1",BUTTON_2:"BUTTON_2",BUTTON_3:"BUTTON_3",CAPTION_1:"CAPTION_1",CAPTION_2:"CAPTION_2",CAPTION_3:"CAPTION_3"},Mi={ONBACKGROUND_1:"ONBACKGROUND_1",ONBACKGROUND_2:"ONBACKGROUND_2",ONBACKGROUND_3:"ONBACKGROUND_3",ONBACKGROUND_4:"ONBACKGROUND_4",ONCONTENT_1:"ONCONTENT_1",ONCONTENT_2:"ONCONTENT_2",ONCONTENT_INVERSE_1:"ONCONTENT_INVERSE_1",ONCONTENT_INVERSE_5:"ONCONTENT_INVERSE_5",PRIMARY:"PRIMARY",ERROR:"ERROR",SECONDARY_3:"SECONDARY_3"};function x7(e){switch(e){case oi.H_1:return"sendbird-label--h-1";case oi.H_2:return"sendbird-label--h-2";case oi.SUBTITLE_1:return"sendbird-label--subtitle-1";case oi.SUBTITLE_2:return"sendbird-label--subtitle-2";case oi.BODY_1:return"sendbird-label--body-1";case oi.BODY_2:return"sendbird-label--body-2";case oi.BUTTON_1:return"sendbird-label--button-1";case oi.BUTTON_2:return"sendbird-label--button-2";case oi.BUTTON_3:return"sendbird-label--button-3";case oi.CAPTION_1:return"sendbird-label--caption-1";case oi.CAPTION_2:return"sendbird-label--caption-2";case oi.CAPTION_3:return"sendbird-label--caption-3";default:return""}}function O7(e){switch(e){case Mi.ONBACKGROUND_1:return"sendbird-label--color-onbackground-1";case Mi.ONBACKGROUND_2:return"sendbird-label--color-onbackground-2";case Mi.ONBACKGROUND_3:return"sendbird-label--color-onbackground-3";case Mi.ONBACKGROUND_4:return"sendbird-label--color-onbackground-4";case Mi.ONCONTENT_1:return"sendbird-label--color-oncontent-1";case Mi.ONCONTENT_2:return"sendbird-label--color-oncontent-2";case Mi.ONCONTENT_INVERSE_1:return"sendbird-label--color-oncontent-inverse-1";case Mi.ONCONTENT_INVERSE_5:return"sendbird-label--color-oncontent-inverse-5";case Mi.PRIMARY:return"sendbird-label--color-primary";case Mi.ERROR:return"sendbird-label--color-error";case Mi.SECONDARY_3:return"sendbird-label--color-secondary-3";default:return""}}const R7={en:{MESSAGE_STATUS__YESTERDAY:"Yesterday",CHANNEL__MESSAGE_LIST__NOTIFICATION__NEW_MESSAGE:"new message(s) since",CHANNEL__MESSAGE_LIST__NOTIFICATION__ON:"on",CHANNEL_PREVIEW_MOBILE_LEAVE:"Leave channel",CHANNEL_SETTING__HEADER__TITLE:"Channel information",CHANNEL_SETTING__PROFILE__EDIT:"Edit",CHANNEL_SETTING__MEMBERS__TITLE:"Members",CHANNEL_SETTING__MEMBERS__SEE_ALL_MEMBERS:"All members",CHANNEL_SETTING__MEMBERS__INVITE_MEMBER:"Invite users",CHANNEL_SETTING__MEMBERS__YOU:" (You)",CHANNEL_SETTING__MEMBERS__SELECT_TITLE:"Select members",CHANNEL_SETTING__MEMBERS__OPERATOR:"Operator",CHANNEL_SETTING__LEAVE_CHANNEL__TITLE:"Leave channel",CHANNEL_SETTING__OPERATORS__TITLE:"Operators",CHANNEL_SETTING__OPERATORS__TITLE_ALL:"All operators",CHANNEL_SETTING__OPERATORS__TITLE_ADD:"Add operator",CHANNEL_SETTING__OPERATORS__ADD_BUTTON:"Add",CHANNEL_SETTING__MUTED_MEMBERS__TITLE:"Muted members",CHANNEL_SETTING__MUTED_MEMBERS__TITLE_ALL:"All muted members",CHANNEL_SETTING__NO_UNMUTED:"No muted members yet",CHANNEL_SETTING__BANNED_MEMBERS__TITLE:"Banned users",CHANNEL_SETTING__FREEZE_CHANNEL:"Freeze Channel",CHANNEL_SETTING__MODERATION__REGISTER_AS_OPERATOR:"Register as operator",CHANNEL_SETTING__MODERATION__UNREGISTER_OPERATOR:"Unregister operator",CHANNEL_SETTING__MODERATION__MUTE:"Mute",CHANNEL_SETTING__MODERATION__UNMUTE:"Unmute",CHANNEL_SETTING__MODERATION__BAN:"Ban",CHANNEL_SETTING__MODERATION__UNBAN:"Unban",CHANNEL_SETTING__MODERATION__EMPTY_BAN:"No banned members yet",CHANNEL_SETTING__MODERATION__ALL_BAN:"All banned members",OPEN_CHANNEL_CONVERSATION__TITLE_PARTICIPANTS:"participants",OPEN_CHANNEL_CONVERSATION__SELECT_PARTICIPANTS:"Select participants",OPEN_CHANNEL_LIST__TITLE:"Channels",CREATE_OPEN_CHANNEL_LIST__TITLE:"New channel profile",CREATE_OPEN_CHANNEL_LIST__SUBTITLE__IMG_SECTION:"Channel image",CREATE_OPEN_CHANNEL_LIST__SUBTITLE__IMG_UPLOAD:"Upload",CREATE_OPEN_CHANNEL_LIST__SUBTITLE__TEXT_SECTION:"Channel name",CREATE_OPEN_CHANNEL_LIST__SUBTITLE__TEXT_PLACE_HOLDER:"Enter channel name",CREATE_OPEN_CHANNEL_LIST__SUBMIT:"Create",OPEN_CHANNEL_SETTINGS__OPERATOR_TITLE:"Channel Information",OPEN_CHANNEL_SETTINGS__OPERATOR_URL:"URL",OPEN_CHANNEL_SETTINGS__PARTICIPANTS_ACCORDION_TITLE:"Participants",OPEN_CHANNEL_SETTINGS__DELETE_CHANNEL_PANEL:"Delete channel",OPEN_CHANNEL_SETTINGS__DELETE_CHANNEL_TITLE:"Delete channel?",OPEN_CHANNEL_SETTINGS__DELETE_CHANNEL_CONTEXT:"Once deleted, this channel can't be restored.",OPEN_CHANNEL_SETTINGS__DELETE_CHANNEL_SUBMIT:"Delete",OPEN_CHANNEL_SETTINGS__OPERATORS_TITLE:"Operators",OPEN_CHANNEL_SETTINGS__OPERATORS__TITLE_ADD:"Add operator",OPEN_CHANNEL_SETTINGS__OPERATORS__TITLE_ALL:"All operators",OPEN_CHANNEL_SETTINGS__MUTED_MEMBERS__TITLE:"Muted participants",OPEN_CHANNEL_SETTINGS__MUTED_MEMBERS__TITLE_ALL:"All muted participants",OPEN_CHANNEL_SETTINGS__MUTED_MEMBERS__NO_ONE:"No muted participants yet",OPEN_CHANNEL_SETTINGS__BANNED_MEMBERS__TITLE:"Banned users",OPEN_CHANNEL_SETTINGS__BANNED_MEMBERS__TITLE_ALL:"All banned users",OPEN_CHANNEL_SETTINGS__BANNED_MEMBERS__NO_ONE:"No banned users yet",OPEN_CHANNEL_SETTINGS__MEMBERS__YOU:" (You)",OPEN_CHANNEL_SETTINGS__MEMBERS__OPERATOR:"Operator",OPEN_CHANNEL_SETTINGS__PARTICIPANTS_TITLE:"Participants",OPEN_CHANNEL_SETTINGS__EMPTY_LIST:"No participants yet",OPEN_CHANNEL_SETTINGS__SEE_ALL:"See all participants",OPEN_CHANNEL_SETTINGS__ALL_PARTICIPANTS_TITLE:"All participants",OPEN_CHANNEL_SETTINGS__NO_TITLE:"(No title)",OPEN_CHANNEL_SETTING__MODERATION__REGISTER_AS_OPERATOR:"Register as operator",OPEN_CHANNEL_SETTING__MODERATION__UNREGISTER_OPERATOR:"Unregister operator",OPEN_CHANNEL_SETTING__MODERATION__MUTE:"Mute",OPEN_CHANNEL_SETTING__MODERATION__UNMUTE:"Unmute",OPEN_CHANNEL_SETTING__MODERATION__BAN:"Ban",OPEN_CHANNEL_SETTING__MODERATION__UNBAN:"Unban",TRYING_TO_CONNECT:"Trying to connect…",TYPING_INDICATOR__IS_TYPING:"is typing...",TYPING_INDICATOR__AND:"and",TYPING_INDICATOR__ARE_TYPING:"are typing...",TYPING_INDICATOR__MULTIPLE_TYPING:"Several people are typing...",CHANNEL_FROZEN:"Channel frozen",PLACE_HOLDER__NO_CHANNEL:"No channels",PLACE_HOLDER__WRONG:"Something went wrong",PLACE_HOLDER__RETRY_TO_CONNECT:"Retry",PLACE_HOLDER__NO_MESSAGES:"No messages",TOOLTIP__AND_YOU:", and you",TOOLTIP__YOU:"you",TOOLTIP__UNKNOWN_USER:"(no name)",UNKNOWN__UNKNOWN_MESSAGE_TYPE:"(Unknown message type)",UNKNOWN__CANNOT_READ_MESSAGE:"Cannot read this message.",UNKNOWN__TEMPLATE_ERROR:"(Template error)",UNKNOWN__CANNOT_READ_TEMPLATE:"Cannot read this template.",MESSAGE_EDITED:"(edited)",MODAL__DELETE_MESSAGE__TITLE:"Delete this message?",MODAL__CHANNEL_INFORMATION__TITLE:"Edit channel information",MODAL__CHANNEL_INFORMATION__CHANNEL_IMAGE:"Channel image",MODAL__CHANNEL_INFORMATION__UPLOAD:"Upload",MODAL__CHANNEL_INFORMATION__CHANNEL_NAME:"Channel name",MODAL__CHANNEL_INFORMATION__INPUT__PLACE_HOLDER:"Enter name",MODAL__INVITE_MEMBER__TITLE:"Invite member",MODAL__INVITE_MEMBER__SELECTED:"selected",MODAL__CHOOSE_CHANNEL_TYPE__TITLE:"New channel",MODAL__CHOOSE_CHANNEL_TYPE__GROUP:"Group",MODAL__CHOOSE_CHANNEL_TYPE__SUPER_GROUP:"Super group",MODAL__CHOOSE_CHANNEL_TYPE__BROADCAST:"Broadcast",MODAL__CREATE_CHANNEL__TITLE:"New channel",MODAL__CREATE_CHANNEL__GROUP:"Group",MODAL__CREATE_CHANNEL__SUPER:"Super group",MODAL__CREATE_CHANNEL__BROADCAST:"Broadcast",MODAL__CREATE_CHANNEL__SELECTED:"selected",MODAL__LEAVE_CHANNEL__TITLE:"Leave this channel?",MODAL__LEAVE_CHANNEL__FOOTER:"Leave",MODAL__VOICE_MESSAGE_INPUT_DISABLED__TITLE_MUTED:"You're muted by the operator.",MODAL__VOICE_MESSAGE_INPUT_DISABLED__TITLE_FROZEN:"Channel is frozen.",USER_PROFILE__MESSAGE:"Message",USER_PROFILE__USER_ID:"User ID",EDIT_PROFILE__TITLE:"My profile",EDIT_PROFILE__IMAGE_LABEL:"Profile image",EDIT_PROFILE__IMAGE_UPLOAD:"Upload",EDIT_PROFILE__NICKNAME_LABEL:"Nickname",EDIT_PROFILE__NICKNAME_PLACEHOLDER:"Enter your nickname",EDIT_PROFILE__USERID_LABEL:"User ID",EDIT_PROFILE__THEME_LABEL:"Dark theme",MESSAGE_INPUT__PLACE_HOLDER:"Enter message",MESSAGE_INPUT__PLACE_HOLDER__DISABLED:"Chat is unavailable in this channel",MESSAGE_INPUT__PLACE_HOLDER__MUTED:"Chat is unavailable because you're muted",MESSAGE_INPUT__PLACE_HOLDER__MUTED_SHORT:"You're muted",MESSAGE_INPUT__QUOTE_REPLY__PLACE_HOLDER:"Reply to message",BUTTON__SUBMIT:"Submit",BUTTON__CANCEL:"Cancel",BUTTON__DELETE:"Delete",BUTTON__SAVE:"Save",BUTTON__CREATE:"Create",BUTTON__INVITE:"Invite",BUTTON__OK:"OK",BADGE__OVER:"+",NO_TITLE:"No title",NO_NAME:"(No name)",NO_MEMBERS:"(No members)",LABEL__OPERATOR:"Operator",MESSAGE_MENU__COPY:"Copy",MESSAGE_MENU__REPLY:"Reply",MESSAGE_MENU__THREAD:"Reply in thread",MESSAGE_MENU__OPEN_IN_CHANNEL:"Open in channel",MESSAGE_MENU__EDIT:"Edit",MESSAGE_MENU__RESEND:"Resend",MESSAGE_MENU__DELETE:"Delete",MESSAGE_MENU__SAVE:"Save",CONTEXT_MENU_DROPDOWN__COPY:"Copy",CONTEXT_MENU_DROPDOWN__EDIT:"Edit",CONTEXT_MENU_DROPDOWN__RESEND:"Resend",CONTEXT_MENU_DROPDOWN__DELETE:"Delete",CONTEXT_MENU_DROPDOWN__SAVE:"Save",SEARCH:"Search",SEARCH_IN_CHANNEL:"Search in channel",SEARCH_IN:"Search in",SEARCHING:"Searching for messages...",NO_SEARCHED_MESSAGE:"No results found.",QUOTE_MESSAGE_INPUT__REPLY_TO:"Reply to",QUOTE_MESSAGE_INPUT__FILE_TYPE_IMAGE:"Photo",QUOTE_MESSAGE_INPUT__FILE_TYPE_GIF:"GIF",QUOTE_MESSAGE_INPUT__FILE_TYPE__VIDEO:"Video",QUOTED_MESSAGE__REPLIED_TO:"replied to",QUOTED_MESSAGE__CURRENT_USER:"You",QUOTED_MESSAGE__UNAVAILABLE:"Message unavailable",THREAD__HEADER_TITLE:"Thread",CHANNEL__THREAD_REPLY:"reply",CHANNEL__THREAD_REPLIES:"replies",CHANNEL__THREAD_OVER_MAX:"99+",THREAD__THREAD_REPLY:"reply",THREAD__THREAD_REPLIES:"replies",THREAD__INPUT__REPLY_TO_THREAD:"Reply to thread",THREAD__INPUT__REPLY_IN_THREAD:"Reply in thread",MENTION_NAME__NO_NAME:"(No name)",MENTION_COUNT__OVER_LIMIT:"You can mention up to %d times at a time.",UI__FILE_VIEWER__UNSUPPORT:"Unsupported message",VOICE_RECORDING_PERMISSION_DENIED:`You cannot record the voice since - voice recording is not permitted in your device system setting`,VOICE_MESSAGE:"Voice Message",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_GIF:"GIF",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_PHOTO:"Photo",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_VIDEO:"Video",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_AUDIO:"Audio",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_VOICE_MESSAGE:"Voice message",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_GENERAL:"File",CHANNEL_PREVIEW_LAST_MESSAGE_TEMPLATE_MESSAGE:"Message",DATE_FORMAT__MESSAGE_LIST__NOTIFICATION__UNREAD_SINCE:"p 'on' MMM dd",DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR:"MMMM dd, yyyy",DATE_FORMAT__THREAD_LIST__DATE_SEPARATOR:"MMM dd, yyyy",FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT:"Up to %d files can be attached.",FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT:"The maximum size per file is %d MB.",FEEDBACK_LIKE:"Like",FEEDBACK_DISLIKE:"Dislike",EDIT_COMMENT:"Edit comment",REMOVE_FEEDBACK:"Remove Feedback",FEEDBACK_MODAL_TITLE:"Provide additional feedback (optional)",FEEDBACK_CONTENT_PLACEHOLDER:"Leave a comment",BUTTON__REMOVE_FEEDBACK:"Remove feedback",FEEDBACK_FAILED_SUBMIT:"Couldn’t submit. Try again.",FEEDBACK_FAILED_SAVE:"Couldn’t save. Try again.",FEEDBACK_FAILED_DELETE:"Couldn’t delete. Try again."}},D2=(e="en")=>R7[e],ut=D.forwardRef(({className:e=[],type:n,color:t,children:r=null},i)=>C.jsx("span",{className:[...Array.isArray(e)?e:[e],"sendbird-label",x7(n),O7(t)].join(" "),ref:i,children:r})),it=oi,at=Mi,$w=D2("en"),Gw={stringSet:D2("en"),dateLocale:Pw},Ki=Dt.createContext(Gw),k7=e=>{const{children:n}=e;return C.jsx(Ki.Provider,{value:{...Gw,...e},children:n})},vl=()=>Dt.useContext(Ki),k0=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)}),L0=k0,L7=({members:e})=>{function n(){const{stringSet:t}=D.useContext(Ki);return!e||e.length===0?"":e&&e.length===1?`${e[0].nickname} ${t.TYPING_INDICATOR__IS_TYPING}`:e&&e.length===2?`${e[0].nickname} ${t.TYPING_INDICATOR__AND} ${e[1].nickname} ${t.TYPING_INDICATOR__ARE_TYPING}`:t.TYPING_INDICATOR__MULTIPLE_TYPING}return C.jsx(C.Fragment,{children:n()})},D7=({channelUrl:e})=>{var l,u,c;const n=fn(),t=(u=(l=n==null?void 0:n.stores)==null?void 0:l.sdkStore)==null?void 0:u.sdk,r=(c=n==null?void 0:n.config)==null?void 0:c.logger,[i,s]=D.useState(k0()),[a,o]=D.useState([]);return D.useEffect(()=>{var d;if((d=t==null?void 0:t.groupChannel)!=null&&d.addGroupChannelHandler){t.groupChannel.removeGroupChannelHandler(i);const h=k0(),f=new x2({onTypingStatusUpdated:p=>{if(r.info("Channel > Typing Indicator: onTypingStatusUpdated",p),p.url===e){const m=p.getTypingUsers();o(m)}}});t.groupChannel.addGroupChannelHandler(h,f),s(h)}return()=>{var h;o([]),(h=t==null?void 0:t.groupChannel)!=null&&h.removeGroupChannelHandler&&t.groupChannel.removeGroupChannelHandler(i)}},[e]),C.jsx(ut,{className:"sendbird-conversation__footer__typing-indicator__text",type:it.CAPTION_2,color:at.ONBACKGROUND_2,children:C.jsx(L7,{members:a})})};var U2=(e=>(e.Text="text",e.Bubble="bubble",e))(U2||{});const ye={ADD:"ADD",ARROW_LEFT:"ARROW_LEFT",ATTACH:"ATTACH",AUDIO_ON_LINED:"AUDIO_ON_LINED",BAN:"BAN",BROADCAST:"BROADCAST",CAMERA:"CAMERA",CHANNELS:"CHANNELS",CHAT:"CHAT",CHAT_FILLED:"CHAT_FILLED",CHEVRON_DOWN:"CHEVRON_DOWN",CHEVRON_RIGHT:"CHEVRON_RIGHT",CLOSE:"CLOSE",COLLAPSE:"COLLAPSE",COPY:"COPY",CREATE:"CREATE",DELETE:"DELETE",DISCONNECTED:"DISCONNECTED",DOCUMENT:"DOCUMENT",DONE:"DONE",DONE_ALL:"DONE_ALL",DOWNLOAD:"DOWNLOAD",EDIT:"EDIT",EMOJI_MORE:"EMOJI_MORE",ERROR:"ERROR",EXPAND:"EXPAND",FILE_AUDIO:"FILE_AUDIO",FILE_DOCUMENT:"FILE_DOCUMENT",FREEZE:"FREEZE",GIF:"GIF",INFO:"INFO",LEAVE:"LEAVE",MEMBERS:"MEMBERS",MESSAGE:"MESSAGE",MODERATIONS:"MODERATIONS",MORE:"MORE",MUTE:"MUTE",NOTIFICATIONS:"NOTIFICATIONS",NOTIFICATIONS_OFF_FILLED:"NOTIFICATIONS_OFF_FILLED",OPERATOR:"OPERATOR",PHOTO:"PHOTO",PLAY:"PLAY",PLUS:"PLUS",QUESTION:"QUESTION",REFRESH:"REFRESH",REPLY:"REPLY",REMOVE:"REMOVE",SEARCH:"SEARCH",SEND:"SEND",SETTINGS_FILLED:"SETTINGS_FILLED",SLIDE_LEFT:"SLIDE_LEFT",SPINNER:"SPINNER",SUPERGROUP:"SUPERGROUP",THREAD:"THREAD",THUMBNAIL_NONE:"THUMBNAIL_NONE",TOGGLE_OFF:"TOGGLE_OFF",TOGGLE_ON:"TOGGLE_ON",USER:"USER",FEEDBACK_LIKE:"FEEDBACK_LIKE",FEEDBACK_DISLIKE:"FEEDBACK_DISLIKE"},Kn={DEFAULT:"DEFAULT",PRIMARY:"PRIMARY",PRIMARY_2:"PRIMARY_2",SECONDARY:"SECONDARY",CONTENT:"CONTENT",CONTENT_INVERSE:"CONTENT_INVERSE",CONTENT_INVERSE_5:"CONTENT_INVERSE_5",WHITE:"WHITE",GRAY:"GRAY",THUMBNAIL_ICON:"THUMBNAIL_ICON",SENT:"SENT",READ:"READ",ON_BACKGROUND_1:"ON_BACKGROUND_1",ON_BACKGROUND_2:"ON_BACKGROUND_2",ON_BACKGROUND_3:"ON_BACKGROUND_3",ON_BACKGROUND_4:"ON_BACKGROUND_4",BACKGROUND_3:"BACKGROUND_3",ERROR:"ERROR"};function U7(e){switch(e){case Kn.PRIMARY:return"sendbird-icon-color--primary";case Kn.PRIMARY_2:return"sendbird-icon-color--primary-2";case Kn.SECONDARY:return"sendbird-icon-color--secondary";case Kn.CONTENT:return"sendbird-icon-color--content";case Kn.CONTENT_INVERSE:return"sendbird-icon-color--content-inverse";case Kn.CONTENT_INVERSE_5:return"sendbird-icon-color--content-inverse-5";case Kn.WHITE:return"sendbird-icon-color--white";case Kn.GRAY:return"sendbird-icon-color--gray";case Kn.THUMBNAIL_ICON:return"sendbird-icon-color--thumbnail-icon";case Kn.SENT:return"sendbird-icon-color--sent";case Kn.READ:return"sendbird-icon-color--read";case Kn.ON_BACKGROUND_1:return"sendbird-icon-color--on-background-1";case Kn.ON_BACKGROUND_2:return"sendbird-icon-color--on-background-2";case Kn.ON_BACKGROUND_3:return"sendbird-icon-color--on-background-3";case Kn.ON_BACKGROUND_4:return"sendbird-icon-color--on-background-4";case Kn.BACKGROUND_3:return"sendbird-icon-color--background-3";case Kn.ERROR:return"sendbird-icon-color--error";default:return""}}function P7(e){switch(e){case ye.ADD:return"sendbird-icon-add";case ye.ARROW_LEFT:return"sendbird-icon-arrow-left";case ye.ATTACH:return"sendbird-icon-attach";case ye.AUDIO_ON_LINED:return"sendbird-icon-audio-on-lined";case ye.BAN:return"sendbird-icon-ban";case ye.BROADCAST:return"sendbird-icon-broadcast";case ye.CAMERA:return"sendbird-icon-camera";case ye.CHANNELS:return"sendbird-icon-channels";case ye.CHAT:return"sendbird-icon-chat";case ye.CHAT_FILLED:return"sendbird-icon-chat-filled";case ye.CHEVRON_DOWN:return"sendbird-icon-chevron-down";case ye.CHEVRON_RIGHT:return"sendbird-icon-chevron-right";case ye.CLOSE:return"sendbird-icon-close";case ye.COLLAPSE:return"sendbird-icon-collapse";case ye.COPY:return"sendbird-icon-copy";case ye.CREATE:return"sendbird-icon-create";case ye.DELETE:return"sendbird-icon-delete";case ye.DISCONNECTED:return"sendbird-icon-disconnected";case ye.DOCUMENT:return"sendbird-icon-document";case ye.DONE:return"sendbird-icon-done";case ye.DONE_ALL:return"sendbird-icon-done-all";case ye.DOWNLOAD:return"sendbird-icon-down-load";case ye.EDIT:return"sendbird-icon-edit";case ye.EMOJI_MORE:return"sendbird-icon-emoji-more";case ye.ERROR:return"sendbird-icon-error";case ye.EXPAND:return"sendbird-icon-expand";case ye.FILE_AUDIO:return"sendbird-icon-file-audio";case ye.FILE_DOCUMENT:return"sendbird-icon-file-document";case ye.FREEZE:return"sendbird-icon-freeze";case ye.GIF:return"sendbird-icon-gif";case ye.INFO:return"sendbird-icon-info";case ye.LEAVE:return"sendbird-icon-leave";case ye.MEMBERS:return"sendbird-icon-members";case ye.MESSAGE:return"sendbird-icon-message";case ye.MODERATIONS:return"sendbird-icon-moderations";case ye.MORE:return"sendbird-icon-more";case ye.MUTE:return"sendbird-icon-mute";case ye.NOTIFICATIONS:return"sendbird-icon-notifications";case ye.NOTIFICATIONS_OFF_FILLED:return"sendbird-icon-notifications-off-filled";case ye.OPERATOR:return"sendbird-icon-operator";case ye.PHOTO:return"sendbird-icon-photo";case ye.PLAY:return"sendbird-icon-play";case ye.PLUS:return"sendbird-iconn-plus";case ye.QUESTION:return"sendbird-icon-question";case ye.REFRESH:return"sendbird-icon-refresh";case ye.REMOVE:return"sendbird-icon-remove";case ye.REPLY:return"sendbird-icon-reply";case ye.SEARCH:return"sendbird-icon-search";case ye.SEND:return"sendbird-icon-send";case ye.SETTINGS_FILLED:return"sendbird-icon-settings-filled";case ye.SPINNER:return"sendbird-icon-spinner";case ye.SUPERGROUP:return"sendbird-icon-supergroup";case ye.THREAD:return"sendbird-icon-thread";case ye.THUMBNAIL_NONE:return"sendbird-icon-thumbnail-none";case ye.TOGGLE_OFF:return"sendbird-icon-toggle-off";case ye.TOGGLE_ON:return"sendbird-icon-toggle-on";case ye.USER:return"sendbird-icon-user";case ye.FEEDBACK_LIKE:return"sendbird-icon-feedback-like";case ye.FEEDBACK_DISLIKE:return"sendbird-icon-feedback-dislike";default:return"sendbird-icon-unknown"}}const F7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M50.667%205.333c4.418%200%208%203.582%208%208v37.334c0%204.418-3.582%208-8%208H13.333c-4.418%200-8-3.582-8-8V13.333c0-4.418%203.582-8%208-8zm0%205.334H13.333c-1.472%200-2.666%201.194-2.666%202.666v37.334c0%201.472%201.194%202.666%202.666%202.666h37.334c1.472%200%202.666-1.194%202.666-2.666V13.333c0-1.472-1.194-2.666-2.666-2.666zm-18.667%208c1.368%200%202.495%201.03%202.649%202.355l.018.311v8h8c1.472%200%202.666%201.194%202.666%202.667%200%201.368-1.03%202.495-2.355%202.649l-.311.018h-8v8c0%201.472-1.194%202.666-2.667%202.666-1.368%200-2.495-1.03-2.649-2.355l-.018-.311v-8h-8c-1.472%200-2.666-1.194-2.666-2.667%200-1.368%201.03-2.495%202.355-2.649l.311-.018h8v-8c0-1.472%201.194-2.666%202.667-2.666z'%20transform='translate(-66%20-271)%20translate(66%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",H7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M33.886%208.781c.96.961%201.035%202.474.221%203.52l-.221.251-16.78%2016.781H56c1.473%200%202.667%201.194%202.667%202.667%200%201.368-1.03%202.495-2.356%202.649l-.311.018-38.895-.001%2016.78%2016.782c.962.961%201.036%202.474.222%203.52l-.221.251c-.962.961-2.474%201.035-3.52.222l-.252-.222L8.781%2033.886c-.961-.962-1.035-2.474-.222-3.52l.222-.252L30.114%208.781c1.042-1.041%202.73-1.041%203.772%200z'%20transform='translate(-66%20-751)%20translate(66%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",j7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M55.334%2028.926l-24.506%2023.34c-5.222%204.973-13.74%204.973-18.962%200-5.149-4.903-5.149-12.797%200-17.7l24.506-23.34c3.138-2.988%208.278-2.988%2011.416%200%203.064%202.919%203.064%207.594%200%2010.513L23.255%2045.077c-1.055%201.005-2.815%201.005-3.87.001-.98-.933-.98-2.39%200-3.325l22.64-21.535c1.067-1.015%201.109-2.703.094-3.77-1.015-1.067-2.703-1.11-3.77-.094L15.709%2037.89c-3.189%203.037-3.189%208.015-.001%2011.05%203.113%202.966%208.11%202.966%2011.224%200l24.533-23.338c5.272-5.021%205.272-13.217%200-18.238-5.197-4.95-13.573-4.95-18.77%200L8.187%2030.704c-7.356%207.005-7.356%2018.419%200%2025.424%207.281%206.935%2019.036%206.935%2026.318%200l24.506-23.34c1.067-1.016%201.108-2.703.092-3.77-1.015-1.066-2.703-1.108-3.77-.092z'%20transform='translate(-642%20-591)%20translate(642%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",B7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333%202.667%2048.2%202.667%2032%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032s10.745%2024%2024%2024%2024-10.745%2024-24S45.255%208%2032%208zm12.333%2021.333c.553%200%201%20.448%201%201v3.334c0%20.552-.447%201-1%201H19.667c-.553%200-1-.448-1-1v-3.334c0-.552.447-1%201-1h24.666z'%20transform='translate(-498%20-1071)%20translate(498%201071)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",$7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M58.545%205.498c.08.258.122.526.122.796v46.079c0%201.473-1.194%202.666-2.667%202.666-.27%200-.538-.04-.795-.12l-17.951-5.61c-.645%205.273-5.14%209.358-10.587%209.358C20.776%2058.667%2016%2053.89%2016%2048v-5.334h-5.333c-4.335%200-7.865-3.447-7.997-7.75l-.003-.25V24c0-4.418%203.581-8%208-8H16L55.205%203.749c1.405-.44%202.901.344%203.34%201.75zM21.333%2044.587V48c0%202.946%202.388%205.333%205.334%205.333%202.811%200%205.115-2.175%205.318-4.935L32%2047.92l-10.667-3.333zm32-34.667l-32%209.997v18.83l32%209.997V9.92zM16%2021.333h-5.333c-1.368%200-2.495%201.03-2.65%202.356L8%2024v10.667c0%201.472%201.194%202.666%202.667%202.666H16v-16z'%20transform='translate(-1074%20-431)%20translate(1074%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",G7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M40%205.333c.892%200%201.724.446%202.219%201.188l4.541%206.812H56c4.26%200%207.743%203.33%207.986%207.53l.014.47v29.334c0%204.418-3.582%208-8%208H8c-4.418%200-8-3.582-8-8V21.333c0-4.418%203.582-8%208-8h9.237l4.544-6.812c.433-.65%201.125-1.072%201.888-1.167l.331-.02zm-1.43%205.334H25.428l-4.542%206.812c-.432.65-1.124%201.072-1.887%201.167l-.331.02H8c-1.473%200-2.667%201.195-2.667%202.667v29.334c0%201.472%201.194%202.666%202.667%202.666h48c1.473%200%202.667-1.194%202.667-2.666V21.333c0-1.472-1.194-2.666-2.667-2.666H45.333c-.891%200-1.724-.446-2.218-1.188l-4.544-6.812zM32%2021.333c7.364%200%2013.333%205.97%2013.333%2013.334C45.333%2042.03%2039.363%2048%2032%2048c-7.364%200-13.333-5.97-13.333-13.333%200-7.364%205.97-13.334%2013.333-13.334zm0%205.334c-4.418%200-8%203.581-8%208%200%204.418%203.582%208%208%208s8-3.582%208-8c0-4.419-3.582-8-8-8z'%20transform='translate(-66%20-591)%20translate(66%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",z7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M42.65%205.333l.311.017c1.36.15%202.366%201.298%202.373%202.633l-.017.311-1.45%2013.04h9.466C54.806%2021.333%2056%2022.526%2056%2024c0%201.368-1.03%202.495-2.356%202.649l-.31.018H43.271l-1.184%2010.666h11.245C54.806%2037.333%2056%2038.527%2056%2040c0%201.368-1.03%202.495-2.356%202.649l-.31.018H41.495l-1.512%2013.627c-.163%201.464-1.481%202.519-2.945%202.356-1.36-.15-2.366-1.298-2.373-2.633l.017-.311%201.448-13.04H25.496l-1.512%2013.628c-.163%201.464-1.481%202.519-2.945%202.356-1.36-.15-2.366-1.298-2.373-2.633l.017-.311%201.448-13.04h-9.464C9.194%2042.667%208%2041.474%208%2040c0-1.368%201.03-2.495%202.356-2.649l.31-.018h10.057l1.186-10.667H10.667C9.194%2026.667%208%2025.474%208%2024c0-1.368%201.03-2.495%202.356-2.649l.31-.018h11.835l1.515-13.627c.151-1.36%201.299-2.366%202.634-2.373l.311.017c1.36.15%202.366%201.298%202.373%202.633l-.017.311-1.45%2013.04H38.5l1.515-13.628c.151-1.36%201.299-2.366%202.634-2.373zm-5.927%2032l1.186-10.667H27.272l-1.184%2010.667h10.635z'%20transform='translate(-66%20-431)%20translate(66%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",V7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333c-4.455%200-8.679-.993-12.461-2.77l-1.753.58c-5.965%201.912-10.133%202.572-12.504%201.981-2.799-.698-3.351-1.919-1.657-3.663%201.171-1.396%202.147-3.14%202.928-5.234.622-1.668.377-4.001-.737-7C3.8%2041.253%202.666%2036.759%202.666%2032%202.667%2015.8%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032c0%203.5.747%206.88%202.168%209.978l.405.837.137.271.106.285c1.517%204.085%201.89%207.622.734%2010.72l-.382.972-.192.433.235-.05c1.38-.317%203.017-.767%204.886-1.363l1.721-.568%202.04-.696%201.95.917C24.965%2055.22%2028.422%2056%2032%2056c13.255%200%2024-10.745%2024-24S45.255%208%2032%208z'%20transform='translate(-210%20-431)%20translate(210%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",q7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333c-4.455%200-8.679-.993-12.461-2.77l-1.753.58c-5.965%201.912-10.133%202.572-12.504%201.981-2.799-.698-3.351-1.919-1.657-3.663%201.171-1.396%202.147-3.14%202.928-5.234.622-1.668.377-4.001-.737-7C3.8%2041.253%202.666%2036.759%202.666%2032%202.667%2015.8%2015.8%202.667%2032%202.667z'%20transform='translate(-358%20-431)%20translate(358%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",W7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M20.879%2048.879c-1.172%201.171-1.172%203.07%200%204.242%201.171%201.172%203.07%201.172%204.242%200l18-18c1.172-1.171%201.172-3.07%200-4.242l-18-18c-1.171-1.172-3.07-1.172-4.242%200-1.172%201.171-1.172%203.07%200%204.242L36.757%2033%2020.88%2048.879z'%20transform='translate(-786%20-751)%20translate(786%20751)%20rotate(90%2032%2033)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",K7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M22.114%2046.114c-1.041%201.042-1.041%202.73%200%203.772%201.042%201.041%202.73%201.041%203.772%200l16-16c1.041-1.042%201.041-2.73%200-3.772l-16-16c-1.042-1.041-2.73-1.041-3.772%200-1.041%201.042-1.041%202.73%200%203.772L36.23%2032%2022.114%2046.114z'%20transform='translate(-642%20-751)%20translate(642%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Q7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M52.552%2011.448c.962.961%201.036%202.474.222%203.52l-.222.251-16.781%2016.78%2016.781%2016.782c1.042%201.041%201.042%202.73%200%203.771-.961.962-2.474%201.036-3.52.222l-.251-.222L32%2035.771%2015.219%2052.552c-1.041%201.042-2.73%201.042-3.771%200-.962-.961-1.036-2.474-.222-3.52l.222-.251L28.228%2032l-16.78-16.781c-1.042-1.041-1.042-2.73%200-3.771.961-.962%202.474-1.036%203.52-.222l.251.222%2016.78%2016.78%2016.782-16.78c1.041-1.042%202.73-1.042%203.771%200z'%20transform='translate(-210%20-751)%20translate(210%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Y7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M16%208c-1.368%200-2.495%201.03-2.649%202.356l-.018.31v42.667C13.333%2054.806%2014.527%2056%2016%2056c1.368%200%202.495-1.03%202.649-2.356l.018-.31V34.666h25.56l-6.113%206.114c-.96.961-1.035%202.474-.221%203.52l.221.251c.962.962%202.474%201.036%203.52.222l.252-.222%2010.666-10.666c.962-.962%201.036-2.474.222-3.52l-.222-.252-10.666-10.666c-1.042-1.042-2.73-1.042-3.772%200-.96.961-1.035%202.474-.221%203.52l.221.251%206.113%206.114h-25.56V10.667C18.667%209.194%2017.473%208%2016%208z'%20transform='translate(-66%20-1215)%20translate(66%201215)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Z7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M53.333%2021.333c4.419%200%208%203.582%208%208v24c0%204.419-3.581%208-8%208h-24c-4.418%200-8-3.581-8-8v-24c0-4.418%203.582-8%208-8zm0%205.334h-24c-1.472%200-2.666%201.194-2.666%202.666v24c0%201.473%201.194%202.667%202.666%202.667h24C54.806%2056%2056%2054.806%2056%2053.333v-24c0-1.472-1.194-2.666-2.667-2.666zm-18.666-24c4.26%200%207.743%203.33%207.986%207.53l.014.47v2.666C42.667%2014.806%2041.473%2016%2040%2016c-1.368%200-2.495-1.03-2.649-2.356l-.018-.31v-2.667c0-1.368-1.03-2.495-2.355-2.65L34.667%208h-24c-1.368%200-2.495%201.03-2.65%202.356l-.017.31v24c0%201.368%201.03%202.495%202.356%202.65l.31.017h2.667C14.806%2037.333%2016%2038.527%2016%2040c0%201.368-1.03%202.495-2.356%202.649l-.31.018h-2.667c-4.26%200-7.743-3.33-7.987-7.53l-.013-.47v-24c0-4.26%203.33-7.743%207.53-7.987l.47-.013h24z'%20transform='translate(-354%20-271)%20translate(354%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",X7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333c-4.455%200-8.679-.993-12.461-2.77l-1.753.58c-5.965%201.912-10.133%202.572-12.504%201.981-2.799-.698-3.351-1.919-1.657-3.663%201.171-1.396%202.147-3.14%202.928-5.234.622-1.668.377-4.001-.737-7C3.8%2041.253%202.666%2036.759%202.666%2032%202.667%2015.8%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032c0%203.5.747%206.88%202.168%209.978l.405.837.137.271.106.285c1.517%204.085%201.89%207.622.734%2010.72l-.382.972-.192.433.235-.05c1.38-.317%203.017-.767%204.886-1.363l1.721-.568%202.04-.696%201.95.917C24.965%2055.22%2028.422%2056%2032%2056c13.255%200%2024-10.745%2024-24S45.255%208%2032%208zm2.667%2016v5.333H40c3.556%200%203.556%205.334%200%205.334h-5.333V40c0%203.556-5.334%203.556-5.334%200v-5.333H24c-3.556%200-3.556-5.334%200-5.334h5.333V24c0-3.556%205.334-3.556%205.334%200z'%20transform='translate(-210%20-271)%20translate(210%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",J7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M9.466%206.069l.248.217%209.736%209.735.04.04%209.573%209.573c.15.118.286.254.405.404l28.246%2028.248c.947.947.947%202.481%200%203.428-.868.868-2.23.94-3.18.217l-.248-.217-13.374-13.373c-.632.126-1.313.002-1.88-.401-4.203-2.987-9.836-2.987-14.04%200-1.092.775-2.605.52-3.38-.572-.776-1.092-.52-2.605.572-3.38%203.363-2.39%207.38-3.414%2011.303-3.072l-6.743-6.744c-3.731.841-7.215%202.56-10.159%205.021-1.027.859-2.556.722-3.415-.305-.858-1.027-.722-2.556.305-3.414%202.772-2.318%205.942-4.087%209.34-5.23l-5.633-5.634c-3.356%201.496-6.467%203.496-9.225%205.934-1.003.886-2.535.792-3.422-.211-.887-1.003-.792-2.535.211-3.422%202.666-2.357%205.624-4.353%208.796-5.941L6.286%209.714c-.947-.947-.947-2.481%200-3.428.868-.868%202.23-.94%203.18-.217zm35.04%2021.474c2.167%201.057%204.193%202.382%206.032%203.942%201.021.866%201.146%202.396.28%203.417-.866%201.02-2.396%201.146-3.417.28-1.53-1.3-3.218-2.402-5.022-3.282-1.203-.587-1.702-2.039-1.115-3.242.587-1.203%202.038-1.703%203.242-1.115zm14.746-4.634c1.004.886%201.1%202.418.214%203.422-.885%201.004-2.417%201.1-3.421.214-7.402-6.53-17.14-9.77-26.978-8.977-1.334.107-2.503-.887-2.61-2.222-.108-1.334.886-2.503%202.221-2.61%2011.15-.9%2022.186%202.773%2030.574%2010.173z'%20transform='translate(-930%20-911)%20translate(930%20911)%20matrix(-1%200%200%201%2064%200)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",e8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M37.333%202.667c.059%200%20.117.002.174.005.033.002.067.005.1.009l.085.01.058.008c.047.007.094.016.141.026l.029.007c.05.01.098.023.146.037l.034.01c.237.07.46.173.663.303l.034.022c.036.023.07.047.104.072l.057.043c.03.022.058.045.085.068.06.05.12.104.176.16l-.126-.117c.05.043.097.088.143.135L55.21%2019.438c.047.046.091.094.134.143l.035.04c.026.032.052.063.076.096l.04.054.07.1.024.038c.16.253.279.535.347.836l.01.048c.009.043.017.086.024.13l.006.048.007.051.004.041c.01.09.014.18.014.27v32c0%204.419-3.582%208-8%208H16c-4.418%200-8-3.581-8-8V10.667c0-4.419%203.582-8%208-8h21.333zM34.666%208H16c-1.473%200-2.667%201.194-2.667%202.667v42.666C13.333%2054.806%2014.527%2056%2016%2056h32c1.473%200%202.667-1.194%202.667-2.667L50.666%2024H37.333c-1.367%200-2.494-1.03-2.648-2.356l-.018-.31L34.666%208zm12.227%2010.667l-6.894-6.894.001%206.894h6.893z'%20transform='translate(-498%20-591)%20translate(498%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",t8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M12.552%2031.448c-1.041-1.042-2.73-1.042-3.771%200-1.041%201.041-1.041%202.73%200%203.771l13.333%2013.333c1.042%201.042%202.73%201.042%203.772%200L55.219%2019.22c1.041-1.041%201.041-2.73%200-3.771-1.041-1.042-2.73-1.042-3.771%200L24%2042.895%2012.552%2031.448z'%20transform='translate(-66%20-911)%20translate(66%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",n8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M5.886%2031.448L19.219%2044.78c1.041%201.041%201.041%202.73%200%203.771-1.041%201.042-2.73%201.042-3.771%200L2.114%2035.22c-1.041-1.041-1.041-2.73%200-3.771%201.042-1.042%202.73-1.042%203.772%200zm52.228-16c1.042-1.042%202.73-1.042%203.772%200%201.041%201.041%201.041%202.73%200%203.771L32.552%2048.552c-1.041%201.042-2.73%201.042-3.771%200L15.448%2035.22c-1.042-1.041-1.042-2.73%200-3.771%201.041-1.042%202.73-1.042%203.771%200l11.448%2011.447zm-9.562%200c1.042%201.041%201.042%202.73%200%203.771L32.556%2035.215c-1.042%201.042-2.73%201.042-3.771%200-1.042-1.041-1.042-2.73%200-3.77L44.78%2015.447c1.041-1.042%202.73-1.042%203.771%200z'%20transform='translate(-210%20-911)%20translate(210%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",r8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M56%2042.667c1.368%200%202.495%201.03%202.649%202.355l.018.311v8c0%204.26-3.33%207.743-7.53%207.987l-.47.013H13.333c-4.26%200-7.743-3.33-7.986-7.53l-.014-.47v-8c0-1.472%201.194-2.666%202.667-2.666%201.368%200%202.495%201.03%202.649%202.355l.018.311v8c0%201.368%201.03%202.495%202.355%202.65l.311.017h37.334c1.367%200%202.494-1.03%202.648-2.356l.018-.31v-8c0-1.473%201.194-2.667%202.667-2.667zm-36.552-8.781c-1.042-1.042-1.042-2.73%200-3.772.961-.96%202.474-1.035%203.52-.221l.251.221%206.114%206.114V5.333c0-1.472%201.194-2.666%202.667-2.666%201.368%200%202.495%201.03%202.649%202.355l.018.311v30.894l6.114-6.113c.961-.96%202.474-1.035%203.52-.221l.251.221c.962.962%201.036%202.474.222%203.52l-.222.252-10.658%2010.657c-.043.044-.088.087-.135.128l.127-.119c-.063.063-.128.121-.195.176l-.056.045c-.028.022-.057.044-.086.064l-.056.04-.086.056-.06.036-.081.046-.079.04c-.046.023-.093.045-.14.065l-.09.036c-.023.01-.045.017-.067.025l-.09.03-.063.019c-.043.012-.086.024-.13.034l-.013.003c-.047.01-.095.02-.144.028l-.064.01c-.03.005-.061.009-.092.012l-.084.008c-.034.003-.068.005-.103.006l-.069.002h-.095c-.028%200-.055-.002-.082-.003l.139.003c-.084%200-.167-.004-.249-.011l-.061-.007c-.031-.003-.062-.007-.092-.012l-.09-.015c-.04-.007-.079-.016-.118-.025l-.04-.01c-.116-.029-.23-.066-.34-.11l-.015-.006c-.05-.02-.097-.04-.145-.063l-.042-.02L30.71%2045c-.022-.012-.045-.025-.067-.039-.03-.018-.059-.035-.087-.054l-.062-.041c-.03-.02-.06-.042-.088-.063l-.04-.03-.008-.007c-.088-.069-.172-.144-.251-.223L19.448%2033.886z'%20transform='translate(-786%20-271)%20translate(786%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",i8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2065%2065'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M56%2056c1.473%200%202.667%201.194%202.667%202.667%200%201.367-1.03%202.494-2.356%202.648l-.311.018H8c-1.473%200-2.667-1.194-2.667-2.666%200-1.368%201.03-2.495%202.356-2.65L8%2056h48zM35.448%203.448c1.041-1.042%202.73-1.042%203.771%200l10.667%2010.666c1.041%201.042%201.041%202.73%200%203.772L20.552%2047.219c-.5.5-1.178.781-1.885.781H8c-1.473%200-2.667-1.194-2.667-2.667V34.667c0-.708.281-1.386.781-1.886zm1.885%205.659L10.667%2035.77v6.896h6.89L44.227%2016l-6.894-6.893z'%20transform='translate(-642%20-271)%20translate(642%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",s8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32.097%203.22c2.65%200%205.255.357%207.763%201.054%201.135.316%201.799%201.493%201.483%202.628-.316%201.135-1.492%201.799-2.627%201.483-2.136-.594-4.356-.899-6.619-.899-13.603%200-24.63%2011.027-24.63%2024.63s11.027%2024.63%2024.63%2024.63%2024.63-11.027%2024.63-24.63c0-2.227-.295-4.413-.87-6.518-.312-1.136.357-2.31%201.494-2.62%201.136-.312%202.31.357%202.62%201.494.677%202.471%201.023%205.036%201.023%207.644%200%2015.96-12.938%2028.897-28.897%2028.897-15.96%200-28.897-12.937-28.897-28.897C3.2%2016.157%2016.138%203.22%2032.097%203.22zm10.705%2034.792c1.456%200%202.485%201.426%202.024%202.808-1.873%205.623-6.937%209.488-12.729%209.488-5.792%200-10.856-3.865-12.73-9.488-.444-1.334.5-2.71%201.875-2.803l.15-.005h21.41zm-3.477%204.266H24.867l.294.382c1.539%201.887%203.718%203.113%206.115%203.342l.314.024.507.015c2.617%200%205.037-1.188%206.743-3.151l.193-.23.292-.382zM21.392%2021.954c1.087%200%201.985.814%202.116%201.866l.017.267v5.353c0%201.178-.955%202.133-2.133%202.133-1.088%200-1.986-.814-2.117-1.865l-.017-.268v-5.353c0-1.178.955-2.133%202.134-2.133zm21.41%200c1.088%200%201.985.814%202.117%201.866l.017.267v5.353c0%201.178-.955%202.133-2.134%202.133-1.087%200-1.985-.814-2.116-1.865l-.017-.268v-5.353c0-1.178.955-2.133%202.133-2.133zM54.853%200c.442%200%20.8.358.8.8v7.786h7.76c.442%200%20.8.359.8.8v2.667c0%20.442-.358.8-.8.8h-7.76v7.758c0%20.442-.358.8-.8.8h-2.666c-.442%200-.8-.358-.8-.8v-7.758h-7.785c-.441%200-.8-.358-.8-.8V9.387c0-.442.359-.8.8-.8l7.784-.001V.8c0-.442.359-.8.8-.8h2.667z'%20transform='translate(-1074%20-271)%20translate(1074%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",a8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%205.06c2.622%200%205.065%201.283%206.561%203.424l.287.439%2022.608%2037.744c1.421%202.461%201.43%205.492.022%207.962-1.32%202.315-3.698%203.81-6.356%204.014l-.535.024H9.384c-2.842-.032-5.455-1.569-6.862-4.038-1.314-2.305-1.394-5.1-.226-7.493l.27-.506L25.16%208.91c1.45-2.39%204.044-3.85%206.84-3.85zm0%205.333c-.816%200-1.58.372-2.076.99l-.196.28-22.565%2037.67c-.474.821-.477%201.831-.008%202.655.41.72%201.129%201.202%201.917%201.318l.341.027h45.144c.948-.01%201.819-.522%202.288-1.345.41-.72.46-1.584.162-2.314l-.148-.304L34.28%2011.676c-.483-.797-1.348-1.283-2.28-1.283zm0%2032.274c1.473%200%202.667%201.194%202.667%202.666C34.667%2046.806%2033.473%2048%2032%2048c-1.473%200-2.667-1.194-2.667-2.667%200-1.472%201.194-2.666%202.667-2.666zm0-21.334c1.368%200%202.495%201.03%202.649%202.356l.018.311v10.667c0%201.472-1.194%202.666-2.667%202.666-1.368%200-2.495-1.03-2.649-2.355l-.018-.311V24c0-1.473%201.194-2.667%202.667-2.667z'%20transform='translate(-354%20-911)%20translate(354%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",o8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M48%208c1.368%200%202.495%201.03%202.649%202.356l.018.31V32l-.001.027v21.306C50.667%2054.806%2049.474%2056%2048%2056c-1.368%200-2.495-1.03-2.649-2.356l-.018-.31V34.665H19.772l6.114%206.115c.96.961%201.035%202.474.221%203.52l-.221.251c-.962.962-2.474%201.036-3.52.222l-.252-.222-10.666-10.666c-.962-.962-1.036-2.474-.222-3.52l.222-.252%2010.666-10.666c1.042-1.042%202.73-1.042%203.772%200%20.96.961%201.035%202.474.221%203.52l-.221.251-6.113%206.114h25.56V10.667C45.333%209.194%2046.527%208%2048%208z'%20transform='translate(-210%20-1215)%20translate(210%201215)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",l8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333%202.667%2048.2%202.667%2032%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032s10.745%2024%2024%2024%2024-10.745%2024-24S45.255%208%2032%208zm1.667%2021.333c.552%200%201%20.448%201%201v14c0%20.553-.448%201-1%201h-3.334c-.552%200-1-.447-1-1v-14c0-.552.448-1%201-1h3.334zm-1.667-8c1.473%200%202.667%201.194%202.667%202.667%200%201.473-1.194%202.667-2.667%202.667-1.473%200-2.667-1.194-2.667-2.667%200-1.473%201.194-2.667%202.667-2.667z'%20transform='translate(-498%20-911)%20translate(498%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",u8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M34.667%2037.333c7.17%200%2013.018%205.66%2013.32%2012.755l.013.579V56c0%201.473-1.194%202.667-2.667%202.667-1.367%200-2.494-1.03-2.648-2.356L42.667%2056v-5.333c0-4.26-3.33-7.743-7.53-7.987l-.47-.013H13.333c-4.26%200-7.743%203.33-7.986%207.53l-.014.47V56c0%201.473-1.194%202.667-2.666%202.667-1.368%200-2.495-1.03-2.65-2.356L0%2056v-5.333c0-7.17%205.66-13.019%2012.755-13.321l.578-.013h21.334zM54%2037.765c5.687%201.468%209.72%206.474%209.986%2012.297l.014.605V56c0%201.473-1.194%202.667-2.667%202.667-1.367%200-2.494-1.03-2.648-2.356L58.667%2056v-5.331c-.003-3.646-2.47-6.829-6-7.74-1.426-.369-2.284-1.823-1.916-3.249.369-1.426%201.823-2.284%203.249-1.915zM24%205.333c7.364%200%2013.333%205.97%2013.333%2013.334C37.333%2026.03%2031.363%2032%2024%2032c-7.364%200-13.333-5.97-13.333-13.333%200-7.364%205.97-13.334%2013.333-13.334zm19.328.43c5.9%201.51%2010.026%206.827%2010.026%2012.917s-4.126%2011.406-10.026%2012.917c-1.427.365-2.88-.495-3.245-1.922-.365-1.427.495-2.88%201.922-3.245%203.54-.906%206.016-4.096%206.016-7.75s-2.476-6.844-6.016-7.75c-1.427-.365-2.287-1.818-1.922-3.245.366-1.427%201.818-2.287%203.245-1.922zM24%2010.667c-4.418%200-8%203.581-8%208%200%204.418%203.582%208%208%208s8-3.582%208-8c0-4.419-3.582-8-8-8z'%20transform='translate(-786%20-431)%20translate(786%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",c8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333c-4.455%200-8.679-.993-12.461-2.77l-1.753.58c-5.965%201.912-10.133%202.572-12.504%201.981-2.799-.698-3.351-1.919-1.657-3.663%201.171-1.396%202.147-3.14%202.928-5.234.622-1.668.377-4.001-.737-7C3.8%2041.253%202.666%2036.759%202.666%2032%202.667%2015.8%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032c0%203.5.747%206.88%202.168%209.978l.405.837.137.271.106.285c1.517%204.085%201.89%207.622.734%2010.72l-.382.972-.192.433.235-.05c1.38-.317%203.017-.767%204.886-1.363l1.721-.568%202.04-.696%201.95.917C24.965%2055.22%2028.422%2056%2032%2056c13.255%200%2024-10.745%2024-24S45.255%208%2032%208zM18.667%2029.333c1.472%200%202.666%201.194%202.666%202.667%200%201.473-1.194%202.667-2.666%202.667C17.194%2034.667%2016%2033.473%2016%2032c0-1.473%201.194-2.667%202.667-2.667zm13.333%200c1.473%200%202.667%201.194%202.667%202.667%200%201.473-1.194%202.667-2.667%202.667-1.473%200-2.667-1.194-2.667-2.667%200-1.473%201.194-2.667%202.667-2.667zm13.333%200C46.806%2029.333%2048%2030.527%2048%2032c0%201.473-1.194%202.667-2.667%202.667-1.472%200-2.666-1.194-2.666-2.667%200-1.473%201.194-2.667%202.666-2.667z'%20transform='translate(-498%20-431)%20translate(498%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",d8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%2045.333c2.946%200%205.333%202.388%205.333%205.334C37.333%2053.612%2034.946%2056%2032%2056s-5.333-2.388-5.333-5.333c0-2.946%202.387-5.334%205.333-5.334zM32%2028c2.946%200%205.333%202.388%205.333%205.333%200%202.946-2.387%205.334-5.333%205.334s-5.333-2.388-5.333-5.334C26.667%2030.388%2029.054%2028%2032%2028zm0-17.333c2.946%200%205.333%202.387%205.333%205.333S34.946%2021.333%2032%2021.333%2026.667%2018.946%2026.667%2016s2.387-5.333%205.333-5.333z'%20transform='translate(-1074%20-751)%20translate(1074%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",h8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M29.83%206.45c1.064-1.489%203.276-1.489%204.34%200l11.697%2016.374L57%2013.918c1.88-1.504%204.573.054%204.32%202.35l-.047.29-8%2037.334c-.263%201.23-1.35%202.108-2.607%202.108H13.333c-1.257%200-2.344-.878-2.607-2.108l-8-37.333c-.525-2.452%202.315-4.207%204.273-2.641l11.132%208.906zM32%2012.587l-11.163%2015.63c-.89%201.245-2.642%201.488-3.836.532l-7.497-5.997%205.984%2027.915h33.021l5.984-27.915L47%2028.749c-1.11.887-2.699.741-3.632-.281l-.204-.251L32%2012.587zM32%2032c2.946%200%205.333%202.388%205.333%205.333%200%202.946-2.387%205.334-5.333%205.334s-5.333-2.388-5.333-5.334C26.667%2034.388%2029.054%2032%2032%2032z'%20transform='translate(-66%20-1071)%20translate(66%201071)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",f8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M51.908%2034.75c1.9-1.233%201.896-3.26.013-4.514L19.376%208.577c-1.893-1.26-3.404-.391-3.376%201.968l.522%2042.888c.028%202.347%201.596%203.247%203.493%202.016L51.908%2034.75z'%20transform='translate(-1076%20-591)%20translate(1076%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",p8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M34.667%2029.333h18.666c3.556%200%203.556%205.334%200%205.334H34.667v18.666c0%203.556-5.334%203.556-5.334%200V34.667H10.667c-3.556%200-3.556-5.334%200-5.334h18.666V10.667c0-3.556%205.334-3.556%205.334%200v18.666z'%20transform='translate(-354%20-751)%20translate(354%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",_8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%2061.333C15.8%2061.333%202.667%2048.2%202.667%2032S15.8%202.667%2032%202.667%2061.333%2015.8%2061.333%2032%2048.2%2061.333%2032%2061.333zM32%2056c13.255%200%2024-10.745%2024-24S45.255%208%2032%208%208%2018.745%208%2032s10.745%2024%2024%2024zm2.213-18.63c0%201.473-1.194%202.667-2.666%202.667-1.473%200-2.667-1.194-2.667-2.667v-2.69c0-1.148.734-2.168%201.823-2.53.173-.058.532-.195%201.01-.407.809-.36%201.616-.79%202.354-1.282%201.835-1.223%202.813-2.528%202.813-3.786.004-2.6-1.868-4.824-4.432-5.264-2.563-.44-5.07%201.033-5.932%203.487-.49%201.389-2.012%202.119-3.4%201.63-1.39-.488-2.12-2.01-1.632-3.4%201.726-4.907%206.74-7.853%2011.866-6.974%205.126.88%208.871%205.328%208.863%2010.525%200%203.413-2.022%206.109-5.187%208.22-.975.649-1.94%201.173-2.813%201.578v.893zm-5.333%207.523c0-1.473%201.194-2.667%202.667-2.667%201.472%200%202.666%201.194%202.666%202.667v.44c0%201.473-1.194%202.667-2.666%202.667-1.473%200-2.667-1.194-2.667-2.667v-.31-.13z'%20transform='translate(-642%20-911)%20translate(642%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",m8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M46.14%2014.43l.562.537%206.631%206.167v-7.8c0-1.368%201.03-2.495%202.356-2.65l.311-.017c1.368%200%202.495%201.03%202.649%202.355l.018.311v16c0%201.368-1.03%202.495-2.356%202.65L56%2032H40c-1.473%200-2.667-1.194-2.667-2.667%200-1.367%201.03-2.494%202.356-2.648l.311-.018h11.452l-8.44-7.85c-5.964-5.893-15.168-7.182-22.563-3.156-7.38%204.018-11.172%2012.357-9.314%2020.455%201.859%208.107%208.935%2014.032%2017.362%2014.518%208.43.487%2016.162-4.585%2018.967-12.426.496-1.387%202.023-2.108%203.41-1.612%201.386.496%202.108%202.022%201.612%203.409C48.88%2050.082%2038.973%2056.582%2028.19%2055.959c-10.785-.623-19.862-8.222-22.254-18.65C3.542%2026.872%208.426%2016.135%2017.9%2010.977c9.227-5.024%2020.65-3.579%2028.241%203.453z'%20transform='translate(-930%20-751)%20translate(930%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",v8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333%202.667%2048.2%202.667%2032%2015.8%202.667%2032%202.667zm9.886%2019.447c-1.042-1.041-2.73-1.041-3.772%200L32%2028.23l-6.114-6.115-.134-.124c-1.047-.915-2.64-.874-3.638.124l-.124.134c-.915%201.047-.874%202.64.124%203.638L28.23%2032l-6.115%206.114-.124.134c-.915%201.047-.874%202.64.124%203.638l.134.124c1.047.915%202.64.874%203.638-.124L32%2035.77l6.114%206.115.134.124c1.047.915%202.64.874%203.638-.124l.124-.134c.915-1.047.874-2.64-.124-3.638L35.77%2032l6.115-6.114.124-.134c.915-1.047.874-2.64-.124-3.638z'%20transform='translate(-1220%20-271)%20translate(1220%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",g8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%2012'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cg%3e%3cg%3e%3cg%3e%3cpath%20class='fill'%20d='M.226%208.5c-.062%200-.12-.025-.164-.07C.02%208.387-.003%208.327%200%208.266c.069-1.447.495-2.678%201.268-3.66.618-.785%201.455-1.409%202.49-1.855.503-.217%201.329-.507%202.406-.655.372-.05.671-.07.862-.078V.225c0-.087.05-.166.128-.203.079-.037.172-.026.24.028l4.522%203.642c.053.042.084.106.084.173%200%20.068-.03.132-.082.175L7.395%207.777c-.067.056-.16.068-.24.03-.079-.036-.13-.115-.13-.202v-1.95c-1.134-.08-2.178.003-3.107.25-.782.207-1.484.53-2.087.96C.813%207.589.433%208.365.43%208.372.39%208.45.313%208.5.226%208.5z'%20transform='translate(-397.000000,%20-324.000000)%20translate(321.000000,%20-0.000000)%20translate(64.000000,%20324.000000)%20translate(11.999950,%200.000000)%20translate(0.000000,%202.000000)%20translate(6.000000,%204.250000)%20scale(-1,%201)%20translate(-6.000000,%20-4.250000)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",y8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M26.667%2048C14.885%2048%205.333%2038.449%205.333%2026.667c0-11.782%209.552-21.334%2021.334-21.334S48%2014.885%2048%2026.667c0%204.93-1.672%209.469-4.48%2013.081l13.67%2013.67c1.041%201.042%201.041%202.73%200%203.772-1.042%201.041-2.73%201.041-3.772%200l-13.67-13.67C36.136%2046.328%2031.597%2048%2026.667%2048zm0-5.333c8.836%200%2016-7.164%2016-16%200-8.837-7.164-16-16-16-8.837%200-16%207.163-16%2016%200%208.836%207.163%2016%2016%2016z'%20transform='translate(-1220%20-750)%20translate(1220%20750)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",E8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M59.795%2029.43L7.329%202.979C4.691%201.802%201.76%204.153%202.932%206.798l6.925%2018.609c.25.67.838%201.157%201.544%201.275l32.273%205.394L11.4%2037.47c-.706.118-1.295.604-1.544%201.275L2.932%2057.353c-.879%202.645%201.76%204.997%204.397%203.527l52.466-26.453c2.051-.882%202.051-3.82%200-4.996z'%20transform='translate(-930%20-271)%20translate(930%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",b8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%20fill='none'%3e%3cpath%20class='fill'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M21.9427%2024.3904C22.4634%2024.9111%2022.4634%2025.7554%2021.9427%2026.2761C21.422%2026.7968%2020.5778%2026.7968%2020.0571%2026.2761L10.7238%2016.9427C10.2031%2016.422%2010.2031%2015.5778%2010.7238%2015.0571L20.0571%205.72378C20.5778%205.20308%2021.422%205.20308%2021.9427%205.72378C22.4634%206.24448%2022.4634%207.0887%2021.9427%207.60939L13.5522%2015.9999L21.9427%2024.3904Z'/%3e%3c/svg%3e",C8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%2061.333C48.2%2061.333%2061.333%2048.2%2061.333%2032S48.2%202.667%2032%202.667%202.667%2015.8%202.667%2032c0%201.568%201.27%202.839%202.838%202.839s2.84-1.271%202.84-2.839C8.344%2018.935%2018.934%208.344%2032%208.344c13.065%200%2023.656%2010.591%2023.656%2023.656S45.065%2055.656%2032%2055.656c-1.568%200-2.839%201.27-2.839%202.839%200%201.567%201.271%202.838%202.839%202.838z'%20transform='translate(-786%20-911)%20translate(786%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",S8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M36.889%2043.013c6.608%200%2012.121%204.685%2012.43%2010.734l.014.537V58c0%201.472-1.194%202.666-2.666%202.666-1.368%200-2.495-1.03-2.65-2.355L44%2058v-3.716c0-3.07-2.87-5.718-6.636-5.925l-.475-.013H27.11c-3.838%200-6.86%202.525-7.096%205.557l-.015.381V58c0%201.472-1.194%202.666-2.667%202.666-1.367%200-2.494-1.03-2.648-2.355L14.667%2058v-3.716c0-6.126%205.324-10.986%2011.864-11.26l.58-.011h9.778zm18.578-17.291c.266%200%20.53.04.784.118%204.632%201.426%207.518%204.801%207.736%209.688l.013.594v12.8c0%201.472-1.194%202.666-2.667%202.666-1.367%200-2.494-1.03-2.648-2.355l-.018-.311V36.124c-.002-2.595-1.163-4.171-3.528-5.034l-.104-.037-2.502.002c-1.367%200-2.494-1.03-2.648-2.356l-.018-.31c0-1.368%201.03-2.495%202.355-2.65l.311-.017h2.934zm-44%200l.31.018c1.327.154%202.356%201.28%202.356%202.648l-.018.311c-.154%201.327-1.28%202.356-2.648%202.356l-2.51-.002-.119.042c-2.246.85-3.503%202.574-3.505%205.147v12.68l-.018.31c-.154%201.327-1.28%202.356-2.648%202.356C1.194%2051.588%200%2050.394%200%2048.922V36.24l.014-.591c.225-4.874%203.203-8.415%207.712-9.809.255-.078.52-.118.788-.118h2.953zM32%2019.958c5.512%200%2010%204.409%2010%209.871%200%205.463-4.488%209.872-10%209.872s-10-4.41-10-9.872%204.488-9.871%2010-9.871zm0%205.333c-2.588%200-4.667%202.043-4.667%204.538%200%202.496%202.08%204.538%204.667%204.538%202.588%200%204.667-2.042%204.667-4.538%200-2.495-2.08-4.538-4.667-4.538zM17.333%202.667c5.513%200%2010%204.409%2010%209.871%200%205.462-4.487%209.871-10%209.871-5.512%200-10-4.409-10-9.871%200-5.462%204.488-9.871%2010-9.871zm29.334%200c5.512%200%2010%204.409%2010%209.871%200%205.462-4.488%209.871-10%209.871-5.513%200-10-4.409-10-9.871%200-5.462%204.487-9.871%2010-9.871zM17.333%208c-2.587%200-4.666%202.042-4.666%204.538%200%202.496%202.079%204.538%204.666%204.538%202.588%200%204.667-2.042%204.667-4.538C22%2010.042%2019.921%208%2017.333%208zm29.334%200C44.079%208%2042%2010.042%2042%2012.538c0%202.496%202.079%204.538%204.667%204.538%202.587%200%204.666-2.042%204.666-4.538%200-2.496-2.079-4.538-4.666-4.538z'%20transform='translate(-930%20-431)%20translate(930%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",T8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M34.667%205.333c1.472%200%202.666%201.194%202.666%202.667%200%201.473-1.194%202.667-2.666%202.667H13.333c-1.472%200-2.666%201.194-2.666%202.666v37.334c0%201.143.72%202.118%201.73%202.497l28.384-28.383c1.041-1.041%202.73-1.041%203.771%200l8.781%208.78v-4.228c0-1.416%201.104-2.574%202.498-2.661l.169-.005c1.473%200%202.667%201.194%202.667%202.666v21.334c0%204.418-3.582%208-8%208H13.33c-4.417-.001-7.998-3.583-7.998-8V13.333c0-4.418%203.582-8%208-8zm8%2025.105L19.77%2053.333h30.897c1.416%200%202.574-1.104%202.661-2.498l.005-.168v-9.563L42.667%2030.438zM22.667%2016c3.682%200%206.666%202.985%206.666%206.667s-2.984%206.666-6.666%206.666c-3.682%200-6.667-2.984-6.667-6.666C16%2018.985%2018.985%2016%2022.667%2016zm0%205.333c-.737%200-1.334.597-1.334%201.334%200%20.736.597%201.333%201.334%201.333.736%200%201.333-.597%201.333-1.333%200-.737-.597-1.334-1.333-1.334zM56.78%203.448c1.041-1.042%202.73-1.042%203.771%200%201.042%201.041%201.042%202.73%200%203.771l-4.782%204.78%204.782%204.782c.998.998%201.04%202.59.125%203.638l-.125.133c-1.041%201.042-2.73%201.042-3.771%200l-4.782-4.781-4.78%204.781c-.998.998-2.59%201.04-3.638.125l-.133-.125c-1.042-1.041-1.042-2.73%200-3.771L48.228%2012l-4.78-4.781c-.998-.998-1.04-2.59-.125-3.638l.125-.133c1.041-1.042%202.73-1.042%203.771%200l4.78%204.78z'%20transform='translate(-354%20-591)%20translate(354%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",w8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2088%2048'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%3e%3cg%20transform='translate(-797%20-1231)%20translate(797%201231)'%3e%3crect%20class='fill'%20width='80'%20height='40'%20x='4'%20y='4'%20fill='%23000'%20rx='20'/%3e%3ccircle%20cx='24'%20cy='24'%20r='12'%20fill='%23FFF'/%3e%3cpath%20fill='%23FFF'%20d='M64%204c11.046%200%2020%208.954%2020%2020s-8.954%2020-20%2020H24C12.954%2044%204%2035.046%204%2024S12.954%204%2024%204h40zm0%202H24C14.059%206%206%2014.059%206%2024c0%209.764%207.774%2017.712%2017.47%2017.992L24%2042h40c9.941%200%2018-8.059%2018-18%200-9.764-7.774-17.712-17.47-17.992L64%206z'/%3e%3cpath%20class='fill'%20fill='%23000'%20d='M64%200H24C10.745%200%200%2010.745%200%2024s10.745%2024%2024%2024h40c13.255%200%2024-10.745%2024-24S77.255%200%2064%200zm0%204c11.046%200%2020%208.954%2020%2020s-8.954%2020-20%2020H24C12.954%2044%204%2035.046%204%2024S12.954%204%2024%204h40z'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",N8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2088%2048'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%3e%3cg%20transform='translate(-655%20-1231)%20translate(655%201231)'%3e%3crect%20class='fill'%20width='80'%20height='40'%20x='4'%20y='4'%20fill='%23000'%20rx='20'/%3e%3ccircle%20cx='64'%20cy='24'%20r='12'%20fill='%23FFF'/%3e%3cpath%20fill='%23FFF'%20d='M64%204c11.046%200%2020%208.954%2020%2020s-8.954%2020-20%2020H24C12.954%2044%204%2035.046%204%2024S12.954%204%2024%204h40zm0%202H24C14.059%206%206%2014.059%206%2024c0%209.764%207.774%2017.712%2017.47%2017.992L24%2042h40c9.941%200%2018-8.059%2018-18%200-9.764-7.774-17.712-17.47-17.992L64%206z'/%3e%3cpath%20class='fill'%20fill='%23000'%20d='M64%200H24C10.745%200%200%2010.745%200%2024s10.745%2024%2024%2024h40c13.255%200%2024-10.745%2024-24S77.255%200%2064%200zm0%204c11.046%200%2020%208.954%2020%2020s-8.954%2020-20%2020H24C12.954%2044%204%2035.046%204%2024S12.954%204%2024%204h40z'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",I8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M42.667%2037.333c7.17%200%2013.018%205.66%2013.32%2012.755l.013.579V56c0%201.473-1.194%202.667-2.667%202.667-1.367%200-2.494-1.03-2.648-2.356L50.667%2056v-5.333c0-4.26-3.33-7.743-7.53-7.987l-.47-.013H21.333c-4.26%200-7.743%203.33-7.986%207.53l-.014.47V56c0%201.473-1.194%202.667-2.666%202.667-1.368%200-2.495-1.03-2.65-2.356L8%2056v-5.333c0-7.17%205.66-13.019%2012.755-13.321l.578-.013h21.334zM32%205.333c7.364%200%2013.333%205.97%2013.333%2013.334C45.333%2026.03%2039.363%2032%2032%2032c-7.364%200-13.333-5.97-13.333-13.333%200-7.364%205.97-13.334%2013.333-13.334zm0%205.334c-4.418%200-8%203.581-8%208%200%204.418%203.582%208%208%208s8-3.582%208-8c0-4.419-3.582-8-8-8z'%20transform='translate(-642%20-431)%20translate(642%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",A8="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='icon-good'%3e%3cg%20id='Group'%3e%3cpath%20id='Union'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.3462%205.33563L12.3468%205.33479C12.7513%204.81247%2013.5284%204.81054%2013.9252%205.2978C14.088%205.49844%2014.1761%205.74147%2014.1761%205.98836V9.66626C14.1761%2010.184%2014.5958%2010.6038%2015.1136%2010.6038H18.6002C18.959%2010.6038%2019.3003%2010.7827%2019.5112%2011.0919L19.5121%2011.0932L19.8809%2011.6409L19.8839%2011.6453C20.0583%2011.9011%2020.1096%2012.2276%2020.0178%2012.5397L18.4861%2017.8555C18.3549%2018.3149%2017.9273%2018.6377%2017.4418%2018.6377H10.3672C10.0667%2018.6377%209.7739%2018.5109%209.56695%2018.2934L8.43645%2017.071V10.4237L12.3462%205.33563ZM7.61615%208.41391L10.861%204.19117L10.8625%204.18917C11.9879%202.73286%2014.2018%202.6675%2015.3795%204.11435C15.8013%204.63345%2016.0511%205.29067%2016.0511%205.98836V8.72876H18.6002C19.5906%208.72876%2020.5085%209.22411%2021.0626%2010.0389L21.065%2010.0424L21.4331%2010.589L21.4348%2010.5915C21.9333%2011.3243%2022.0617%2012.2328%2021.8174%2013.0662L21.8166%2013.0688L20.289%2018.3706C19.9252%2019.6429%2018.7556%2020.5127%2017.4418%2020.5127H10.3672C9.54424%2020.5127%208.75863%2020.1683%208.20092%2019.5778L8.19422%2019.5706L8.1279%2019.4989C7.75433%2020.1135%207.07847%2020.5239%206.30673%2020.5239H4.19222C3.01601%2020.5239%202.0625%2019.5704%202.0625%2018.3942V10.0937C2.0625%208.91744%203.01601%207.96393%204.19222%207.96393H6.30673C6.80046%207.96393%207.25496%208.13194%207.61615%208.41391ZM3.9375%2010.0937C3.9375%209.95297%204.05154%209.83893%204.19222%209.83893H6.30673C6.44741%209.83893%206.56145%209.95297%206.56145%2010.0937V18.3942C6.56145%2018.5349%206.44741%2018.6489%206.30673%2018.6489H4.19222C4.05154%2018.6489%203.9375%2018.5349%203.9375%2018.3942V10.0937Z'%20fill='black'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",M8="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='icon-good'%3e%3cg%20id='Group'%3e%3cpath%20id='Union'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.6538%2018.6644L11.6532%2018.6652C11.2487%2019.1875%2010.4716%2019.1895%2010.0748%2018.7022C9.91197%2018.5016%209.82395%2018.2585%209.82395%2018.0116V14.3337C9.82395%2013.816%209.40422%2013.3962%208.88645%2013.3962H5.39976C5.04099%2013.3962%204.69967%2013.2173%204.48881%2012.9081L4.48789%2012.9068L4.11909%2012.3591L4.11608%2012.3547C3.94167%2012.0989%203.8904%2011.7724%203.98222%2011.4603L5.51387%206.1445C5.64514%205.68505%206.07272%205.36229%206.55824%205.36229H13.6328C13.9333%205.36229%2014.2261%205.48913%2014.4331%205.70657L15.5635%206.92898V13.5763L11.6538%2018.6644ZM16.3838%2015.5861L13.139%2019.8088L13.1375%2019.8108C12.0121%2021.2671%209.79817%2021.3325%208.6205%2019.8857C8.19873%2019.3665%207.94895%2018.7093%207.94895%2018.0116V15.2712H5.39976C4.40936%2015.2712%203.49145%2014.7759%202.93741%2013.9611L2.93505%2013.9576L2.5669%2013.411L2.5652%2013.4085C2.0667%2012.6757%201.93834%2011.7672%202.18261%2010.9338L2.18339%2010.9312L3.71101%205.6294C4.07483%204.35709%205.24439%203.48729%206.55824%203.48729H13.6328C14.4558%203.48729%2015.2414%203.83167%2015.7991%204.42218L15.8058%204.42936L15.8721%204.50107C16.2457%203.88653%2016.9215%203.47606%2017.6933%203.47606H19.8078C20.984%203.47606%2021.9375%204.42956%2021.9375%205.60578V13.9063C21.9375%2015.0826%2020.984%2016.0361%2019.8078%2016.0361H17.6933C17.1995%2016.0361%2016.745%2015.8681%2016.3838%2015.5861ZM20.0625%2013.9063C20.0625%2014.047%2019.9485%2014.1611%2019.8078%2014.1611H17.6933C17.5526%2014.1611%2017.4385%2014.047%2017.4385%2013.9063V5.60578C17.4385%205.4651%2017.5526%205.35106%2017.6933%205.35106H19.8078C19.9485%205.35106%2020.0625%205.4651%2020.0625%205.60578V13.9063Z'%20fill='black'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",bi=()=>{},x8=e=>{const n=/iPhone|iPad|iPod/i.test(e),t=/WebKit/i.test(e),r=/Safari/i.test(e);return n&&(t||r)},Tp=e=>{const n={};return Object.entries(e).forEach(([t,r])=>{r!=null&&(n[t]=r)}),n};function ls(...e){return e.filter(Boolean).join(" ")}function O8(e){switch(e){case ye.ADD:return C.jsx(F7,{});case ye.ARROW_LEFT:return C.jsx(H7,{});case ye.ATTACH:return C.jsx(j7,{});case ye.BAN:return C.jsx(B7,{});case ye.BROADCAST:return C.jsx($7,{});case ye.CAMERA:return C.jsx(G7,{});case ye.CHANNELS:return C.jsx(z7,{});case ye.CHAT:return C.jsx(V7,{});case ye.CHAT_FILLED:return C.jsx(q7,{});case ye.CHEVRON_DOWN:return C.jsx(W7,{});case ye.CHEVRON_RIGHT:return C.jsx(K7,{});case ye.CLOSE:return C.jsx(Q7,{});case ye.COLLAPSE:return C.jsx(Y7,{});case ye.COPY:return C.jsx(Z7,{});case ye.CREATE:return C.jsx(X7,{});case ye.DISCONNECTED:return C.jsx(J7,{});case ye.DOCUMENT:return C.jsx(e8,{});case ye.DONE:return C.jsx(t8,{});case ye.DONE_ALL:return C.jsx(n8,{});case ye.DOWNLOAD:return C.jsx(r8,{});case ye.EDIT:return C.jsx(i8,{});case ye.EMOJI_MORE:return C.jsx(s8,{});case ye.ERROR:return C.jsx(a8,{});case ye.EXPAND:return C.jsx(o8,{});case ye.INFO:return C.jsx(l8,{});case ye.MEMBERS:return C.jsx(u8,{});case ye.MESSAGE:return C.jsx(c8,{});case ye.MORE:return C.jsx(d8,{});case ye.OPERATOR:return C.jsx(h8,{});case ye.PLAY:return C.jsx(f8,{});case ye.PLUS:return C.jsx(p8,{});case ye.QUESTION:return C.jsx(_8,{});case ye.REFRESH:return C.jsx(m8,{});case ye.REMOVE:return C.jsx(v8,{});case ye.REPLY:return C.jsx(g8,{});case ye.SEARCH:return C.jsx(y8,{});case ye.SEND:return C.jsx(E8,{});case ye.SLIDE_LEFT:return C.jsx(b8,{});case ye.SPINNER:return C.jsx(C8,{});case ye.SUPERGROUP:return C.jsx(S8,{});case ye.THUMBNAIL_NONE:return C.jsx(T8,{});case ye.TOGGLE_OFF:return C.jsx(w8,{});case ye.TOGGLE_ON:return C.jsx(N8,{});case ye.USER:return C.jsx(I8,{});case ye.FEEDBACK_LIKE:return C.jsx(A8,{});case ye.FEEDBACK_DISLIKE:return C.jsx(M8,{});default:return"icon"}}function Sn({className:e="",type:n,fillColor:t=Kn.DEFAULT,width:r=26,height:i=26,onClick:s=bi,children:a=null}){const o={width:typeof r=="string"?r:`${r}px`,minWidth:typeof r=="string"?r:`${r}px`,height:typeof i=="string"?i:`${i}px`,minHeight:typeof i=="string"?i:`${i}px`};return C.jsx("div",{className:[...Array.isArray(e)?e:[e],"sendbird-icon",P7(n),U7(t)].join(" "),role:"button",onClick:s,onKeyDown:s,tabIndex:0,style:o,children:a||O8(n)})}const Qt=ye,Yt=Kn;function R8(){const{stringSet:e}=D.useContext(Ki);return C.jsxs("div",{className:"sendbird-connection-status",children:[C.jsx(ut,{type:it.BODY_2,color:at.ONBACKGROUND_2,children:e.TRYING_TO_CONNECT}),C.jsx(Sn,{type:Qt.DISCONNECTED,fillColor:Yt.SENT,width:"14px",height:"14px"})]})}function k8({className:e="",width:n="26px",height:t="26px",children:r}){return C.jsx("div",{className:[...Array.isArray(e)?e:[e],"sendbird-loader"].join(" "),style:{width:typeof n=="string"?n:`${n}px`,height:typeof t=="string"?t:`${t}px`},children:r||C.jsx(Sn,{type:Qt.SPINNER,width:"26px",height:"26px"})})}const bn={LOADING:"LOADING",NO_CHANNELS:"NO_CHANNELS",NO_MESSAGES:"NO_MESSAGES",WRONG:"WRONG",SEARCH_IN:"SEARCH_IN",SEARCHING:"SEARCHING",NO_RESULTS:"NO_RESULTS"};function Wl({className:e="",type:n,iconSize:t,searchInString:r="",retryToConnect:i}){const{stringSet:s}=D.useContext(Ki);return C.jsxs("div",{className:[...Array.isArray(e)?e:[e],"sendbird-place-holder"].join(" "),children:[n===bn.LOADING&&C.jsx(k8,{width:t||"48px",height:t||"48px",children:C.jsx(Sn,{type:Qt.SPINNER,fillColor:Yt.PRIMARY,width:t||"48px",height:t||"48px"})}),(n===bn.NO_CHANNELS||n===bn.NO_MESSAGES||n===bn.WRONG)&&C.jsxs("div",{className:"sendbird-place-holder__body",children:[n===bn.NO_CHANNELS&&C.jsx(Sn,{className:"sendbird-place-holder__body__icon",type:Qt.CHAT,fillColor:Yt.ON_BACKGROUND_3,width:t||"64px",height:t||"64px"}),n===bn.WRONG&&C.jsx(Sn,{className:"sendbird-place-holder__body__icon",type:Qt.ERROR,fillColor:Yt.ON_BACKGROUND_3,width:t||"64px",height:t||"64px"}),n===bn.NO_MESSAGES&&C.jsx(Sn,{className:"sendbird-place-holder__body__icon",type:Qt.MESSAGE,fillColor:Yt.ON_BACKGROUND_3,width:t||"64px",height:t||"64px"}),C.jsxs(ut,{className:"sendbird-place-holder__body__text",type:it.BODY_1,color:at.ONBACKGROUND_2,children:[n===bn.NO_CHANNELS&&s.PLACE_HOLDER__NO_CHANNEL,n===bn.WRONG&&s.PLACE_HOLDER__WRONG,n===bn.NO_MESSAGES&&s.PLACE_HOLDER__NO_MESSAGES]}),i&&C.jsxs("div",{className:"sendbird-place-holder__body__reconnect",role:"button",onClick:i,onKeyPress:i,tabIndex:0,children:[C.jsx(Sn,{className:"sendbird-place-holder__body__reconnect__icon",type:Qt.REFRESH,fillColor:Yt.PRIMARY,width:"20px",height:"20px"}),C.jsx(ut,{className:"sendbird-place-holder__body__reconnect__text",type:it.BUTTON_1,color:at.PRIMARY,children:s.PLACE_HOLDER__RETRY_TO_CONNECT})]})]}),(n===bn.NO_RESULTS||n===bn.SEARCH_IN||n===bn.SEARCHING)&&C.jsxs("div",{className:"sendbird-place-holder__body--align-top",children:[n===bn.SEARCH_IN&&C.jsxs("div",{className:"sendbird-place-holder__body--align-top__text",children:[C.jsx(ut,{className:"sendbird-place-holder__body--align-top__text__search-in",type:it.BUTTON_2,color:at.ONBACKGROUND_2,children:s.SEARCH_IN}),C.jsx(ut,{className:"sendbird-place-holder__body--align-top__text__channel-name",type:it.BUTTON_2,color:at.PRIMARY,children:`'${r}`}),C.jsx(ut,{className:"sendbird-place-holder__body--align-top__text__quote",type:it.BUTTON_2,color:at.PRIMARY,children:"'"})]}),n===bn.SEARCHING&&C.jsx(ut,{className:"sendbird-place-hlder__body--align-top__searching",type:it.BODY_1,color:at.ONBACKGROUND_2,children:s.SEARCHING}),n===bn.NO_RESULTS&&C.jsx(ut,{className:"sendbird-place-hlder__body--align-top__no-result",type:it.BODY_1,color:at.ONBACKGROUND_2,children:s.NO_SEARCHED_MESSAGE})]})]})}const L8=e=>{var m,b,v,_;const{isLoading:n,isInvalid:t,channelUrl:r}=e,{renderChannelHeader:i,renderMessageList:s,renderMessageInput:a,renderTypingIndicator:o,renderPlaceholderLoader:l,renderPlaceholderInvalid:u}=Tp(e),{stores:c,config:d}=fn(),h=(m=c==null?void 0:c.sdkStore)==null?void 0:m.error,{logger:f,isOnline:p}=d;return n?C.jsx("div",{className:"sendbird-conversation",children:(l==null?void 0:l())||C.jsx(Wl,{type:bn.LOADING})}):r?t?C.jsx("div",{className:"sendbird-conversation",children:(u==null?void 0:u())||C.jsx(Wl,{type:bn.WRONG})}):h?C.jsx("div",{className:"sendbird-conversation",children:(u==null?void 0:u())||C.jsx(Wl,{type:bn.WRONG,retryToConnect:()=>{f.info("Channel: reconnecting")}})}):C.jsxs("div",{className:"sendbird-conversation",children:[i==null?void 0:i({className:"sendbird-conversation__channel-header"}),s==null?void 0:s(e),C.jsxs("div",{className:"sendbird-conversation__footer",children:[a==null?void 0:a(),C.jsxs("div",{className:"sendbird-conversation__footer__typing-indicator",children:[(o==null?void 0:o())||((b=d==null?void 0:d.groupChannel)==null?void 0:b.enableTypingIndicator)&&((_=(v=d==null?void 0:d.groupChannel)==null?void 0:v.typingIndicatorTypes)==null?void 0:_.has(U2.Text))&&C.jsx(D7,{channelUrl:r}),!p&&C.jsx(R8,{})]})]})]}):C.jsx("div",{className:"sendbird-conversation",children:(u==null?void 0:u())||C.jsx(Wl,{type:bn.NO_CHANNELS})})},zw=e=>{if(e!==null)return typeof e=="number"?`${e}px`:e};function p3(e,n,t){return`min(${n??t}, ${zw(e)??t})`}function D8({width:e,height:n,maxSideLength:t,defaultMinLength:r}){const i=D.useMemo(()=>p3(e,t,r),[e]),s=D.useMemo(()=>p3(n,t,r),[n]);return[i,s]}const U8=e=>{const[n,t]=D.useState(!1);return D.useLayoutEffect(()=>{const r=new IntersectionObserver(i=>{const[s]=i;s&&t(s.isIntersecting)});return e.current&&r.observe(e.current),()=>r.disconnect()},[e.current]),n},P8=e=>{const n=D.useRef(!1);return U8(e)&&(n.current=!0),n.current};function _3(e=!1,n=null){return e?"50%":zw(n)}const js=({className:e="",url:n,alt:t="",width:r=null,maxSideLength:i=null,height:s=null,circle:a=!1,fixedSize:o=!1,placeHolder:l=null,defaultComponent:u=null,borderRadius:c=null,onLoad:d=bi,onError:h=bi,shadeOnHover:f,isUploaded:p=!0})=>{const m=D.useRef(null),v=P8(m)?n:null,[_,E]=D.useState(!1),[S,w]=D.useState(!0),[N,I]=D8({width:r,height:s,maxSideLength:i,defaultMinLength:"400px"}),x=()=>typeof l=="function"?l({style:{width:"100%",minWidth:N,maxWidth:o?N:"400px",height:I,position:"absolute",display:"flex",justifyContent:"center",alignItems:"center"}}):l,A=()=>typeof u=="function"?u():u,O=()=>{const U=v?{backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover",backgroundImage:`url(${v})`}:{};return C.jsx("div",{className:"sendbird-image-renderer__image",style:{width:"100%",minWidth:N,maxWidth:o?N:"400px",height:I,position:"absolute",borderRadius:_3(a,c),...U}})};return N&&I&&C.jsxs("div",{ref:m,className:[...Array.isArray(e)?e:[e],"sendbird-image-renderer"].join(" "),style:{width:"100%",minWidth:N,maxWidth:o?N:"400px",height:I},children:[S&&x(),!v||_?A():O(),f&&C.jsx("div",{className:"sendbird-multiple-files-image-renderer__image-cover",style:{borderRadius:_3(a,c),...p?{}:{display:"inline-flex"}}}),v&&C.jsx(F8,{src:v,alt:t,onLoadStart:()=>{w(!0),E(!1)},onLoad:()=>{w(!1),E(!1),d()},onError:()=>{w(!1),E(!0),h()}})]})},F8=e=>{const{src:n,alt:t,onLoadStart:r=bi,onLoad:i=bi,onError:s=bi}=e,a=D.useRef({currSrc:n,prevSrc:n,loadFailure:!1});return a.current.currSrc!==n&&(a.current.prevSrc=a.current.currSrc,a.current.currSrc=n),D.useLayoutEffect(()=>{if(n){const o=a.current.prevSrc!==a.current.currSrc,l=a.current.loadFailure;(o||l)&&r()}},[n,navigator.onLine]),C.jsx("img",{className:"sendbird-image-renderer__hidden-image-loader",src:n,alt:t,onLoad:()=>{a.current.loadFailure=!1,i()},onError:()=>{a.current.loadFailure=!0,s()}})},D0=e=>{if(typeof e=="number")return e;if(typeof e=="string"){const n=Number.parseFloat(e);if(!Number.isNaN(n))return n}return NaN},Vw=e=>{const{width:n,height:t,text:r}=e;let i=D0(n),s=D0(t);return typeof i=="number"&&!Number.isNaN(i)&&(i*=.575),typeof s=="number"&&!Number.isNaN(s)&&(s*=.575),C.jsx("div",{className:ls("sendbird-avatar-img--default",r&&"text"),style:{width:n,height:t},children:r?C.jsx("div",{className:"sendbird-avatar-text",children:r}):C.jsx(Sn,{type:Qt.USER,fillColor:Yt.CONTENT,width:i,height:s})})},Bs="sendbird-avatar-img",H8=({src:e="",alt:n="",height:t,width:r,customDefaultComponent:i})=>{const s=()=>i?i({width:r,height:t}):C.jsx(Vw,{width:r,height:t});return typeof e=="string"?C.jsx(js,{className:Bs,url:e,height:t,width:r,alt:n,defaultComponent:s}):e&&e.length?e.length===1?C.jsx(js,{className:Bs,url:e[0],height:t,width:r,alt:n,defaultComponent:s}):e.length===2?C.jsxs("div",{className:"sendbird-avatar--inner__two-child",children:[C.jsx(js,{className:Bs,url:e[0],height:t,width:r,alt:n,defaultComponent:s}),C.jsx(js,{className:Bs,url:e[1],height:t,width:r,alt:n,defaultComponent:s})]}):e.length===3?C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"sendbird-avatar--inner__three-child--upper",children:C.jsx(js,{className:Bs,url:e[0],height:t,width:r,alt:n,defaultComponent:s})}),C.jsxs("div",{className:"sendbird-avatar--inner__three-child--lower",children:[C.jsx(js,{className:Bs,url:e[1],height:t,width:r,alt:n,defaultComponent:s}),C.jsx(js,{className:Bs,url:e[2],height:t,width:r,alt:n,defaultComponent:s})]})]}):C.jsx("div",{className:"sendbird-avatar--inner__four-child",children:e.slice(0,4).map((a,o)=>C.jsx(js,{className:Bs,url:a,height:t,width:r,alt:n,defaultComponent:s},`${a}-${o}`))}):C.jsx(js,{className:Bs,url:"",height:t,width:r,alt:n,defaultComponent:s})};function j8({className:e="",src:n="",alt:t="",width:r="56px",height:i="56px",zIndex:s=0,left:a="",bottom:o="",onClick:l,customDefaultComponent:u},c){return C.jsx("div",{className:[...Array.isArray(e)?e:[e],"sendbird-avatar"].join(" "),role:"button",ref:c,style:{height:i,width:r,zIndex:s,left:a,bottom:o},onClick:l,onKeyDown:l,tabIndex:0,children:C.jsx(H8,{src:n,width:r,height:i,alt:t,customDefaultComponent:u})})}const Ps=Dt.forwardRef(j8),qw="https://static.sendbird.com/sample/cover/cover_",K_=(e,n)=>e!=null&&e.coverUrl&&!new RegExp(`^${qw}`).test(e.coverUrl)?e.coverUrl:((e==null?void 0:e.members)||[]).filter(t=>t.userId!==n).map(({profileUrl:t})=>t),B8=e=>e!=null&&e.coverUrl?!!new RegExp(`^${qw}`).test(e.coverUrl):!0;function $8({channel:e,userId:n,theme:t,width:r=56,height:i=56}){const s=e==null?void 0:e.isBroadcast,a=D.useMemo(()=>s?B8(e)?C.jsx("div",{className:"sendbird-chat-header--default-avatar",style:{width:r,height:i,display:"flex",justifyContent:"center",alignItems:"center"},children:C.jsx(Sn,{type:Qt.BROADCAST,fillColor:Yt.CONTENT,width:r*.575,height:i*.575})}):C.jsx(Ps,{className:"sendbird-chat-header--avatar--broadcast-channel",src:K_(e,n),width:r,height:i,alt:e==null?void 0:e.name}):C.jsx(Ps,{className:"sendbird-chat-header--avatar--group-channel",src:K_(e,n),width:`${r}px`,height:`${i}px`,alt:e==null?void 0:e.name}),[K_(e,n),t]);return C.jsx(C.Fragment,{children:a})}const G8=(e,n,t)=>{var i;const r=t||$w;return!(e!=null&&e.name)&&!(e!=null&&e.members)?r.NO_TITLE:e!=null&&e.name&&e.name!=="Group Channel"?e.name:((i=e==null?void 0:e.members)==null?void 0:i.length)===1?r.NO_MEMBERS:e==null?void 0:e.members.filter(({userId:s})=>s!==n).map(({nickname:s})=>s||r.NO_NAME).join(", ")},z8=!1,Ww="sendbird--mobile-mode",Kw=Dt.createContext({breakpoint:z8,isMobile:!1}),m3=()=>{try{const e=document.querySelector("body");e==null||e.classList.add(Ww)}catch{}},v3=()=>{try{const e=document.querySelector("body");e==null||e.classList.remove(Ww)}catch{}},V8=e=>{const{children:n,logger:t}=e,r=(e==null?void 0:e.breakpoint)||!1,[i,s]=D.useState(!1);return D.useEffect(()=>{var o;const a=()=>{var l,u,c,d,h;if(typeof r=="boolean")s(r),r?((l=t==null?void 0:t.info)==null||l.call(t,"MediaQueryProvider: isMobile: true"),m3()):((u=t==null?void 0:t.info)==null||u.call(t,"MediaQueryProvider: isMobile: false"),v3());else{const f=window.matchMedia(`(max-width: ${r})`);(c=t==null?void 0:t.info)==null||c.call(t,`MediaQueryProvider: Screensize updated to ${r}`),f.matches?(s(!0),m3(),(d=t==null?void 0:t.info)==null||d.call(t,"MediaQueryProvider: isMobile: true")):(s(!1),v3(),(h=t==null?void 0:t.info)==null||h.call(t,"MediaQueryProvider: isMobile: false"))}};return a(),window.addEventListener("resize",a),(o=t==null?void 0:t.info)==null||o.call(t,"MediaQueryProvider: addEventListener",{updateSize:a}),()=>{var l;window.removeEventListener("resize",a),(l=t==null?void 0:t.info)==null||l.call(t,"MediaQueryProvider: removeEventListener",{updateSize:a})}},[r]),C.jsx(Kw.Provider,{value:{breakpoint:r,isMobile:i},children:n})},Ja=()=>Dt.useContext(Kw);var P2=(e=>(e.ONBACKGROUND_1="ONBACKGROUND_1",e.ONBACKGROUND_2="ONBACKGROUND_2",e.ONBACKGROUND_3="ONBACKGROUND_3",e.ONBACKGROUND_4="ONBACKGROUND_4",e.ONCONTENT_1="ONCONTENT_1",e.ONCONTENT_2="ONCONTENT_2",e.PRIMARY="PRIMARY",e.ERROR="ERROR",e))(P2||{});const Fv=e=>{switch(e){case"ONBACKGROUND_1":return"sendbird-color--onbackground-1";case"ONBACKGROUND_2":return"sendbird-color--onbackground-2";case"ONBACKGROUND_3":return"sendbird-color--onbackground-3";case"ONBACKGROUND_4":return"sendbird-color--onbackground-4";case"ONCONTENT_1":return"sendbird-color--oncontent-1";case"PRIMARY":return"sendbird-color--primary";case"ERROR":return"sendbird-color--error";default:return""}},q8=({className:e="",color:n=P2.ONBACKGROUND_1,disabled:t=!1,disableUnderline:r=!1,onClick:i=()=>{},children:s})=>C.jsx("div",{className:[...Array.isArray(e)?e:[e],Fv(n),r?"sendbird-textbutton--not-underline":"sendbird-textbutton",t?"sendbird-textbutton--disabled":""].join(" "),role:"button",tabIndex:0,onClick:a=>i(a),onKeyPress:a=>i(a),children:s}),U0=Dt.forwardRef((e,n)=>{const{className:t="",children:r,disabled:i=!1,width:s="56px",height:a="56px",type:o="button",style:l={},onBlur:u=()=>{},onClick:c=()=>{}}=e,[d,h]=D.useState(!1);return C.jsx("button",{className:[...Array.isArray(t)?t:[t],"sendbird-iconbutton",d?"sendbird-iconbutton--pressed":""].join(" "),disabled:i,ref:n,type:o,style:{...l,height:a,width:s},onClick:f=>{i||(h(!0),c==null||c(f))},onBlur:f=>{h(!1),u==null||u(f)},children:C.jsx("span",{className:"sendbird-iconbutton__inner",children:r})})}),W8=({className:e,renderLeft:n,renderRight:t,renderMiddle:r})=>{var s;let i=!1;try{i=(s=Ja==null?void 0:Ja())==null?void 0:s.isMobile}catch{}return C.jsxs("div",{className:`sendbird-ui-header ${e}`,children:[n?C.jsx("div",{className:ls("sendbird-ui-header__left",i?"sendbird-ui-header--is-mobile":"sendbird-ui-header--is-desktop"),children:n==null?void 0:n()}):null,C.jsx("div",{className:"sendbird-ui-header__middle",children:r==null?void 0:r()}),t?C.jsx("div",{className:ls("sendbird-ui-header__right",i?"sendbird-ui-header--is-mobile":"sendbird-ui-header--is-desktop"),children:t==null?void 0:t()}):null]})},K8=({title:e,subtitle:n,onClickSubtitle:t})=>C.jsxs("div",{className:"sendbird-ui-header__middle",children:[e&&C.jsx(ut,{className:"sendbird-ui-header__middle__title",type:it.H_2,color:at.ONBACKGROUND_1,children:e}),n&&(t?C.jsx(q8,{className:"sendbird-ui-header__middle__subtitle__container",onClick:t,disableUnderline:!0,children:C.jsx(ut,{className:"sendbird-ui-header__middle__subtitle",type:it.CAPTION_3,color:at.ONBACKGROUND_2,children:n})}):C.jsx(ut,{className:"sendbird-ui-header__middle__subtitle",type:it.BODY_1,color:at.ONBACKGROUND_2,children:n}))]}),Q8=({className:e,onClick:n,type:t,color:r,width:i="32px",height:s="32px",renderIcon:a=o=>C.jsx(Qw,{...o})})=>C.jsx(U0,{className:e,width:i,height:s,onClick:n,children:a({type:t,color:r})}),Qw=({className:e,type:n,color:t,width:r="22px",height:i="22px",onClick:s=bi})=>C.jsx(Sn,{className:e,type:n,fillColor:t,width:r,height:i,onClick:a=>s==null?void 0:s(a)}),ga=Object.assign(W8,{Title:K8,IconButton:Q8,Icon:Qw}),Y8=({className:e,currentChannel:n,showSearchIcon:t,onBackClick:r,onSearchClick:i,onChatHeaderActionClick:s,renderLeft:a,renderMiddle:o,renderRight:l})=>{const{config:u}=fn(),{userId:c,theme:d}=u,{isMobile:h}=Ja(),{stringSet:f}=vl(),p=(n==null?void 0:n.myMutedState)==="muted",m=G8(n,c,f);return C.jsx(ga,{className:`sendbird-chat-header ${e}`,renderLeft:a??(()=>C.jsxs(C.Fragment,{children:[h&&C.jsx(ga.Icon,{className:"sendbird-chat-header__icon_back",onClick:r,type:Qt.ARROW_LEFT,color:Yt.PRIMARY,width:"24px",height:"24px"}),C.jsx($8,{theme:d,channel:n,userId:c,height:32,width:32})]})),renderMiddle:o??(()=>C.jsx(ga.Title,{title:m})),renderRight:l??(()=>C.jsxs(C.Fragment,{children:[p&&C.jsx(ga.Icon,{className:"sendbird-chat-header__right__mute",type:Qt.NOTIFICATIONS_OFF_FILLED,color:Yt.ON_BACKGROUND_2,width:"24px",height:"24px"}),t&&!(n!=null&&n.isEphemeral)&&C.jsx(ga.IconButton,{className:"sendbird-chat-header__right__search",onClick:i,type:Qt.SEARCH,color:Yt.PRIMARY,renderIcon:b=>C.jsx(ga.Icon,{...b,width:"24px",height:"24px"})}),C.jsx(ga.IconButton,{className:"sendbird-chat-header__right__info",onClick:s,type:Qt.INFO,color:Yt.PRIMARY,renderIcon:b=>C.jsx(ga.Icon,{...b,width:"24px",height:"24px"})})]}))})},Z8=e=>{const n=Ai();return C.jsx(Y8,{...e,...n,currentChannel:n.currentChannel})};var Yw=(e=>(e.NONE="NONE",e.PENDING="PENDING",e.SENT="SENT",e.FAILED="FAILED",e.DELIVERED="DELIVERED",e.READ="READ",e))(Yw||{});const X8=(e,n)=>{var t,r,i;if(!n||!("sendingStatus"in n))return"NONE";if(n.sendingStatus==="pending")return"PENDING";if(n.sendingStatus==="failed")return"FAILED";if((t=e==null?void 0:e.isGroupChannel)!=null&&t.call(e)){if(((r=e.getUnreadMemberCount)==null?void 0:r.call(e,n))===0)return"READ";if(((i=e.getUndeliveredMemberCount)==null?void 0:i.call(e,n))===0)return"DELIVERED"}return n.sendingStatus==="succeeded"?"SENT":"NONE"};var P0=Symbol("@ts-pattern/matcher"),g3="@ts-pattern/anonymous-select-key",y3=function(e){return!!(e&&typeof e=="object")},Q_=function(e){return e&&!!e[P0]},J8=function e(n,t,r){if(y3(n)){if(Q_(n)){var i=n[P0]().match(t),s=i.matched,a=i.selections;return s&&a&&Object.keys(a).forEach(function(l){return r(l,a[l])}),s}if(!y3(t))return!1;if(Array.isArray(n))return!!Array.isArray(t)&&n.length===t.length&&n.every(function(l,u){return e(l,t[u],r)});if(n instanceof Map)return t instanceof Map&&Array.from(n.keys()).every(function(l){return e(n.get(l),t.get(l),r)});if(n instanceof Set){if(!(t instanceof Set))return!1;if(n.size===0)return t.size===0;if(n.size===1){var o=Array.from(n.values())[0];return Q_(o)?Array.from(t.values()).every(function(l){return e(o,l,r)}):t.has(o)}return Array.from(n.values()).every(function(l){return t.has(l)})}return Object.keys(n).every(function(l){var u,c=n[l];return(l in t||Q_(u=c)&&u[P0]().matcherType==="optional")&&e(c,t[l],r)})}return Object.is(t,n)};function gl(e){var n;return(n={})[P0]=function(){return{match:function(t){return{matched:!!e(t)}}}},n}gl(function(e){return!0});gl(function(e){return typeof e=="string"});gl(function(e){return typeof e=="number"});gl(function(e){return typeof e=="boolean"});gl(function(e){return typeof e=="bigint"});gl(function(e){return typeof e=="symbol"});gl(function(e){return e==null});function Gu(e){return new eP(e,[])}var eP=function(){function e(t,r){this.value=void 0,this.cases=void 0,this.value=t,this.cases=r}var n=e.prototype;return n.with=function(){var t=[].slice.call(arguments),r=t[t.length-1],i=[t[0]],s=[];return t.length===3&&typeof t[1]=="function"?(i.push(t[0]),s.push(t[1])):t.length>2&&i.push.apply(i,t.slice(1,t.length-1)),new e(this.value,this.cases.concat([{match:function(a){var o={},l=!!(i.some(function(u){return J8(u,a,function(c,d){o[c]=d})})&&s.every(function(u){return u(a)}));return{matched:l,value:l&&Object.keys(o).length?g3 in o?o[g3]:o:a}},handler:r}]))},n.when=function(t,r){return new e(this.value,this.cases.concat([{match:function(i){return{matched:!!t(i),value:i}},handler:r}]))},n.otherwise=function(t){return new e(this.value,this.cases.concat([{match:function(r){return{matched:!0,value:r}},handler:t}])).run()},n.exhaustive=function(){return this.run()},n.run=function(){for(var t=this.value,r=void 0,i=0;iArray.isArray(e)&&e.length>0?e.reduce((n,t)=>{switch(t){case"image":{n.push(...Kl.IMAGE);break}case"video":{n.push(...Kl.VIDEO);break}case"audio":{n.push(...Kl.AUDIO);break}default:{n.push(t);break}}return n},[]).join():Object.values(Kl).reduce((n,t)=>n.concat(t),[]).join(),E3=e=>e===""||e===null,F2=e=>Kl.IMAGE.indexOf(e)>=0,Zw=e=>Kl.VIDEO.indexOf(e)>=0,b3=e=>F2(e)||Zw(e),C3=(e,n)=>X8(e,n)===Yw.READ,nP=e=>e&&(e.isMultipleFilesMessage&&typeof e.isMultipleFilesMessage=="function"?e.isMultipleFilesMessage():e.messageType==="file"&&Object.prototype.hasOwnProperty.call(e,"fileInfoList")),rP=(e,n)=>Array.isArray(n)?[...e,...n]:(e.push(n),e),Hv=e=>Array.isArray(e)?e.reduce(rP,[]).join(" "):e;function Xw(e){var n;return e!=null&&e.extendedMessagePayload&&Array.isArray((n=e==null?void 0:e.extendedMessagePayload)==null?void 0:n.suggested_replies)?e.extendedMessagePayload.suggested_replies:[]}const iP=(e,n)=>{if(Array.isArray(e)&&Array.isArray(n)&&e.length===n.length){for(let t=0;t!!e&&"sender"in e,Jw=10,eN=15,ad="@";var tN=(e=>(e.PARENT="PARENT",e.THREAD="THREAD",e))(tN||{});function S3(e){if(e){const n=e.querySelectorAll("[data-sb-mention='true']");return Array.from(n)}return[]}function nN({ref:e},{logger:n}){const t=e.current,[r,i]=D.useState([]);return D.useLayoutEffect(()=>{if(t){const s=S3(t);i(s)}},[t]),D.useEffect(()=>{const s={childList:!0,subtree:!0},a=l=>{l.length>0&&i(S3(t))},o=new MutationObserver(a);return t&&o.observe(t,s),()=>{try{o.disconnect()}catch{n.error("useDirtyGetMentions: observer disconnect failed",{observer:o})}}},[t]),r}const T3=(e,n)=>{const[t,r]=D.useState(!1);D.useEffect(()=>{t?e():r(!0)},n)},sP=({children:e=void 0,className:n="",separatorColor:t=P2.ONBACKGROUND_4})=>C.jsxs("div",{className:[...Array.isArray(n)?n:[n],"sendbird-separator"].join(" "),children:[C.jsx("div",{className:["sendbird-separator__left",`${Fv(t)}--background-color`].join(" ")}),C.jsx("div",{className:"sendbird-separator__text",children:e||C.jsx(ut,{type:it.CAPTION_2,color:at.ONBACKGROUND_2,children:"Date Separator"})}),C.jsx("div",{className:["sendbird-separator__right",`${Fv(t)}--background-color`].join(" ")})]}),aP=e=>{var Le;const{message:n,children:t,hasSeparator:r,chainTop:i,chainBottom:s,handleScroll:a,channel:o,editInputDisabled:l,shouldRenderSuggestedReplies:u,isReactionEnabled:c,replyType:d,threadReplySelectType:h,nicknamesMap:f,scrollToMessage:p,toggleReaction:m,setQuoteMessage:b,onQuoteMessageClick:v,onReplyInThreadClick:_,onBeforeDownloadFileMessage:E,sendUserMessage:S,updateUserMessage:w,resendMessage:N,deleteMessage:I,setAnimatedMessageId:x,animatedMessageId:A,onMessageAnimated:O,usedInLegacy:U=!0}=e,{renderUserMentionItem:W,renderMessage:P,renderCustomSeparator:J,renderEditInput:V,renderFileViewer:H,renderRemoveMessageModal:Te}=Tp(e),{dateLocale:q,stringSet:ee}=vl(),ie=fn(),{userId:Ne,isOnline:X,userMention:oe,logger:te,groupChannel:ce}=ie.config,$=(oe==null?void 0:oe.maxMentionCount)||Jw;oe!=null&&oe.maxSuggestionCount;const[ke,B]=D.useState(!1);D.useState(!1),D.useState(!1);const[ae,de]=D.useState(!1),[Ee,se]=D.useState(""),[he,fe]=D.useState([]),[ve,me]=D.useState([]);D.useState(null),D.useState(null),D.useState([]);const pe=D.useRef(null),Ce=D.useRef(null);X&&ce.enableMention&&Ee.length>0&&!I0(o)&&A0(o);const ze=nN({ref:pe},{logger:te});(ze==null?void 0:ze.length)<$,D.useEffect(()=>{fe(he.filter(({userId:re})=>{const Re=ve.indexOf(re);return Re<0?!1:(ve.splice(Re,1),!0)}))},[ve]),T3(()=>{a==null||a()},[ke,(Le=n==null?void 0:n.reactions)==null?void 0:Le.length]),T3(()=>{a==null||a(!0)},[n==null?void 0:n.updatedAt,n==null?void 0:n.message]);const ue=D.useRef(u);D.useEffect(()=>{ue.current!==u?a==null||a():ue.current=u},[u]),D.useLayoutEffect(()=>{U&&(a==null||a(!0))},[]),D.useLayoutEffect(()=>{const re=[];return A===n.messageId&&(Ce!=null&&Ce.current)?(re.push(setTimeout(()=>{de(!0)},500)),re.push(setTimeout(()=>{x(null),O==null||O()},1600))):de(!1),()=>{re.forEach(Re=>clearTimeout(Re))}},[A,Ce.current,n.messageId]);const ne=D.useMemo(()=>(J==null?void 0:J({message:n}))??null,[n,J]),xe=()=>{if(t)return t;if(P){const re={...e,renderMessage:void 0};return P(re)}return C.jsx(C.Fragment,{})};return C.jsxs("div",{className:Hv(["sendbird-msg-hoc sendbird-msg--scroll-ref",ae?"sendbird-msg-hoc__animated":""]),style:t||P?void 0:{marginBottom:"2px"},"data-sb-message-id":n.messageId,"data-sb-created-at":n.createdAt,ref:Ce,children:[r&&(ne||C.jsx(sP,{children:C.jsx(ut,{type:it.CAPTION_2,color:at.ONBACKGROUND_2,children:L2(n.createdAt,ee.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR,{locale:q})})})),xe()]})},Du="sendbird-modal-root",oP=()=>C.jsx("div",{id:Du,className:Du});var Zn=(e=>(e.PRIMARY="PRIMARY",e.SECONDARY="SECONDARY",e.DANGER="DANGER",e.DISABLED="DISABLED",e.WARNING="WARNING",e))(Zn||{}),Uu=(e=>(e.BIG="BIG",e.SMALL="SMALL",e))(Uu||{});function lP(e){switch(e){case Zn.PRIMARY:return"sendbird-button--primary";case Zn.SECONDARY:return"sendbird-button--secondary";case Zn.DANGER:return"sendbird-button--danger";case Zn.DISABLED:return"sendbird-button--disabled";case Zn.WARNING:return"sendbird-button--warning";default:return""}}function uP(e){switch(e){case Uu.BIG:return"sendbird-button--big";case Uu.SMALL:return"sendbird-button--small";default:return""}}function ra({className:e,type:n=Zn.PRIMARY,size:t=Uu.BIG,children:r="Button",disabled:i=!1,onClick:s=()=>{},labelType:a=it.BUTTON_1,labelColor:o=at.ONCONTENT_1}){const l=[...Array.isArray(e)?e:[e],"sendbird-button",i?"sendbird-button__disabled":"",lP(n),uP(t)].join(" ");return C.jsx("button",{className:l,type:"button",onClick:s,disabled:i,children:C.jsx(ut,{className:"sendbird-button__text",type:a,color:o,children:r})})}/*! + */var ur=typeof Symbol=="function"&&Symbol.for,a2=ur?Symbol.for("react.element"):60103,o2=ur?Symbol.for("react.portal"):60106,sp=ur?Symbol.for("react.fragment"):60107,ap=ur?Symbol.for("react.strict_mode"):60108,op=ur?Symbol.for("react.profiler"):60114,lp=ur?Symbol.for("react.provider"):60109,up=ur?Symbol.for("react.context"):60110,l2=ur?Symbol.for("react.async_mode"):60111,cp=ur?Symbol.for("react.concurrent_mode"):60111,dp=ur?Symbol.for("react.forward_ref"):60112,hp=ur?Symbol.for("react.suspense"):60113,FA=ur?Symbol.for("react.suspense_list"):60120,fp=ur?Symbol.for("react.memo"):60115,pp=ur?Symbol.for("react.lazy"):60116,HA=ur?Symbol.for("react.block"):60121,jA=ur?Symbol.for("react.fundamental"):60117,BA=ur?Symbol.for("react.responder"):60118,$A=ur?Symbol.for("react.scope"):60119;function Ni(e){if(typeof e=="object"&&e!==null){var n=e.$$typeof;switch(n){case a2:switch(e=e.type,e){case l2:case cp:case sp:case op:case ap:case hp:return e;default:switch(e=e&&e.$$typeof,e){case up:case dp:case pp:case fp:case lp:return e;default:return n}}case o2:return n}}}function HS(e){return Ni(e)===cp}Rt.AsyncMode=l2;Rt.ConcurrentMode=cp;Rt.ContextConsumer=up;Rt.ContextProvider=lp;Rt.Element=a2;Rt.ForwardRef=dp;Rt.Fragment=sp;Rt.Lazy=pp;Rt.Memo=fp;Rt.Portal=o2;Rt.Profiler=op;Rt.StrictMode=ap;Rt.Suspense=hp;Rt.isAsyncMode=function(e){return HS(e)||Ni(e)===l2};Rt.isConcurrentMode=HS;Rt.isContextConsumer=function(e){return Ni(e)===up};Rt.isContextProvider=function(e){return Ni(e)===lp};Rt.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===a2};Rt.isForwardRef=function(e){return Ni(e)===dp};Rt.isFragment=function(e){return Ni(e)===sp};Rt.isLazy=function(e){return Ni(e)===pp};Rt.isMemo=function(e){return Ni(e)===fp};Rt.isPortal=function(e){return Ni(e)===o2};Rt.isProfiler=function(e){return Ni(e)===op};Rt.isStrictMode=function(e){return Ni(e)===ap};Rt.isSuspense=function(e){return Ni(e)===hp};Rt.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===sp||e===cp||e===op||e===ap||e===hp||e===FA||typeof e=="object"&&e!==null&&(e.$$typeof===pp||e.$$typeof===fp||e.$$typeof===lp||e.$$typeof===up||e.$$typeof===dp||e.$$typeof===jA||e.$$typeof===BA||e.$$typeof===$A||e.$$typeof===HA)};Rt.typeOf=Ni;FS.exports=Rt;var u2=FS.exports,GA=function(n,t,r,i){var s=r?r.call(i,n,t):void 0;if(s!==void 0)return!!s;if(n===t)return!0;if(typeof n!="object"||!n||typeof t!="object"||!t)return!1;var a=Object.keys(n),o=Object.keys(t);if(a.length!==o.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),u=0;uEe)&&(ue=(re=re.replace(" ",":")).length),0ce&&(ce=(oe=oe.trim()).charCodeAt(0)),ce){case 38:return oe.replace(v,"$1"+X.trim());case 58:return X.trim()+oe.replace(v,"$1"+X.trim());default:if(0<1*te&&0B.charCodeAt(8))break;case 115:$=$.replace(B,"-webkit-"+B)+";"+$;break;case 207:case 102:$=$.replace(B,"-webkit-"+(102te.charCodeAt(0)&&(te=te.trim()),Ne=te,te=[Ne],01?n-1:0),r=1;r0?" Args: "+t.join(", "):""))}var s6=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}var n=e.prototype;return n.indexOfGroup=function(t){for(var r=0,i=0;i=this.groupSizes.length){for(var i=this.groupSizes,s=i.length,a=s;t>=a;)(a<<=1)<0&&il(16,""+t);this.groupSizes=new Uint32Array(a),this.groupSizes.set(i),this.length=a;for(var o=s;o=this.length||this.groupSizes[t]===0)return r;for(var i=this.groupSizes[t],s=this.indexOfGroup(t),a=s+i,o=s;o=Fc&&(Fc=n+1),gf.set(e,n),i0.set(n,e)},l6="style["+Tu+'][data-styled-version="5.3.11"]',u6=new RegExp("^"+Tu+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),c6=function(e,n,t){for(var r,i=t.split(","),s=0,a=i.length;s=0;u--){var c=l[u];if(c&&c.nodeType===1&&c.hasAttribute(Tu))return c}}(t),s=i!==void 0?i.nextSibling:null;r.setAttribute(Tu,"active"),r.setAttribute("data-styled-version","5.3.11");var a=h6();return a&&r.setAttribute("nonce",a),t.insertBefore(r,s),r},f6=function(){function e(t){var r=this.element=$S(t);r.appendChild(document.createTextNode("")),this.sheet=function(i){if(i.sheet)return i.sheet;for(var s=document.styleSheets,a=0,o=s.length;a=0){var i=document.createTextNode(r),s=this.nodes[t];return this.element.insertBefore(i,s||null),this.length++,!0}return!1},n.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},n.getRule=function(t){return t0&&(d+=h+",")}),s+=""+u+c+'{content:"'+d+`"}/*!sc*/ +`}}}return s}(this)},e}(),v6=/(a)(d)/gi,wy=function(e){return String.fromCharCode(e+(e>25?39:97))};function sv(e){var n,t="";for(n=Math.abs(e);n>52;n=n/52|0)t=wy(n%52)+t;return(wy(n%52)+t).replace(v6,"$1-$2")}var zl=function(e,n){for(var t=n.length;t;)e=33*e^n.charCodeAt(--t);return e},zS=function(e){return zl(5381,e)};function g6(e){for(var n=0;n>>0);if(!t.hasNameForId(i,o)){var l=r(a,"."+o,void 0,i);t.insertRules(i,o,l)}s.push(o),this.staticRulesId=o}else{for(var u=this.rules.length,c=zl(this.baseHash,r.hash),d="",h=0;h>>0);if(!t.hasNameForId(i,b)){var v=r(d,"."+b,void 0,i);t.insertRules(i,b,v)}s.push(b)}}return s.join(" ")},e}(),b6=/^\s*\/\/.*$/gm,C6=[":","[",".","#"];function VS(e){var n,t,r,i,s=e===void 0?qa:e,a=s.options,o=a===void 0?qa:a,l=s.plugins,u=l===void 0?r0:l,c=new VA(o),d=[],h=function(m){function b(v){if(v)try{m(v+"}")}catch{}}return function(v,_,E,S,T,N,I,x,A,O){switch(v){case 1:if(A===0&&_.charCodeAt(0)===64)return m(_+";"),"";break;case 2:if(x===0)return _+"/*|*/";break;case 3:switch(x){case 102:case 112:return m(E[0]+_),"";default:return _+(O===0?"/*|*/":"")}case-2:_.split("/*|*/}").forEach(b)}}}(function(m){d.push(m)}),f=function(m,b,v){return b===0&&C6.indexOf(v[t.length])!==-1||v.match(i)?m:"."+n};function p(m,b,v,_){_===void 0&&(_="&");var E=m.replace(b6,""),S=b&&v?v+" "+b+" { "+E+" }":E;return n=_,t=b,r=new RegExp("\\"+t+"\\b","g"),i=new RegExp("(\\"+t+"\\b){2,}"),c(v||!b?"":b,S)}return c.use([].concat(u,[function(m,b,v){m===2&&v.length&&v[0].lastIndexOf(t)>0&&(v[0]=v[0].replace(r,f))},h,function(m){if(m===-2){var b=d;return d=[],b}}])),p.hash=u.length?u.reduce(function(m,b){return b.name||il(15),zl(m,b.name)},5381).toString():"",p}var p2=Dt.createContext();p2.Consumer;var _2=Dt.createContext(),S6=(_2.Consumer,new GS),av=VS();function qS(){return D.useContext(p2)||S6}function w6(){return D.useContext(_2)||av}function T6(e){var n=D.useState(e.stylisPlugins),t=n[0],r=n[1],i=qS(),s=D.useMemo(function(){var o=i;return e.sheet?o=e.sheet:e.target&&(o=o.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(o=o.reconstructWithOptions({useCSSOMInjection:!1})),o},[e.disableCSSOMInjection,e.sheet,e.target]),a=D.useMemo(function(){return VS({options:{prefix:!e.disableVendorPrefixes},plugins:t})},[e.disableVendorPrefixes,t]);return D.useEffect(function(){zA(t,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]),Dt.createElement(p2.Provider,{value:s},Dt.createElement(_2.Provider,{value:a},e.children))}var WS=function(){function e(n,t){var r=this;this.inject=function(i,s){s===void 0&&(s=av);var a=r.name+s.hash;i.hasNameForId(r.id,a)||i.insertRules(r.id,a,s(r.rules,a,"@keyframes"))},this.toString=function(){return il(12,String(r.name))},this.name=n,this.id="sc-keyframes-"+n,this.rules=t}return e.prototype.getName=function(n){return n===void 0&&(n=av),this.name+n.hash},e}(),N6=/([A-Z])/,I6=/([A-Z])/g,A6=/^ms-/,M6=function(e){return"-"+e.toLowerCase()};function Ty(e){return N6.test(e)?e.replace(I6,M6).replace(A6,"-ms-"):e}var Ny=function(e){return e==null||e===!1||e===""};function Nu(e,n,t,r){if(Array.isArray(e)){for(var i,s=[],a=0,o=e.length;a1?n-1:0),r=1;r?@[\\\]^`{|}~-]+/g,R6=/(^-|-$)/g;function m_(e){return e.replace(O6,"-").replace(R6,"")}var KS=function(e){return sv(zS(e)>>>0)};function Oh(e){return typeof e=="string"&&!0}var ov=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},k6=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function L6(e,n,t){var r=e[t];ov(n)&&ov(r)?QS(r,n):e[t]=n}function QS(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r=0||(O[x]=N[x]);return O}(n,["componentId"]),T=E&&E+"-"+(Oh(_)?_:m_(Cy(_)));return YS(_,xs({},S,{attrs:h,componentId:T}),t)},Object.defineProperty(p,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(_){this._foldedDefaultProps=r?QS({},e.defaultProps,_):_}}),Object.defineProperty(p,"toString",{value:function(){return"."+p.styledComponentId}}),i&&r6(p,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),p}var Se=function(e){return function n(t,r,i){if(i===void 0&&(i=qa),!u2.isValidElementType(r))return il(1,String(r));var s=function(){return t(r,i,ro.apply(void 0,arguments))};return s.withConfig=function(a){return n(t,r,xs({},i,{},a))},s.attrs=function(a){return n(t,r,xs({},i,{attrs:Array.prototype.concat(i.attrs,a).filter(Boolean)}))},s}(YS,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){Se[e]=Se(e)});function U6(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.all(t.map(o=>{if(o=H6(o),o in Ay)return;Ay[o]=!0;const l=o.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${u}`))return;const c=document.createElement("link");if(c.rel=l?"stylesheet":F6,l||(c.as="script",c.crossOrigin=""),c.href=o,a&&c.setAttribute("nonce",a),document.head.appendChild(c),l)return new Promise((d,h)=>{c.addEventListener("load",d),c.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${o}`)))})}))}return i.then(()=>n()).catch(s=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s})};var lv=function(e,n){return lv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},lv(e,n)};function w(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}lv(e,n),e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var M=function(){return M=Object.assign||function(e){for(var n,t=1,r=arguments.length;t0&&i[i.length-1])||c[0]!==6&&c[0]!==2)){a=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function Me(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var r,i,s=t.call(e),a=[];try{for(;(n===void 0||n-- >0)&&!(r=s.next()).done;)a.push(r.value)}catch(o){i={error:o}}finally{try{r&&!r.done&&(t=s.return)&&t.call(s)}finally{if(i)throw i.error}}return a}function Fe(e,n,t){if(arguments.length===2)for(var r,i=0,s=n.length;i0&&B6.indexOf(e)>=0},s0=function(e){return e>0&&$6.indexOf(e)>=0},Er=function(e,n){if(n===void 0&&(n=!1),n&&th(e))return!0;var t=typeof e=="object"&&e!==null&&e.hasOwnProperty("name")&&typeof e.name=="string"&&e.hasOwnProperty("uri")&&typeof e.uri=="string"&&e.hasOwnProperty("type")&&typeof e.type=="string";if(!t){if(typeof Blob<"u")return e instanceof Blob;if(typeof File<"u")return e instanceof File}return t},V6=function(e,n){if(e===n)return!0;if(e==null||n==null||e.length!==n.length)return!1;for(var t=Fe([],Me(e),!1).sort(),r=Fe([],Me(n),!1).sort(),i=0;i=1e3&&n<=9e3&&(this._typingIndicatorThrottle=n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"websocketResponseTimeout",{get:function(){return this._websocketResponseTimeout},set:function(n){k("number",n)&&n>=5e3&&n<=3e4&&(this._websocketResponseTimeout=n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionTokenRefreshTimeout",{get:function(){return this._sessionTokenRefreshTimeout},set:function(n){k("number",n)&&(n<60?n=60:n>1800&&(n=1800),this._sessionTokenRefreshTimeout=n)},enumerable:!1,configurable:!0}),e}(),ew={encrypt:function(e){return e},decrypt:function(e){return e}},xy=function(){function e(n){var t=n.store;this._preference=new Map,this._store=t}return e.prototype._savePreferenceKeys=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._store.set({key:this._keysAddress,value:Fe([],Me(this._preference.keys()),!1)})];case 1:return n.sent(),[2]}})})},e.prototype.init=function(n,t){var r;return t===void 0&&(t=1),y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return this._version=t,this._keysAddress=n,i="".concat(n,".metadata.version"),[4,this._store.get(i)];case 1:return s=p.sent(),[4,this._store.get(n)];case 2:return a=(r=p.sent())!==null&&r!==void 0?r:[],!s||s.versiond.channel.messageCollectionLastAccessedAt?1:-1},this._maxSize=Math.max(i,64),o?(this._clearOrder=a,this._customClearOrderComparator=o):this._clearOrder=Hc.MESSAGE_COLLECTION_ACCESSED_AT,this._enableAutoResend=u}return Object.defineProperty(e.prototype,"maxSize",{get:function(){return this._maxSize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrder",{get:function(){return this._clearOrder},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrderComparator",{get:function(){var n;return this._clearOrder===Hc.MESSAGE_COLLECTION_ACCESSED_AT?this._clearOrderComparatorUseMessageCollectionAccessedAt:(n=this._customClearOrderComparator)!==null&&n!==void 0?n:this._clearOrderComparatorUseMessageCollectionAccessedAt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableAutoResend",{get:function(){return this._enableAutoResend},enumerable:!1,configurable:!0}),e}();(function(e){e.FEED="feed",e.CHAT="chat"})(Nd||(Nd={}));var et,Bi,Ns,Tt,ar,Iu,lr,Bn,cs,ht,Oy,cv,dv,K6=function(){function e(){this.isRefreshing=!1}return Object.defineProperty(e.prototype,"hasSession",{get:function(){return!!this.sessionKey},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]},e}(),la=function(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(n==="x"?t:3&t|8).toString(16)})},Ry=function(){function e(n){var t=n.container;this._container={},this._container=t,this.key=la()}return e.prototype._register=function(n,t,r){var i;return n in this._container||(this._container[n]=new Map),(i=this._container[n])===null||i===void 0||i.set(this.key,{occurence:t,handler:r}),this},e.prototype.on=function(n,t){return this._register(n,-1,t)},e.prototype.once=function(n,t){return this._register(n,1,t)},e.prototype.close=function(){var n=this;Object.keys(this._container).forEach(function(t){var r;(r=n._container[t])===null||r===void 0||r.delete(n.key)})},e}(),fl=function(){function e(){this._container={}}return e.prototype.on=function(n,t){return new Ry({container:this._container}).on(n,t)},e.prototype.once=function(n,t){return new Ry({container:this._container}).once(n,t)},e.prototype.dispatch=function(n,t){var r,i,s=this._container[n];if(s){var a=[];try{for(var o=ge(s.keys()),l=o.next();!l.done;l=o.next()){var u=l.value,c=s.get(u);c.handler(t),c.occurence>0&&(c.occurence--,c.occurence===0&&a.push(u))}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}a.forEach(function(d){return s.delete(d)})}},e}(),Q6=function(){function e(){this._dispatcher=new fl}return e.prototype.on=function(n){return this._dispatcher.on("event",n)},e.prototype.once=function(n){return this._dispatcher.once("event",n)},e.prototype.dispatch=function(n){this._dispatcher.dispatch("event",n)},e}(),At=function(){},be=function(e){var n={};return e&&Object.keys(e).forEach(function(t){e[t]===void 0||Number.isNaN(e[t])||e[t]===null||(n[t]=e[t])}),n},Ie=function(e){if(e!=null){if(typeof e=="object"){if(Array.isArray(e)){for(var n=Fe([],Me(e),!1),t=0;t"u"&&typeof navigator<"u"&&navigator.product=="ReactNative"},ky=function(){return!(typeof navigator>"u"||!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent))};(function(e){e.CHAT="chat",e.CALLS="calls",e.DESK="desk",e.LIVE="live",e.UIKIT_CHAT="uikit-chat",e.UIKIT_LIVE="uikit-live"})(jc||(jc={})),function(e){e.ANDROID="android",e.IOS="ios",e.JS="js",e.UNREAL="unreal",e.UNITY="unity",e.REACT_NATIVE="react-native",e.FLUTTER="flutter"}(Wo||(Wo={})),function(e){e.ANDROID="android",e.IOS="ios",e.WEB="web",e.MOBILE_WEB="mobile_web",e.WINDOWS="windows"}(Ui||(Ui={}));var lM="^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",a0=function(){function e(){}return e.sendbirdSdkUserAgentWithExtension=function(n){var t=fv()?Wo.REACT_NATIVE:Wo.JS,r={main_sdk_info:"chat/".concat(t,"/").concat(Wa.SDK_VERSION),device_os_platform:ky()?"mobile-web":"web",os_version:Wa.OS_VERSION};if(n){var i=n.sendbirdExtensions,s=n.deviceOS,a=n.customData,o=a===void 0?{}:a;s.version&&(r.os_version=s.version),s.platform&&(r.device_os_platform=s.platform),i.length>0&&(r.extension_sdk_info=i.map(function(l){var u=l.product,c=l.platform,d=l.version;return"".concat(u,"/").concat(c,"/").concat(d)}).join(",")),Object.keys(r).forEach(function(l){return delete o[l]}),Object.keys(o).length>0&&(r=M(M({},r),o))}return Object.entries(r).map(function(l){var u=Me(l,2),c=u[0],d=u[1];return"".concat(c,"=").concat(d)}).join("&")},e.userAgentWithExtension=function(n){var t=fv()?"reactnative":"JS",r=n.sb_syncmanager?"s".concat(n.sb_syncmanager):"",i=n.sb_uikit?"u".concat(n.sb_uikit):"",s=n["device-os-platform"]?"o".concat(n["device-os-platform"]):ky()?"omobile-web":"oweb";return"".concat(t,"/c").concat(Wa.SDK_VERSION,"/").concat(r,"/").concat(i,"/").concat(s)},e}(),Or=function(){var e=this;this.promise=new Promise(function(n,t){e.resolve=n,e.reject=function(r){t(r)}})},o0=function(e){function n(t){var r=e.call(this)||this;return r.requestId=t.requestId,r}return w(n,e),n}(At),lw=function(e){function n(t){var r=e.call(this)||this;return r.method=Y.DELETE,r.path="".concat(nt(t.channelType),"/").concat(t.channelUrl,"/messages/").concat(t.messageId),t.messageToken&&(r.params=be({mesg_token:t.messageToken})),r}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var uM=function(e){function n(t,r,i){var s,a=this;return(a=e.call(this,t,"DELM",i)||this).channelUrl=i.channel_url,a.channelType=i.channel_type,a.messageId=Number(i.msg_id),a.silent=i.silent,a.messageCreatedAt=i.message_created_at?Number(i.message_created_at):-1,a.senderId=(s=i.sender_id)!==null&&s!==void 0?s:void 0,a}return w(n,e),n}(Et),cM=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,a=t.logger,o=t.useFetchCompat,l=o!==void 0&&o,u=this;this._abortControl=new Map,this._shouldImportFetchCompat=!1,this._iid=n,this._session=r,this._sdkState=i,this._dispatcher=s,this._dispatcher.on(function(c){c instanceof iM&&u.cancel(c.requestId)}),this._logger=a,this._shouldImportFetchCompat=l}return e.prototype._createHeader=function(n,t){var r=this._sdkState,i=r.appId,s=r.appVersion,a=r.sendbirdRuntimeEnvironment,o=M(M({},n.headers),{SendBird:"JS,".concat(Wa.OS_VERSION,",").concat(Wa.SDK_VERSION,",").concat(i).concat(s?",".concat(s):""),"SB-User-Agent":a0.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":a0.sendbirdSdkUserAgentWithExtension(a)});return t||(o["Content-Type"]="application/json; charset=utf-8"),n.requireAuth&&!n.hasSessionKey&&this._session.hasSession&&(o["Session-Key"]=this._session.sessionKey),o["App-Id"]=i,this._session&&this._session.authToken&&(o["Access-Token"]=this._session.authToken),o},e.prototype._statLogApiResult=function(n,t,r){this._dispatcher.dispatch(new g2(new Vt({type:St.API_RESULT,data:{endpoint:n.path,method:n.method,success:!r,latency:Date.now()-t,error_code:r==null?void 0:r.code,error_description:r==null?void 0:r.message}})))},e.prototype._isBodyRequired=function(n){var t=n.method;return t!==Y.GET&&(t!==Y.DELETE||n instanceof lw)},e.prototype.send=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T;return g(this,function(N){switch(N.label){case 0:t=n.path,r=n.method,i=n.uploadProgressHandler,s=this._isBodyRequired(n),a=this._sdkState.api,o="".concat(a.host).concat(t).concat(s?"":n.query),l=s?n.payload:null,u=this._createHeader(n,l instanceof FormData?l:void 0),c=new AbortController,d=c.signal,this._abortControl.set(n.requestId,c),h=Date.now(),N.label=1;case 1:return N.trys.push([1,13,,14]),i?[4,g_(()=>import("./__bundle-c839c84a-BFaoQucn.js"),[])]:[3,6];case 2:f=N.sent().xmlHttpRequest,N.label=3;case 3:return N.trys.push([3,5,,6]),[4,f(this._iid,{requestId:n.requestId,method:n.method,url:o,headers:u,data:l??void 0,uploadProgressHandler:i})];case 4:return p=N.sent(),this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,p];case 5:if(!((m=N.sent())instanceof L&&m.code===Ae.XMLHTTPREQUEST_NOT_SUPPORTED))throw m;return this._logger.debug("XMLHttpRequest is not available in this environment. progressHandler is ignored."),[3,6];case 6:return this._shouldImportFetchCompat&&(this._shouldImportFetchCompat=!1,(typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{fetch:null}).fetch=null),typeof AbortController<"u"?[3,8]:[4,g_(()=>import("./__bundle-2aa1a987-CHiZbB3_.js").then(I=>I._),[])];case 7:N.sent(),N.label=8;case 8:return typeof fetch=="function"?[3,10]:[4,g_(()=>import("./__bundle-347d730c-D-KRdieC.js").then(I=>I._),[])];case 9:N.sent(),N.label=10;case 10:return[4,fetch(o,{method:r,body:l,headers:u,signal:d})];case 11:return[4,(b=N.sent()).json()];case 12:if(v=N.sent(),b.ok||b.redirected)return this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,new le(this._iid,v)];if(v){if((_=new L(v)).isSessionExpiredError){if(this._dispatcher.dispatch(new Mu({reason:_.code})),!(n instanceof v2))return E=new Or,this._dispatcher.dispatch(new ow({request:n,deferred:E,error:_})),[2,E.promise];throw _}throw _.isSessionInvalidatedError&&this._dispatcher.dispatch(new Mu({reason:_.code})),_}throw L.requestFailed;case 13:throw S=N.sent(),this._statLogApiResult(n,h,S),S instanceof L?(this._logger.debug("fail api request",S),S):(S==null?void 0:S.name)==="AbortError"?L.requestCanceled:(T=L.networkError,this._logger.debug("fail api request",T),T);case 14:return[2]}})})},e.prototype.cancel=function(n){this._abortControl.has(n)&&(this._abortControl.get(n).abort(),this._abortControl.delete(n)),this._dispatcher.dispatch(new o0({requestId:n}))},e.prototype.cancelAll=function(){var n,t;try{for(var r=ge(this._abortControl.values()),i=r.next();!i.done;i=r.next())i.value.abort()}catch(s){n={error:s}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(n)throw n.error}}this._abortControl.clear(),this._dispatcher.dispatch(new o0({}))},e}(),Ke=function(){};function Bu(e){let n=e.length;for(;--n>=0;)e[n]=0}const y2=256,uw=286,Bc=30,$c=15,pv=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),yf=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),dM=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ly=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vs=new Array(576);Bu(Vs);const Gc=new Array(60);Bu(Gc);const Id=new Array(512);Bu(Id);const zc=new Array(256);Bu(zc);const E2=new Array(29);Bu(E2);const l0=new Array(Bc);function y_(e,n,t,r,i){this.static_tree=e,this.extra_bits=n,this.extra_base=t,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let Dy,Uy,Py;function E_(e,n){this.dyn_tree=e,this.max_code=0,this.stat_desc=n}Bu(l0);const cw=e=>e<256?Id[e]:Id[256+(e>>>7)],Ad=(e,n)=>{e.pending_buf[e.pending++]=255&n,e.pending_buf[e.pending++]=n>>>8&255},ti=(e,n,t)=>{e.bi_valid>16-t?(e.bi_buf|=n<>16-e.bi_valid,e.bi_valid+=t-16):(e.bi_buf|=n<{ti(e,t[2*n],t[2*n+1])},dw=(e,n)=>{let t=0;do t|=1&e,e>>>=1,t<<=1;while(--n>0);return t>>>1},hw=(e,n,t)=>{const r=new Array(16);let i,s,a=0;for(i=1;i<=$c;i++)a=a+t[i-1]<<1,r[i]=a;for(s=0;s<=n;s++){let o=e[2*s+1];o!==0&&(e[2*s]=dw(r[o]++,o))}},fw=e=>{let n;for(n=0;n{e.bi_valid>8?Ad(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Fy=(e,n,t,r)=>{const i=2*n,s=2*t;return e[i]{const r=e.heap[t];let i=t<<1;for(;i<=e.heap_len&&(i{let r,i,s,a,o=0;if(e.sym_next!==0)do r=255&e.pending_buf[e.sym_buf+o++],r+=(255&e.pending_buf[e.sym_buf+o++])<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Is(e,i,n):(s=zc[i],Is(e,s+y2+1,n),a=pv[s],a!==0&&(i-=E2[s],ti(e,i,a)),r--,s=cw(r),Is(e,s,t),a=yf[s],a!==0&&(r-=l0[s],ti(e,r,a)));while(o{const t=n.dyn_tree,r=n.stat_desc.static_tree,i=n.stat_desc.has_stree,s=n.stat_desc.elems;let a,o,l,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a>1;a>=1;a--)b_(e,t,a);l=s;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],b_(e,t,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,t[2*l]=t[2*a]+t[2*o],e.depth[l]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,t[2*a+1]=t[2*o+1]=l,e.heap[1]=l++,b_(e,t,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((c,d)=>{const h=d.dyn_tree,f=d.max_code,p=d.stat_desc.static_tree,m=d.stat_desc.has_stree,b=d.stat_desc.extra_bits,v=d.stat_desc.extra_base,_=d.stat_desc.max_length;let E,S,T,N,I,x,A=0;for(N=0;N<=$c;N++)c.bl_count[N]=0;for(h[2*c.heap[c.heap_max]+1]=0,E=c.heap_max+1;E<573;E++)S=c.heap[E],N=h[2*h[2*S+1]+1]+1,N>_&&(N=_,A++),h[2*S+1]=N,S>f||(c.bl_count[N]++,I=0,S>=v&&(I=b[S-v]),x=h[2*S],c.opt_len+=x*(N+I),m&&(c.static_len+=x*(p[2*S+1]+I)));if(A!==0){do{for(N=_-1;c.bl_count[N]===0;)N--;c.bl_count[N]--,c.bl_count[N+1]+=2,c.bl_count[_]--,A-=2}while(A>0);for(N=_;N!==0;N--)for(S=c.bl_count[N];S!==0;)T=c.heap[--E],T>f||(h[2*T+1]!==N&&(c.opt_len+=(N-h[2*T+1])*h[2*T],h[2*T+1]=N),S--)}})(e,n),hw(t,u,e.bl_count)},jy=(e,n,t)=>{let r,i,s=-1,a=n[1],o=0,l=7,u=4;for(a===0&&(l=138,u=3),n[2*(t+1)+1]=65535,r=0;r<=t;r++)i=a,a=n[2*(r+1)+1],++o{let r,i,s=-1,a=n[1],o=0,l=7,u=4;for(a===0&&(l=138,u=3),r=0;r<=t;r++)if(i=a,a=n[2*(r+1)+1],!(++o{ti(e,0+(r?1:0),3),pw(e),Ad(e,t),Ad(e,~t),t&&e.pending_buf.set(e.window.subarray(n,n+t),e.pending),e.pending+=t};var hM=(e,n,t,r)=>{let i,s,a=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=(o=>{let l,u=4093624447;for(l=0;l<=31;l++,u>>>=1)if(1&u&&o.dyn_ltree[2*l]!==0)return 0;if(o.dyn_ltree[18]!==0||o.dyn_ltree[20]!==0||o.dyn_ltree[26]!==0)return 1;for(l=32;l{let l;for(jy(o,o.dyn_ltree,o.l_desc.max_code),jy(o,o.dyn_dtree,o.d_desc.max_code),C_(o,o.bl_desc),l=18;l>=3&&o.bl_tree[2*Ly[l]+1]===0;l--);return o.opt_len+=3*(l+1)+5+5+4,l})(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=t+5,t+4<=i&&n!==-1?_w(e,n,t,r):e.strategy===4||s===i?(ti(e,2+(r?1:0),3),Hy(e,Vs,Gc)):(ti(e,4+(r?1:0),3),((o,l,u,c)=>{let d;for(ti(o,l-257,5),ti(o,u-1,5),ti(o,c-4,4),d=0;d{$y||((()=>{let n,t,r,i,s;const a=new Array(16);for(r=0,i=0;i<28;i++)for(E2[i]=r,n=0;n<1<>=7;i(e.pending_buf[e.sym_buf+e.sym_next++]=n,e.pending_buf[e.sym_buf+e.sym_next++]=n>>8,e.pending_buf[e.sym_buf+e.sym_next++]=t,n===0?e.dyn_ltree[2*t]++:(e.matches++,n--,e.dyn_ltree[2*(zc[t]+y2+1)]++,e.dyn_dtree[2*cw(n)]++),e.sym_next===e.sym_end),_tr_align:e=>{ti(e,2,3),Is(e,256,Vs),(n=>{n.bi_valid===16?(Ad(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=255&n.bi_buf,n.bi_buf>>=8,n.bi_valid-=8)})(e)}},Vc=(e,n,t,r)=>{let i=65535&e,s=e>>>16&65535,a=0;for(;t!==0;){a=t>2e3?2e3:t,t-=a;do i=i+n[r++]|0,s=s+i|0;while(--a);i%=65521,s%=65521}return i|s<<16};const pM=new Uint32Array((()=>{let e,n=[];for(var t=0;t<256;t++){e=t;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;n[t]=e}return n})());var rr=(e,n,t,r)=>{const i=pM,s=r+t;e^=-1;for(let a=r;a>>8^i[255&(e^n[a])];return~e},sl={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},pl={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:_M,_tr_stored_block:_v,_tr_flush_block:mM,_tr_tally:Ka,_tr_align:vM}=fM,{Z_NO_FLUSH:Qa,Z_PARTIAL_FLUSH:gM,Z_FULL_FLUSH:yM,Z_FINISH:Pi,Z_BLOCK:Gy,Z_OK:fr,Z_STREAM_END:zy,Z_STREAM_ERROR:vs,Z_DATA_ERROR:EM,Z_BUF_ERROR:S_,Z_DEFAULT_COMPRESSION:bM,Z_FILTERED:CM,Z_HUFFMAN_ONLY:Rh,Z_RLE:SM,Z_FIXED:wM,Z_DEFAULT_STRATEGY:TM,Z_UNKNOWN:NM,Z_DEFLATED:u0}=pl,Mo=258,Ls=262,tu=42,Eo=113,yc=666,bo=(e,n)=>(e.msg=sl[n],n),Vy=e=>2*e-(e>4?9:0),Na=e=>{let n=e.length;for(;--n>=0;)e[n]=0},IM=e=>{let n,t,r,i=e.w_size;n=e.hash_size,r=n;do t=e.head[--r],e.head[r]=t>=i?t-i:0;while(--n);n=i,r=n;do t=e.prev[--r],e.prev[r]=t>=i?t-i:0;while(--n)};let Ya=(e,n,t)=>(n<{const n=e.state;let t=n.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.output.set(n.pending_buf.subarray(n.pending_out,n.pending_out+t),e.next_out),e.next_out+=t,n.pending_out+=t,e.total_out+=t,e.avail_out-=t,n.pending-=t,n.pending===0&&(n.pending_out=0))},pi=(e,n)=>{mM(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,n),e.block_start=e.strstart,ci(e.strm)},Ct=(e,n)=>{e.pending_buf[e.pending++]=n},tc=(e,n)=>{e.pending_buf[e.pending++]=n>>>8&255,e.pending_buf[e.pending++]=255&n},mv=(e,n,t,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,n.set(e.input.subarray(e.next_in,e.next_in+i),t),e.state.wrap===1?e.adler=Vc(e.adler,n,i,t):e.state.wrap===2&&(e.adler=rr(e.adler,n,i,t)),e.next_in+=i,e.total_in+=i,i)},mw=(e,n)=>{let t,r,i=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match;const l=e.strstart>e.w_size-Ls?e.strstart-(e.w_size-Ls):0,u=e.window,c=e.w_mask,d=e.prev,h=e.strstart+Mo;let f=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do if(t=n,u[t+a]===p&&u[t+a-1]===f&&u[t]===u[s]&&u[++t]===u[s+1]){s+=2,t++;do;while(u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&sa){if(e.match_start=n,a=r,r>=o)break;f=u[s+a-1],p=u[s+a]}}while((n=d[n&c])>l&&--i!=0);return a<=e.lookahead?a:e.lookahead},Vl=e=>{const n=e.w_size;let t,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-Ls)&&(e.window.set(e.window.subarray(n,n+n-r),0),e.match_start-=n,e.strstart-=n,e.block_start-=n,e.insert>e.strstart&&(e.insert=e.strstart),IM(e),r+=n),e.strm.avail_in===0)break;if(t=mv(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=t,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ya(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ya(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead{let t,r,i,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,o=e.strm.avail_in;do{if(t=65535,i=e.bi_valid+42>>3,e.strm.avail_outr+e.strm.avail_in&&(t=r+e.strm.avail_in),t>i&&(t=i),t>8,e.pending_buf[e.pending-2]=~t,e.pending_buf[e.pending-1]=~t>>8,ci(e.strm),r&&(r>t&&(r=t),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,t-=r),t&&(mv(e.strm,e.strm.output,e.strm.next_out,t),e.strm.next_out+=t,e.strm.avail_out-=t,e.strm.total_out+=t)}while(a===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_wateri&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(mv(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,s=i>e.w_size?e.w_size:i,r=e.strstart-e.block_start,(r>=s||(r||n===Pi)&&n!==Qa&&e.strm.avail_in===0&&r<=i)&&(t=r>i?i:r,a=n===Pi&&e.strm.avail_in===0&&t===r?1:0,_v(e,e.block_start,t,a),e.block_start+=t,ci(e.strm)),a?3:1)},w_=(e,n)=>{let t,r;for(;;){if(e.lookahead=3&&(e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),t!==0&&e.strstart-t<=e.w_size-Ls&&(e.match_length=mw(e,t)),e.match_length>=3)if(r=Ka(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do e.strstart++,e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!=0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+1]);else r=Ka(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(pi(e,!1),e.strm.avail_out===0))return 1}return e.insert=e.strstart<2?e.strstart:2,n===Pi?(pi(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(pi(e,!1),e.strm.avail_out===0)?1:2},Tl=(e,n)=>{let t,r,i;for(;;){if(e.lookahead=3&&(e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,t!==0&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=Ka(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Ya(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!=0);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(pi(e,!1),e.strm.avail_out===0))return 1}else if(e.match_available){if(r=Ka(e,0,e.window[e.strstart-1]),r&&pi(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ka(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,n===Pi?(pi(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(pi(e,!1),e.strm.avail_out===0)?1:2};function _s(e,n,t,r,i){this.good_length=e,this.max_lazy=n,this.nice_length=t,this.max_chain=r,this.func=i}const Ec=[new _s(0,0,0,0,vw),new _s(4,4,8,4,w_),new _s(4,5,16,8,w_),new _s(4,6,32,32,w_),new _s(4,4,16,16,Tl),new _s(8,16,32,32,Tl),new _s(8,16,128,128,Tl),new _s(8,32,128,256,Tl),new _s(32,128,258,1024,Tl),new _s(32,258,258,4096,Tl)];function AM(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=u0,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Na(this.dyn_ltree),Na(this.dyn_dtree),Na(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Na(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Na(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const bc=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.status!==tu&&n.status!==57&&n.status!==69&&n.status!==73&&n.status!==91&&n.status!==103&&n.status!==Eo&&n.status!==yc?1:0},gw=e=>{if(bc(e))return bo(e,vs);e.total_in=e.total_out=0,e.data_type=NM;const n=e.state;return n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap===2?57:n.wrap?tu:Eo,e.adler=n.wrap===2?0:1,n.last_flush=-2,_M(n),fr},yw=e=>{const n=gw(e);var t;return n===fr&&((t=e.state).window_size=2*t.w_size,Na(t.head),t.max_lazy_match=Ec[t.level].max_lazy,t.good_match=Ec[t.level].good_length,t.nice_match=Ec[t.level].nice_length,t.max_chain_length=Ec[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n},qy=(e,n,t,r,i,s)=>{if(!e)return vs;let a=1;if(n===bM&&(n=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>9||t!==u0||r<8||r>15||n<0||n>9||s<0||s>wM||r===8&&a!==1)return bo(e,vs);r===8&&(r=9);const o=new AM;return e.state=o,o.strm=e,o.status=tu,o.wrap=a,o.gzhead=null,o.w_bits=r,o.w_size=1<qy(e,n,u0,15,8,TM),deflateInit2:qy,deflateReset:yw,deflateResetKeep:gw,deflateSetHeader:(e,n)=>bc(e)||e.state.wrap!==2?vs:(e.state.gzhead=n,fr),deflate:(e,n)=>{if(bc(e)||n>Gy||n<0)return e?bo(e,vs):vs;const t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===yc&&n!==Pi)return bo(e,e.avail_out===0?S_:vs);const r=t.last_flush;if(t.last_flush=n,t.pending!==0){if(ci(e),e.avail_out===0)return t.last_flush=-1,fr}else if(e.avail_in===0&&Vy(n)<=Vy(r)&&n!==Pi)return bo(e,S_);if(t.status===yc&&e.avail_in!==0)return bo(e,S_);if(t.status===tu&&t.wrap===0&&(t.status=Eo),t.status===tu){let i=u0+(t.w_bits-8<<4)<<8,s=-1;if(s=t.strategy>=Rh||t.level<2?0:t.level<6?1:t.level===6?2:3,i|=s<<6,t.strstart!==0&&(i|=32),i+=31-i%31,tc(t,i),t.strstart!==0&&(tc(t,e.adler>>>16),tc(t,65535&e.adler)),e.adler=1,t.status=Eo,ci(e),t.pending!==0)return t.last_flush=-1,fr}if(t.status===57){if(e.adler=0,Ct(t,31),Ct(t,139),Ct(t,8),t.gzhead)Ct(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),Ct(t,255&t.gzhead.time),Ct(t,t.gzhead.time>>8&255),Ct(t,t.gzhead.time>>16&255),Ct(t,t.gzhead.time>>24&255),Ct(t,t.level===9?2:t.strategy>=Rh||t.level<2?4:0),Ct(t,255&t.gzhead.os),t.gzhead.extra&&t.gzhead.extra.length&&(Ct(t,255&t.gzhead.extra.length),Ct(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=rr(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=69;else if(Ct(t,0),Ct(t,0),Ct(t,0),Ct(t,0),Ct(t,0),Ct(t,t.level===9?2:t.strategy>=Rh||t.level<2?4:0),Ct(t,3),t.status=Eo,ci(e),t.pending!==0)return t.last_flush=-1,fr}if(t.status===69){if(t.gzhead.extra){let i=t.pending,s=(65535&t.gzhead.extra.length)-t.gzindex;for(;t.pending+s>t.pending_buf_size;){let o=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>i&&(e.adler=rr(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=o,ci(e),t.pending!==0)return t.last_flush=-1,fr;i=0,s-=o}let a=new Uint8Array(t.gzhead.extra);t.pending_buf.set(a.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending+=s,t.gzhead.hcrc&&t.pending>i&&(e.adler=rr(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=73}if(t.status===73){if(t.gzhead.name){let i,s=t.pending;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(e.adler=rr(e.adler,t.pending_buf,t.pending-s,s)),ci(e),t.pending!==0)return t.last_flush=-1,fr;s=0}i=t.gzindexs&&(e.adler=rr(e.adler,t.pending_buf,t.pending-s,s)),t.gzindex=0}t.status=91}if(t.status===91){if(t.gzhead.comment){let i,s=t.pending;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(e.adler=rr(e.adler,t.pending_buf,t.pending-s,s)),ci(e),t.pending!==0)return t.last_flush=-1,fr;s=0}i=t.gzindexs&&(e.adler=rr(e.adler,t.pending_buf,t.pending-s,s))}t.status=103}if(t.status===103){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(ci(e),t.pending!==0))return t.last_flush=-1,fr;Ct(t,255&e.adler),Ct(t,e.adler>>8&255),e.adler=0}if(t.status=Eo,ci(e),t.pending!==0)return t.last_flush=-1,fr}if(e.avail_in!==0||t.lookahead!==0||n!==Qa&&t.status!==yc){let i=t.level===0?vw(t,n):t.strategy===Rh?((s,a)=>{let o;for(;;){if(s.lookahead===0&&(Vl(s),s.lookahead===0)){if(a===Qa)return 1;break}if(s.match_length=0,o=Ka(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,o&&(pi(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,a===Pi?(pi(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(pi(s,!1),s.strm.avail_out===0)?1:2})(t,n):t.strategy===SM?((s,a)=>{let o,l,u,c;const d=s.window;for(;;){if(s.lookahead<=Mo){if(Vl(s),s.lookahead<=Mo&&a===Qa)return 1;if(s.lookahead===0)break}if(s.match_length=0,s.lookahead>=3&&s.strstart>0&&(u=s.strstart-1,l=d[u],l===d[++u]&&l===d[++u]&&l===d[++u])){c=s.strstart+Mo;do;while(l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&us.lookahead&&(s.match_length=s.lookahead)}if(s.match_length>=3?(o=Ka(s,1,s.match_length-3),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0):(o=Ka(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++),o&&(pi(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,a===Pi?(pi(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(pi(s,!1),s.strm.avail_out===0)?1:2})(t,n):Ec[t.level].func(t,n);if(i!==3&&i!==4||(t.status=yc),i===1||i===3)return e.avail_out===0&&(t.last_flush=-1),fr;if(i===2&&(n===gM?vM(t):n!==Gy&&(_v(t,0,0,!1),n===yM&&(Na(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),ci(e),e.avail_out===0))return t.last_flush=-1,fr}return n!==Pi?fr:t.wrap<=0?zy:(t.wrap===2?(Ct(t,255&e.adler),Ct(t,e.adler>>8&255),Ct(t,e.adler>>16&255),Ct(t,e.adler>>24&255),Ct(t,255&e.total_in),Ct(t,e.total_in>>8&255),Ct(t,e.total_in>>16&255),Ct(t,e.total_in>>24&255)):(tc(t,e.adler>>>16),tc(t,65535&e.adler)),ci(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?fr:zy)},deflateEnd:e=>{if(bc(e))return vs;const n=e.state.status;return e.state=null,n===Eo?bo(e,EM):fr},deflateSetDictionary:(e,n)=>{let t=n.length;if(bc(e))return vs;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==tu||r.lookahead)return vs;if(i===1&&(e.adler=Vc(e.adler,n,t,0)),r.wrap=0,t>=r.w_size){i===0&&(Na(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(n.subarray(t-r.w_size,t),0),n=l,t=r.w_size}const s=e.avail_in,a=e.next_in,o=e.input;for(e.avail_in=t,e.next_in=0,e.input=n,Vl(r);r.lookahead>=3;){let l=r.strstart,u=r.lookahead-2;do r.ins_h=Ya(r,r.ins_h,r.window[l+3-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=2,Vl(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=a,e.input=o,e.avail_in=s,r.wrap=i,fr},deflateInfo:"pako deflate (from Nodeca project)"};const MM=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var _p={assign:function(e){const n=Array.prototype.slice.call(arguments,1);for(;n.length;){const t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const r in t)MM(t,r)&&(e[r]=t[r])}}return e},flattenChunks:e=>{let n=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Md[254]=Md[254]=1;var xd={string2buf:e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,r,i,s,a=e.length,o=0;for(i=0;i>>6,n[s++]=128|63&t):t<65536?(n[s++]=224|t>>>12,n[s++]=128|t>>>6&63,n[s++]=128|63&t):(n[s++]=240|t>>>18,n[s++]=128|t>>>12&63,n[s++]=128|t>>>6&63,n[s++]=128|63&t);return n},buf2string:(e,n)=>{const t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let r,i;const s=new Array(2*t);for(i=0,r=0;r4)s[i++]=65533,r+=o-1;else{for(a&=o===2?31:o===3?15:7;o>1&&r1?s[i++]=65533:a<65536?s[i++]=a:(a-=65536,s[i++]=55296|a>>10&1023,s[i++]=56320|1023&a)}}return((a,o)=>{if(o<65534&&a.subarray&&Ew)return String.fromCharCode.apply(null,a.length===o?a:a.subarray(0,o));let l="";for(let u=0;u{(n=n||e.length)>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(192&e[t])==128;)t--;return t<0||t===0?n:t+Md[e[t]]>n?t:n}},bw=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Cw=Object.prototype.toString,{Z_NO_FLUSH:xM,Z_SYNC_FLUSH:OM,Z_FULL_FLUSH:RM,Z_FINISH:kM,Z_OK:c0,Z_STREAM_END:LM,Z_DEFAULT_COMPRESSION:DM,Z_DEFAULT_STRATEGY:UM,Z_DEFLATED:PM}=pl;function Wc(e){this.options=_p.assign({level:DM,method:PM,chunkSize:16384,windowBits:15,memLevel:8,strategy:UM},e||{});let n=this.options;n.raw&&n.windowBits>0?n.windowBits=-n.windowBits:n.gzip&&n.windowBits>0&&n.windowBits<16&&(n.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new bw,this.strm.avail_out=0;let t=qc.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(t!==c0)throw new Error(sl[t]);if(n.header&&qc.deflateSetHeader(this.strm,n.header),n.dictionary){let r;if(r=typeof n.dictionary=="string"?xd.string2buf(n.dictionary):Cw.call(n.dictionary)==="[object ArrayBuffer]"?new Uint8Array(n.dictionary):n.dictionary,t=qc.deflateSetDictionary(this.strm,r),t!==c0)throw new Error(sl[t]);this._dict_set=!0}}function T_(e,n){const t=new Wc(n);if(t.push(e,!0),t.err)throw t.msg||sl[t.err];return t.result}Wc.prototype.push=function(e,n){const t=this.strm,r=this.options.chunkSize;let i,s;if(this.ended)return!1;for(s=n===~~n?n:n===!0?kM:xM,typeof e=="string"?t.input=xd.string2buf(e):Cw.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;)if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(s===OM||s===RM)&&t.avail_out<=6)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else{if(i=qc.deflate(t,s),i===LM)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=qc.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===c0;if(t.avail_out!==0){if(s>0&&t.next_out>0)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else if(t.avail_in===0)break}else this.onData(t.output)}return!0},Wc.prototype.onData=function(e){this.chunks.push(e)},Wc.prototype.onEnd=function(e){e===c0&&(this.result=_p.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var FM={Deflate:Wc,deflate:T_,deflateRaw:function(e,n){return(n=n||{}).raw=!0,T_(e,n)},gzip:function(e,n){return(n=n||{}).gzip=!0,T_(e,n)},constants:pl};const kh=16209;var HM=function(e,n){let t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x,A;const O=e.state;t=e.next_in,x=e.input,r=t+(e.avail_in-5),i=e.next_out,A=e.output,s=i-(n-e.avail_out),a=i+(e.avail_out-257),o=O.dmax,l=O.wsize,u=O.whave,c=O.wnext,d=O.window,h=O.hold,f=O.bits,p=O.lencode,m=O.distcode,b=(1<>>24,h>>>=E,f-=E,E=_>>>16&255,E===0)A[i++]=65535&_;else{if(!(16&E)){if(64&E){if(32&E){O.mode=16191;break e}e.msg="invalid literal/length code",O.mode=kh;break e}_=p[(65535&_)+(h&(1<>>=E,f-=E),f<15&&(h+=x[t++]<>>24,h>>>=E,f-=E,E=_>>>16&255,16&E){if(T=65535&_,E&=15,fo){e.msg="invalid distance too far back",O.mode=kh;break e}if(h>>>=E,f-=E,E=i-s,T>E){if(E=T-E,E>u&&O.sane){e.msg="invalid distance too far back",O.mode=kh;break e}if(N=0,I=d,c===0){if(N+=l-E,E2;)A[i++]=I[N++],A[i++]=I[N++],A[i++]=I[N++],S-=3;S&&(A[i++]=I[N++],S>1&&(A[i++]=I[N++]))}else{N=i-T;do A[i++]=A[N++],A[i++]=A[N++],A[i++]=A[N++],S-=3;while(S>2);S&&(A[i++]=A[N++],S>1&&(A[i++]=A[N++]))}break}if(64&E){e.msg="invalid distance code",O.mode=kh;break e}_=m[(65535&_)+(h&(1<>3,t-=S,f-=S<<3,h&=(1<{const l=o.bits;let u,c,d,h,f,p,m=0,b=0,v=0,_=0,E=0,S=0,T=0,N=0,I=0,x=0,A=null;const O=new Uint16Array(16),U=new Uint16Array(16);let W,P,J,V=null;for(m=0;m<=Lh;m++)O[m]=0;for(b=0;b=1&&O[_]===0;_--);if(E>_&&(E=_),_===0)return i[s++]=20971520,i[s++]=20971520,o.bits=1,0;for(v=1;v<_&&O[v]===0;v++);for(E0&&(e===0||_!==1))return-1;for(U[1]=0,m=1;m852||e===2&&I>592)return 1;for(;;){W=m-T,a[b]+1=p?(P=V[a[b]-p],J=A[a[b]-p]):(P=96,J=0),u=1<>T)+c]=W<<24|P<<16|J;while(c!==0);for(u=1<>=1;if(u!==0?(x&=u-1,x+=u):x=0,b++,--O[m]==0){if(m===_)break;m=n[t+a[b]]}if(m>E&&(x&h)!==d){for(T===0&&(T=E),f+=v,S=m-T,N=1<852||e===2&&I>592)return 1;d=x&h,i[d]=E<<24|S<<16|f-s}}return x!==0&&(i[f+x]=m-T<<24|64<<16),o.bits=E,0};const{Z_FINISH:Wy,Z_BLOCK:zM,Z_TREES:Dh,Z_OK:Co,Z_STREAM_END:VM,Z_NEED_DICT:qM,Z_STREAM_ERROR:ki,Z_DATA_ERROR:Ky,Z_MEM_ERROR:Qy,Z_BUF_ERROR:WM,Z_DEFLATED:Yy}=pl,mp=16180,Uh=16190,Hs=16191,N_=16192,I_=16194,Ph=16199,Fh=16200,A_=16206,en=16209,Zy=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function KM(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const xo=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.mode16211?1:0},Sw=e=>{if(xo(e))return ki;const n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=1&n.wrap),n.mode=mp,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(852),n.distcode=n.distdyn=new Int32Array(592),n.sane=1,n.back=-1,Co},ww=e=>{if(xo(e))return ki;const n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,Sw(e)},Tw=(e,n)=>{let t;if(xo(e))return ki;const r=e.state;return n<0?(t=0,n=-n):(t=5+(n>>4),n<48&&(n&=15)),n&&(n<8||n>15)?ki:(r.window!==null&&r.wbits!==n&&(r.window=null),r.wrap=t,r.wbits=n,ww(e))},Xy=(e,n)=>{if(!e)return ki;const t=new KM;e.state=t,t.strm=e,t.window=null,t.mode=mp;const r=Tw(e,n);return r!==Co&&(e.state=null),r};let M_,x_,Jy=!0;const QM=e=>{if(Jy){M_=new Int32Array(512),x_=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(Kc(1,e.lens,0,288,M_,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;Kc(2,e.lens,0,32,x_,0,e.work,{bits:5}),Jy=!1}e.lencode=M_,e.lenbits=9,e.distcode=x_,e.distbits=5},eE=(e,n,t,r)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<=s.wsize?(s.window.set(n.subarray(t-s.wsize,t),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(n.subarray(t-r,t-r+i),s.wnext),(r-=i)?(s.window.set(n.subarray(t-r,t),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whaveXy(e,15),inflateInit2:Xy,inflate:(e,n)=>{let t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x=0;const A=new Uint8Array(4);let O,U;const W=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(xo(e)||!e.output||!e.input&&e.avail_in!==0)return ki;t=e.state,t.mode===Hs&&(t.mode=N_),a=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,o=e.avail_in,u=t.hold,c=t.bits,d=o,h=l,I=Co;e:for(;;)switch(t.mode){case mp:if(t.wrap===0){t.mode=N_;break}for(;c<16;){if(o===0)break e;o--,u+=r[s++]<>>8&255,t.check=rr(t.check,A,2,0),u=0,c=0,t.mode=16181;break}if(t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",t.mode=en;break}if((15&u)!==Yy){e.msg="unknown compression method",t.mode=en;break}if(u>>>=4,c-=4,N=8+(15&u),t.wbits===0&&(t.wbits=N),N>15||N>t.wbits){e.msg="invalid window size",t.mode=en;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(A[0]=255&u,A[1]=u>>>8&255,t.check=rr(t.check,A,2,0)),u=0,c=0,t.mode=16182;case 16182:for(;c<32;){if(o===0)break e;o--,u+=r[s++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,t.check=rr(t.check,A,4,0)),u=0,c=0,t.mode=16183;case 16183:for(;c<16;){if(o===0)break e;o--,u+=r[s++]<>8),512&t.flags&&4&t.wrap&&(A[0]=255&u,A[1]=u>>>8&255,t.check=rr(t.check,A,2,0)),u=0,c=0,t.mode=16184;case 16184:if(1024&t.flags){for(;c<16;){if(o===0)break e;o--,u+=r[s++]<>>8&255,t.check=rr(t.check,A,2,0)),u=0,c=0}else t.head&&(t.head.extra=null);t.mode=16185;case 16185:if(1024&t.flags&&(f=t.length,f>o&&(f=o),f&&(t.head&&(N=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(s,s+f),N)),512&t.flags&&4&t.wrap&&(t.check=rr(t.check,r,f,s)),o-=f,s+=f,t.length-=f),t.length))break e;t.length=0,t.mode=16186;case 16186:if(2048&t.flags){if(o===0)break e;f=0;do N=r[s+f++],t.head&&N&&t.length<65536&&(t.head.name+=String.fromCharCode(N));while(N&&f>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=Hs;break;case 16189:for(;c<32;){if(o===0)break e;o--,u+=r[s++]<>>=7&c,c-=7&c,t.mode=A_;break}for(;c<3;){if(o===0)break e;o--,u+=r[s++]<>>=1,c-=1,3&u){case 0:t.mode=16193;break;case 1:if(QM(t),t.mode=Ph,n===Dh){u>>>=2,c-=2;break e}break;case 2:t.mode=16196;break;case 3:e.msg="invalid block type",t.mode=en}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(o===0)break e;o--,u+=r[s++]<>>16^65535)){e.msg="invalid stored block lengths",t.mode=en;break}if(t.length=65535&u,u=0,c=0,t.mode=I_,n===Dh)break e;case I_:t.mode=16195;case 16195:if(f=t.length,f){if(f>o&&(f=o),f>l&&(f=l),f===0)break e;i.set(r.subarray(s,s+f),a),o-=f,s+=f,l-=f,a+=f,t.length-=f;break}t.mode=Hs;break;case 16196:for(;c<14;){if(o===0)break e;o--,u+=r[s++]<>>=5,c-=5,t.ndist=1+(31&u),u>>>=5,c-=5,t.ncode=4+(15&u),u>>>=4,c-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=en;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,c-=3}for(;t.have<19;)t.lens[W[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,O={bits:t.lenbits},I=Kc(0,t.lens,0,19,t.lencode,0,t.work,O),t.lenbits=O.bits,I){e.msg="invalid code lengths set",t.mode=en;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,v=x>>>16&255,_=65535&x,!(b<=c);){if(o===0)break e;o--,u+=r[s++]<>>=b,c-=b,t.lens[t.have++]=_;else{if(_===16){for(U=b+2;c>>=b,c-=b,t.have===0){e.msg="invalid bit length repeat",t.mode=en;break}N=t.lens[t.have-1],f=3+(3&u),u>>>=2,c-=2}else if(_===17){for(U=b+3;c>>=b,c-=b,N=0,f=3+(7&u),u>>>=3,c-=3}else{for(U=b+7;c>>=b,c-=b,N=0,f=11+(127&u),u>>>=7,c-=7}if(t.have+f>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=en;break}for(;f--;)t.lens[t.have++]=N}}if(t.mode===en)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=en;break}if(t.lenbits=9,O={bits:t.lenbits},I=Kc(1,t.lens,0,t.nlen,t.lencode,0,t.work,O),t.lenbits=O.bits,I){e.msg="invalid literal/lengths set",t.mode=en;break}if(t.distbits=6,t.distcode=t.distdyn,O={bits:t.distbits},I=Kc(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,O),t.distbits=O.bits,I){e.msg="invalid distances set",t.mode=en;break}if(t.mode=Ph,n===Dh)break e;case Ph:t.mode=Fh;case Fh:if(o>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=s,e.avail_in=o,t.hold=u,t.bits=c,HM(e,h),a=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,o=e.avail_in,u=t.hold,c=t.bits,t.mode===Hs&&(t.back=-1);break}for(t.back=0;x=t.lencode[u&(1<>>24,v=x>>>16&255,_=65535&x,!(b<=c);){if(o===0)break e;o--,u+=r[s++]<>E)],b=x>>>24,v=x>>>16&255,_=65535&x,!(E+b<=c);){if(o===0)break e;o--,u+=r[s++]<>>=E,c-=E,t.back+=E}if(u>>>=b,c-=b,t.back+=b,t.length=_,v===0){t.mode=16205;break}if(32&v){t.back=-1,t.mode=Hs;break}if(64&v){e.msg="invalid literal/length code",t.mode=en;break}t.extra=15&v,t.mode=16201;case 16201:if(t.extra){for(U=t.extra;c>>=t.extra,c-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=16202;case 16202:for(;x=t.distcode[u&(1<>>24,v=x>>>16&255,_=65535&x,!(b<=c);){if(o===0)break e;o--,u+=r[s++]<>E)],b=x>>>24,v=x>>>16&255,_=65535&x,!(E+b<=c);){if(o===0)break e;o--,u+=r[s++]<>>=E,c-=E,t.back+=E}if(u>>>=b,c-=b,t.back+=b,64&v){e.msg="invalid distance code",t.mode=en;break}t.offset=_,t.extra=15&v,t.mode=16203;case 16203:if(t.extra){for(U=t.extra;c>>=t.extra,c-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=en;break}t.mode=16204;case 16204:if(l===0)break e;if(f=h-l,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=en;break}f>t.wnext?(f-=t.wnext,p=t.wsize-f):p=t.wnext-f,f>t.length&&(f=t.length),m=t.window}else m=i,p=a-t.offset,f=t.length;f>l&&(f=l),l-=f,t.length-=f;do i[a++]=m[p++];while(--f);t.length===0&&(t.mode=Fh);break;case 16205:if(l===0)break e;i[a++]=t.length,l--,t.mode=Fh;break;case A_:if(t.wrap){for(;c<32;){if(o===0)break e;o--,u|=r[s++]<{if(xo(e))return ki;let n=e.state;return n.window&&(n.window=null),e.state=null,Co},inflateGetHeader:(e,n)=>{if(xo(e))return ki;const t=e.state;return 2&t.wrap?(t.head=n,n.done=!1,Co):ki},inflateSetDictionary:(e,n)=>{const t=n.length;let r,i,s;return xo(e)?ki:(r=e.state,r.wrap!==0&&r.mode!==Uh?ki:r.mode===Uh&&(i=1,i=Vc(i,n,t,0),i!==r.check)?Ky:(s=eE(e,n,t,t),s?(r.mode=16210,Qy):(r.havedict=1,Co)))},inflateInfo:"pako inflate (from Nodeca project)"},YM=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Nw=Object.prototype.toString,{Z_NO_FLUSH:ZM,Z_FINISH:XM,Z_OK:Qc,Z_STREAM_END:O_,Z_NEED_DICT:R_,Z_STREAM_ERROR:JM,Z_DATA_ERROR:tE,Z_MEM_ERROR:ex}=pl;function Yc(e){this.options=_p.assign({chunkSize:65536,windowBits:15,to:""},e||{});const n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),!(n.windowBits>=0&&n.windowBits<16)||e&&e.windowBits||(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(15&n.windowBits||(n.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new bw,this.strm.avail_out=0;let t=Qs.inflateInit2(this.strm,n.windowBits);if(t!==Qc)throw new Error(sl[t]);if(this.header=new YM,Qs.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=xd.string2buf(n.dictionary):Nw.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=Qs.inflateSetDictionary(this.strm,n.dictionary),t!==Qc)))throw new Error(sl[t])}function k_(e,n){const t=new Yc(n);if(t.push(e),t.err)throw t.msg||sl[t.err];return t.result}Yc.prototype.push=function(e,n){const t=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=n===~~n?n:n===!0?XM:ZM,Nw.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),s=Qs.inflate(t,a),s===R_&&i&&(s=Qs.inflateSetDictionary(t,i),s===Qc?s=Qs.inflate(t,a):s===tE&&(s=R_));t.avail_in>0&&s===O_&&t.state.wrap>0&&e[t.next_in]!==0;)Qs.inflateReset(t),s=Qs.inflate(t,a);switch(s){case JM:case tE:case R_:case ex:return this.onEnd(s),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||s===O_))if(this.options.to==="string"){let l=xd.utf8border(t.output,t.next_out),u=t.next_out-l,c=xd.buf2string(t.output,l);t.next_out=u,t.avail_out=r-u,u&&t.output.set(t.output.subarray(l,l+u),0),this.onData(c)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(s!==Qc||o!==0){if(s===O_)return s=Qs.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},Yc.prototype.onData=function(e){this.chunks.push(e)},Yc.prototype.onEnd=function(e){e===Qc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=_p.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var tx={Inflate:Yc,inflate:k_,inflateRaw:function(e,n){return(n=n||{}).raw=!0,k_(e,n)},ungzip:k_,constants:pl};const{Deflate:nx,deflate:rx,deflateRaw:ix,gzip:sx}=FM,{Inflate:ax,inflate:ox,inflateRaw:lx,ungzip:ux}=tx;var As,cx={Deflate:nx,deflate:rx,deflateRaw:ix,gzip:sx,Inflate:ax,inflate:ox,inflateRaw:lx,ungzip:ux,constants:pl},nE=function(e){return y(void 0,void 0,void 0,function(){var n;return g(this,function(t){return n=cx.ungzip(e),[2,String.fromCharCode.apply(null,n)]})})};(function(e){e.CONNECTING="CONNECTING",e.OPEN="OPEN",e.CLOSED="CLOSED"})(As||(As={}));var lt,dx=function(e){function n(t,r){var i=r.sdkState,s=r.dispatcher,a=r.logger,o=e.call(this)||this;return o.lastActive=0,o._iid=t,o._sdkState=i,o._dispatcher=s,o._logger=a,o}return w(n,e),Object.defineProperty(n.prototype,"isOpen",{get:function(){return this.connectionState===As.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"connectionState",{get:function(){if(this._ws)switch(this._ws.readyState){case 0:return As.CONNECTING;case 1:return As.OPEN}return As.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ws",{get:function(){var t;return(t=this._ws)!==null&&t!==void 0?t:null},enumerable:!1,configurable:!0}),n.prototype._handleMessage=function(t){var r=this;t.split(` +`).forEach(function(i){if(i){var s=Et.createFromRawMessage(r._iid,i);if(r._logger.debug("receive websocket event",s),s.code==="LOGI")r.dispatch("message",s);else if(s.code==="PONG")r.dispatch("pong");else if(s.code==="EXPR"){if(s.payload){var a=new Mu(s.payload);a.expiresIn>=0&&r._dispatcher.dispatch(a)}}else s.code==="NOOP"||r.dispatch("message",s)}})},n.prototype.connect=function(t,r){var i=this;r===void 0&&(r=""),this._ws=new WebSocket(t,encodeURIComponent(r)),this._ws.onopen=function(){i._logger.debug("websocket open"),i.dispatch("open")},this._ws.onmessage=function(s){return y(i,void 0,void 0,function(){var a,o,l,u,c=this;return g(this,function(d){switch(d.label){case 0:return!((u=this._sdkState.websocket)===null||u===void 0)&&u.compression?s.data instanceof Blob?((a=new FileReader).readAsArrayBuffer(s.data),a.onloadend=function(){return y(c,void 0,void 0,function(){var h,f;return g(this,function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),[4,nE(a.result)];case 1:return h=p.sent(),this._handleMessage(h),[3,3];case 2:return f=p.sent(),this.error(f),[3,3];case 3:return[2]}})})},[3,7]):[3,1]:[3,8];case 1:if(!(s.data instanceof ArrayBuffer))return[3,6];d.label=2;case 2:return d.trys.push([2,4,,5]),[4,nE(new Uint8Array(s.data))];case 3:return o=d.sent(),this._handleMessage(o),[3,5];case 4:return l=d.sent(),this.error(l),[3,5];case 5:return[3,7];case 6:typeof s.data=="string"&&this._handleMessage(s.data),d.label=7;case 7:return[3,9];case 8:this._handleMessage(s.data),d.label=9;case 9:return[2]}})})},this._ws.onerror=function(){i._logger.debug("websocket error"),i.dispatch("error",L.networkError)},this._ws.onclose=function(){i._logger.debug("websocket close"),i.dispatch("close")},this.lastActive=Date.now()},n.prototype.disconnect=function(){var t=this;return new Promise(function(r){t._logger.debug("websocket disconnect"),t._ws?(t._ws.onopen=Ke,t._ws.onmessage=Ke,t._ws.onerror=Ke,t.connectionState!==As.CLOSED?(t._ws.onclose=function(){t.dispatch("close"),r()},t._ws.close(),t._ws=void 0):r()):r()})},n.prototype.send=function(t){if(!this._ws)throw L.connectionClosed;t.code!=="PING"?this.dispatch("ping-refresh"):this._logger.debug("send ping",t),this._ws.send(t.convertToMessage())},n.prototype.error=function(t){this._logger.debug("websocket error",t),this.dispatch("error",t)},n}(fl),Iw=function(e){function n(t){var r=t.all,i=t.feed,s=t.custom_types,a=t.ts,o=e.call(this)||this;return o.all=r,o.feed=i,o.customTypes=s,o.ts=a,o}return w(n,e),n}(At),hx=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,a=t.logger,o=t.useFetchCompat,l=o!==void 0&&o,u=this;this._ackStateMap=new Map,this._sdkState=i,this._dispatcher=s,this._logger=a,this.apiClient=new cM(n,{session:r,sdkState:i,dispatcher:s,logger:a,useFetchCompat:l}),this.websocketClient=new dx(n,{sdkState:i,dispatcher:s,logger:a}),this.websocketClient.on("message",function(c){if(c.payload.unread_cnt&&u._dispatcher.dispatch(new Iw(c.payload.unread_cnt)),c.requestId){if(u._ackStateMap.has(c.requestId)){var d=u._ackStateMap.get(c.requestId);c.code!=="EROR"?d.resolve(c):d.reject(new L({code:c.payload.code,message:c.payload.message}))}}else u._dispatcher.dispatch(c)}).on("close",function(){u._ackStateMap.forEach(function(c){c.reject(L.connectionClosed)}),u._ackStateMap.clear()})}return e.prototype._sendApiRequest=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.apiClient.send(n)];case 1:return[2,t.sent()]}})})},e.prototype._sendWebsocketRequest=function(n){return y(this,void 0,void 0,function(){var t,r,i,s=this;return g(this,function(a){if(!this._sdkState.websocket)throw L.connectionRequired;if(t=new Or,n.ackRequired){i=function(o,l){s._ackStateMap.has(n.requestId)&&(s._ackStateMap.delete(n.requestId),r&&(clearTimeout(r),r=null),o?(s._logger.debug("fail websocket request",n.requestId,o),t.reject(o)):(s._logger.debug("receive websocket ack",n.requestId,n),s._logger.debug("receive websocket ack",l),t.resolve(l)))};try{r=setTimeout(function(){return i(L.noAckTimeout)},this._sdkState.websocket.responseTimeout),this._ackStateMap.set(n.requestId,{resolve:function(o){return i(void 0,o)},reject:function(o){return i(o)}}),this.websocketClient.send(n)}catch(o){i(o)}}else try{this.websocketClient.send(n),t.resolve()}catch(o){t.reject(o)}return[2,t.promise]})})},e.prototype.send=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return n instanceof Z?[4,this._sendApiRequest(n)]:[3,2];case 1:case 3:return[2,t.sent()];case 2:return n instanceof Rr?[4,this._sendWebsocketRequest(n)]:[3,4];case 4:throw L.invalidParameters}})})},e.prototype.cancel=function(n){this.apiClient.cancel(n)},e.prototype.cancelAll=function(){this.apiClient.cancelAll()},e}();(function(e){e[e.NONE=0]="NONE",e[e.INITIALIZED=1]="INITIALIZED",e[e.CONNECTING=2]="CONNECTING",e[e.CONNECTED=3]="CONNECTED",e[e.RECONNECTING=4]="RECONNECTING",e[e.INTERNAL_DISCONNECTED=5]="INTERNAL_DISCONNECTED",e[e.EXTERNAL_DISCONNECTED=6]="EXTERNAL_DISCONNECTED",e[e.LOGOUT=7]="LOGOUT"})(lt||(lt={}));var Oo,Ro,Ii=function(e){function n(t){var r=t.stateType,i=e.call(this)||this;return i.stateType=r,i}return w(n,e),n}(At),Aw=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return w(n,e),n}(At),vv=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return w(n,e),n}(At),Mw=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return w(n,e),n}(At),rE=function(){function e(n){var t,r,i,s;this.isEnabled=(t=n.enabled)!==null&&t!==void 0&&t,this.feedChannels=(r=n.feed_channels)!==null&&r!==void 0?r:{},this.templateListToken=(i=n.template_list_token)!==null&&i!==void 0?i:null,this.settingsUpdatedAt=(s=n.settings_updated_at)!==null&&s!==void 0?s:0}return e.payloadify=function(n){return be(Ie({enabled:n.isEnabled,feed_channels:n.feedChannels,template_list_token:n.templateListToken,settings_updated_at:n.settingsUpdatedAt}))},e}(),b2=function(e){return"sendbird@".concat(e,"/changelog_include_chat_notifications")},iE=function(){function e(n){var t;this.lastUpdatedAt=(t=n.last_updated_at)!==null&&t!==void 0?t:0}return e.payloadify=function(n){return be(Ie({last_updated_at:n.lastUpdatedAt}))},e}(),sE=function(){function e(n){var t;this.token=(t=n.template_list_token)!==null&&t!==void 0?t:""}return e.payloadify=function(n){return be(Ie({template_list_token:n.token}))},e}(),Hh=function(){function e(n){n===void 0&&(n={min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}),this.minStatCount=n.min_stat_count,this.minInterval=1e3*n.min_interval,this.maxStatCountPerRequest=n.max_stat_count_per_request,this.lowerThreshold=n.lower_threshold,this.requestDelayRange=1e3*n.request_delay_range}return e.payloadify=function(n){return be(Ie({min_stat_count:n.minStatCount,min_interval:n.minInterval/1e3,max_stat_count_per_request:n.maxStatCountPerRequest,lower_threshold:n.lowerThreshold,request_delay_range:n.requestDelayRange/1e3}))},e}(),L_=function(){function e(n){n===void 0&&(n={default:{min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}}),this.default=new Hh(n.default),this.realTime=new Hh(n.realtime)}return e.payloadify=function(n){return be(Ie({default:Hh.payloadify(n.default),realtime:Hh.payloadify(n.realTime)}))},e}(),aE=1048576,fx=5;(function(e){e[e.NONE=0]="NONE",e[e.INCLUDE_REPLY=1]="INCLUDE_REPLY",e[e.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",e[e.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL"})(Oo||(Oo={})),function(e){e[e.NONE=0]="NONE",e[e.INCLUDE_REPLY=1]="INCLUDE_REPLY",e[e.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",e[e.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL"}(Ro||(Ro={}));var oE=function(){function e(n){var t,r,i,s,a,o,l;n===void 0&&(n={}),this.emojiHash=n.emoji_hash||"",this.uploadSizeLimit=n.file_upload_size_limit?n.file_upload_size_limit*aE:Number.MAX_SAFE_INTEGER,this.useReaction=!!n.use_reaction,this.applicationAttributes=(t=n.application_attributes)!==null&&t!==void 0?t:[],this.premiumFeatureList=(r=n.premium_feature_list)!==null&&r!==void 0?r:[],this.deviceTokenCache=this.applicationAttributes.includes("sdk_device_token_cache"),this.enabledChannelMemberShipHistory=this.applicationAttributes.includes("channel_membership_history"),this.multipleFilesMessageFileCountLimit=(i=n.multiple_file_send_max_size)!==null&&i!==void 0?i:5,this.allowSdkStatsUpload=(s=n.allow_sdk_log_ingestion)===null||s===void 0||s,this.unreadCountThreadingPolicy=(a=n.unread_cnt_threading_policy)!==null&&a!==void 0?a:Oo.NONE,this.lastMessageThreadingPolicy=(o=n.last_msg_threading_policy)!==null&&o!==void 0?o:Ro.NONE,this.uikitConfigInfo=new iE((l=n.uikit_config)!==null&&l!==void 0?l:{}),this.notificationInfo=n.notifications?new rE(n.notifications):null,this.messageTemplateInfo=n.message_template?new sE(n.message_template):null,this.statConfigInfo=n.log_publish_config?new L_(n.log_publish_config):new L_}return e.payloadify=function(n){return be(Ie({emoji_hash:n.emojiHash,file_upload_size_limit:n.uploadSizeLimit/aE,application_attributes:n.applicationAttributes,premium_feature_list:n.premiumFeatureList,use_reaction:n.useReaction,allow_sdk_log_ingestion:n.allowSdkStatsUpload,unread_cnt_threading_policy:n.unreadCountThreadingPolicy,last_msg_threading_policy:n.lastMessageThreadingPolicy,uikit_config:n.uikitConfigInfo?iE.payloadify(n.uikitConfigInfo):null,notifications:n.notificationInfo?rE.payloadify(n.notificationInfo):null,message_template:n.messageTemplateInfo?sE.payloadify(n.messageTemplateInfo):null,log_publish_config:n.statConfigInfo?L_.payloadify(n.statConfigInfo):null}))},e}(),Jn=function(){function e(n){this._iid="",this._iid=n}return e.payloadify=function(n){return{}},e}(),px=function(e){function n(t){var r=t.userId,i=t.metadata,s=e.call(this)||this;return s.method=Y.POST,s.path="".concat(tt,"/").concat(r,"/metadata"),s.params={metadata:i},s}return w(n,e),n}(Z),_x=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaData=r,i}return w(n,e),n}(le),mx=function(e){function n(t){var r=t.userId,i=t.metadata,s=t.upsert,a=e.call(this)||this;return a.method=Y.PUT,a.path="".concat(tt,"/").concat(r,"/metadata"),a.params={metadata:i,upsert:s},a}return w(n,e),n}(Z),vx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metadata=r,i}return w(n,e),n}(le),gx=function(e){function n(t){var r=t.userId,i=t.metadataKey,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(r,"/metadata/").concat(i),s}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var yx=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.DELETE,i.path="".concat(tt,"/").concat(r,"/metadata"),i}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var ql,nh=function(e,n){var t=JSON.parse(JSON.stringify(e));return t._iid&&delete t._iid,n&&n(t),t},Ko=function(e,n){var t=JSON.parse(JSON.stringify(e));return t},Q=function(e){return{do:function(n){e||n()},throw:function(n){if(!e)throw n}}};(function(e){e.ONLINE="online",e.OFFLINE="offline",e.NON_AVAILABLE="nonavailable"})(ql||(ql={}));var xu,Ze=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b=this;return(b=e.call(this,t)||this).userId=(s=(i=r.guest_id)!==null&&i!==void 0?i:r.user_id)!==null&&s!==void 0?s:"",b.nickname=(o=(a=r.nickname)!==null&&a!==void 0?a:r.name)!==null&&o!==void 0?o:"",b.plainProfileUrl=(u=(l=r.profile_url)!==null&&l!==void 0?l:r.image)!==null&&u!==void 0?u:"",b.requireAuth=(c=r.require_auth_for_profile_image)!==null&&c!==void 0&&c,b.metaData=(d=r.metadata)!==null&&d!==void 0?d:{},b.connectionStatus=ql.NON_AVAILABLE,Ve(ql,r.is_online)?b.connectionStatus=r.is_online:k("boolean",r.is_online)&&(b.connectionStatus=r.is_online?ql.ONLINE:ql.OFFLINE),b.isActive=(h=r.is_active)===null||h===void 0||h,b.lastSeenAt=(f=r.last_seen_at)!==null&&f!==void 0?f:null,b.preferredLanguages=r.preferred_languages?Fe([],Me(r.preferred_languages),!1):null,b.friendDiscoveryKey=(p=r.friend_discovery_key)!==null&&p!==void 0?p:null,b.friendName=(m=r.friend_name)!==null&&m!==void 0?m:null,b}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{user_id:t.userId,nickname:t.nickname,profile_url:t.plainProfileUrl,require_auth_for_profile_image:t.requireAuth,metadata:t.metaData,is_online:t.connectionStatus,is_active:t.isActive,last_seen_at:t.lastSeenAt,preferred_languages:t.preferredLanguages,friend_discovery_key:t.friendDiscoveryKey,friend_name:t.friendName})))},Object.defineProperty(n.prototype,"profileUrl",{get:function(){var t=R.of(this._iid).sessionManager;return this.requireAuth&&t.ekey?"".concat(this.plainProfileUrl,"?auth=").concat(t.ekey):this.plainProfileUrl},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){return nh(this)},n.prototype._isValidMetaData=function(t){return!Array.isArray(t)&&Object.keys(t).length>0&&Object.keys(t).map(function(r){return t[r]}).every(function(r){return k("string",r)})},n.prototype._applyMetaData=function(t,r){var i=this;r===void 0&&(r=!1),Object.keys(t).forEach(function(s){r?delete i.metaData[s]:i.metaData[s]=t[s]})},n.prototype.createMetaData=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(this._isValidMetaData(t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=new px({userId:i.userId,metadata:t}),[4,s.send(a)];case 1:return o=u.sent(),l=o.as(_x).metaData,this._applyMetaData(l),[2,this.metaData]}})})},n.prototype.updateMetaData=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(this._isValidMetaData(t)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new mx({userId:s.userId,metadata:t,upsert:r}),[4,a.send(o)];case 1:return l=c.sent(),u=l.as(vx).metadata,this._applyMetaData(u),[2,this.metaData]}})})},n.prototype.deleteMetaData=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return Q(k("string",t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=new gx({userId:i.userId,metadataKey:t}),[4,s.send(a)];case 1:return l.sent(),this._applyMetaData(((o={})[t]=!0,o),!0),[2,this.metaData]}})})},n.prototype.deleteAllMetaData=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new yx({userId:r.userId}),[4,i.send(s)];case 1:return a.sent(),this.metaData={},[2]}})})},n}(Jn),xw=function(e){function n(t){var r=t.userProfile,i=e.call(this)||this;return i.userProfile=r,i}return w(n,e),n}(At),gv=function(){function e(n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b;this._iid=n,this.appInfo=new oE(t),this.user=new Ze(n,t),this.connectedAt=(r=t.login_ts)!==null&&r!==void 0?r:0,this.firstConnectedAt=0,this.pingInterval=(i=t.ping_interval)!==null&&i!==void 0?i:15e3,this.pongTimeout=(s=t.pong_timeout)!==null&&s!==void 0?s:5e3,this.reconnectInterval=(o=(a=t.reconnect)===null||a===void 0?void 0:a.interval)!==null&&o!==void 0?o:3e3,this.reconnectMaxInterval=(u=(l=t.reconnect)===null||l===void 0?void 0:l.max_interval)!==null&&u!==void 0?u:6e4,this.reconnectRetryCount=(d=(c=t.reconnect)===null||c===void 0?void 0:c.retry_cnt)!==null&&d!==void 0?d:5,this.reconnectIntervalMultiple=(f=(h=t.reconnect)===null||h===void 0?void 0:h.mul)!==null&&f!==void 0?f:2,this.maxUnreadCountOnSuperGroup=(p=t.max_unread_cnt_on_super_group)!==null&&p!==void 0?p:100,this.profileImageEncryption=!!t.profile_image_encryption,this.concurrentCallLimit=(m=t.concurrent_call_limit)!==null&&m!==void 0?m:5,this.backOffDelay=(b=t.back_off_delay)!==null&&b!==void 0?b:100}return e.payloadify=function(n){return be(Ie(M(M(M({},Ze.payloadify(n.user)),oE.payloadify(n.appInfo)),{login_ts:n.connectedAt,ping_interval:n.pingInterval,pong_timeout:n.pongTimeout,reconnect:{interval:n.reconnectInterval,max_interval:n.reconnectMaxInterval,retry_cnt:n.reconnectRetryCount,mul:n.reconnectIntervalMultiple},max_unread_cnt_on_super_group:n.maxUnreadCountOnSuperGroup,profile_image_encryption:n.profileImageEncryption,concurrent_call_limit:n.concurrentCallLimit,back_off_delay:n.backOffDelay})))},e.prototype.apply=function(){var n=this.reconnectInterval,t=this.reconnectMaxInterval,r=this.reconnectIntervalMultiple,i=R.of(this._iid);i.sdkState.websocket&&(i.sdkState.websocket.pingInterval=1e3*this.pingInterval,i.sdkState.websocket.pongTimeout=1e3*this.pongTimeout,i.sdkState.websocket.reconnectMaxRetry=this.reconnectRetryCount,i.sdkState.websocket.reconnectRetryStrategy={calcTimeout:function(s){return s>0?1e3*Math.min(n*Math.pow(r,s-1),t):10}}),i.appInfo=this.appInfo,i.sessionManager.currentUser=this.user,i.connectedAt=this.connectedAt,this.firstConnectedAt||(i.firstConnectedAt=this.connectedAt),i.maxSuperGroupChannelUnreadCount=this.maxUnreadCountOnSuperGroup,i.concurrentCallLimit=this.concurrentCallLimit,i.backOffDelay=this.backOffDelay,i.dispatcher.dispatch(new xw({userProfile:this}))},e}(),Ow=function(e){function n(t){var r=t.request,i=r===void 0||r,s=t.features,a=s===void 0?{}:s,o=t.options,l=o===void 0?{}:o,u=t.statConfigInfo,c=e.call(this)||this;return c.request=i,c.features=M({localCache:!0,notification:!0},a),c.options=M({ingestion:!0},l),c.statConfigInfo=u,c}return w(n,e),n}(At),Ef=function(e){function n(t,r,i){var s,a,o,l,u=this;return(u=e.call(this,t,r,i)||this).error=null,u.services=[],u.userProfile=new gv(t,i),u.deviceTokenLastDeletedAt=(s=i.device_token_last_deleted_at)!==null&&s!==void 0?s:0,u.key=(a=i.key)!==null&&a!==void 0?a:"",u.ekey=(o=i.ekey)!==null&&o!==void 0?o:"",u.error=i.error?new L(i):null,u.services=(l=i.services)!==null&&l!==void 0?l:[],u}return w(n,e),n.asError=function(t){return new n("","LOGI",M({user_id:"",error:!0},t))},n.prototype.applyTo=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(a){switch(a.label){case 0:return this.error?[3,4]:(r=R.of(t))?(i=r.sessionManager,s=r.dispatcher,[4,i.login(this)]):[3,2];case 1:return a.sent(),this.userProfile.apply(),s.dispatch(new Ow({request:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_request_log_publish"),features:{localCache:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_feature_local_cache_log_publish"),notification:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_noti_stats_log_publish")},options:{ingestion:this.userProfile.appInfo.allowSdkStatsUpload},statConfigInfo:this.userProfile.appInfo.statConfigInfo})),[3,3];case 2:throw L.lostInstance;case 3:return[3,5];case 4:throw this.error;case 5:return[2]}})})},n}(Et),_l=function(){function e(){this.type=lt.NONE,this.name="none"}return e.prototype.run=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},e.prototype.onConnect=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onReconnect=function(n,t){return t.resetReconnectCount,y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onDisconnect=function(n,t){return t.error,t.autoReconnect,t.cause,y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onDisconnectWebSocket=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onLogout=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},e}(),Ue=function(e){return y(void 0,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e()];case 1:return t.sent(),[3,3];case 2:if(!((n=t.sent())instanceof L))throw n;return n.throwOutside(),[3,3];case 3:return[2]}})})},Lt=function(e){return y(void 0,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:case 2:return n.sent(),[3,3];case 3:return[2]}})})},Za=function(e){function n(t){t===void 0&&(t={});var r,i=this;return(i=e.call(this)||this).type=lt.LOGOUT,i.name="logout",i._wasPreviouslyConnected=(r=t.wasPreviouslyConnected)===null||r===void 0||r,i}return w(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){var r,i,s=this;return g(this,function(a){switch(a.label){case 0:return r=Date.now(),i=t.sdkState.userId,[4,t.logout()];case 1:return a.sent(),[4,t.changeState(new C2,r)];case 2:return a.sent(),this._wasPreviouslyConnected&&Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(o){return t.connectionHandlers.forEach(function(l){l.onDisconnected&&l.onDisconnected(i)}),[2]})})}),[2]}})})},n}(_l),vp=function(e){function n(){var t=e.call(this)||this;return t.type=lt.EXTERNAL_DISCONNECTED,t.name="externaldisconnected",t}return w(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,t.disconnect()];case 1:return r.sent(),[2]}})})},n.prototype.onConnect=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new yp({authToken:r}),i)];case 2:return s.sent(),[2]}})})},n.prototype.onReconnect=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new h0,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new Za,r)];case 1:return i.sent(),[2]}})})},n}(_l),d0=function(e){function n(t){var r=t.autoReconnect,i=e.call(this)||this;return i.type=lt.INTERNAL_DISCONNECTED,i.name="internaldisconnected",i._autoReconnect=!1,i._autoReconnect=r,i}return w(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.disconnect()];case 1:return i.sent(),this._autoReconnect?[4,t.changeState(new h0,r)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},n.prototype.onConnect=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new yp({authToken:r}),i)];case 2:return s.sent(),[2]}})})},n.prototype.onReconnect=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new h0,r)];case 1:return i.sent(),[2]}})})},n.prototype.onDisconnectWebSocket=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new vp,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new Za,r)];case 1:return i.sent(),[2]}})})},n}(_l),Br=function(e){return y(void 0,void 0,void 0,function(){return g(this,function(n){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},Rw=function(){function e(){}return e.prototype.calcTimeout=function(){return 0},e}(),gp=function(e,n,t){return t===void 0&&(t=new Rw),y(void 0,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:r=0,i=null,s=function(c){return i=c??new Error("Halted")},a=function(){r=0},u.label=1;case 1:if(!(n===-1||r=this._stateUpdatedAt?(this._currentState=t,this._stateUpdatedAt=r,this._dispatcher.dispatch(new Ii({stateType:t.type})),this._logger.debug("connection state changes to ".concat(t.name)),[4,this._currentState.run(this)]):[3,2];case 1:return i.sent(),[2,!0];case 2:return[2,!1]}})})},n.prototype._tryResolveConnectionRequest=function(){var t;return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=this._unresolvedLogi,this._websocketClient.isOpen&&r?(this._unresolvedLogi=void 0,r.error?[3,2]:[4,r.applyTo(this._iid)]):[3,3];case 1:return i.sent(),this._statLogConnection(),(t=this._pinger)===null||t===void 0||t.start(),this._connectionRequestQueue.forEach(function(s){return s.resolve()}),this._connectionRequestQueue=[],this.sdkState.appState="foreground",[3,3];case 2:this._sessionManager.session.authToken=void 0,(r.error.isSessionExpiredError||r.error.isSessionInvalidatedError)&&this._dispatcher.dispatch(new Mu({reason:r.error.code})),this._rejectConnectionRequest(r.error),i.label=3;case 3:return[2]}})})},n.prototype._rejectConnectionRequest=function(t){var r;if((r=this._pinger)===null||r===void 0||r.stop(),this.clearLoginTimer(),this._connectionRequestQueue.length>0){var i=this._connectionRequestQueue;this._connectionRequestQueue=[],i.forEach(function(s){return s.reject(t)}),this._statLogConnection(t)}},n.prototype._url=function(){var t,r=this.sdkState,i=r.appId,s=r.appVersion,a=r.userId,o=r.extensions,l=r.sendbirdRuntimeEnvironment,u=this.cacheContext.localCacheEnabled,c=this._sessionManager.session,d=(t=this.sdkState.websocket)===null||t===void 0?void 0:t.compression,h=!!(o??{}).sb_uikit,f=a0.userAgentWithExtension(o);return"".concat(this.sdkState.websocket.host,"/?p=JS&pv=").concat(encodeURIComponent(Wa.OS_VERSION),"&sv=").concat(encodeURIComponent(Wa.SDK_VERSION),"&ai=").concat(i).concat(s?"&av=".concat(s):"").concat(c.hasSession?"":"&user_id=".concat(encodeURIComponent(a)),"&pmce=").concat(d?1:0,"&active=1&device_token_types=").concat(encodeURIComponent(["gcm","huawei","apns"].join(",")),"&SB-User-Agent=").concat(f,"&SB-SDK-User-Agent=").concat(encodeURIComponent(a0.sendbirdSdkUserAgentWithExtension(l)),"&Request-Sent-Timestamp=").concat(Date.now().toString(),"&include_extra_data=").concat(encodeURIComponent(String(Lw))).concat(this._sessionManager.handler?"&expiring_session=1":"","&use_local_cache=").concat(u?1:0,"&include_poll_details=1").concat(h?"&uikit_config=1":"")},n.prototype._statLogConnection=function(t){var r;this._dispatcher.dispatch(new g2(new Vt({type:St.WEBSOCKET_CONNECT,data:{host_url:(r=this.sdkState.websocket)===null||r===void 0?void 0:r.host,success:!t,latency:Date.now()-this._connectingAt,error_code:t==null?void 0:t.code,error_description:t==null?void 0:t.message}})))},n.prototype.connect=function(t){var r;return t===void 0&&(t=""),y(this,void 0,void 0,function(){var i,s,a,o=this;return g(this,function(l){return this._logiProcessingTimer&&(clearTimeout(this._logiProcessingTimer),this._logiProcessingTimer=void 0,this._rejectConnectionRequest(L.connectionCanceled)),i=this._url(),s=new Or,this._connectionRequestQueue.push(s),this._connectionRequestQueue.length===1&&(this._connectingAt=Date.now(),this._loginTimer=setTimeout(function(){o._loginTimer=void 0,o._rejectConnectionRequest(L.loginTimeout)},(r=this.sdkState.websocket)===null||r===void 0?void 0:r.responseTimeout),a=this._sessionManager.session,t&&(a.authToken=t),a.sessionKey||a.authToken?this._websocketClient.connect(i,JSON.stringify(a.hasSession?{auth:a.sessionKey}:{token:a.authToken})):this._websocketClient.connect(i,JSON.stringify({}))),[2,s.promise]})})},n.prototype.cancelConnectForRetry=function(){this._dispatcher.dispatch(Ef.asError(L.connectionRenew))},n.prototype.disconnect=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._websocketClient.disconnect()];case 1:return t.sent(),[2]}})})},n.prototype.logout=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.sdkState.userId=void 0,this._unresolvedLogi=void 0,[4,this.disconnect()];case 1:return t.sent(),[4,this._sessionManager.clear()];case 2:return t.sent(),[2]}})})},n.prototype.clearLoginTimer=function(){this._loginTimer&&(clearTimeout(this._loginTimer),this._loginTimer=void 0)},n}(fl),Dw=function(e){function n(t){var r=t.appId,i=t.userId,s=t.services,a=t.includeUIKitConfig,o=a!==void 0&&a,l=t.localCacheEnabled,u=l===void 0||l,c=t.expiringSession,d=c===void 0||c,h=e.call(this)||this;return h.path="".concat(tt,"/").concat(i,"/login"),h.method=Y.POST,h.params=be({expiring_session:!!d,services:s,include_logi:!0,include_extra_data:String(Lw),uikit_config:o,use_local_cache:u,app_id:r}),h.requireAuth=!1,h}return w(n,e),n}(Z),wx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.logi=new Ef(t,"LOGI",r),i}return w(n,e),n}(le);(function(e){e[e.ALL=0]="ALL",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.API=2]="API"})(Ca||(Ca={}));var jt,uE,Tx=[v2,Dw],Nx=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,a=t.logger,o=t.useFetchCompat,l=o!==void 0&&o,u=this;this._currentConnectionStateType=lt.INITIALIZED,this._lazyCallQueue=[],this.commandRouter=new hx(n,{session:r,sdkState:i,dispatcher:s,logger:a,useFetchCompat:l}),this._session=r,this._logger=a,this._dispatcher=s,this._dispatcher.on(function(c){var d,h,f,p;if(c instanceof Ii){var m=c.stateType;switch(u._currentConnectionStateType=m,m){case lt.CONNECTED:u._resolveLazyCallQueue();break;case lt.INITIALIZED:case lt.INTERNAL_DISCONNECTED:case lt.EXTERNAL_DISCONNECTED:case lt.LOGOUT:u._rejectLazyCallQueue(!((f=u._session)===null||f===void 0)&&f.hasSession?L.connectionClosed:L.connectionRequired)}}else if(c instanceof Aw)!((p=u._session.services)===null||p===void 0)&&p.includes(Nd.CHAT)||u._resolveLazyCallQueue(Ca.API);else if(c instanceof vv||c instanceof Mw)u._rejectLazyCallQueue(L.connectionClosed);else if(c instanceof ow){var b=c.request,v=c.deferred,_=c.error;try{for(var E=ge(Tx),S=E.next();!S.done;S=E.next())if(b instanceof S.value)return void v.reject(_)}catch(T){d={error:T}}finally{try{S&&!S.done&&(h=E.return)&&h.call(E)}finally{if(d)throw d.error}}u._lazyCallQueue.push({command:b,deferred:v})}})}return Object.defineProperty(e.prototype,"isReady",{get:function(){return this._currentConnectionStateType===lt.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLazyCallActivated",{get:function(){return this._currentConnectionStateType===lt.CONNECTING||this._currentConnectionStateType===lt.RECONNECTING||this._session.isRefreshing},enumerable:!1,configurable:!0}),e.prototype._classifyLazyCallQueueByScope=function(n){var t,r=[],i=[];switch(n){case Ca.ALL:t=null;break;case Ca.WEBSOCKET:t=Rr;break;case Ca.API:t=Z}var s=!1;return this._lazyCallQueue.forEach(function(a){!t||a.command instanceof t||(s=!0),s?i.push(a):r.push(a)}),[r,i]},e.prototype._resolveLazyCallQueue=function(n){var t=this;n===void 0&&(n=Ca.ALL);var r=Me(this._classifyLazyCallQueueByScope(n),2),i=r[0],s=r[1];this._lazyCallQueue=s,i.forEach(function(a){return y(t,void 0,void 0,function(){var o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:o=a.command,l=a.deferred,(u=a.timeout)&&clearTimeout(u),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.send(o)];case 2:return c=h.sent(),l.resolve(c),[3,4];case 3:return d=h.sent(),l.reject(d),[3,4];case 4:return[2]}})})})},e.prototype._rejectLazyCallQueue=function(n,t){var r=this;t===void 0&&(t=Ca.ALL);var i=Me(this._classifyLazyCallQueueByScope(t),2),s=i[0],a=i[1];this._lazyCallQueue=a,s.forEach(function(o){return y(r,void 0,void 0,function(){var l,u;return g(this,function(c){return l=o.deferred,u=o.timeout,clearTimeout(u),l.reject(n),[2]})})})},e.prototype.send=function(n){return y(this,void 0,void 0,function(){var t,r,i=this;return g(this,function(s){switch(s.label){case 0:return n instanceof Rr?this.isReady?(this._logger.debug("send websocket request",n),[4,this.commandRouter.send(n)]):[3,2]:[3,4];case 1:case 5:case 7:return[2,s.sent()];case 2:if(this.isLazyCallActivated)return this._logger.debug("wait websocket request",n),t=new Or,this._lazyCallQueue.push({command:n,deferred:t,timeout:setTimeout(function(){return i.timeout(n.requestId)},1e4)}),[2,t.promise];throw this._logger.debug("fail websocket request"),L.connectionRequired;case 3:case 9:return[3,11];case 4:return n instanceof Z?this._session.hasSession?(this._logger.debug("send api request",n),[4,this.commandRouter.send(n)]):[3,6]:[3,10];case 6:return n.hasSessionKey?(this._logger.debug("send api request with tmp session key",n),[4,this.commandRouter.send(n)]):[3,8];case 8:if(this.isLazyCallActivated)return this._logger.debug("wait api request",n),t=new Or,this._lazyCallQueue.push({command:n,deferred:t,timeout:setTimeout(function(){return i.timeout(n.requestId)},1e4)}),[2,t.promise];throw r=L.connectionRequired,this._logger.debug("fail api request",r),r;case 10:throw L.invalidCommand;case 11:return[2]}})})},e.prototype.forceSend=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this._logger.debug("send forced request",n),n instanceof Rr||n instanceof Z?[4,this.commandRouter.send(n)]:[3,2];case 1:return[2,t.sent()];case 2:throw L.invalidCommand}})})},e.prototype.timeout=function(n){this._logger.debug("timeout request",n);var t=this._lazyCallQueue.findIndex(function(r){return r.command.requestId===n});t>-1&&(this._lazyCallQueue[t].deferred.reject(L.connectionRequired),this._lazyCallQueue.splice(t,1))},e.prototype.cancel=function(n){this._logger.debug("cancel api request",n),this.commandRouter.cancel(n)},e.prototype.cancelAll=function(){this._logger.debug("cancel all api requests"),this.commandRouter.cancelAll()},e}(),D_="sendbird@devicetokens",U_=function(){function e(n){var t=n.type,r=n.token,i=n.device_os,s=n.device_manufacturer,a=n.system_push_enabled;this.type=t,this.token=r,this.deviceOS=i,this.deviceManufacturer=s,this.systemPushEnabled=a}return e.payloadify=function(n){return be(Ie({type:n.type,token:n.token,device_os:n.deviceOS,device_manufacturer:n.deviceManufacturer,system_push_enabled:n.systemPushEnabled}))},e}(),P_=new WeakMap,Ix=function(e){function n(t){var r=t._iid,i=t.session,s=t.cacheContext,a=t.sdkState,o=t.dispatcher,l=t.requestQueue,u=t.logger,c=t.pushNotificationAckManager,d=e.call(this)||this;return d._currentConnectionStateType=lt.INITIALIZED,d._isRefreshingAuthToken=!1,d.currentUser=null,d.session=i,d._iid=r,d._cacheContext=s,d._sdkState=a,d._dispatcher=o,d._requestQueue=l,d._logger=u,d._pushNotificationAckManager=c,d._deviceTokens=[],d._dispatcher.on(function(h){var f,p,m;if(h instanceof Ii){var b=h.stateType;d._currentConnectionStateType=b}else h instanceof Mu&&d.handler&&!d.isSessionKeyRefreshing&&(!((f=h.error)===null||f===void 0)&&f.isSessionInvalidatedError?d.close():(!((p=h.error)===null||p===void 0)&&p.isSessionTokenExpiredError&&d.refreshAuthToken().catch(function(v){if(zr(v)&&d._sdkState.appState==="foreground")throw v}),!((m=h.error)===null||m===void 0)&&m.isSessionKeyExpiredError&&(d._logger.debug("session expired"),d.handler.onSessionExpired&&d.handler.onSessionExpired(),d.refreshSessionKey().catch(function(v){if(zr(v)&&d._sdkState.appState==="foreground")throw v}))))}),d}return w(n,e),Object.defineProperty(n.prototype,"ekey",{get:function(){return P_.get(this)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceTokens",{get:function(){return this._deviceTokens},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceTokenLastDeletedAt",{get:function(){return this._deviceTokenLastDeletedAt},enumerable:!1,configurable:!0}),n.prototype.indexOfDeviceToken=function(t,r){return this._deviceTokens.findIndex(function(i){return i.type===t&&i.token===r})},n.prototype.hasDeviceToken=function(t,r){return this.indexOfDeviceToken(t,r)>=0},n.prototype.createRefreshWebsocketCommand=function(t,r){return new sM({authToken:t,expiringSession:!0,requestId:r})},n.prototype._refreshSessionKeyByWebSocket=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return r=this.createRefreshWebsocketCommand(t),[4,this._requestQueue.forceSend(r)];case 1:if(i=l.sent(),s=i.as(oM),a=s.newKey,o=s.error)throw o;return this.session.sessionKey=a??this.session.sessionKey,[2]}})})},n.prototype._refreshSessionKeyByApi=function(t){return y(this,void 0,void 0,function(){var r,i=this;return g(this,function(s){switch(s.label){case 0:return r=new v2({userId:this._sdkState.userId,authToken:t,services:this.session.services&&this.session.services.length>0?this.session.services:void 0,expiringSession:!0}),[4,gp(function(a){return y(i,void 0,void 0,function(){var o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return h.trys.push([0,2,,3]),[4,this._requestQueue.forceSend(r)];case 1:return o=h.sent(),l=o.as(aM),u=l.key,c=l.services,this.session.sessionKey=u,this.session.services=c,[3,3];case 2:if(d=h.sent(),!this._isSessionRelatedError(d))throw d;return a(d),[3,3];case 3:return[2]}})})},3)];case 1:return s.sent(),[2]}})})},n.prototype._refreshSessionKey=function(t,r){return r===void 0&&(r=!0),y(this,void 0,void 0,function(){var i,s;return g(this,function(a){switch(a.label){case 0:if(this._currentConnectionStateType!==lt.CONNECTED)return[3,8];a.label=1;case 1:return a.trys.push([1,3,,8]),[4,this._refreshSessionKeyByWebSocket(t)];case 2:return a.sent(),this.complete(),[2];case 3:i=a.sent(),a.label=4;case 4:return a.trys.push([4,6,,7]),[4,this._handleSessionRefreshError(i,r)];case 5:return a.sent(),[2];case 6:return a.sent(),[3,7];case 7:return[3,8];case 8:return a.trys.push([8,10,,12]),[4,this._refreshSessionKeyByApi(t)];case 9:return a.sent(),this.complete(),[3,12];case 10:return s=a.sent(),[4,this._handleSessionRefreshError(s,r)];case 11:return a.sent(),[3,12];case 12:return[2]}})})},n.prototype._receiveNewAuthToken=function(){var t,r=this,i=new Or;if(this._isRefreshingAuthToken=!0,this.session.sessionKey=void 0,this.session.authToken=void 0,(t=this.handler)===null||t===void 0?void 0:t.onSessionTokenRequired){var s=null,a=function(){s&&(clearTimeout(s),s=null)},o=function(u){a(),r._isRefreshingAuthToken&&(r._isRefreshingAuthToken=!1,i.resolve(u))},l=function(u){a(),r._isRefreshingAuthToken&&(r._isRefreshingAuthToken=!1,i.reject(u))};s=setTimeout(function(){return l()},1e3*this._sdkState.sessionTokenRefreshTimeout),Ue(function(){return y(r,void 0,void 0,function(){var u;return g(this,function(c){return!((u=this.handler)===null||u===void 0)&&u.onSessionTokenRequired&&this.handler.onSessionTokenRequired(o,l),[2]})})})}else i.resolve(null);return i.promise},n.prototype._handleSessionRefreshError=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return t instanceof L&&(t.isSessionTokenExpiredError||t.code===Ae.APPLICATION_NOT_FOUND)?(this.session.authToken=void 0,r?[4,this._receiveNewAuthToken()]:[3,6]):[3,6];case 1:return(i=s.sent())?(this.session.authToken=i,[4,this._refreshSessionKey(this.session.authToken,!1)]):[3,3];case 2:return s.sent(),this.complete(),[3,5];case 3:return[4,this.clear()];case 4:s.sent(),s.label=5;case 5:return[2];case 6:throw t}})})},n.prototype._isSessionRelatedError=function(t){return t instanceof L&&(t.isSessionExpiredError||t.isSessionInvalidatedError)},Object.defineProperty(n.prototype,"isSessionKeyRefreshing",{get:function(){return this.session.isRefreshing},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRefreshingAuthToken",{get:function(){return this._isRefreshingAuthToken},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSessionExpiring",{get:function(){return!!this.handler},enumerable:!1,configurable:!0}),n.prototype.authenticateFeed=function(t,r){var i;return y(this,void 0,void 0,function(){var s,a,o;return g(this,function(l){switch(l.label){case 0:return this.session.authToken=r,s=new Dw({appId:this._sdkState.appId,userId:t,services:[Nd.FEED],includeUIKitConfig:!!((i=this._sdkState.extensions)!==null&&i!==void 0?i:{}).sb_uikit,localCacheEnabled:this._cacheContext.localCacheEnabled,expiringSession:!r||this.isSessionExpiring}),[4,this._requestQueue.commandRouter.send(s)];case 1:return a=l.sent(),(o=a.as(wx).logi).error?[3,3]:[4,o.applyTo(this._iid)];case 2:return l.sent(),[3,4];case 3:throw o.error;case 4:return[2]}})})},n.prototype.login=function(t){var r;return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return i=t.key,s=t.ekey,a=t.services,o=t.userProfile,l=t.deviceTokenLastDeletedAt,u=l===void 0?0:l,this.session.sessionKey=i,this.session.services=a,P_.set(this,s),this._deviceTokenCacheEnabled=(r=o==null?void 0:o.appInfo)===null||r===void 0?void 0:r.deviceTokenCache,c=this._cacheContext.preference,this._deviceTokenCacheEnabled?[4,c.get(D_)]:[3,5];case 1:return!(d=h.sent())||d.lastDeletedAt0&&(this.queue=this.queue.concat(this.flushWaitQueue),this.flushWaitQueue=[])},e.prototype._isDuplicateStat=function(n){var t=this._sentLogStats.find(function(r){var i;return r.channelUrl===n.data.channel_url&&r.messageId===((i=n.data.notificationId)!==null&&i!==void 0?i:n.data.message_id)&&r.action===n.data.action});return t||this._sentLogStats.push({channelUrl:n.data.channel_url,messageId:n.data.message_id,action:n.data.action}),!!t},e.prototype._flush=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:if(t=!0,!(n.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,a.label=1;case 1:return a.trys.push([1,4,8,9]),r=Fe([],Me(n),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new Ax({deviceId:this.deviceId,statLogs:r}),[4,this.requestQueue.send(i)];case 2:return a.sent(),this.queue=Fe([],Me(n),!1).slice(r.length).concat(this.flushWaitQueue),this.flushWaitQueue=[],this.limit=100,this.logInfo.lastFlushedAt=Date.now(),[4,this._save()];case 3:return a.sent(),[3,9];case 4:return(s=a.sent())instanceof L?s.code!==Ae.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return a.sent(),this.enabledState=jt.DISABLED,[3,7];case 6:s.code===Ae.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=jt.COLLECT_ONLY),a.label=7;case 7:return this.limit=this.limit+20,t=!1,[3,9];case 8:return this.isFlushing=!1,[7];case 9:return[3,11];case 10:this.isFlushing=!1,a.label=11;case 11:return[2,t]}})})},e.prototype._save=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=Fe(Fe([],Me(this.queue),!1),Me(this.flushWaitQueue),!1),[4,this.cacheContext.preference.set(this.key,{deviceId:this.logInfo.deviceId,statLogs:n.map(function(r){return Vt.payloadify(r)}),generation:this.logInfo.generation++,lastFlushedAt:this.logInfo.lastFlushedAt})];case 1:return t.sent(),[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this.queue=[],this.flushWaitQueue=[],this.logInfo.generation=1,this._save(),[2]})})},e}(),Ou=function(e){function n(t){var r,i,s,a,o=t.type,l=t.data,u=t.ts,c=u===void 0?Date.now():u,d=e.call(this,{type:o,data:l,ts:c})||this;return d.date=new Date(c),d.key="".concat((r=d.date,i=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),a=String(r.getDate()).padStart(2,"0"),"".concat(i).concat(s).concat(a)),"_").concat(o),d}return w(n,e),n}(Vt),Mx=function(e){function n(t){var r=t.deviceId,i=t.cacheContext,s=t.requestQueue;return e.call(this,{deviceId:r,cacheContext:i,requestQueue:s})||this}return w(n,e),Object.defineProperty(n.prototype,"_isSendable",{get:function(){return this.queue.length!==0&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval},enumerable:!1,configurable:!0}),n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.init.call(this,t+".daily")];case 1:return r.sent(),this.queue=this.logInfo.statLogs.map(function(i){return new Vt({type:i.stat_type,ts:i.ts,data:i.data})}),[2]}})})},n.prototype.setConfig=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this.statConfig=t,this.statConfig.minInterval=864e5,this._mergeQueue(),r.localCacheStat?(this.enabledState=r.enabledStat?jt.ENABLED:jt.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=jt.DISABLED,[4,this.clear()];case 2:l.sent(),l.label=3;case 3:return this.isEnabled&&this._isSendable?[4,this._getUploadStats()]:[3,9];case 4:i=l.sent(),s=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),a=0,l.label=5;case 5:return a=this.statConfig.minStatCount&&this.queue.length>this.statConfig.lowerThreshold||this.logInfo.lastFlushedAt>0&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval},enumerable:!1,configurable:!0}),n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.init.call(this,t+".realtime")];case 1:return r.sent(),this.queue=this.logInfo.statLogs.map(function(i){var s;return i.data=be(M(M({},i.data),{message_id:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,notificationId:void 0})),new Vt({type:i.stat_type,ts:i.ts,data:i.data})}),this._sentLogStats=this.queue.map(function(i){var s;return{channelUrl:i.data.channelUrl,messageId:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,action:i.data.action}}),[2]}})})},n.prototype.setConfig=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return this.statConfig=t,this._mergeQueue(),r.notificationStat?(this.enabledState=r.enabledStat?jt.ENABLED:jt.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=jt.DISABLED,[4,this.clear()];case 2:s.sent(),s.label=3;case 3:return this.isEnabled&&this._isSendable?(i=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),[4,Br(i)]):[3,6];case 4:return s.sent(),[4,this._flush(this.queue)];case 5:s.sent(),s.label=6;case 6:return[2]}})})},n.prototype.put=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.enabledState===jt.DISABLED?[2,!0]:(r=this.enabledState===jt.PENDING||this.isFlushing?this.flushWaitQueue:this.queue,this._isDuplicateStat(t)?[2,!0]:(r.push(t),this.enabledState===jt.PENDING?[3,2]:[4,this._save()]));case 1:i.sent(),i.label=2;case 2:return this.isEnabled?(this._mergeQueue(),this.isEnabled&&this._isSendable?[4,this._flush(r)]:[3,4]):[3,4];case 3:return[2,i.sent()];case 4:return[2,!0]}})})},n}(S2),Rx=function(){function e(n){var t=n.cacheContext,r=n.requestQueue,i=n.dispatcher,s=n.logger;this._collectRequestStat=!0,this._collectFeatureLocalCacheStat=!0,this._collectionNotificationStat=!0,this._retryCount=0,this.deviceId=la(),this.cacheContext=t,this.requestQueue=r,this.dispatcher=i,this.logger=s,this._dailyStatCollector=new Mx({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._defaultStatCollector=new xx({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._realTimeStatCollector=new Ox({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue})}return e.prototype._migration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return[4,this.cacheContext.preference.get(this.key)];case 1:return(n=s.sent())?(t=[],n.statLogs.forEach(function(a){a.stat_type===St.FEATURE_LOCALCACHE&&t.push(new Vt({type:a.stat_type,ts:a.ts,data:a.data}))}),[4,this.cacheContext.preference.set(this.key+".daily",{deviceId:n.deviceId,statLogs:t.map(function(a){return Vt.payloadify(a)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})]):[3,6];case 2:return s.sent(),r=[],n.statLogs.forEach(function(a){a.stat_type!==St.FEATURE_LOCALCACHE&&a.stat_type!==St.NOTIFICATION&&(a.stat_type===St.FEATURE_LOCALCACHE_EVENT&&(a.data=M({message_init_policy:"",starting_point:0},a.data)),r.push(new Vt({type:a.stat_type,ts:a.ts,data:a.data})))}),[4,this.cacheContext.preference.set(this.key+".default",{deviceId:n.deviceId,statLogs:r.map(function(a){return Vt.payloadify(a)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 3:return s.sent(),i=[],n.statLogs.forEach(function(a){var o;a.stat_type===St.NOTIFICATION&&(a.data=be(M(M({},a.data),{message_id:(o=a.data.notificationId)!==null&&o!==void 0?o:a.data.message_id,notificationId:void 0})),i.push(new Vt({type:a.stat_type,ts:a.ts,data:a.data})))}),[4,this.cacheContext.preference.set(this.key+".realtime",{deviceId:n.deviceId,statLogs:i.map(function(a){return Vt.payloadify(a)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 4:return s.sent(),[4,this.cacheContext.preference.remove(this.key)];case 5:s.sent(),s.label=6;case 6:return[2]}})})},e.prototype.init=function(n){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return this.key=n,[4,this._migration()];case 1:return r.sent(),[4,this._dailyStatCollector.init(this.key)];case 2:return r.sent(),[4,this._defaultStatCollector.init(this.key)];case 3:return r.sent(),[4,this._realTimeStatCollector.init(this.key)];case 4:return r.sent(),this.commandEventContext||(this.commandEventContext=this.dispatcher.on(function(i){return y(t,void 0,void 0,function(){var s,a,o,l,u,c;return g(this,function(d){return i instanceof g2?(s=i.statLog,this.put(s)):i instanceof Ow&&(a=i.request,o=i.features,l=i.options,u=i.statConfigInfo,this._retryCount=0,this._collectRequestStat=a,this._collectFeatureLocalCacheStat=o==null?void 0:o.localCache,this._collectionNotificationStat=o==null?void 0:o.notification,this._statConfig=u,this._dailyStatCollector.setConfig(this._statConfig.default,{localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:l.ingestion}),this._defaultStatCollector.setConfig(this._statConfig.default,{requestStat:this._collectRequestStat,localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:l.ingestion}),this._realTimeStatCollector.setConfig((c=this._statConfig.realTime)!==null&&c!==void 0?c:this._statConfig.default,{notificationStat:this._collectionNotificationStat,enabledStat:l.ingestion})),[2]})})})),[2]}})})},e.prototype.put=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return t=!0,n instanceof Ou?this._collectFeatureLocalCacheStat?[4,this._dailyStatCollector.put(n)]:[3,2]:[3,3];case 1:t=r.sent(),r.label=2;case 2:return[3,13];case 3:switch(n.type){case St.API_RESULT:case St.WEBSOCKET_CONNECT:return[3,4];case St.FEATURE_LOCALCACHE:case St.FEATURE_LOCALCACHE_EVENT:return[3,7];case St.NOTIFICATION:return[3,10]}return[3,13];case 4:return this._collectRequestStat?[4,this._defaultStatCollector.put(n)]:[3,6];case 5:t=r.sent(),r.label=6;case 6:return[3,13];case 7:return this._collectFeatureLocalCacheStat?[4,this._defaultStatCollector.put(n)]:[3,9];case 8:t=r.sent(),r.label=9;case 9:return[3,13];case 10:return this._collectionNotificationStat?[4,this._realTimeStatCollector.put(n)]:[3,12];case 11:t=r.sent(),r.label=12;case 12:return[3,13];case 13:return t?this._retryCount=0:(this._retryCount++,this._retryCount>20&&(this._dailyStatCollector.enabledState=jt.COLLECT_ONLY,this._defaultStatCollector.enabledState=jt.COLLECT_ONLY,this._realTimeStatCollector.enabledState=jt.COLLECT_ONLY,this.logger.debug(L.statLogUploadLimitExceededError))),[2]}})})},e.prototype.close=function(){this.commandEventContext&&(this.commandEventContext.close(),this.commandEventContext=void 0)},e}();(function(e){e.DELIVERY_RECEIPT="delivery_receipt",e.PUSH_ACKNOWLEDGEMENT="push_acknowledgement"})(f0||(f0={}));var z,kx=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._pushAckedCache={},t}return w(n,e),n.prototype.isAcked=function(t,r){var i,s="".concat(t,"_").concat(r);return(i=this._pushAckedCache[s])!==null&&i!==void 0&&i},n.prototype.markAsAcked=function(t,r){var i="".concat(t,"_").concat(r);this._pushAckedCache[i]=!0},n.prototype.clear=function(){R.of(this._iid).logger.debug("clear push acked cache"),this._pushAckedCache={}},n.prototype.parseData=function(t){var r,i,s,a,o=R.of(this._iid).logger,l=t.sendbird;if(typeof l=="string")try{l=JSON.parse(l)}catch{throw o.info("push notification payload does not contain sendbird payload in JSON format."),L.malformedDataError}if(!l||typeof l!="object")throw o.info("push notification payload does not contain sendbird payload in JSON format."),L.malformedDataError;var u=(r=l.push_tracking_id)!==null&&r!==void 0?r:"",c=l.notification_message_id,d=l.notification_channel_key,h=l.notification_template_key,f=l.notification_event_deadline,p=(i=l.session_key)!==null&&i!==void 0?i:{},m=(s=p==null?void 0:p.key)!==null&&s!==void 0?s:"",b=(a=p==null?void 0:p.topics)!==null&&a!==void 0?a:[];if(typeof u!="string"||u.length===0)throw o.info("push tracking id is not available"),L.malformedDataError;if(typeof c!="string"||c.length===0)throw o.info("message id is not available"),L.malformedDataError;return{pushTrackingId:u,sessionKey:m,sessionTopics:b,messageId:c,channelKey:d,templateKey:h,notificationEventDeadline:f}},n}(Jn),co={},R=function(){function e(n,t){var r,i,s,a,o,l,u,c,d;if(this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map,!co[n]){co[n]=this;var h=(r=t.options)!==null&&r!==void 0?r:new JS,f=this.sdkState={appId:t.appId,appVersion:(i=t.appVersion)!==null&&i!==void 0?i:"",appState:"foreground",userId:void 0,extensions:{},api:{host:(s=t.apiHost)!==null&&s!==void 0?s:"https://api-".concat(t.appId,".sendbird.com")},websocket:{host:(a=t.websocketHost)!==null&&a!==void 0?a:"wss://ws-".concat(t.appId,".sendbird.com"),pingerDisabled:!!t.noPingpong,pingInterval:void 0,pongTimeout:void 0,connectMaxRetry:2,compression:!0,reconnectMaxRetry:-1,reconnectRetryStrategy:new Rw,responseTimeout:h.websocketResponseTimeout},sessionTokenRefreshTimeout:h.sessionTokenRefreshTimeout};this.appInfo=void 0,this.subscribedUnreadMessageCount={all:0,feed:0,customTypes:{},ts:0};var p=this.logger=t.logger;this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map;var m=this.cacheContext=new q6({encryption:t.encryption,store:t.store,localCacheEnabled:(o=t.localCacheEnabled)!==null&&o!==void 0&&o,localCacheConfig:(l=t.localCacheConfig)!==null&&l!==void 0?l:new tw});this.debugMode=(u=t.debugMode)!==null&&u!==void 0&&u,this.maxSuperGroupChannelUnreadCount=Wa.DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL,this.useMemberInfoInMessage=h.useMemberInfoInMessage,this.typingIndicatorInvalidateTime=h.typingIndicatorInvalidateTime,this.typingIndicatorThrottle=h.typingIndicatorThrottle,this.concurrentCallLimit=void 0,this.backOffDelay=void 0;var b=this.dispatcher=new Q6,v=new K6;this.requestQueue=new Nx(n,{session:v,sdkState:f,dispatcher:b,logger:p,useFetchCompat:t.useFetchCompat}),this.pushNotificationAckManager=new kx(n),this.sessionManager=new Ix({_iid:n,session:v,cacheContext:m,sdkState:f,dispatcher:b,requestQueue:this.requestQueue,logger:p,pushNotificationAckManager:this.pushNotificationAckManager}),this.connectionManager=new Ex(n,{sdkState:f,cacheContext:this.cacheContext,connectionHandlers:this.connectionHandlers,dispatcher:b,sessionManager:this.sessionManager,websocketClient:this.requestQueue.commandRouter.websocketClient,disableWebSocketCloseEventHandling:(c=t.disableWebSocketCloseEventHandling)!==null&&c!==void 0&&c,logger:p}),this.statManager=new Rx({cacheContext:this.cacheContext,requestQueue:this.requestQueue,dispatcher:this.dispatcher,logger:p}),this.appStateToggleEnabled=(d=t.appStateToggleEnabled)===null||d===void 0||d}return co[n]}return e.of=function(n){if(co[n])return co[n];throw L.lostInstance},e.clear=function(n){co[n]&&delete co[n]},e.prototype.hasExtension=function(n){return this.sdkState.extensions&&this.sdkState.extensions[n]},e}(),w2=function(){function e(){}return e.prototype.init=function(n,t){var r=t.sdkState,i=t.dispatcher,s=t.sessionManager,a=t.requestQueue,o=t.logger;t.onlineDetector;var l=t.cacheContext;this._iid=n,this._cacheContext=l,this._sdkState=r,this._dispatcher=i,this._sessionManager=s,this._requestQueue=a,this._logger=o},e}();(function(e){e.UNKNOWN="UNKNOWN",e.EVENT_CHANNEL_CREATED="EVENT_CHANNEL_CREATED",e.EVENT_CHANNEL_UPDATED="EVENT_CHANNEL_UPDATED",e.EVENT_CHANNEL_DELETED="EVENT_CHANNEL_DELETED",e.EVENT_CHANNEL_READ="EVENT_CHANNEL_READ",e.EVENT_CHANNEL_DELIVERED="EVENT_CHANNEL_DELIVERED",e.EVENT_CHANNEL_INVITED="EVENT_CHANNEL_INVITED",e.EVENT_CHANNEL_JOINED="EVENT_CHANNEL_JOINED",e.EVENT_CHANNEL_LEFT="EVENT_CHANNEL_LEFT",e.EVENT_CHANNEL_ACCEPTED_INVITE="EVENT_CHANNEL_ACCEPTED_INVITE",e.EVENT_CHANNEL_DECLINED_INVITE="EVENT_CHANNEL_DECLINED_INVITE",e.EVENT_CHANNEL_OPERATOR_UPDATED="EVENT_CHANNEL_OPERATOR_UPDATED",e.EVENT_CHANNEL_BANNED="EVENT_CHANNEL_BANNED",e.EVENT_CHANNEL_UNBANNED="EVENT_CHANNEL_UNBANNED",e.EVENT_CHANNEL_MUTED="EVENT_CHANNEL_MUTED",e.EVENT_CHANNEL_UNMUTED="EVENT_CHANNEL_UNMUTED",e.EVENT_CHANNEL_FROZEN="EVENT_CHANNEL_FROZEN",e.EVENT_CHANNEL_UNFROZEN="EVENT_CHANNEL_UNFROZEN",e.EVENT_CHANNEL_HIDDEN="EVENT_CHANNEL_HIDDEN",e.EVENT_CHANNEL_UNHIDDEN="EVENT_CHANNEL_UNHIDDEN",e.EVENT_CHANNEL_RESET_HISTORY="EVENT_CHANNEL_RESET_HISTORY",e.EVENT_CHANNEL_TYPING_STATUS_UPDATE="EVENT_CHANNEL_TYPING_STATUS_UPDATE",e.EVENT_CHANNEL_MEMBER_COUNT_UPDATED="EVENT_CHANNEL_MEMBER_COUNT_UPDATED",e.EVENT_CHANNEL_METADATA_CREATED="EVENT_CHANNEL_METADATA_CREATED",e.EVENT_CHANNEL_METADATA_UPDATED="EVENT_CHANNEL_METADATA_UPDATED",e.EVENT_CHANNEL_METADATA_DELETED="EVENT_CHANNEL_METADATA_DELETED",e.EVENT_CHANNEL_METACOUNTER_CREATED="EVENT_CHANNEL_METACOUNTER_CREATED",e.EVENT_CHANNEL_METACOUNTER_UPDATED="EVENT_CHANNEL_METACOUNTER_UPDATED",e.EVENT_CHANNEL_METACOUNTER_DELETED="EVENT_CHANNEL_METACOUNTER_DELETED",e.EVENT_MESSAGE_SENT="EVENT_MESSAGE_SENT",e.EVENT_MESSAGE_RECEIVED="EVENT_MESSAGE_RECEIVED",e.EVENT_MESSAGE_UPDATED="EVENT_MESSAGE_UPDATED",e.EVENT_PINNED_MESSAGE_UPDATED="EVENT_PINNED_MESSAGE_UPDATED",e.REQUEST_CHANNEL="REQUEST_CHANNEL",e.REQUEST_CHANNEL_CHANGELOGS="REQUEST_CHANNEL_CHANGELOGS",e.REFRESH_CHANNEL="REFRESH_CHANNEL",e.CHANNEL_LASTACCESSEDAT_UPDATED="CHANNEL_LASTACCESSEDAT_UPDATED",e.SYNC_CHANNEL_BACKGROUND="SYNC_CHANNEL_BACKGROUND",e.SYNC_CHANNEL_CHANGELOGS="SYNC_CHANNEL_CHANGELOGS",e.EVENT_MESSAGE_SENT_SUCCESS="EVENT_MESSAGE_SENT_SUCCESS",e.EVENT_MESSAGE_SENT_FAILED="EVENT_MESSAGE_SENT_FAILED",e.EVENT_MESSAGE_SENT_PENDING="EVENT_MESSAGE_SENT_PENDING",e.EVENT_MESSAGE_DELETED="EVENT_MESSAGE_DELETED",e.EVENT_MESSAGE_FEEDBACK_ADDED="EVENT_MESSAGE_FEEDBACK_ADDED",e.EVENT_MESSAGE_FEEDBACK_UPDATED="EVENT_MESSAGE_FEEDBACK_UPDATED",e.EVENT_MESSAGE_FEEDBACK_DELETED="EVENT_MESSAGE_FEEDBACK_DELETED",e.EVENT_MESSAGE_READ="EVENT_MESSAGE_READ",e.EVENT_MESSAGE_DELIVERED="EVENT_MESSAGE_DELIVERED",e.EVENT_MESSAGE_REACTION_UPDATED="EVENT_MESSAGE_REACTION_UPDATED",e.EVENT_MESSAGE_THREADINFO_UPDATED="EVENT_MESSAGE_THREADINFO_UPDATED",e.EVENT_MESSAGE_OFFSET_UPDATED="EVENT_MESSAGE_OFFSET_UPDATED",e.REQUEST_MESSAGE="REQUEST_MESSAGE",e.EVENT_THREAD_INFO_UPDATED="EVENT_THREADINFO_UPDATED",e.EVENT_POLL_UPDATED="EVENT_POLL_UPDATED",e.EVENT_POLL_VOTED="EVENT_POLL_VOTED",e.SYNC_POLL_CHANGELOGS="SYNC_POLL_CHANGELOGS",e.REQUEST_RESEND_MESSAGE="REQUEST_RESEND_MESSAGE",e.REQUEST_THREADED_MESSAGE="REQUEST_THREADED_MESSAGE",e.REQUEST_MESSAGE_CHANGELOGS="REQUEST_MESSAGE_CHANGELOGS",e.SYNC_MESSAGE_FILL="SYNC_MESSAGE_FILL",e.SYNC_MESSAGE_BACKGROUND="SYNC_MESSAGE_BACKGROUND",e.SYNC_MESSAGE_CHANGELOGS="SYNC_MESSAGE_CHANGELOGS",e.LOCAL_MESSAGE_PENDING_CREATED="LOCAL_MESSAGE_PENDING_CREATED",e.LOCAL_MESSAGE_FAILED="LOCAL_MESSAGE_FAILED",e.LOCAL_MESSAGE_CANCELED="LOCAL_MESSAGE_CANCELED",e.LOCAL_MESSAGE_RESEND_STARTED="LOCAL_MESSAGE_RESEND_STARTED"})(z||(z={}));var Ru;M({},z);var qs=function(e){return e.startsWith("EVENT_")||e.startsWith("LOCAL_MESSAGE_")||e===z.SYNC_MESSAGE_FILL||e===z.SYNC_MESSAGE_CHANGELOGS||e===z.SYNC_POLL_CHANGELOGS},wt=function(e){function n(t){var r=t.messages,i=t.source,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.messages=r,o.source=i,o.isWebSocketEventComing=a,o}return w(n,e),n}(At),T2=function(e){function n(t){var r=t.messageIds,i=t.source,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.messageIds=r,o.source=i,o.isWebSocketEventComing=a,o}return w(n,e),n}(At),Pw=function(e){function n(t){var r=t.event,i=t.source,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.event=r,o.source=i,o.isWebSocketEventComing=a,o}return w(n,e),n}(At),Fw=function(e){function n(t){var r=t.event,i=t.source,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.event=r,o.source=i,o.isWebSocketEventComing=a,o}return w(n,e),n}(At),Hw=function(e){function n(t){var r=t.reqId,i=t.source,s=e.call(this)||this;return s.reqId=r,s.source=i,s}return w(n,e),n}(At),jw=function(e){function n(t){var r=t.polls,i=t.source,s=e.call(this)||this;return s.polls=r,s.source=i,s}return w(n,e),n}(At),Bw=function(e){function n(t){var r=t.event,i=t.source,s=e.call(this)||this;return s.event=r,s.source=i,s}return w(n,e),n}(At),N2=function(e){function n(t){var r=t.event,i=t.source,s=e.call(this)||this;return s.event=r,s.source=i,s}return w(n,e),n}(At);(function(e){e.OPEN="open",e.CLOSED="closed"})(Ru||(Ru={}));var Lx="removed",yv=function(e){switch(e){case"open":return Ru.OPEN;case"closed":return Ru.CLOSED;default:return null}},$w=function(e){return!e||!!e.text&&k("string",e.text)},bf=function(e){function n(t,r){var i,s,a,o,l,u,c,d=this;return(d=e.call(this,t)||this).pollId=0,d.id=0,d.text=null,d.voteCount=0,d.createdBy=null,d.createdAt=0,d.updatedAt=0,d._lastVotedAt=0,d.pollId=(i=r.poll_id)!==null&&i!==void 0?i:0,d.id=(s=r.id)!==null&&s!==void 0?s:0,d.text=(a=r.text)!==null&&a!==void 0?a:null,d.voteCount=(o=r.vote_count)!==null&&o!==void 0?o:0,d.createdBy=(l=r.created_by)!==null&&l!==void 0?l:null,d.createdAt=(u=r.created_at)!==null&&u!==void 0?u:0,d.updatedAt=(c=r.updated_at)!==null&&c!==void 0?c:0,d}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{vote_count:t.voteCount,poll_id:t.pollId,text:t.text,created_at:t.createdAt,id:t.id,created_by:t.createdBy,updated_at:t.updatedAt})))},n}(Jn),Vi=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v=this;return(v=e.call(this,t)||this).id=0,v.title=null,v.createdAt=0,v.updatedAt=0,v.closeAt=-1,v.status=Ru.CLOSED,v.messageId=0,v.data=null,v.voterCount=-1,v.options=[],v.createdBy=null,v.allowUserSuggestion=!1,v.allowMultipleVotes=!1,v.votedPollOptionIds=[],v.id=(i=r.id)!==null&&i!==void 0?i:0,v.title=(s=r.title)!==null&&s!==void 0?s:null,v.createdAt=(a=r.created_at)!==null&&a!==void 0?a:0,v.updatedAt=(o=r.updated_at)!==null&&o!==void 0?o:0,v.closeAt=(l=r.close_at)!==null&&l!==void 0?l:-1,v.status=(u=yv(r.status))!==null&&u!==void 0?u:Ru.CLOSED,v.messageId=(c=r.message_id)!==null&&c!==void 0?c:0,v.data=(d=r.data)!==null&&d!==void 0?d:null,v.voterCount=(h=r.voter_count)!==null&&h!==void 0?h:-1,v.options=r.options?r.options.map(function(_){return new bf(v._iid,_)}):[],v.createdBy=(f=r.created_by)!==null&&f!==void 0?f:null,v.allowUserSuggestion=(p=r.allow_user_suggestion)!==null&&p!==void 0&&p,v.allowMultipleVotes=(m=r.allow_multiple_votes)!==null&&m!==void 0&&m,v.votedPollOptionIds=(b=r.voted_option_ids)!==null&&b!==void 0?b:[],v}return w(n,e),n.prototype._applyPollUpdatePayload=function(t){var r,i,s,a,o,l,u,c,d=this;this.title=(r=t.title)!==null&&r!==void 0?r:this.title,this.updatedAt=(i=t.updated_at)!==null&&i!==void 0?i:this.updatedAt,this.closeAt=(s=t.close_at)!==null&&s!==void 0?s:this.closeAt,this.status=(a=yv(t.status))!==null&&a!==void 0?a:this.status,this.data=(o=t.data)!==null&&o!==void 0?o:this.data,this.voterCount=(l=t.voter_count)!==null&&l!==void 0?l:this.voterCount,t.options&&(this.options=t.options.map(function(h){return new bf(d._iid,h)}),this.votedPollOptionIds=t.options.filter(function(h){return h.vote_count>0}).map(function(h){return h.id})),this.allowUserSuggestion=(u=t.allow_user_suggestion)!==null&&u!==void 0?u:this.allowUserSuggestion,this.allowMultipleVotes=(c=t.allow_multiple_votes)!==null&&c!==void 0?c:this.allowMultipleVotes},n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{id:t.id,title:t.title,created_at:t.createdAt,updated_at:t.updatedAt,close_at:t.closeAt,status:t.status,message_id:t.messageId,data:t.data,voter_count:t.voterCount,options:t.options.map(function(r){return bf.payloadify(r)}),created_by:t.createdBy,allow_user_suggestion:t.allowUserSuggestion,allow_multiple_votes:t.allowMultipleVotes,voted_option_ids:t.votedPollOptionIds})))},n.prototype.applyPollUpdateEvent=function(t){var r=t._payload.poll;return!(!r||this.id!==r.id||r.updated_at-1){var u=r[l];a>=u._lastVotedAt&&(u.voteCount=o.vote_count,u._lastVotedAt=a)}}),s.req_id&&s.voted_option_ids&&(this.votedPollOptionIds=s.voted_option_ids),typeof s.voter_count=="number"&&(this.voterCount=s.voter_count),!0},n.prototype.serialize=function(){return nh(this)},n}(Jn),lo=function(){function e(n,t){var r;this.limit=20,this._isLoading=!1,this._hasNext=!0,this._token="",this._iid=n,this.limit=(r=t.limit)!==null&&r!==void 0?r:20}return Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),e.prototype._validate=function(){return k("number",this.limit)&&this.limit>0},e}(),ca=function(e){function n(t,r,i,s){var a=e.call(this,t,s)||this;return a.channelUrl=r,a.channelType=i,a}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.channelUrl)&&Ve(et,this.channelType)},n}(lo),Dx=function(e){this.pollId=0,this.messageId=0,this.pollId=e.poll_id,this.messageId=e.message_id,this._payload=e},Ux=function(e){function n(t){var r=t.title,i=t.optionTexts,s=t.data,a=t.allowUserSuggestion,o=t.allowMultipleVotes,l=t.closeAt,u=e.call(this)||this;return u.method=Y.POST,u.path=ds,u.params={title:r,options:i,data:s,allow_user_suggestion:a,allow_multiple_votes:o,close_at:l},u}return w(n,e),n}(Z),Px=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return w(n,e),n}(le),Fx=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,a=e.call(this)||this;return a.method=Y.GET,a.path="".concat(ds,"/").concat(encodeURIComponent(s)),a.params={channel_url:r,channel_type:i},a}return w(n,e),n}(Z),Hx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return w(n,e),n}(le),jx=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,a=t.pollOptionId,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(ds,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(a)),o.params={channel_url:r,channel_type:i},o}return w(n,e),n}(Z),Bx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pollOption=new bf(t,r),i}return w(n,e),n}(le),$x=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,a=t.token,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/polls/changelogs"),o.params=be({change_ts:s,token:a}),o}return w(n,e),n}(Z),Gx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedPolls=r.updated.map(function(s){return function(a,o){return new Vi(a,o)}(t,s)}),i.deletedPollIds=r.deleted.map(function(s){return s}),i.hasMore=r.has_more,i.nextToken=r.next,i}return w(n,e),n}(le),zx={title:"",optionTexts:[],data:void 0,allowUserSuggestion:void 0,allowMultipleVotes:void 0,closeAt:-1},Gw=function(e){return k("string",e.title)&&(n=e.optionTexts,Qe("string",n)&&n.every(function(t){return t.trim()!==""}))&&$w(e.data)&&k("boolean",e.allowUserSuggestion,!0)&&k("boolean",e.allowMultipleVotes,!0)&&k("number",e.closeAt,!0);var n},Vx={channelUrl:"",channelType:et.BASE,pollId:0,pollOptionId:0},zw=function(e){return k("string",e.channelUrl)&&e.channelUrl!==""&&Ve(et,e.channelType)&&k("number",e.pollId)&&e.pollId>0&&k("number",e.pollOptionId)&&e.pollOptionId>0},qx={channelUrl:"",channelType:et.BASE,pollId:0},Vw=function(e){return k("string",e.channelUrl)&&e.channelUrl!==""&&Ve(et,e.channelType)&&k("number",e.pollId)},cE={},p0=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.sessionManager,a=t.requestQueue,o=t.logger;this._iid=n,this._sdkState=r,this._sessionManager=s,this._requestQueue=a,this._dispatcher=i,this._logger=o,cE[n]=this}return e.of=function(n){return cE[n]},e.prototype.buildPollFromSerializedData=function(n){var t=Ko(n);return new Vi(this._iid,Vi.payloadify(t))},e.prototype.get=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return Q(Vw(n)).throw(L.invalidParameters),t=new Fx(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(Hx).poll]}})})},e.prototype.create=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return Q(Gw(n)).throw(L.invalidParameters),t=new Ux(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(Px).poll]}})})},e.prototype.getOption=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return Q(zw(n)).throw(L.invalidParameters),t=new jx(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(Bx).pollOption]}})})},e.prototype.getPollChangeLogs=function(n,t,r,i){return i===void 0&&(i=z.SYNC_POLL_CHANGELOGS),y(this,void 0,void 0,function(){var s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return s=new $x(Ie({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null})),[4,this._requestQueue.send(s)];case 1:return a=h.sent(),o=a.as(Gx),l=o.updatedPolls,u=o.deletedPollIds,c=o.hasMore,d=o.nextToken,l.length>0&&this._dispatcher.dispatch(new jw({polls:l,source:i})),[2,{updatedPolls:l,deletedPollIds:u,hasMore:c,token:d}]}})})},e}(),Wx=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.token,a=t.limit,o=e.call(this)||this;return o.method=Y.GET,o.path=ds,o.params={channel_url:r,channel_type:i,token:s,limit:a},o}return w(n,e),n}(Z),Kx=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).polls=((i=r.polls)!==null&&i!==void 0?i:[]).map(function(a){return new Vi(t,a)}),s.token=r.next,s}return w(n,e),n}(le),qw=function(e){function n(t,r){return e.call(this,t,r.channelUrl,r.channelType,r)||this}return w(n,e),n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new Wx(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Kx),a=s.polls,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),Qx=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,a=t.pollOptionId,o=t.token,l=t.limit,u=e.call(this)||this;return u.method=Y.GET,u.path="".concat(ds,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(a),"/voters"),u.params={channel_url:r,channel_type:i,token:o,limit:l},u}return w(n,e),n}(Z),Yx=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).voters=((i=r.voters)!==null&&i!==void 0?i:[]).map(function(a){return new Ze(t,a)}),s.token=r.next,s}return w(n,e),n}(le),Ww=function(e){function n(t,r){var i=e.call(this,t,r.channelUrl,r.channelType,r)||this;return i.pollId=r.pollId,i.pollOptionId=r.pollOptionId,i}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("number",this.pollId)&&k("number",this.pollOptionId)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new Qx(M(M({},this),{pollId:this.pollId,pollOptionId:this.pollOptionId,token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Yx),a=s.voters,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),Od,da=function(){function e(n,t,r){var i,s;this.width=0,this.height=0,this.realWidth=0,this.realHeight=0,this._requireAuth=!1,this._iid=n,this.plainUrl=t.url,this.width=t.width,this.height=t.height,this.realWidth=(i=t.real_width)!==null&&i!==void 0?i:t.width,this.realHeight=(s=t.real_height)!==null&&s!==void 0?s:t.height,this._requireAuth=r}return e.payloadify=function(n){return be(Ie(n instanceof e?{url:n.plainUrl,width:n.width,height:n.height,real_width:n.realWidth,real_height:n.realHeight}:{url:"",width:n.maxWidth,height:n.maxHeight,real_width:0,real_height:0}))},Object.defineProperty(e.prototype,"url",{get:function(){var n=R.of(this._iid).sessionManager;return this._requireAuth&&n.ekey?"".concat(this.plainUrl,"?auth=").concat(n.ekey):this.plainUrl},enumerable:!1,configurable:!0}),e}(),_0=function(e){function n(t){var r=e.call(this)||this;if(r.method=Y.POST,r.path="".concat(Y6),r.params=be({file:t.file,channel_url:t.channelUrl}),t.thumbnailSizes)for(var i=0;i0:void 0,u.lastRepliedAt=(o=r.last_replied_at)!==null&&o!==void 0?o:0,u.updatedAt=(l=r.updated_at)!==null&&l!==void 0?l:0,u}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{reply_count:t.replyCount,unread_message_count:t.unreadReplyCount,member_count:t.memberCount,most_replies:Array.isArray(t.mostRepliedUsers)?t.mostRepliedUsers.map(function(r){return Ze.payloadify(r)}):[],push_enabled:typeof t.isPushNotificationEnabled=="boolean"?t.isPushNotificationEnabled?1:0:void 0,last_replied_at:t.lastRepliedAt,updated_at:t.updatedAt})))},Object.defineProperty(n.prototype,"_isUpdateRequired",{get:function(){return this.unreadReplyCount===void 0||this.isPushNotificationEnabled===void 0},enumerable:!1,configurable:!0}),n.prototype._updateFrom=function(t){var r,i;this.unreadReplyCount=(r=t.unreadReplyCount)!==null&&r!==void 0?r:this.unreadReplyCount,this.isPushNotificationEnabled=(i=t.isPushNotificationEnabled)!==null&&i!==void 0?i:this.isPushNotificationEnabled},n}(Jn);(function(e){e.ADD="add",e.DELETE="delete"})(Od||(Od={}));var Sa,I2=function(e){this.messageId=0,this.operation=null,this.updatedAt=0;var n=k("string",e.msg_id)?parseInt(e.msg_id):e.msg_id,t=e.user_id,r=e.operation?e.operation.toLowerCase():null,i=e.reaction,s=e.updated_at;n&&k("string",t)&&k("string",r)&&Ve(Od,r)&&k("string",i)&&i&&k("number",s)&&(this.messageId=n,this.userId=t,this.key=i,this.operation=r,this.updatedAt=s)},jh=function(){function e(n){var t,r,i,s=n.key,a=(i=Fe([],Me(n.user_ids),!1))!==null&&i!==void 0?i:[],o=n.updated_at;k("string",s)&&s&&Qe("string",a)&&a.length>0&&k("number",o)&&(this.key=s,this.userIds=a,this.updatedAt=o);var l={};try{for(var u=ge(this.userIds),c=u.next();!c.done;c=u.next())l[c.value]=this.updatedAt}catch(d){t={error:d}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}this._version=l}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.userIds.length===0},enumerable:!1,configurable:!0}),e.payloadify=function(n){return be(Ie({key:n.key,user_ids:n.userIds,updated_at:n.updatedAt}))},e.prototype.applyEvent=function(n){if(n.key===this.key&&this.updatedAt<=n.updatedAt){if(!this._version[n.userId]||this._version[n.userId]<=n.updatedAt){var t=this.userIds.indexOf(n.userId);switch(n.operation){case Od.ADD:t<0&&this.userIds.push(n.userId);break;case Od.DELETE:t>=0&&this.userIds.splice(t,1)}this._version[n.userId]=n.updatedAt}this.updatedAt=Math.max(this.updatedAt,n.updatedAt)}},e}(),dE=function(){function e(n){this.secureUrl=null,this.type=null,this.width=0,this.height=0,this.alt=null,this.url=n.url,n.secure_url&&(this.secureUrl=n.secure_url),n.type&&(this.type=n.type),n.width&&(this.width=n.width),n.height&&(this.height=n.height),n.alt&&(this.alt=n.alt)}return e.payloadify=function(n){var t,r;return be(Ie({url:n.url,secure_url:n.secureUrl,type:n.type,width:(t=n.width)!==null&&t!==void 0?t:0,height:(r=n.height)!==null&&r!==void 0?r:0,alt:n.alt}))},e}(),hE=function(){function e(n){this.title=null,this.url=null,this.description=null,this.defaultImage=null,n["og:title"]&&(this.title=n["og:title"]),n["og:url"]&&(this.url=n["og:url"]),n["og:description"]&&(this.description=n["og:description"]),n["og:image"]&&(this.defaultImage=new dE(n["og:image"]))}return e.payloadify=function(n){return be(Ie({"og:title":n.title,"og:url":n.url,"og:description":n.description,"og:image":n.defaultImage?dE.payloadify(n.defaultImage):null}))},e}(),qi=function(){function e(n){var t,r;this.volume=0,this.name=(t=n.name)!==null&&t!==void 0?t:"default",this.volume=(r=n.volume)!==null&&r!==void 0?r:1}return e.prototype.serialize=function(){return{name:this.name,volume:this.volume}},e.payloadify=function(n){return be(Ie({name:n.name,volume:n.volume}))},e}();(function(e){e.GOOD="good",e.BAD="bad"})(Sa||(Sa={}));var fE,Qo=function(){function e(n){this.id=n.id,this.rating=n.rating,this.comment=n.comment}return e.parseFeedbackStatusFromPayload=function(n){return n&&n.id!==null&&n.rating!==null?"SUBMITTED":"NOT_APPLICABLE"},e.payloadify=function(n){return be(Ie({id:n.id,rating:n.rating,comment:n.comment}))},e}(),ku=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).isBlockedByMe=!1,s.role=Ve(Bi,r.role)?r.role:Bi.NONE,s.isBlockedByMe=(i=r.is_blocked_by_me)!==null&&i!==void 0&&i,s}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{role:t.role,is_blocked_by_me:t.isBlockedByMe})))},n}(Ze),br=function(){function e(n){this.key=n.key,this.value=Qe("string",n.value)?Fe([],Me(n.value),!1):[]}return e.payloadify=function(n){var t;return be(Ie({key:n.key,value:(t=n.value)!==null&&t!==void 0?t:[]}))},e}(),Kw=function(e){switch(e){case Tt.BASE:return"";case Tt.USER:return"MESG";case Tt.FILE:return"FILE";case Tt.ADMIN:return"ADMM"}},Qw=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p=this;(p=e.call(this,t)||this).channelType=et.BASE,p.messageType=Tt.BASE,p.mentionType=null,p.mentionedUsers=null,p.mentionedUserIds=null,p.metaArrays=[],p.extendedMessage={},p.createdAt=0,p.updatedAt=0,p.channelUrl=r.channel_url,p.channelType=Ve(et,r.channel_type)?r.channel_type:et.GROUP,r.channel&&(r.channel.channel_url&&(p.channelUrl=r.channel.channel_url),r.channel.channel_type&&(p.channelType=r.channel.channel_type)),p.data=(i=r.data)!==null&&i!==void 0?i:"",p.customType=(s=r.custom_type)!==null&&s!==void 0?s:"",p.mentionType=Ve(lr,r.mention_type)?r.mention_type:null,p.mentionedUsers=r.mentioned_users?r.mentioned_users.map(function(E){return new Ze(p._iid,E)}):null,p.mentionedUserIds=(a=r.mentioned_user_ids)!==null&&a!==void 0?a:null,p.mentionedUsers&&!p.mentionedUserIds&&(p.mentionedUserIds=p.mentionedUsers.map(function(E){return E.userId})),p.mentionedMessageTemplate=(o=r.mentioned_message_template)!==null&&o!==void 0?o:"";var m=(l=r.metaarray)!==null&&l!==void 0?l:{},b=(u=r.metaarray_key_order)!==null&&u!==void 0?u:Object.keys(m).sort(function(E,S){return E.localeCompare(S)});p.metaArrays=[];for(var v=0;v0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSubmittable",{get:function(){return this.fields.every(function(n){return n.isSubmittable})},enumerable:!1,configurable:!0}),e.prototype.getFieldAnswer=function(n){var t;return(t=this.answers)===null||t===void 0?void 0:t[n]},e.payloadify=function(n){var t;return be(Ie({key:(t=n.formKey)!==null&&t!==void 0?t:n.key,fields:n.fields.map(function(r){return Yw.payloadify(r)})}))},e.isFormPayload=function(n){var t;return!!(!((t=n==null?void 0:n.forms)===null||t===void 0)&&t[0])},e}(),Yw=function(){function e(n){this.key=n.key,this.inputType=n.input_type,this.title=n.title,this.required=n.required,this.regex=n.regex,this.placeholder=n.placeholder,this.fieldKey=n.key}return e.prototype.isValid=function(n){if(!this.regex)return!0;try{return new RegExp(this.regex).test(n)}catch{return!0}},Object.defineProperty(e.prototype,"isSubmittable",{get:function(){return!(this.temporaryAnswer!=null&&!this.isValid(this.temporaryAnswer)||this.required&&this.temporaryAnswer==null)},enumerable:!1,configurable:!0}),e.payloadify=function(n){var t;return be(Ie({key:(t=n.fieldKey)!==null&&t!==void 0?t:n.key,input_type:n.inputType,title:n.title,required:n.required,regex:n.regex,placeholder:n.placeholder}))},e}(),Zw=function(e){function n(t,r){var i,s,a=this;return(a=e.call(this,t)||this).channelUrl=(i=r.channel_url)!==null&&i!==void 0?i:"",a.channelType=(s=r.channel_type)!==null&&s!==void 0?s:et.GROUP,a.reader=new Ze(a._iid,r.user),a.readAt=r.ts,a}return w(n,e),n}(Jn),Zx=function(e){function n(t){var r=t.channelUrl;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:r}})||this}return w(n,e),n}(Rr);(function(e){function n(t){var r=e.call(this)||this,i=t.channelUrl,s=t.channelType,a=t.userId,o=t.notificationIds;return r.method=Y.PUT,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/messages/mark_as_read"),r.params=be(Ie({user_id:a,message_ids:o})),r}return w(n,e),n})(Z);var Xw=function(e){function n(t,r,i){var s=e.call(this,t,"READ",i)||this;return s.readStatus=new Zw(t,i),s}return w(n,e),n}(Et);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.readAt=r.ts,i.unreadMessageCount=r.unread_message_count,i}return w(n,e),n})(le);var Xx=function(e){function n(t){var r=t.channelUrl,i=t.messageId;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:r,parent_message_id:i}})||this}return w(n,e),n}(Rr),Jx=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.pushEnabled,o=e.call(this)||this;return o.method=Y.PUT,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/thread_push"),o.params={push_enabled:a},o}return w(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}w(n,e)})(le);var pE=function(e){function n(t){var r=e.call(this)||this;return r.method=Y.POST,r.path="".concat(cr,"/").concat(encodeURIComponent(t.channelUrl),"/messages/").concat(t.messageId,"/submit_forms"),r.params=be({forms:t.forms}),r}return w(n,e),n}(Z),eO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.rating,o=t.comment,l=e.call(this)||this;return l.method=Y.POST,l.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks"),l.params={rating:a,comment:o},l}return w(n,e),n}(Z),tO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new Qo(r),i}return w(n,e),n}(le),nO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.feedbackId,o=t.rating,l=t.comment,u=e.call(this)||this;return u.method=Y.PUT,u.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(a),u.params={rating:o,comment:l},u}return w(n,e),n}(Z),rO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new Qo(r),i}return w(n,e),n}(le),iO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.feedbackId,o=e.call(this)||this;return o.method=Y.DELETE,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(a),o}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new Qo(r),i}w(n,e)})(le);var Ua,_i,Ev=function(e){function n(t,r){var i,s,a,o,l,u=this;return(u=e.call(this,t)||this).plainUrl="",u.fileName=null,u.mimeType=null,u.fileSize=0,u.thumbnails=[],u._requireAuth=!1,u.plainUrl=(i=r.url)!==null&&i!==void 0?i:"",u.fileName=(s=r.file_name)!==null&&s!==void 0?s:null,u.mimeType=(a=r.file_type)!==null&&a!==void 0?a:null,u.fileSize=(o=r.file_size)!==null&&o!==void 0?o:0,u._requireAuth=(l=r.require_auth)!==null&&l!==void 0&&l,u.thumbnails=r.thumbnails?r.thumbnails.map(function(c){var d;return new da(u._iid,typeof c=="string"?{url:c,width:0,height:0}:M(M({},c),{url:((d=c.url)!==null&&d!==void 0?d:"").split("auth=")[0]}),u._requireAuth)}):[],u}return w(n,e),n.payloadify=function(t){var r;return be(Ie({url:t.plainUrl,file_name:t.fileName,file_type:t.mimeType,file_size:t.fileSize,thumbnails:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){var s;return{url:((s=i.plainUrl)!==null&&s!==void 0?s:"").split("auth=")[0],width:i.width,height:i.height,real_width:i.realWidth,real_height:i.realHeight}}),require_auth:t._requireAuth}))},Object.defineProperty(n.prototype,"url",{get:function(){var t=R.of(this._iid).sessionManager;return this._requireAuth&&t.ekey?"".concat(this.plainUrl,"?auth=").concat(t.ekey):this.plainUrl},enumerable:!1,configurable:!0}),n}(Jn),Jw=function(e){var n=e.channelUrl,t=e.channelType,r=e.parentMessage;this.channelUrl=n,this.channelType=t,this.parentMessage=r};(function(e){e.PENDING="pending",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled"})(Ua||(Ua={})),function(e){e.PENDING="pending",e.IN_QUEUE="in_queue",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled",e.REMOVED="removed"}(_i||(_i={}));var ko,vr=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p=this;return(p=e.call(this,t,r)||this).parentMessage=null,p.silent=!1,p.isOperatorMessage=!1,p.threadInfo=null,p.reactions=[],p.appleCriticalAlertOptions=null,p.scheduledInfo=null,p.suggestedReplies=null,p.myFeedback=null,p.myFeedbackStatus="NOT_APPLICABLE",p.forms=null,p._isContinuousMessages=!1,p._scheduledStatus=null,p.messageId=(s=(i=r.msg_id)!==null&&i!==void 0?i:r.message_id)!==null&&s!==void 0?s:0,p.parentMessageId=(a=typeof r.parent_message_id=="string"?parseInt(r.parent_message_id):r.parent_message_id)!==null&&a!==void 0?a:0,p.threadInfo=r.thread_info?new v0(p._iid,r.thread_info):null,p.reactions=r.reactions?r.reactions.map(function(m){return new jh(m)}):[],p.ogMetaData=r.og_tag?new hE(r.og_tag):null,p.silent=(o=r.silent)!==null&&o!==void 0&&o,p.isOperatorMessage=(l=r.is_op_msg)!==null&&l!==void 0&&l,p.appleCriticalAlertOptions=r.apple_critical_alert_options?new qi(r.apple_critical_alert_options):null,typeof r.scheduled_message_id=="number"&&typeof r.scheduled_at=="number"&&r.scheduled_status&&(p.scheduledInfo={scheduledMessageId:r.scheduled_message_id,scheduledAt:r.scheduled_at},p._scheduledStatus=r.scheduled_status),p._isContinuousMessages=(u=r.is_continuous_messages)!==null&&u!==void 0&&u,p.myFeedback=!((c=r.feedback)===null||c===void 0)&&c.id?new Qo(r.feedback):null,p.myFeedbackStatus=(d=r.my_feedback_status)!==null&&d!==void 0?d:Qo.parseFeedbackStatusFromPayload(r.feedback),p.suggestedReplies=(f=(h=r.extended_message_payload)===null||h===void 0?void 0:h.suggested_replies)!==null&&f!==void 0?f:null,p.forms=Bh.isFormPayload(r.extended_message_payload)?r.extended_message_payload.forms.map(function(m){return new Bh(p.messageId,m.key,m.fields.map(function(b){return new Yw(b)}))}):null,p}return w(n,e),n.payloadify=function(t){var r,i;return be(Ie(M(M({},e.payloadify.call(this,t)),{message_id:t.messageId,parent_message_id:t.parentMessageId,thread_info:t.threadInfo?v0.payloadify(t.threadInfo):null,reactions:t.reactions.map(function(s){return jh.payloadify(s)}),og_tag:t.ogMetaData?hE.payloadify(t.ogMetaData):null,silent:t.silent,is_op_msg:t.isOperatorMessage,apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,scheduled_message_id:(r=t.scheduledInfo)===null||r===void 0?void 0:r.scheduledMessageId,scheduled_at:(i=t.scheduledInfo)===null||i===void 0?void 0:i.scheduledAt,scheduled_status:t._scheduledStatus,feedback:t.myFeedback?Qo.payloadify(t.myFeedback):null,my_feedback_status:t.myFeedbackStatus,forms:t.forms?t.forms.map(function(s){return Bh.payloadify(s)}):null})))},n._getParentMessageInfoPayload=function(t){return be(Ie({type:Kw(t.messageType),ts:t.createdAt,user:t.sender?ku.payloadify(t.sender):null,message:t.message,file:{url:t.plainUrl,name:t.name,type:t.type,require_auth:t.requireAuth},files:Array.isArray(t.fileInfoList)?t.fileInfoList.map(function(r){return Ev.payloadify(r)}):null}))},n.prototype.isIdentical=function(t){return this.messageId===t.messageId},n.prototype.applyThreadInfoUpdateEvent=function(t){return this.messageId===t.targetMessageId&&(t.threadInfo._isUpdateRequired&&this.threadInfo&&t.threadInfo._updateFrom(this.threadInfo),this.threadInfo=t.threadInfo,!0)},n.prototype.applyReactionEvent=function(t){if(this.messageId===t.messageId){for(var r=!1,i=0;i=r)return this.parentMessage=t,!0}return!1},n.prototype._triggerThreadInfoUpdatedEvent=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){return(t=R.of(this._iid).dispatcher).dispatch(new Jw({channelType:et.GROUP,channelUrl:this.channelUrl,parentMessage:this})),t.dispatch(new wt({messages:[this],source:z.EVENT_MESSAGE_THREADINFO_UPDATED})),[2]})})},n.prototype.markThreadAsRead=function(){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=R.of(this._iid).requestQueue,r=new Xx({channelUrl:this.channelUrl,messageId:this.messageId}),[4,t.send(r)];case 1:return i.sent(),this.threadInfo&&this.threadInfo.unreadReplyCount!==0?(this.threadInfo.unreadReplyCount=0,[4,this._triggerThreadInfoUpdatedEvent()]):[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},n.prototype.setPushNotificationEnabled=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return r=R.of(this._iid).requestQueue,i=new Jx({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,pushEnabled:t}),[4,r.send(i)];case 1:return s.sent(),this.threadInfo&&this.threadInfo.isPushNotificationEnabled!==t&&(this.threadInfo.isPushNotificationEnabled=t),[2]}})})},n.prototype.submitForm=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:if(Q(t.form&&t.form instanceof Bh||k("string",t.formId)&&k("object",t.answers)).throw(L.invalidParameters),r=R.of(this._iid),i=r.requestQueue,s=r.sdkState,a=r.logger,!t.form)return[3,2];if(!(o=t.form).isSubmittable)throw new L({code:Ae.INVALID_PARAMETER,message:"The given form is not submittable."});if(o.isSubmitted)throw new L({code:Ae.INVALID_PARAMETER,message:"The given form is already submitted."});if(o.messageId!=this.messageId)throw new L({code:Ae.INVALID_PARAMETER,message:"This form does not belong to the message."});return l=o.fields.reduce(function(d,h){return d[h.key]=h.temporaryAnswer,d},{}),u=new pE({userId:s.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:o.key,data:l}]}),[4,i.send(u)];case 1:return c.sent(),[3,4];case 2:return t.formId&&t.answers?(a.warn("The submitForm method with formId and answers is deprecated. Use submitForm({ form: Form }) instead."),u=new pE({userId:s.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:t.formId,data:t.answers}]}),[4,i.send(u)]):[3,4];case 3:c.sent(),c.label=4;case 4:return[2]}})})},n.prototype.submitFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=R.of(this._iid),i=r.requestQueue,s=r.dispatcher,a=new eO({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,rating:t.rating,comment:t.comment}),[4,i.send(a)];case 1:return o=u.sent(),l=o.as(tO),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new wt({messages:[this],source:z.EVENT_MESSAGE_FEEDBACK_ADDED})),[2]}})})},n.prototype.updateFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=R.of(this._iid),i=r.requestQueue,s=r.dispatcher,a=new nO({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:t.id,rating:t.rating,comment:t.comment}),[4,i.send(a)];case 1:return o=u.sent(),l=o.as(rO),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new wt({messages:[this],source:z.EVENT_MESSAGE_FEEDBACK_UPDATED})),[2]}})})},n.prototype.deleteFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=R.of(this._iid),i=r.requestQueue,s=r.dispatcher,a=new iO({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:t}),[4,i.send(a)];case 1:return o.sent(),this.myFeedback=null,this.myFeedbackStatus="NO_FEEDBACK",s.dispatch(new wt({messages:[this],source:z.EVENT_MESSAGE_FEEDBACK_DELETED})),[2]}})})},n}(Qw),Ht=function(e){function n(t,r){var i,s,a,o,l=this;if((l=e.call(this,t,r)||this).reqId="",l.replyToChannel=!1,l.errorCode=0,l.sender=r.user?new ku(l._iid,r.user):r.sender_id,l.reqId=(s=(i=r.req_id)!==null&&i!==void 0?i:r.request_id)!==null&&s!==void 0?s:"",l.replyToChannel=(a=r.is_reply_to_channel)!==null&&a!==void 0&&a,r.request_state&&Ve(ht,r.request_state)&&(l.sendingStatus=r.request_state),!l.sendingStatus)if(l.messageId>0)l.sendingStatus=ht.SUCCEEDED;else if(l.scheduledInfo)switch(r.scheduled_status&&(l._scheduledStatus=r.scheduled_status),r.scheduled_status){case _i.SENT:case _i.IN_QUEUE:l.sendingStatus=ht.SUCCEEDED;break;case _i.PENDING:l.sendingStatus=ht.SCHEDULED;break;case _i.FAILED:case _i.REMOVED:l.sendingStatus=ht.FAILED;break;case _i.CANCELED:l.sendingStatus=ht.CANCELED}else l.sendingStatus=ht.PENDING;return l.errorCode=(o=r.error_code)!==null&&o!==void 0?o:0,l._messageToken=r.mesg_token,l}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{user:ku.payloadify(t.sender),req_id:t.reqId,is_reply_to_channel:t.replyToChannel,request_state:t.sendingStatus,error_code:t.errorCode,mesg_token:t._messageToken})))},Object.defineProperty(n.prototype,"isResendable",{get:function(){return(this.sendingStatus===ht.FAILED||this.sendingStatus===ht.CANCELED)&&z6(this.errorCode)},enumerable:!1,configurable:!0}),n.prototype.isIdentical=function(t){return this.messageId>0&&t.messageId>0?this.messageId===t.messageId:this.reqId===t.reqId},n}(vr),rh={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:ar.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1},Ep=function(e){return k("number",e.prevResultSize)&&k("number",e.nextResultSize)&&k("boolean",e.isInclusive)&&k("boolean",e.reverse)&&k("string",e.messageTypeFilter)&&Ve(ar,e.messageTypeFilter)&&Qe("string",e.customTypesFilter,!0)&&Qe("string",e.senderUserIdsFilter,!0)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeReactions)&&k("boolean",e.includeParentMessageInfo)},Lu=function(e){function n(t,r){var i,s,a,o,l=this;if((l=e.call(this,t,r)||this).translations={},l.message=(i=r.message)!==null&&i!==void 0?i:"",l.messageType=Tt.ADMIN,l.translations=(s=r.translations)!==null&&s!==void 0?s:{},r.parent_message_info){var u=r.parent_message_info;l.parentMessage=wr(t,be(Ie(M(M({},u),{message_id:l.parentMessageId,channel_url:l.channelUrl,channel_type:l.channelType,file:u.file,url:(a=u.file)===null||a===void 0?void 0:a.url,require_auth:(o=u.file)===null||o===void 0?void 0:o.require_auth}))))}return l}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{message:t.message,translations:t.translations,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},rh),r),Q(this.messageId>0&&k("number",t)&&Ep(i)).throw(L.invalidParameters),[4,Ln.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(vr),_E=function(){function e(n){var t,r;this.detail={},this.type=(t=n.type)!==null&&t!==void 0?t:"",this.vendor=(r=n.vendor)!==null&&r!==void 0?r:"",n.detail&&k("object",n.detail)&&!Array.isArray(n.detail)&&(this.detail=n.detail)}return e.payloadify=function(n){return be(Ie({type:n.type,vendor:n.vendor,detail:n.detail}))},e}(),mE=function(){function e(n){this.status=n.status,n.original_message_info&&(this.originalMessageInfo={createdAt:n.original_message_info.ts,messageId:n.original_message_info.id})}return e.payloadify=function(n){return be({status:n.status,original_message_info:n.originalMessageInfo?{id:n.originalMessageInfo.messageId,ts:n.originalMessageInfo.createdAt}:void 0})},e}(),sr=function(e){function n(t,r){var i,s,a,o,l,u,c,d=this;if((d=e.call(this,t,r)||this).message="",d.messageParams=null,d.translations={},d.translationTargetLanguages=[],d.messageSurvivalSeconds=-1,d.plugins=[],d._poll=null,d.message=r.message,d.messageType=Tt.USER,d.translations=(a=r.translations)!==null&&a!==void 0?a:{},d.translationTargetLanguages=(o=r.target_langs)!==null&&o!==void 0?o:[],Object.keys(d.translations).length===0&&d.translationTargetLanguages.length>0)try{for(var h=ge(d.translationTargetLanguages),f=h.next();!f.done;f=h.next()){var p=f.value;d.translations[p]=""}}catch(b){i={error:b}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}if(d.messageSurvivalSeconds=(l=r.message_survival_seconds)!==null&&l!==void 0?l:-1,d.plugins=r.plugins?r.plugins.map(function(b){return new _E(b)}):[],d._poll=r.poll?new Vi(d._iid,r.poll):null,r.parent_message_info){var m=r.parent_message_info;d.parentMessage=wr(t,be(Ie(M(M({},m),{created_at:m.ts,message_id:d.parentMessageId,channel_url:d.channelUrl,channel_type:d.channelType,file:m.file,url:(u=m.file)===null||u===void 0?void 0:u.url,require_auth:(c=m.file)===null||c===void 0?void 0:c.require_auth}))))}return r.review_info&&(d.messageReviewInfo=new mE(r.review_info)),d}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{message:t.message,translations:t.translations,message_survival_seconds:t.messageSurvivalSeconds,plugins:t.plugins.map(function(r){return _E.payloadify(r)}),poll:t._poll?Vi.payloadify(t._poll):null,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null,review_info:t.messageReviewInfo?mE.payloadify(t.messageReviewInfo):void 0})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},rh),r),Q(this.messageId>0&&k("number",t)&&Ep(i)).throw(L.invalidParameters),[4,Ln.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n.prototype.applyPoll=function(t){return!(this._poll&&this._poll.id===t.id&&this._poll.updatedAt>t.updatedAt)&&(this._poll=t,!0)},Object.defineProperty(n.prototype,"poll",{get:function(){return this._poll},enumerable:!1,configurable:!0}),n}(Ht),yi=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h=this;if((h=e.call(this,t,r)||this).messageParams=null,h.fileInfoList=[],h.messageSurvivalSeconds=-1,h.messageType=Tt.FILE,h.data=(a=(s=(i=r.file)===null||i===void 0?void 0:i.data)!==null&&s!==void 0?s:r.custom)!==null&&a!==void 0?a:"",h.fileInfoList=(l=(o=r.files)===null||o===void 0?void 0:o.map(function(p){return new Ev(t,p)}))!==null&&l!==void 0?l:[],h.messageSurvivalSeconds=(u=r.message_survival_seconds)!==null&&u!==void 0?u:-1,r.parent_message_info){var f=r.parent_message_info;h.parentMessage=wr(t,be(Ie(M(M({},f),{created_at:f.ts,message_id:h.parentMessageId,channel_url:h.channelUrl,channel_type:h.channelType,file:f.file,url:(c=f.file)===null||c===void 0?void 0:c.url,require_auth:(d=f.file)===null||d===void 0?void 0:d.require_auth}))))}return h}return w(n,e),n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},rh),r),Q(this.messageId>0&&k("number",t)&&Ep(i)).throw(L.invalidParameters),[4,Ln.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n.payloadify=function(t){var r,i,s,a,o,l;return be(Ie(M(M({},e.payloadify.call(this,t)),{file:{name:(i=(r=t.fileInfoList[0])===null||r===void 0?void 0:r.fileName)!==null&&i!==void 0?i:"",size:(a=(s=t.fileInfoList[0])===null||s===void 0?void 0:s.fileSize)!==null&&a!==void 0?a:0,type:(l=(o=t.fileInfoList[0])===null||o===void 0?void 0:o.mimeType)!==null&&l!==void 0?l:"",data:t.data},files:Array.isArray(t.fileInfoList)?t.fileInfoList.map(function(u){return Ev.payloadify(u)}):null,message_survival_seconds:t.messageSurvivalSeconds,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},n._isMultipleFilesMessagePayload=function(t){var r=t.files;return Array.isArray(r)&&r.length>=2},n._isMultipleFilesMessageSerializedData=function(t){var r=t.fileInfoList;return Array.isArray(r)},n}(Ht);(function(e){e.SENT="SENT",e.READ="READ"})(ko||(ko={}));var al=function(e){function n(t,r){var i,s,a=this;if((a=e.call(this,t,r)||this).notificationData=null,a.notificationId=r.notification_message_id,a.messageType=Tt.ADMIN,a.messageStatus=(i=r.message_status)!==null&&i!==void 0?i:ko.SENT,a.priority=(s=r.priority)!==null&&s!==void 0?s:cv.NORMAL,a.notificationEventDeadline=r.notification_event_deadline,a.extendedMessage.sub_type===0)try{var o=JSON.parse(a.extendedMessage.sub_data),l=o.label,u=o.tags,c=u===void 0?[]:u,d=o.template_key,h=o.template_variables;a.notificationData={label:l,tags:c,templateKey:d,templateVariables:h}}catch{}return a}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{notification_message_id:t.notificationId,message_status:t.messageStatus,priority:t.priority,notification_event_deadline:t.notificationEventDeadline})))},n.prototype.isIdentical=function(t){return this.notificationId===t.notificationId},n}(Qw),vE=function(e){if(e.notificationId)return al.payloadify(e);switch(e.messageType){case Tt.USER:return sr.payloadify(e);case Tt.FILE:return e.fileInfoList?yi.payloadify(e):nn.payloadify(e);case Tt.ADMIN:return Lu.payloadify(e);default:throw L.unknown}},wr=function(e,n){if(n.notification_message_id)return new al(e,n);switch(n.type){case"MESG":return new sr(e,n);case"FILE":return yi._isMultipleFilesMessagePayload(n)?new yi(e,n):new nn(e,n);case"ADMM":case"BRDM":return new Lu(e,n);default:return null}},nn=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_=this;(_=e.call(this,t,r)||this).messageParams=null,_.plainUrl="",_.requireAuth=!1,_.thumbnails=[],_.messageSurvivalSeconds=-1,_.messageType=Tt.FILE;var E=r.file;if(_.plainUrl=((s=(i=E==null?void 0:E.url)!==null&&i!==void 0?i:r.url)!==null&&s!==void 0?s:"").split("?auth=")[0],_.name=(o=(a=E==null?void 0:E.name)!==null&&a!==void 0?a:r.name)!==null&&o!==void 0?o:"File",_.size=(u=(l=E==null?void 0:E.size)!==null&&l!==void 0?l:r.size)!==null&&u!==void 0?u:0,_.data=(d=(c=E==null?void 0:E.data)!==null&&c!==void 0?c:r.custom)!==null&&d!==void 0?d:"",_.type=E?(h=E.type)!==null&&h!==void 0?h:"":(f=r.type)!==null&&f!==void 0?f:"",_.requireAuth=(p=r.require_auth)!==null&&p!==void 0&&p,_.thumbnails=r.thumbnails?r.thumbnails.map(function(T){var N;return new da(_._iid,typeof T=="string"?{url:T,width:0,height:0}:M(M({},T),{url:((N=T.url)!==null&&N!==void 0?N:"").split("auth=")[0]}),_.requireAuth)}):[],_.messageSurvivalSeconds=(m=r.message_survival_seconds)!==null&&m!==void 0?m:-1,r.parent_message_info){var S=r.parent_message_info;_.parentMessage=wr(t,be(Ie(M(M({},S),{created_at:S.ts,message_id:_.parentMessageId,channel_url:_.channelUrl,channel_type:_.channelType,file:S.file,url:(b=S.file)===null||b===void 0?void 0:b.url,require_auth:(v=S.file)===null||v===void 0?void 0:v.require_auth}))))}return _}return w(n,e),n.payloadify=function(t){var r;return be(Ie(M(M({},e.payloadify.call(this,t)),{url:t.plainUrl,require_auth:t.requireAuth,file:{name:t.name,size:t.size,type:t.type,data:t.data},thumbnails:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){return{url:i.plainUrl,width:i.width,height:i.height,real_width:i.realWidth,real_height:i.realHeight}}),message_survival_seconds:t.messageSurvivalSeconds,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},Object.defineProperty(n.prototype,"url",{get:function(){var t=R.of(this._iid).sessionManager;return this.requireAuth&&t.ekey?"".concat(this.plainUrl,"?auth=").concat(t.ekey):this.plainUrl},enumerable:!1,configurable:!0}),n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},rh),r),Q(this.messageId>0&&k("number",t)&&Ep(i)).throw(L.invalidParameters),[4,Ln.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(Ht),g0=function(e){function n(t,r){var i=r.file,s=r.fileUrl,a=r.fileName,o=r.fileSize,l=r.mimeType,u=r.thumbnailSizes,c=r._uploadedMetaData,d=r._thumbnails,h=e.call(this,t)||this;return h._plainUrl=s,h.file=i,h.fileName=a,h.fileSize=o,h.mimeType=l,h.thumbnailSizes=u,h._uploadedMetaData=c,h._thumbnails=d,h}return w(n,e),n.getPlainUrl=function(t){return t instanceof n?t._plainUrl:t.fileUrl},Object.defineProperty(n.prototype,"fileUrl",{get:function(){var t,r=R.of(this._iid).sessionManager;return this._plainUrl&&(!((t=this._uploadedMetaData)===null||t===void 0)&&t.requireAuth)&&r.ekey?"".concat(this._plainUrl,"?auth=").concat(r.ekey):this._plainUrl},set:function(t){this._plainUrl=t},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return{file:this.file,fileUrl:this._plainUrl,fileName:this.fileName,fileSize:this.fileSize,mimeType:this.mimeType,thumbnailSizes:this.thumbnailSizes,_thumbnails:this._thumbnails,_uploadedMetaData:this._uploadedMetaData}},n}(Jn),sO=function(e){function n(t){var r,i,s,a,o=[];return t.mentionType===lr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(l){return l.userId}))),e.call(this,{code:"FILE",ackRequired:!0,payload:be(Ie({channel_url:t.channelUrl,files:t.files?tT(t.files):null,url:t.url,name:(r=t.fileName)!==null&&r!==void 0?r:"",type:(i=t.mimeType)!==null&&i!==void 0?i:"",size:(s=t.fileSize)!==null&&s!==void 0?s:0,custom:t.data,custom_type:t.customType,thumbnails:(a=t._thumbnails)===null||a===void 0?void 0:a.map(function(l){return da.payloadify(l)}),require_auth:t.requireAuth,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:o,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==cs.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,silent:t.silent,reply_to_channel:t.isReplyToChannel,parent_message_id:t.parentMessageId?t.parentMessageId:null,req_id:t.reqId,pin_message:t.isPinnedMessage}))})||this}return w(n,e),n}(Rr),aO=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var a=[];return t.mentionType===lr.USERS&&(t.mentionedUserIds?a=t.mentionedUserIds:t.mentionedUsers&&(a=t.mentionedUsers.map(function(o){return o.userId}))),s.method=Y.POST,s.path="".concat(nt(t.channelType),"/").concat(encodeURIComponent(t.channelUrl),"/messages"),s.params=be(Ie({message_type:Tt.FILE,user_id:t.userId,files:t.files?tT(t.files):null,url:t.fileUrl,mention_type:t.mentionType,mentioned_user_ids:a,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,data:t.data,custom_type:t.customType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(o){return da.payloadify(o)}),require_auth:t.requireAuth,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(o){return br.payloadify(o)}),push_option:t.pushNotificationDeliveryOption,parent_message_id:t.parentMessageId?t.parentMessageId:null,apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,reply_to_channel:t.isReplyToChannel,req_id:t.reqId,pin_message:t.isPinnedMessage})),s}return w(n,e),n}(Z),eT=function(e){function n(t,r,i){var s,a,o,l,u=this;(u=e.call(this,t,"FILE",i)||this).message=i.files&&i.files.length>=2?new yi(t,i):new nn(t,i);var c=R.of(t).sdkState;return u.isMentioned=Au(u.message.mentionType,(o=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(a=u.message.mentionedUsers)===null||a===void 0?void 0:a.map(function(d){return d.userId}))!==null&&o!==void 0?o:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return w(n,e),n}(Et),oO=function(e){function n(t,r){var i,s,a,o,l=this;(l=e.call(this,t,r)||this).message=r.files&&r.files.length>=2?new yi(t,r):new nn(t,r);var u=R.of(t).sdkState;return l.isMentioned=Au(l.message.mentionType,(a=(i=l.message.mentionedUserIds)!==null&&i!==void 0?i:(s=l.message.mentionedUsers)===null||s===void 0?void 0:s.map(function(c){return c.userId}))!==null&&a!==void 0?a:[],u.userId),l.forceUpdateLastMessage=(o=r.force_update_last_message)!==null&&o!==void 0&&o,l}return w(n,e),n}(le);function tT(e){return e.map(function(n){var t,r;return be(Ie({url:g0.getPlainUrl(n),file_name:n.fileName,file_type:n.mimeType,file_size:n.fileSize,thumbnails:(t=n._thumbnails)===null||t===void 0?void 0:t.map(function(i){return da.payloadify(i)}),require_auth:(r=n._uploadedMetaData)===null||r===void 0?void 0:r.requireAuth}))})}var Mn;(function(e){e[e.PENDING=0]="PENDING",e[e.UPLOADING=1]="UPLOADING",e[e.UPLOADED=2]="UPLOADED",e[e.SENDING=3]="SENDING",e[e.FAILED=4]="FAILED"})(Mn||(Mn={}));var lO=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.requestQueue,a=t.onlineDetector,o=t.cacheContext,l=this;this._queueMap=new Map,this._iid=n,this._sdkState=r,this._requestQueue=s,this._cacheContext=o,this._dispatcher=i,this._dispatcher.on(function(u){u instanceof Ii&&(l._connectionState=u.stateType)}),this._onlineDetector=a}return Object.defineProperty(e.prototype,"_shouldSendThroughWebSocket",{get:function(){return this._connectionState===lt.CONNECTED||this._connectionState===lt.CONNECTING||this._connectionState===lt.RECONNECTING},enumerable:!1,configurable:!0}),e.prototype._sendFileMessage=function(n,t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(a){switch(a.label){case 0:return r=this._createSendFileMessageRequestParams(n,t),this._shouldSendThroughWebSocket?(i=new sO(r),[4,this._requestQueue.send(i)]):[3,2];case 1:return s=a.sent(),[2,s.as(eT).message];case 2:return i=new aO(M(M({},r),{userId:this._sdkState.userId})),[4,this._requestQueue.send(i)];case 3:return s=a.sent(),[2,s.as(oO).message]}})})},e.prototype._createSendFileMessageRequestParams=function(n,t){var r=M(M({},t.params),{channelUrl:n.url,channelType:n.channelType,reqId:t.requestId,url:""});if(t.multipleFileUploadInfo){var i=t.params;r.files=i.fileInfoList}else i=t.params,r.url=i.fileUrl,r.requireAuth=i.requireAuth;return r},e.prototype._resolveMessageQueue=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p,m;return g(this,function(b){switch(b.label){case 0:if(!(r=this._queueMap.get(n.url)))return[3,21];if(r.isResolving)return[3,20];r.isResolving=!0,i=[],s=!0,b.label=1;case 1:b.trys.push([1,15,16,17]),a=ge(r.messageQueue),o=a.next(),b.label=2;case 2:if(o.done)return[3,14];switch(l=o.value,l.state){case Mn.PENDING:case Mn.UPLOADING:return[3,3];case Mn.UPLOADED:return[3,4];case Mn.FAILED:return[3,12]}return[3,13];case 3:return s=!1,i.push(l),[3,13];case 4:if(!s)return[3,10];b.label=5;case 5:return b.trys.push([5,8,,9]),l.state=Mn.SENDING,[4,this._sendFileMessage(n,l)];case 6:return u=b.sent(),l.deferred.resolve(u),[4,Br(100)];case 7:return b.sent(),[3,9];case 8:return c=b.sent(),l.deferred.reject(c),[3,9];case 9:return[3,11];case 10:i.push(l),b.label=11;case 11:return[3,13];case 12:return d=(t=l.error)!==null&&t!==void 0?t:L.unknown,l.deferred.reject(d.code===Ae.REQUEST_CANCELED?L.fileUploadCanceled:d),[3,13];case 13:return o=a.next(),[3,2];case 14:return[3,17];case 15:return h=b.sent(),p={error:h},[3,17];case 16:try{o&&!o.done&&(m=a.return)&&m.call(a)}finally{if(p)throw p.error}return[7];case 17:return f=r.isResolveRequestPending,r.messageQueue=i,r.isResolving=!1,r.isResolveRequestPending=!1,f?[4,this._resolveMessageQueue(n)]:[3,19];case 18:b.sent(),b.label=19;case 19:return[3,21];case 20:r.isResolveRequestPending=!0,b.label=21;case 21:return[2]}})})},e.prototype._uploadNextPendingItem=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return(r=this._queueMap.get(n.url))&&(i=r.messageQueue.find(function(p){return p.state===Mn.PENDING}))?i.multipleFileUploadInfo?(s=i.multipleFileUploadInfo,a=s.uploadIndex,o=s.uploadCount,l=s.requestHandler,h=i.params,u=h.fileInfoList[a],!Er(u.file)||!((t=u._uploadedMetaData)===null||t===void 0)&&t.isUploaded?[3,2]:[4,this._tryUploadNextItemAndUpdateItemState(n,r,i)]):[3,4]:[3,9];case 1:return f.sent(),[3,3];case 2:i.state=a=0&&n.uploadQueue.splice(r,1)},e.prototype._uploadNextFileForSingleFileItemAndUpdateParams=function(n,t,r){var i,s,a;return y(this,void 0,void 0,function(){var o,l,u,c,d,h,f,p,m,b;return g(this,function(v){switch(v.label){case 0:return o=new _0({file:r.file,channelUrl:n.url,thumbnailSizes:r.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(o)];case 1:return l=v.sent(),u=l.as(m0),c=u.url,d=u.fileSize,h=d===void 0?r.fileSize:d,f=u.thumbnails,p=f===void 0?[]:f,m=u.requireAuth,b=m!==void 0&&m,r.fileName=(i=r.fileName)!==null&&i!==void 0?i:r.file.name,r.mimeType=(s=r.mimeType)!==null&&s!==void 0?s:r.file.type,r.fileSize=(a=r.fileSize)!==null&&a!==void 0?a:r.file.size,r.fileUrl=c,r.fileSize=h,r.requireAuth=b,r._thumbnails=p,[2]}})})},e.prototype._uploadNextFileForMultipleFilesItemAndUpdateParams=function(n,t,r){var i,s,a;return y(this,void 0,void 0,function(){var o,l,u,c,d,h,f,p,m,b,v;return g(this,function(_){switch(_.label){case 0:return o=t.multipleFileUploadInfo.uploadIndex,l=r.fileInfoList[o],u=new _0({file:l.file,channelUrl:n.url,thumbnailSizes:l.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(u)];case 1:return c=_.sent(),d=c.as(m0),h=d.url,f=d.fileSize,p=f===void 0?l.fileSize:f,m=d.thumbnails,b=d.requireAuth,v=b!==void 0&&b,l.fileName=(i=l.fileName)!==null&&i!==void 0?i:l.file.name,l.mimeType=(s=l.mimeType)!==null&&s!==void 0?s:l.file.type,l.fileSize=(a=l.fileSize)!==null&&a!==void 0?a:l.file.size,l.file=void 0,l.fileUrl=h,l.fileSize=p,l._thumbnails=m,l._uploadedMetaData=M(M({},l._uploadedMetaData),{requireAuth:v,isUploaded:!0}),l instanceof g0||(r.fileInfoList[o]=new g0(this._iid,l)),[2]}})})},e.prototype.request=function(n,t,r,i){return i===void 0&&(i={}),y(this,void 0,void 0,function(){var s,a,o,l,u;return g(this,function(c){return this._queueMap.has(n.url)||(s={messageQueue:[],uploadQueue:[],isResolving:!1,isResolveRequestPending:!1},this._queueMap.set(n.url,s)),a=this._queueMap.get(n.url),o=new Or,l={requestId:t,params:r,state:Mn.PENDING,deferred:o},function(d){return"fileInfoList"in d}(r)&&(u=M({uploadIndex:0,uploadCount:r.fileInfoList.length},i),l.multipleFileUploadInfo=u),a.messageQueue.push(l),this._uploadNextPendingItem(n),[2,o.promise]})})},e.prototype.cancel=function(n,t){var r,i,s=this._queueMap.get(n.url);if(s){var a=t?[s.messageQueue.find(function(p){return p.requestId===t})]:Fe([],Me(s.messageQueue),!1);try{for(var o=ge(a),l=o.next();!l.done;l=o.next()){var u=l.value;if(u)switch(u.state){case Mn.PENDING:if(u.state=Mn.FAILED,u.error=L.requestCanceled,u.multipleFileUploadInfo&&!u.multipleFileUploadInfo.isCopy){var c=u.multipleFileUploadInfo,d=c.uploadIndex,h=c.requestHandler,f=u.params.fileInfoList[d];h==null||h._triggerOnFileUploaded(u.requestId,d,f,L.fileUploadCanceled)}this._resolveMessageQueue(n);break;case Mn.UPLOADING:this._requestQueue.cancel(u.requestId),this._dispatcher.dispatch(new o0({requestId:u.requestId}))}}}catch(p){r={error:p}}finally{try{l&&!l.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}}else t&&(this._requestQueue.cancel(t),this._dispatcher.dispatch(new o0({requestId:t})))},e}(),bv,Zc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:ar.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,replyType:Bn.NONE,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1,showSubchannelMessagesOnly:!1},gE=function(e){return k("number",e.prevResultSize)&&k("number",e.nextResultSize)&&k("boolean",e.isInclusive)&&k("boolean",e.reverse)&&k("string",e.messageTypeFilter)&&Ve(ar,e.messageTypeFilter)&&Qe("string",e.customTypesFilter,!0)&&Qe("string",e.senderUserIdsFilter,!0)&&Ve(Bn,e.replyType)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeReactions)&&k("boolean",e.includeParentMessageInfo)&&k("boolean",e.includeThreadInfo)&&k("boolean",e.showSubchannelMessagesOnly)},Cv={replyType:Bn.NONE,includeReactions:!1,includeThreadInfo:!1,includeMetaArray:!1,includeParentMessageInfo:!1},yE=function(e){return Ve(Bn,e.replyType)&&k("boolean",e.includeReactions)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeParentMessageInfo)&&k("boolean",e.includeThreadInfo)},uO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.includeMetaArray,o=t.includeReactions,l=t.includeThreadInfo,u=t.includeParentMessageInfo,c=e.call(this)||this;return c.method=Y.GET,c.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(encodeURIComponent(s)),c.params={is_sdk:!0,with_sorted_meta_array:a,include_reactions:o,include_thread_info:l,include_parent_message_info:u,include_poll_details:!0},c}return w(n,e),n}(Z),cO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?wr(t,M({},r)):null,i}return w(n,e),n}(le),$h=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,a=t.token,o=t.prevResultSize,l=t.nextResultSize,u=t.isInclusive,c=t.reverse,d=t.messageTypeFilter,h=t.customTypesFilter,f=t.senderUserIdsFilter,p=t.replyType,m=t.includeMetaArray,b=t.includeReactions,v=t.parentMessageId,_=t.includeThreadInfo,E=t.includeParentMessageInfo,S=t.showSubchannelMessagesOnly,T=t.checkingHasNext,N=t.checkingContinuousMessages,I=e.call(this)||this;return I.method=Y.GET,I.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages"),I.params=be(Ie({is_sdk:!0,prev_limit:o,next_limit:l,include:u,reverse:c,message_ts:s,message_id:a,message_type:d??null,custom_types:h,sender_ids:f,include_reply_type:p,with_sorted_meta_array:m,include_reactions:b,parent_message_id:v,include_thread_info:_,include_parent_message_info:E,show_subchannel_message_only:S,include_poll_details:!0,checking_has_next:T,checking_continuous_messages:N})),I}return w(n,e),n}(Z),Gh=function(e){function n(t,r){var i=e.call(this,t,r)||this;return r.is_continuous_messages!==void 0&&(i.isContinuousMessages=r.is_continuous_messages),r.has_next!==void 0&&(i.hasNext=r.has_next),i.messages=r.messages.map(function(s){return wr(t,s)}),i}return w(n,e),n}(le),dO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,a=t.token,o=t.replyType,l=t.includeMetaArray,u=t.includeReactions,c=t.includeThreadInfo,d=t.includeParentMessageInfo,h=e.call(this)||this;return h.method=Y.GET,h.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/changelogs"),h.params={change_ts:s,token:a,with_sorted_meta_array:l,include_reactions:u,include_thread_info:c,include_reply_type:o,include_parent_message_info:d,include_poll_details:!0},h}return w(n,e),n}(Z),hO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedMessages=r.updated.map(function(s){return wr(t,s)}),i.deletedMessagesInfo=r.deleted.map(function(s){return{messageId:s.message_id,deletedAt:s.deleted_at}}),i.hasMore=r.has_more,i.nextToken=r.next,i}return w(n,e),n}(le),fO=function(e){function n(t){var r=t.channelUrl,i=t.scheduledMessageId,s=e.call(this)||this;return s.method=Y.GET,s.path="".concat(cr,"/").concat(encodeURIComponent(r),"/scheduled_messages/").concat(encodeURIComponent(i)),s.params={},s}return w(n,e),n}(Z),pO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?wr(t,M({},r)):null,i}return w(n,e),n}(le);(function(e){e.MUTED="muted",e.BANNED="banned"})(bv||(bv={}));var EE=function(){function e(n){var t,r,i,s;this.restrictionType=null,Ve(bv,n.restriction_type)&&(this.restrictionType=n.restriction_type),this.description=(t=n.description)!==null&&t!==void 0?t:null,this.endAt=(i=(r=n.end_at)!==null&&r!==void 0?r:n.muted_end_at)!==null&&i!==void 0?i:-1,this.remainingDuration=(s=n.remaining_duration)!==null&&s!==void 0?s:-1}return e.payloadify=function(n){return be(Ie({restriction_type:n.restrictionType,description:n.description,end_at:n.endAt,remaining_duration:n.remainingDuration}))},e}(),ml=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.restrictionInfo=new EE(r),i}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),EE.payloadify(t.restrictionInfo))))},n}(Ze);(function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).isMuted=!1,s.isMuted=(i=r.is_muted)!==null&&i!==void 0&&i,s}return w(n,e),n})(Ze);var Xr=function(){function e(){this._onPending=Ke,this._onFailed=Ke,this._onSucceeded=Ke}return e.prototype._trigger=function(n){switch(n==null?void 0:n.sendingStatus){case ht.PENDING:n.errorCode===0&&this._onPending(n);break;case ht.SCHEDULED:case ht.SUCCEEDED:this._onSucceeded(n)}},e.prototype._triggerFailed=function(n,t){switch(t==null?void 0:t.sendingStatus){case ht.FAILED:case ht.CANCELED:this._onFailed(n,t.scheduledInfo?null:t)}},e.prototype.onPending=function(n){return this._onPending=n,this},e.prototype.onFailed=function(n){return this._onFailed=n,this},e.prototype.onSucceeded=function(n){return this._onSucceeded=n,this},e}(),bp={data:void 0,customType:void 0,mentionType:lr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,parentMessageId:void 0,isReplyToChannel:!1,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0,isPinnedMessage:!1},Cp=function(e){return k("string",e.data,!0)&&k("string",e.customType,!0)&&Ve(lr,e.mentionType)&&Qe("string",e.mentionedUserIds,!0)&&Qe(Ze,e.mentionedUsers,!0)&&k("string",e.mentionedMessageTemplate,!0)&&Qe(br,e.metaArrays,!0)&&k("number",e.parentMessageId,!0)&&k("boolean",e.isReplyToChannel)&&Ve(cs,e.pushNotificationDeliveryOption,!0)&&k(qi,e.appleCriticalAlertOptions,!0)&&k("boolean",e.isPinnedMessage,!0)},bE=function(e){return{isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption,pollId:e.pollId}},nT=M(M({},bp),{message:"",translationTargetLanguages:void 0,pollId:void 0,extendedMessagePayload:void 0});function rT(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(M(M({},e),{mentionType:e.mentionType,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(i){return i.userId}),translationTargetLanguages:Object.keys(e.translations),pushNotificationDeliveryOption:cs.DEFAULT,parentMessageId:null,isReplyToChannel:!1,isPinnedMessage:!1}))}var Yo,Sv=function(e){var n;return be(Ie({data:e.data,customType:e.customType,mentionType:e.mentionType,mentionedUsers:e.mentionedUsers,mentionedUserIds:e.mentionedUserIds,mentionedMessageTemplate:e.mentionedMessageTemplate,metaArrays:e.metaArrays,pollId:(n=e.poll)===null||n===void 0?void 0:n.id,parentMessageId:e.parentMessageId,appleCriticalAlertOptions:e.appleCriticalAlertOptions,message:e.message,translationTargetLanguages:Object.keys(e.translations),extendedMessagePayload:e.extendedMessagePayload}))},iT=function(e){return Cp(e)&&k("string",e.message)&&Qe("string",e.translationTargetLanguages,!0)&&k("number",e.pollId,!0)&&k("object",e.extendedMessagePayload,!0)};(function(e){e.FILE="file",e.BLOB="blob",e.BLOB_LIKE_OBJECT="blobLikeObject",e.URL="url"})(Yo||(Yo={}));var Cf=function(e){return typeof window<"u"&&"Blob"in window&&typeof Blob<"u"&&e instanceof Blob},F_=function(e){return e===Yo.BLOB||e===Yo.FILE},CE=function(e){return{file:e.file,fileKey:e.fileKey,fileType:e.fileType,isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption}},SE=M(M({},bp),{file:void 0,fileKey:void 0,fileUrl:void 0,fileName:void 0,fileType:void 0,fileSize:void 0,mimeType:void 0,thumbnailSizes:void 0,requireAuth:!1});function sT(e){var n,t,r,i;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(M(M({},e),{fileUrl:e.plainUrl,fileName:e.name,fileSize:e.size,mimeType:e.type,mentionType:e.mentionType,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(s){return s.userId}),pushNotificationDeliveryOption:cs.DEFAULT,parentMessageId:null,isReplyToChannel:!1,thumbnailSizes:(i=e.thumbnails)===null||i===void 0?void 0:i.map(function(s){return{maxWidth:s.width,maxHeight:s.height}}),requireAuth:e.requireAuth,isPinnedMessage:!1,_thumbnails:e.thumbnails}))}var Xc,wv=function(e,n){var t;return e.messageParams?(!e.url&&Er(n)&&(e.messageParams.file=n),e.messageParams):be(Ie({data:e.data,customType:e.customType,mentionType:e.mentionType,mentionedUsers:e.mentionedUsers,mentionedUserIds:e.mentionedUserIds,metaArrays:e.metaArrays,parentMessageId:e.parentMessageId,appleCriticalAlertOptions:e.appleCriticalAlertOptions,file:n,fileUrl:e.url,fileName:e.name,fileSize:e.size,mimeType:e.type,thumbnailSizes:(t=e.thumbnails)===null||t===void 0?void 0:t.map(function(r){return{maxWidth:r.width,maxHeight:r.height}})}))},wE=function(e){return Cp(e)&&(Er(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return k("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},A2={data:void 0,customType:void 0,mentionType:lr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0},M2=function(e){return k("string",e.data,!0)&&k("string",e.customType,!0)&&Ve(lr,e.mentionType)&&Qe("string",e.mentionedUserIds,!0)&&Qe(Ze,e.mentionedUsers,!0)&&k("string",e.mentionedMessageTemplate,!0)&&Qe(br,e.metaArrays,!0)&&Ve(cs,e.pushNotificationDeliveryOption,!0)&&k(qi,e.appleCriticalAlertOptions,!0)},aT=M(M({},A2),{message:void 0,translationTargetLanguages:void 0,pollId:void 0}),oT=function(e){return M2(e)&&k("string",e.message,!0)&&Qe("string",e.translationTargetLanguages,!0)&&k("number",e.pollId,!0)},_O=M({},A2),mO=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.token,a=t.limit,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(nt(i),"/").concat(encodeURIComponent(r),"/operators"),o.params={token:s,limit:a},o}return w(n,e),n}(Z),vO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.operators=r.operators.map(function(s){return new Ze(t,s)}),i.token=r.next,i}return w(n,e),n}(le),gO=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:(t=[],this._hasNext?(this._isLoading=!0,r=R.of(this._iid).requestQueue,i=new mO(M(M({},this),{channelUrl:this.channelUrl,token:this._token})),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),a=s.as(vO),o=a.operators,l=a.token,this._token=l,this._hasNext=!!l,this._isLoading=!1,[2,o];case 2:return[2,t];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),yO=function(e){function n(t,r,i,s){var a,o,l,u,c,d,h,f,p,m,b=this;return(b=e.call(this,t,r,i,s)||this).reverse=!1,b.messageTypeFilter=ar.ALL,b.customTypesFilter=null,b.senderUserIdsFilter=null,b.replyType=Bn.NONE,b.includeMetaArray=!1,b.includeReactions=!1,b.includeParentMessageInfo=!1,b.includeThreadInfo=!1,b.showSubchannelMessagesOnly=!1,b._edge=Number.MAX_SAFE_INTEGER,b.reverse=(a=s.reverse)!==null&&a!==void 0&&a,b.messageTypeFilter=(o=s.messageTypeFilter)!==null&&o!==void 0?o:ar.ALL,b.customTypesFilter=(l=s.customTypesFilter)!==null&&l!==void 0?l:null,b.senderUserIdsFilter=(u=s.senderUserIdsFilter)!==null&&u!==void 0?u:null,b.replyType=(c=s.replyType)!==null&&c!==void 0?c:Bn.NONE,b.includeMetaArray=(d=s.includeMetaArray)!==null&&d!==void 0&&d,b.includeReactions=(h=s.includeReactions)!==null&&h!==void 0&&h,b.includeParentMessageInfo=(f=s.includeParentMessageInfo)!==null&&f!==void 0&&f,b.includeThreadInfo=(p=s.includeThreadInfo)!==null&&p!==void 0&&p,b.showSubchannelMessagesOnly=(m=s.showSubchannelMessagesOnly)!==null&&m!==void 0&&m,b}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.reverse)&&Ve(ar,this.messageTypeFilter)&&Ve(Bn,this.replyType)&&Qe("string",this.customTypesFilter,!0)&&Qe("string",this.senderUserIdsFilter,!0)&&k("boolean",this.includeMetaArray)&&k("boolean",this.includeReactions)&&k("boolean",this.includeParentMessageInfo)&&k("boolean",this.includeThreadInfo)&&k("boolean",this.showSubchannelMessagesOnly)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,Ln.of(this._iid).getMessagesByTimestamp(this.channelUrl,this.channelType,this._edge,Ie({prevResultSize:this.limit,nextResultSize:0,isInclusive:!1,reverse:this.reverse,messageTypeFilter:this.messageTypeFilter,customTypesFilter:this.customTypesFilter,replyType:this.replyType,senderUserIdsFilter:this.senderUserIdsFilter,includeReactions:this.includeReactions,includeMetaArray:this.includeMetaArray,includeParentMessageInfo:this.includeParentMessageInfo,includeThreadInfo:this.includeThreadInfo,showSubchannelMessagesOnly:this.showSubchannelMessagesOnly}))]):[3,2]:[3,5];case 1:return t=r.sent(),this._edge=Math.min.apply(Math,Fe([Number.MAX_SAFE_INTEGER],Me(t.map(function(i){return i.createdAt})),!1)),this._hasNext=t.length>=this.limit,this._isLoading=!1,[2,t];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),EO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.limit,o=t.token;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={limit:a,token:o},r}return w(n,e),n}(Z),bO=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.mutedUsers=[];var s=r.next,a=r.muted_list;return i.token=s,a&&a.length>0&&(i.mutedUsers=a.map(function(o){return new ml(t,o)})),i}return w(n,e),n}(le),CO=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return w(n,e),n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new EO(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(bO),a=s.mutedUsers,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),SO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.limit,o=t.token;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=be({limit:a,token:o}),r}return w(n,e),n}(Z),wO=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.bannedUsers=[];var s=r.next,a=r.banned_list;return i.token=s,a&&a.length>0&&(i.bannedUsers=a.map(function(o){return new ml(t,o.user)})),i}return w(n,e),n}(le),TO=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new SO(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(wO),a=s.bannedUsers,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca);(function(e){e.SPAM="spam",e.HARASSING="harassing",e.SUSPICIOUS="suspicious",e.INAPPROPRIATE="inappropriate"})(Xc||(Xc={}));var NO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.operatorUserIds;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:a},r}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var IO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.operatorUserIds;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:a},r}return w(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}w(n,e)})(le);var AO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/mute/").concat(a),r}return w(n,e),n}(Z),MO=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.isMuted=!1,i.startAt=0,i.endAt=0;var s=r.is_muted,a=r.start_at,o=r.end_at,l=r.remaining_duration,u=r.description;return i.isMuted=s,i.startAt=a,i.endAt=o,i.remainingDuration=l,i.description=u,i}return w(n,e),n}(le),TE=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.keys;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={keys:a,include_ts:!0},r}return w(n,e),n}(Z),NE=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.metadata,a=r.ts;return i.metadata=s,i.ts=a,i}return w(n,e),n}(le),xO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.metadata;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:a,include_ts:!0},r}return w(n,e),n}(Z),OO=function(e){function n(t,r){var i,s,a=this;return(a=e.call(this,t,r)||this).metaData=(i=r.metadata)!==null&&i!==void 0?i:{},a.ts=(s=r.ts)!==null&&s!==void 0?s:null,a}return w(n,e),n}(le),RO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.metadata,o=t.upsert;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:a,include_ts:!0,upsert:o!=null&&o},r}return w(n,e),n}(Z),kO=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.metadata,a=r.ts;return i.metadata=s,i.ts=a,i}return w(n,e),n}(le),LO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return i.data&&(s.created=i.data.created,s.updated=i.data.updated,s.deleted=i.data.deleted),s}return w(n,e),n}(Et),DO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.key;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata/").concat(a),r.params={include_ts:!0},r}return w(n,e),n}(Z),UO=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts;return i.ts=s,i}return w(n,e),n}(le),PO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={include_ts:!0},r}return w(n,e),n}(Z),FO=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts;return i.ts=s,i}return w(n,e),n}(le),IE=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.keys;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={keys:a},r}return w(n,e),n}(Z),AE=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return w(n,e),n}(le),HO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.metaCounter;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:a},r}return w(n,e),n}(Z),jO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return w(n,e),n}(le),H_=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.metaCounter,o=t.upsert,l=o!==void 0&&o,u=t.mode,c=u===void 0?"set":u;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:a,upsert:l,mode:c},r}return w(n,e),n}(Z),j_=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return w(n,e),n}(le),BO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return i.data&&(s.created=i.data.created,s.updated=i.data.updated,s.deleted=i.data.deleted),s}return w(n,e),n}(Et),$O=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.key;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter/").concat(a),r.params={},r}return w(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}w(n,e)})(le);var GO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={},r}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var zO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId,o=t.seconds,l=t.description;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={user_id:a,seconds:o,description:l},r}return w(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}w(n,e)})(le);var VO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new ml(t,i.data),s}return w(n,e),n}(Et),qO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/mute/").concat(encodeURIComponent(a)),r}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var WO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new ml(t,i.data),s}return w(n,e),n}(Et),KO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId,o=t.seconds,l=t.description;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=be({user_id:a,seconds:o,description:l}),r}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var QO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new ml(t,i.data),i.data.member_count&&(s.memberCount=i.data.member_count),i.data.joined_member_count&&(s.joinedMemberCount=i.data.joined_member_count),s}return w(n,e),n}(Et),YO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.userId;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/ban/").concat(encodeURIComponent(a)),r}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var ZO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new ml(t,i.data),s}return w(n,e),n}(Et),ME=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.freezing;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(nt(s),"/").concat(encodeURIComponent(i),"/freeze"),r.params={freeze:a},r}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var XO=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.freeze=i.data.freeze,s}return w(n,e),n}(Et),JO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.category,o=t.userId,l=t.description;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(sw(s),"/").concat(encodeURIComponent(i)),r.params={report_category:a,reporting_user_id:o,report_description:l},r}return w(n,e),n}(Z),eR=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.category,o=t.userId,l=t.offendingUserId,u=t.description;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(hv,"/users/").concat(l),r.params={channel_url:i,channel_type:s===et.OPEN?"open_channels":"group_channels",report_category:a,reporting_user_id:o,report_description:u},r}return w(n,e),n}(Z),tR=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,a=t.category,o=t.userId,l=t.offendingUserId,u=t.messageId,c=t.description,d=t.messageToken;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(sw(s),"/").concat(encodeURIComponent(i),"/messages/").concat(u),r.params=be({report_category:a,reporting_user_id:o,report_description:c,offending_user_id:l,mesg_token:d}),r}return w(n,e),n}(Z),nR=function(e){function n(t){var r=[];return t.mentionType===lr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"MESG",ackRequired:!0,payload:be(Ie({channel_url:t.channelUrl,message:t.message,data:t.data,custom_type:t.customType,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:r,mentioned_message_template:t.mentionedMessageTemplate,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==cs.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions,silent:t.silent,reply_to_channel:t.isReplyToChannel,parent_message_id:t.parentMessageId?t.parentMessageId:null,req_id:t.reqId,poll_id:t.pollId,pin_message:t.isPinnedMessage,extended_message_payload:t.extendedMessagePayload}))})||this}return w(n,e),n}(Rr),lT=function(e){function n(t,r,i){var s,a,o,l,u=this;(u=e.call(this,t,"MESG",i)||this).message=new sr(t,i);var c=R.of(t).sdkState;return u.isMentioned=Au(u.message.mentionType,(o=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(a=u.message.mentionedUsers)===null||a===void 0?void 0:a.map(function(d){return d.userId}))!==null&&o!==void 0?o:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return w(n,e),n}(Et),xE=function(e){function n(t){var r=null;return t.mentionType===lr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"MEDI",ackRequired:!0,payload:be(Ie({channel_url:t.channelUrl,msg_id:t.messageId,message:t.message,data:t.data,custom_type:t.customType,metaarray:t.metaArrayParams,mention_type:t.mentionType,mentioned_user_ids:r,mentioned_message_template:t.mentionedMessageTemplate,apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,poll_id:t.pollId}))})||this}return w(n,e),n}(Rr),Tv=function(e){function n(t,r,i){var s,a,o,l,u,c=this;(c=e.call(this,t,"MEDI",i)||this).message=new sr(t,i);var d=R.of(t).sdkState;return c.mentionCountChange=m2({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(o=(a=i.old_values)===null||a===void 0?void 0:a.mentioned_user_ids)!==null&&o!==void 0?o:[]},Ie({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return w(n,e),n}(Et),OE=function(e){function n(t){var r=null;return t.mentionType===lr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"FEDI",ackRequired:!0,payload:be(Ie({channel_url:t.channelUrl,msg_id:t.messageId,data:t.data,custom_type:t.customType,metaarray:t.metaArrayParams,mention_type:t.mentionType,mentioned_user_ids:r,apple_critical_alert_options:t.appleCriticalAlertOptions}))})||this}return w(n,e),n}(Rr),Nv=function(e){function n(t,r,i){var s,a,o,l,u,c=this;(c=e.call(this,t,"FEDI",i)||this).message=new nn(t,i);var d=R.of(t).sdkState;return c.mentionCountChange=m2({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(o=(a=i.old_values)===null||a===void 0?void 0:a.mentioned_user_ids)!==null&&o!==void 0?o:[]},Ie({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return w(n,e),n}(Et),rR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.reactionKey,o=e.call(this)||this;return o.method=Y.POST,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),o.params={reaction:a},o}return w(n,e),n}(Z),iR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new I2(r),i}return w(n,e),n}(le),sR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.reactionKey,o=e.call(this)||this;return o.method=Y.DELETE,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),o.params={reaction:a},o}return w(n,e),n}(Z),aR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new I2(M({},r)),i}return w(n,e),n}(le),oR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=t.translationTargetLanguages,o=e.call(this)||this;return o.method=Y.POST,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(encodeURIComponent(s),"/translation"),o.params={target_langs:a},o}return w(n,e),n}(Z),lR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new sr(t,r),i}return w(n,e),n}(le),uR=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===lr.USERS&&(t.mentionedUserIds?s=t.mentionedUserIds:t.mentionedUsers&&(s=t.mentionedUsers.map(function(l){return l.userId})));var a=t.channelType,o=t.channelUrl;return i.method=Y.POST,i.path="".concat(nt(a),"/").concat(encodeURIComponent(o),"/scheduled_messages"),i.params=be(Ie({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Iu.USER,message:t.message,custom_type:t.customType,data:t.data,mention_type:t.mentionType,mentioned_user_ids:s,sorted_metaarray:(r=t.metaArrays)===null||r===void 0?void 0:r.map(function(l){return br.payloadify(l)}),apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return w(n,e),n}(Z),uT=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new sr(t,r),i}return w(n,e),n}(le),cR=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var a=[];t.mentionType===lr.USERS&&(t.mentionedUserIds?a=t.mentionedUserIds:t.mentionedUsers&&(a=t.mentionedUsers.map(function(u){return u.userId})));var o=t.channelType,l=t.channelUrl;return s.method=Y.POST,s.path="".concat(nt(o),"/").concat(encodeURIComponent(l),"/scheduled_messages"),s.params=Ie({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Iu.FILE,url:t.fileUrl,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(u){return da.payloadify(u)}),custom_type:t.customType,data:t.data,require_auth:t.requireAuth,mention_type:t.mentionType,mentioned_user_ids:a,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(u){return br.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption}),s}return w(n,e),n}(Z),dR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new nn(t,r),i}return w(n,e),n}(le),hR=function(e){function n(t){var r=t.pollId,i=t.title,s=t.data,a=t.allowUserSuggestion,o=t.allowMultipleVotes,l=t.closeAt,u=e.call(this)||this;return u.method=Y.PUT,u.path="".concat(ds,"/").concat(encodeURIComponent(r)),u.params={title:i,data:s,allow_user_suggestion:a,allow_multiple_votes:o,close_at:l},u}return w(n,e),n}(Z),fR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return w(n,e),n}(le),pR=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Y.DELETE,i.path="".concat(ds,"/").concat(encodeURIComponent(r)),i}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var _R=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Y.PUT,i.path="".concat(ds,"/").concat(encodeURIComponent(r),"/close"),i}return w(n,e),n}(Z),mR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return w(n,e),n}(le),vR=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,a=t.optionText,o=e.call(this)||this;return o.method=Y.POST,o.path="".concat(ds,"/").concat(encodeURIComponent(s),"/options"),o.params={channel_url:r,channel_type:i,text:a},o}return w(n,e),n}(Z),gR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return w(n,e),n}(le),yR=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=t.optionText,a=e.call(this)||this;return a.method=Y.PUT,a.path="".concat(ds,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),a.params={text:s},a}return w(n,e),n}(Z),ER=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Vi(t,r),i}return w(n,e),n}(le),bR=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(ds,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),s}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var CR=function(e){function n(t){var r=t.reqId,i=t.channelType,s=t.channelUrl,a=t.pollId,o=t.pollOptionIds;return e.call(this,{code:"VOTE",ackRequired:!0,payload:be({req_id:r,channel_type:i===et.OPEN?"open_channels":"group_channels",channel_url:s,poll_id:a,option_ids:o})})||this}return w(n,e),n}(Rr),cT=function(e){function n(t,r,i){var s=e.call(this,t,"VOTE",i)||this;return s.event=new Dx(i),s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return w(n,e),n}(Et),dT=100,hT="GroupChannel",SR="url",fT=100,Iv="Message",wR="messageId",pT="NotificationMessage",TR="notificationId",NR="Poll",IR="pollId",AR="FeedChannel",MR="url";function xR(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(M(M({},e),{isReplyToChannel:!1,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(i){return i.userId}),pushNotificationDeliveryOption:cs.DEFAULT,isPinnedMessage:!1,fileInfoList:e.fileInfoList.map(function(i){var s;return{fileUrl:i.plainUrl,fileName:i.fileName,fileSize:i.fileSize,mimeType:i.mimeType,thumbnailSizes:(s=i.thumbnails)===null||s===void 0?void 0:s.map(function(a){return{maxWidth:a.width,maxHeight:a.height}}),_thumbnails:i.thumbnails,_uploadedMetaData:{requireAuth:i._requireAuth,isUploaded:!0}}})}))}var nr,OR=M(M({},bp),{fileInfoList:[]}),RR=function(e){return(Er(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return n.maxWidth>0&&n.maxHeight>0}))},Sf=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._onFileUploaded=Ke,t}return w(n,e),n.prototype._triggerOnFileUploaded=function(t,r,i,s){this._onFileUploaded(t,r,i,s)},n.prototype.onFileUploaded=function(t){return this._onFileUploaded=t,this},n.prototype.onPending=function(t){return e.prototype.onPending.call(this,t),this},n.prototype.onFailed=function(t){return e.prototype.onFailed.call(this,t),this},n.prototype.onSucceeded=function(t){return e.prototype.onSucceeded.call(this,t),this},n}(Xr),kR=2;(function(e){e.SEND="send",e.RESEND="resend",e.COPY="copy"})(nr||(nr={}));var It,RE=function(e){function n(t,r){var i,s,a,o,l,u,c=this;return(c=e.call(this,t)||this)._name="",c._createdAt=0,c.channelType=et.BASE,c.coverUrl="",c.customType="",c.data="",c.isFrozen=!1,c.isEphemeral=!1,c.creator=null,c._messageCollectionLastAccessedAt=0,c._url=r.channel_url,c._name=(i=r.name)!==null&&i!==void 0?i:"",c._createdAt=1e3*r.created_at,c.coverUrl=(s=r.cover_url)!==null&&s!==void 0?s:"",c.customType=(a=r.custom_type)!==null&&a!==void 0?a:"",c.data=(o=r.data)!==null&&o!==void 0?o:"",c.isFrozen=(l=r.freeze)!==null&&l!==void 0&&l,c.isEphemeral=(u=r.is_ephemeral)!==null&&u!==void 0&&u,c.creator=r.created_by?new Ze(c._iid,r.created_by):null,r.metadata&&Object.keys(r.metadata).length>0&&r.ts&&(c._cachedMetaData=new Map,Object.keys(r.metadata).forEach(function(d){c._cachedMetaData.set(d,{value:r.metadata[d],isRemoved:!1,updatedAt:r.ts})})),c}return w(n,e),Object.defineProperty(n.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},set:function(t){this._name=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"createdAt",{get:function(){return this._createdAt},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return M(M({},this),{url:this._url,name:this._name,createdAt:this._createdAt})},n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{channel_url:t.url,name:t.name,cover_url:t.coverUrl,custom_type:t.customType,data:t.data,freeze:t.isFrozen,is_ephemeral:t.isEphemeral,created_by:t.creator?Ze.payloadify(t.creator):null,created_at:t.createdAt/1e3})))},n.prototype.isGroupChannel=function(){return this.channelType===et.GROUP},n.prototype.isOpenChannel=function(){return this.channelType===et.OPEN},n.prototype.isFeedChannel=function(){return this.channelType===et.FEED},Object.defineProperty(n.prototype,"cachedMetaData",{get:function(){var t={};return this._cachedMetaData&&this._cachedMetaData.forEach(function(r,i){r.isRemoved||(t[i]=r.value)}),t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"messageCollectionLastAccessedAt",{get:function(){return this._messageCollectionLastAccessedAt},enumerable:!1,configurable:!0}),n.prototype._updateMessageCollectionLastAccessedAt=function(){this._messageCollectionLastAccessedAt=Date.now()},n.prototype._update=function(t){var r=be(t);Object.assign(this,r)},n.prototype._upsertCachedMetaData=function(t,r){var i=this;Object.keys(t).forEach(function(s){i._cachedMetaData||(i._cachedMetaData=new Map);var a=i._cachedMetaData.get(s);(!a||a.updatedAt<=r)&&i._cachedMetaData.set(s,{value:t[s],isRemoved:!1,updatedAt:r})})},n.prototype._updateCachedMetaData=function(t,r){var i=this;this._cachedMetaData?this._cachedMetaData.forEach(function(s,a){var o;s.updatedAt<=r&&i._cachedMetaData.set(a,{value:(o=t[a])!==null&&o!==void 0?o:s.value,isRemoved:!t[a],updatedAt:r})}):(this._cachedMetaData=new Map,Object.keys(t).forEach(function(s){i._cachedMetaData.set(s,{value:t[s],isRemoved:!1,updatedAt:r})}))},n.prototype._removeFromCachedMetaData=function(t,r){var i=this;this._cachedMetaData&&t.forEach(function(s){var a=i._cachedMetaData.get(s);a&&a.updatedAt0&&Qe("string",r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new oR({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,translationTargetLanguages:r}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(lR).message]}})})},n.prototype._createScheduledUserMessage=function(t,r){var i=this,s=R.of(this._iid).requestQueue,a=Date.now(),o=this._generateRequestId();Br(2).then(function(){var u=i._createPendingScheduledUserMessage(t,o,a);Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(c){return[2,r._trigger(u)]})})})});var l=new uR(M({reqId:o,channelType:this.channelType,channelUrl:this.url},t));s.send(l).then(function(u){var c=u.as(uT).message;Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(d){return[2,r._trigger(c)]})})})}).catch(function(u){if(zr(u))throw u;Br(2).then(function(){var c=i._createPendingScheduledUserMessage(t,o,a);i._markMessageAsFailed(c,u),Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessage=function(t){var r=M(M({},SE),t);return Q(wE(r)).throw(L.invalidParameters),this._sendFileMessage(r)},n.prototype.sendMultipleFilesMessage=function(t){var r,i=M(M({},OR),t),s=R.of(this._iid);Q(function(o,l){return l===void 0&&(l=fx),Cp(o)&&Array.isArray(o.fileInfoList)&&o.fileInfoList.length>=2&&o.fileInfoList.length<=l&&o.fileInfoList.every(function(u){return RR(u)})}(i,(r=s.appInfo)===null||r===void 0?void 0:r.multipleFilesMessageFileCountLimit)).throw(L.invalidParameters);var a=!!t.fileInfoList.find(function(o){var l=s.appInfo.uploadSizeLimit;return o.file instanceof Blob&&o.file.size>l||o.fileSize>l});return Q(!a).throw(L.fileSizeLimitExceededError),this._sendMultipleFilesMessage(i)},n.prototype._sendFileMessage=function(t,r,i){var s=this;r===void 0&&(r=nr.SEND);var a=R.of(this._iid).dispatcher,o=Ln.of(this._iid).fileMessageQueue,l=i??this._generateRequestId(),u=Date.now(),c=new Xr;return Br(2).then(function(){var d=s._createPendingFileMessage(t,l,u);a.dispatch(new wt({messages:[d],source:r===nr.RESEND?z.LOCAL_MESSAGE_RESEND_STARTED:z.EVENT_MESSAGE_SENT_PENDING})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(h){return[2,c._trigger(d)]})})}),o.request(s,l,t).then(function(h){a.dispatch(new wt({messages:[h],source:z.EVENT_MESSAGE_SENT_SUCCESS})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(f){return[2,c._trigger(h)]})})})}).catch(function(h){if(zr(h))throw h;Br(2).then(function(){var f=s._createPendingFileMessage(t,l,u),p=R.of(s._iid).cacheContext,m=p.localCacheEnabled&&p.localCacheConfig.enableAutoResend&&s0(h.code);s._markMessageAsFailed(f,h,m),a.dispatch(new wt({messages:[f],source:f.sendingStatus===ht.PENDING?z.REQUEST_RESEND_MESSAGE:h.code===Ae.FILE_UPLOAD_CANCEL_FAILED?z.LOCAL_MESSAGE_CANCELED:z.EVENT_MESSAGE_SENT_FAILED})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(b){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._autoResendFileMessage=function(t){Q(t instanceof nn&&!!t.messageParams).throw(L.invalidParameters);var r=R.of(this._iid).logger;return r.debug("autoResendFileMessage pending",t),this._sendFileMessage(t.messageParams,nr.SEND,t.reqId).onFailed(function(i){r.debug("autoResendFileMessage failed",i)}).onSucceeded(function(i){r.debug("autoResendFileMessage success",i)})},n.prototype._sendMultipleFilesMessage=function(t,r,i){var s=this,a=R.of(this._iid).dispatcher,o=Ln.of(this._iid).fileMessageQueue,l=i??this._generateRequestId(),u=Date.now(),c=new Sf;return Br(2).then(function(){var d=s._createPendingMultipleFilesMessage(t,l,u);a.dispatch(new wt({messages:[d],source:r===nr.RESEND?z.LOCAL_MESSAGE_RESEND_STARTED:z.EVENT_MESSAGE_SENT_PENDING})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(h){return[2,c._trigger(d)]})})}),o.request(s,l,t,{requestHandler:c,isCopy:r===nr.COPY}).then(function(h){a.dispatch(new wt({messages:[h],source:z.EVENT_MESSAGE_SENT_SUCCESS})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(f){return[2,c._trigger(h)]})})})}).catch(function(h){if(zr(h))throw h;Br(2).then(function(){var f=s._createPendingMultipleFilesMessage(t,l,u);s._markMessageAsFailed(f,h),a.dispatch(new wt({messages:[f],source:z.EVENT_MESSAGE_SENT_FAILED})),Ue(function(){return y(s,void 0,void 0,function(){return g(this,function(p){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._createScheduledFileMessage=function(t,r,i,s){var a=this,o=R.of(this._iid).requestQueue,l=new cR(M(M({reqId:i,channelType:this.channelType,channelUrl:this.url},t),{fileUrl:t.fileUrl,requireAuth:t.requireAuth}));o.send(l).then(function(u){var c=u.as(dR).message;Ue(function(){return y(a,void 0,void 0,function(){return g(this,function(d){return[2,r._trigger(c)]})})})}).catch(function(u){if(zr(u))throw u;Br(2).then(function(){var c=a._createPendingScheduledFileMessage(t,i,s);a._markMessageAsFailed(c,u),Ue(function(){return y(a,void 0,void 0,function(){return g(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessages=function(t){var r,i;Q(t.every(function(u){return wE(M(M({},SE),u))})).throw(L.invalidParameters);var s=new Xr;try{for(var a=ge(t),o=a.next();!o.done;o=a.next()){var l=o.value;this.sendFileMessage(l).onPending(function(u){return s._trigger(u)}).onFailed(function(u,c){return s._triggerFailed(u,c)}).onSucceeded(function(u){return s._trigger(u)})}}catch(u){r={error:u}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return s},n.prototype.resendFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){return i=this._validateFailedFileMessageHasFile(t,r),Q(t instanceof nn&&i&&!t.scheduledInfo).throw(L.invalidParameters),s=new Or,a=wv(t,r),this._sendFileMessage(a,nr.RESEND,t.reqId).onFailed(function(l){return s.reject(l)}).onSucceeded(function(l){return s.resolve(l)}),[2,s.promise]})})},n.prototype.resendMessage=function(t,r){var i,s;if(Q(t instanceof Ht&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var a=(i=t.messageParams)!==null&&i!==void 0?i:Sv(t);return this._sendUserMessage(a,nr.RESEND,t.reqId)}if(t.isFileMessage()){var o=this._validateFailedFileMessageHasFile(t,r);return Q(o).throw(L.invalidParameters),a=(s=t.messageParams)!==null&&s!==void 0?s:wv(t,r),this._sendFileMessage(a,nr.RESEND,t.reqId)}if(t.isMultipleFilesMessage())throw L.channelTypeNotSupportedError},n.prototype.updateFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return i=M(M({},_O),r),Q(k("number",t)&&function(u){return M2(u)}(i)).throw(L.invalidParameters),s=R.of(this._iid).requestQueue,a=new OE(M({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:i.metaArrays?{array:i.metaArrays,mode:"add",upsert:!0}:void 0},i)),[4,s.send(a)];case 1:return o=l.sent(),[2,o.as(Nv).message]}})})},n.prototype.uploadFile=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return r=R.of(this._iid).requestQueue,i=la(),(s=new _0({file:t.file,channelUrl:this.url,thumbnailSizes:t.thumbnailSizes,requestId:i})).uploadProgressHandler=t.progressHandler,t.uploadStartedHandler&&t.uploadStartedHandler(i),[4,r.send(s)];case 1:return a=c.sent(),o=a.as(m0),l=o.url,u=o.thumbnails,[2,{requestId:i,url:l,thumbnails:u}]}})})},n.prototype.cancelUploadingFileMessage=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(k("string",t)).throw(L.invalidParameters),Ln.of(this._iid).fileMessageQueue.cancel(this,t),[2,!0]})})},n.prototype.copyFileMessage=function(t,r){var i,s,a;return y(this,void 0,void 0,function(){var o,l;return g(this,function(u){return Q(t instanceof n&&r instanceof nn&&r.sendingStatus===ht.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),o=new Or,l=Ie(M(M({},r),{fileUrl:r.url,fileName:r.name,fileSize:r.size,mimeType:r.type,mentionType:r.mentionType,mentionedUserIds:(i=r.mentionedUserIds)!==null&&i!==void 0?i:(s=r.mentionedUsers)===null||s===void 0?void 0:s.map(function(c){return c.userId}),pushNotificationDeliveryOption:cs.DEFAULT,parentMessageId:null,isReplyToChannel:!1,thumbnailSizes:(a=r.thumbnails)===null||a===void 0?void 0:a.map(function(c){return{maxWidth:c.width,maxHeight:c.height}}),requireAuth:r.requireAuth,isPinnedMessage:!1})),t._sendFileMessage(l).onSucceeded(function(c){return o.resolve(c)}).onFailed(function(c){return o.reject(c)}),[2,o.promise]})})},n.prototype.copyMessage=function(t,r){Q(t instanceof n&&r instanceof Ht&&r.sendingStatus===ht.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters);var i=r,s=t;if(i.isUserMessage()){Q(!i.poll).throw(L.notSupportedError);var a=rT(i);return s._sendUserMessage(a)}if(i.isFileMessage())return a=sT(i),s._sendFileMessage(a);if(r.isMultipleFilesMessage())throw L.channelTypeNotSupportedError},n.prototype.deleteMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return Q(t instanceof vr).throw(L.invalidParameters),t.messageId>0?(r=R.of(this._iid).requestQueue,i=new lw({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,messageToken:t instanceof Ht?t._messageToken:void 0}),[4,r.send(i)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},n.prototype.addReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(t instanceof vr&&t.messageId>0&&k("string",r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new rR({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(iR).reactionEvent]}})})},n.prototype.deleteReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(t instanceof vr&&t.messageId>0&&k("string",r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new sR({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(aR).reactionEvent]}})})},n.prototype._updateUserMessageMetaArray=function(t,r,i,s){return y(this,void 0,void 0,function(){var a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return a=R.of(this._iid),o=a.dispatcher,l=a.requestQueue,u=new xE({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:{array:r,mode:i,upsert:s}}),[4,l.send(u)];case 1:return c=h.sent(),d=c.as(Tv).message,o.dispatch(new wt({messages:[d],source:z.EVENT_MESSAGE_UPDATED})),[2,d]}})})},n.prototype._updateFileMessageMetaArray=function(t,r,i,s){return y(this,void 0,void 0,function(){var a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return a=R.of(this._iid),o=a.dispatcher,l=a.requestQueue,u=new OE({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:{array:r,mode:i,upsert:s}}),[4,l.send(u)];case 1:return c=h.sent(),d=c.as(Nv).message,o.dispatch(new wt({messages:[d],source:z.EVENT_MESSAGE_UPDATED})),[2,d]}})})},n.prototype.createMessageMetaArrayKeys=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){return Q(t instanceof vr&&t.messageId>0&&Qe("string",r)).throw(L.invalidParameters),i=r.map(function(a){return new br({key:a})}),t instanceof nn?[2,this._updateFileMessageMetaArray(t.messageId,i,"add",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,i,"add",!0)]})})},n.prototype.deleteMessageMetaArrayKeys=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){return Q(t instanceof vr&&t.messageId>0&&Qe("string",r)).throw(L.invalidParameters),i=r.map(function(a){return new br({key:a})}),t instanceof nn?[2,this._updateFileMessageMetaArray(t.messageId,i,"remove",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,i,"remove",!0)]})})},n.prototype.addMessageMetaArrayValues=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return Q(t instanceof vr&&t.messageId>0&&r.every(function(s){return s instanceof br})).throw(L.invalidParameters),t instanceof nn?[2,this._updateFileMessageMetaArray(t.messageId,r,"add",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,r,"add",!0)]})})},n.prototype.removeMessageMetaArrayValues=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return Q(t instanceof vr&&t.messageId>0&&r.every(function(s){return s instanceof br})).throw(L.invalidParameters),t instanceof nn?[2,this._updateFileMessageMetaArray(t.messageId,r,"remove",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,r,"remove",!0)]})})},n.prototype.report=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return Q(Ve(Xc,t)&&k("string",r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new JO({channelUrl:this.url,channelType:this.channelType,userId:s.userId,category:t,description:r}),[4,a.send(o)];case 1:return l.sent(),[2]}})})},n.prototype.reportUser=function(t,r,i){return y(this,void 0,void 0,function(){var s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(t instanceof Ze&&Ve(Xc,r)&&k("string",i)).throw(L.invalidParameters),s=R.of(this._iid),a=s.sdkState,o=s.requestQueue,l=new eR({channelUrl:this.url,channelType:this.channelType,userId:a.userId,offendingUserId:t.userId,category:r,description:i}),[4,o.send(l)];case 1:return u.sent(),[2]}})})},n.prototype.reportMessage=function(t,r,i){return y(this,void 0,void 0,function(){var s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(t instanceof Ht&&Ve(Xc,r)&&k("string",i)).throw(L.invalidParameters),s=R.of(this._iid),a=s.sdkState,o=s.requestQueue,l=new tR({channelUrl:this.url,channelType:this.channelType,userId:a.userId,offendingUserId:t.sender.userId,messageId:t.messageId,category:r,description:i,messageToken:t._messageToken}),[4,o.send(l)];case 1:return u.sent(),[2]}})})},n.prototype.updatePoll=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(k("number",t)&&function(l){return k("string",l.title,!0)&&$w(l.data)&&k("boolean",l.allowUserSuggestion,!0)&&k("boolean",l.allowMultipleVotes,!0)&&k("number",l.closeAt,!0)}(r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new hR(M({pollId:t},r)),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(fR).poll]}})})},n.prototype.deletePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(a){switch(a.label){case 0:return r=k("number",t),Q(r).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new pR({pollId:t}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},n.prototype.closePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=k("number",t),Q(r).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new _R({pollId:t}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(mR).poll]}})})},n.prototype.addPollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return i=k("number",t)&&k("string",r)&&r.trim()!=="",Q(i).throw(L.invalidParameters),s=R.of(this._iid).requestQueue,a=new vR({channelUrl:this.url,channelType:this.channelType,pollId:t,optionText:r}),[4,s.send(a)];case 1:return o=l.sent(),[2,o.as(gR).poll]}})})},n.prototype.updatePollOption=function(t,r,i){return y(this,void 0,void 0,function(){var s,a,o,l;return g(this,function(u){switch(u.label){case 0:return s=k("number",t)&&k("number",r)&&k("string",i)&&i.trim()!=="",Q(s).throw(L.invalidParameters),a=R.of(this._iid).requestQueue,o=new yR({pollId:t,pollOptionId:r,optionText:i}),[4,a.send(o)];case 1:return l=u.sent(),[2,l.as(ER).poll]}})})},n.prototype.deletePollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return i=k("number",t)&&k("number",r),Q(i).throw(L.invalidParameters),s=R.of(this._iid).requestQueue,a=new bR({pollId:t,pollOptionId:r}),[4,s.send(a)];case 1:return o.sent(),[2]}})})},n.prototype.votePoll=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:return i=k("number",t)&&Qe("number",r),Q(i).throw(L.invalidParameters),s=R.of(this._iid),a=s.requestQueue,o=s.dispatcher,l=new CR({reqId:this._generateRequestId(),channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionIds:r}),[4,a.send(l)];case 1:return u=d.sent(),c=u.as(cT).event,o.dispatch(new N2({event:c,source:z.EVENT_POLL_VOTED})),[2,c]}})})},n.prototype.getPollChangeLogsSinceTimestamp=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Q(k("number",t)).throw(L.invalidParameters),[4,p0.of(this._iid).getPollChangeLogs(this.url,this.channelType,t)];case 1:return[2,r.sent()]}})})},n.prototype.getPollChangeLogsSinceToken=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Q(k("string",t,!0)),[4,p0.of(this._iid).getPollChangeLogs(this.url,this.channelType,t)];case 1:return[2,r.sent()]}})})},n.prototype.createPollListQuery=function(t){return t===void 0&&(t=10),new qw(this._iid,{channelUrl:this.url,channelType:this.channelType,limit:t})},n.prototype.createPollVoterListQuery=function(t,r,i){return i===void 0&&(i=20),new Ww(this._iid,{channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionId:r,limit:i})},n}(Jn),_T=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return w(n,e),n}(function(){this.onConnected=Ke,this.onReconnectStarted=Ke,this.onReconnectSucceeded=Ke,this.onReconnectFailed=Ke,this.onDisconnected=Ke}),kE=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return w(n,e),n}(function(){this.onSessionExpired=Ke,this.onSessionTokenRequired=function(e){return e(null)},this.onSessionError=Ke,this.onSessionRefreshed=Ke,this.onSessionClosed=Ke}),LR=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return w(n,e),n}(function(){this.onFriendsDiscovered=Ke,this.onTotalUnreadMessageCountChanged=Ke,this.onTotalUnreadMessageCountUpdated=Ke}),DR=function(e){function n(t){var r=t.limit,i=t.token,s=t.userIdsFilter,a=t.metaDataKeyFilter,o=t.metaDataValuesFilter,l=t.nicknameStartsWithFilter,u=e.call(this)||this;return u.method=Y.GET,u.path=tt,u.params=be({limit:r,token:i,user_ids:s,metadatakey:a,metadatavalues_in:o,nickname_startswith:l}),u}return w(n,e),n}(Z),UR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ze(t,s)}),i.next=r.next,i}return w(n,e),n}(le),PR=function(e){function n(t,r){var i,s,a,o=this;return(o=e.call(this,t,r)||this).userIdsFilter=null,o.metaDataKeyFilter=null,o.metaDataValuesFilter=null,o.nicknameStartsWithFilter=null,o.userIdsFilter=(i=r.userIdsFilter)!==null&&i!==void 0?i:null,o.metaDataKeyFilter=(s=r.metaDataKeyFilter)!==null&&s!==void 0?s:null,o.metaDataValuesFilter=(a=r.metaDataValuesFilter)!==null&&a!==void 0?a:null,o.nicknameStartsWithFilter=r.nicknameStartsWithFilter||null,o}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&Qe("string",this.userIdsFilter,!0)&&k("string",this.metaDataKeyFilter,!0)&&Qe("string",this.metaDataValuesFilter,!0)&&k("string",this.nicknameStartsWithFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new DR(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(UR),a=s.users,o=s.next,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),FR=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,a=t.userIdsFilter,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(tt,"/").concat(r,"/block"),o.params=be({limit:i,token:s,user_ids:a}),o}return w(n,e),n}(Z),HR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ze(t,s)}),i.next=r.next,i}return w(n,e),n}(le),jR=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).userIdsFilter=null,s.userIdsFilter=(i=r.userIdsFilter)!==null&&i!==void 0?i:null,s}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&Qe("string",this.userIdsFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new FR(Ie(M(M({},this),{userId:r.userId,token:this._token}))),[4,i.send(s)]):[3,2]:[3,5];case 1:return a=c.sent(),o=a.as(HR),l=o.users,u=o.next,this._token=u,this._hasNext=!!u,this._isLoading=!1,[2,l];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),BR=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,a=e.call(this)||this;return a.method=Y.GET,a.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friends"),a.params={limit:i,token:s},a}return w(n,e),n}(Z),$R=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.hasMore=r.has_more,i.users=r.users.map(function(s){return new Ze(t,s)}),i.next=r.next,i}return w(n,e),n}(le),GR=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new BR(M(M({},this),{userId:r.userId,token:this._token})),[4,i.send(s)]):[3,2]:[3,5];case 1:return a=d.sent(),o=a.as($R),l=o.users,u=o.hasMore,c=o.next,this._token=c,this._hasNext=u,this._isLoading=!1,[2,l];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),zh={},ih=function(){function e(n){var t=n.dbname,r=n.itemSizeLimit,i=r===void 0?1048576:r,s=n.cacheLimit,a=s===void 0?256:s,o=n.blockHashBase,l=o===void 0?2:o,u=n.blockHashMultiplier,c=u===void 0?10:u,d=n.blockHashConstant,h=d===void 0?11:d,f=n.transactionApplyDelay,p=f===void 0?200:f,m=n.disableLogger,b=m!==void 0&&m;return zh[t]||(this.itemSizeLimit=i,this.cacheLimit=a,this.blockHashBase=l,this.blockHashMultiplier=c,this.blockHashConstant=h,this.transactionApplyDelay=p,this.disableLogger=b,zh[t]=this),zh[t]}return e.get=function(n){return zh[n]},e}();(function(e){e[e.UNKNOWN_ERROR=6e7]="UNKNOWN_ERROR",e[e.STORE_NOT_DEFINED=61001e3]="STORE_NOT_DEFINED",e[e.STORE_NOT_AVAILABLE=61001001]="STORE_NOT_AVAILABLE",e[e.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING=61001002]="STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING",e[e.STORE_IS_FULL=61001003]="STORE_IS_FULL",e[e.STORE_NOT_INITIALIZED=61001004]="STORE_NOT_INITIALIZED",e[e.STORE_INVALID_KEY_TYPE=61002e3]="STORE_INVALID_KEY_TYPE",e[e.STORE_BROKEN_INTEGRITY=61002001]="STORE_BROKEN_INTEGRITY",e[e.STORE_BROKEN_BLOB=61002002]="STORE_BROKEN_BLOB",e[e.STORE_ENCRYPTION_INVALID=61002003]="STORE_ENCRYPTION_INVALID",e[e.STORE_ITEM_SIZE_LIMIT_EXCEEDED=61017e3]="STORE_ITEM_SIZE_LIMIT_EXCEEDED",e[e.STORE_READ_FAILED=61017001]="STORE_READ_FAILED",e[e.STORE_WRITE_FAILED=61017002]="STORE_WRITE_FAILED",e[e.DATABASE_SCHEMA_NOT_ON_UPGRADE=62002e3]="DATABASE_SCHEMA_NOT_ON_UPGRADE",e[e.COLLECTION_NOT_READY=63001e3]="COLLECTION_NOT_READY",e[e.COLLECTION_KEY_NOT_MATCH=63002e3]="COLLECTION_KEY_NOT_MATCH",e[e.COLLECTION_QUERY_NOT_VALID=63002001]="COLLECTION_QUERY_NOT_VALID",e[e.COLLECTION_KEY_NOT_FOUND=63004e3]="COLLECTION_KEY_NOT_FOUND",e[e.COLLECTION_KEY_NOT_GIVEN=63004001]="COLLECTION_KEY_NOT_GIVEN",e[e.COLLECTION_INSERT_DUPLICATE=63009e3]="COLLECTION_INSERT_DUPLICATE",e[e.COLLECTION_WRITE_FAILED=63017e3]="COLLECTION_WRITE_FAILED",e[e.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED=63017001]="COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED",e[e.INDEX_TABLE_IS_REQUIRED=65001e3]="INDEX_TABLE_IS_REQUIRED",e[e.INDEX_TYPE_NOT_MATCH=65002e3]="INDEX_TYPE_NOT_MATCH",e[e.COMPARE_TYPE_NOT_MATCH=69002001]="COMPARE_TYPE_NOT_MATCH",e[e.CIRCULAR_REFERENCE_FOUND=69002002]="CIRCULAR_REFERENCE_FOUND"})(It||(It={}));var Lo,ot=function(e){function n(t){var r=t.code,i=r===void 0?It.UNKNOWN_ERROR:r,s=t.message,a=s===void 0?"Unknown error occurred.":s,o=e.call(this,a)||this;return o.code=i,Object.setPrototypeOf(o,n.prototype),o}return w(n,e),Object.defineProperty(n,"storeNotDefined",{get:function(){return new n({code:It.STORE_NOT_DEFINED,message:"Store is not defined. Specify the store on NestDB()"})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotAvailable",{get:function(){return new n({code:It.STORE_NOT_AVAILABLE,message:"Store is not available. Check your environment settings."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotAvailableInPrivateBrowsing",{get:function(){return new n({code:It.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING,message:"Store is not available because it is in private browsing."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeIsFull",{get:function(){return new n({code:It.STORE_IS_FULL,message:"Store is full."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotInitialized",{get:function(){return new n({code:It.STORE_NOT_INITIALIZED,message:"Store is not initialized."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeKeyTypeIsInvalid",{get:function(){return new n({code:It.STORE_INVALID_KEY_TYPE,message:"Store key should be string type."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeBrokenIntegrity",{get:function(){return new n({code:It.STORE_BROKEN_INTEGRITY,message:"Data should be in a store but it does not. Integrity is broken."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeBrokenBlob",{get:function(){return new n({code:It.STORE_BROKEN_BLOB,message:"Data should be in a store but it does not. Blob data is broken."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeEncryptionInvalid",{get:function(){return new n({code:It.STORE_ENCRYPTION_INVALID,message:"Encryption algorithm has changed. All the store should reset."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeItemSizeExceeded",{get:function(){return new n({code:It.STORE_ITEM_SIZE_LIMIT_EXCEEDED,message:"The size of the item exceeds the limit that the store allows."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeReadFailed",{get:function(){return new n({code:It.STORE_READ_FAILED,message:"Failed to read from store."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeWriteFailed",{get:function(){return new n({code:It.STORE_WRITE_FAILED,message:"Failed to write to store."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"databaseSchemaNotOnUpgrade",{get:function(){return new n({code:It.DATABASE_SCHEMA_NOT_ON_UPGRADE,message:"Committing schema is not allowed when upgrade is not running."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionNotReady",{get:function(){return new n({code:It.COLLECTION_NOT_READY,message:"Collection is not ready due to an error during initialization."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotMatch",{get:function(){return new n({code:It.COLLECTION_KEY_NOT_MATCH,message:"keyName of collection could not change."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionQueryNotValid",{get:function(){return new n({code:It.COLLECTION_QUERY_NOT_VALID,message:"Query parameter is not a valid format."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionInsertDuplicate",{get:function(){return new n({code:It.COLLECTION_INSERT_DUPLICATE,message:"The key already exists."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotFound",{get:function(){return new n({code:It.COLLECTION_KEY_NOT_FOUND,message:"The key is not found."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotGiven",{get:function(){return new n({code:It.COLLECTION_KEY_NOT_GIVEN,message:"The item should contain [keyName] property."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionWriteFailed",{get:function(){return new n({code:It.COLLECTION_WRITE_FAILED,message:"Failed to write an item."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionItemSizeExceeded",{get:function(){return new n({code:It.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED,message:"The size of the item exceeds the limit that a collection allows."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"indexTableIsRequired",{get:function(){return new n({code:It.INDEX_TABLE_IS_REQUIRED,message:"Index table is required."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"indexTypesNotMatch",{get:function(){return new n({code:It.INDEX_TYPE_NOT_MATCH,message:"Indexed column should have primitive type."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"compareTypesNotMatch",{get:function(){return new n({code:It.COMPARE_TYPE_NOT_MATCH,message:"Values to compare have different types."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circularReferenceFound",{get:function(){return new n({code:It.CIRCULAR_REFERENCE_FOUND,message:"Cannot handle circular referenced object."})},enumerable:!1,configurable:!0}),n}(Error);(function(e){e.INIT="init",e.READY="ready",e.CLOSED="closed"})(Lo||(Lo={}));var LE,$r=function(e,n){if(n===void 0&&(n=new WeakMap),typeof e=="object"&&e!==null){if(n.has(e))throw ot.circularReferenceFound;n.set(e,!0);var t=void 0;if(Array.isArray(e))t=e.map(function(i){return $r(i,n)});else if(e instanceof RegExp)t=e;else if(e instanceof Date)t=e;else for(var r in t={},e)t[r]=$r(e[r],n);return n.delete(e),t}return e},ea=function(e,n){if(n==null)return 1;if(e==null)return-1;if(typeof e!=typeof n)throw ot.compareTypesNotMatch;var t=0;switch(typeof e){case"boolean":case"number":t=e-n;break;case"string":t=e.localeCompare(n)}return t},DE=function(e,n){for(var t=0,r=0;r>>0)%n},Vh=function(e){return new Promise(function(n){setTimeout(function(){return n()},e)})},Zo=function(e,n){if(!n)return!1;if(typeof e!="function"){for(var t in e)if(["/and","&&"].includes(t)){if(e[t].some(function(l){return!Zo(l,n)}))return!1}else if(["/or","||"].includes(t)){if(e[t].every(function(l){return!Zo(l,n)}))return!1}else if(t==="/where"){if(!(0,e[t])(n))return!1}else{var r=t;if(typeof e[r]=="object"){var i=e[r];for(var s in i)switch(s){case"/eq":case"=":if((a=n[r])!==(o=i[s]))return!1;break;case"/neq":case"!=":if((a=n[r])===(o=i[s]))return!1;break;case"/gt":case">":var a=n[r],o=i[s];if(!(ea(a,o)>0))return!1;break;case"/gte":case">=":if(a=n[r],o=i[s],!(ea(a,o)>=0))return!1;break;case"/lt":case"<":if(a=n[r],o=i[s],!(ea(a,o)<0))return!1;break;case"/lte":case"<=":if(a=n[r],o=i[s],!(ea(a,o)<=0))return!1;break;case"/in":if(a=n[r],!(o=i[s]).includes(a))return!1;break;case"/nin":if(a=n[r],(o=i[s]).includes(a))return!1;break;case"/contain":if(a=n[r],o=i[s],!a.includes(o))return!1;break;case"/regex":if(a=n[r],!(o=i[s]).test(a))return!1;break;case"/where":if(a=n[r],!(0,i[s])(a))return!1}}else if(typeof e[r]=="function"){if(!e[r](n[r]))return!1}else if(e[r]!==n[r])return!1}return!0}return e(n)},Cc=function(){},UE=function(){return Promise.resolve()},zR=function(e){return e},PE=function(e,n){n()};(function(e){e[e.FORWARD=0]="FORWARD",e[e.BACKWARD=1]="BACKWARD"})(LE||(LE={}));var Xo,gr,Cs,VR=function(){function e(n){var t=n.initialPrevValue,r=t===void 0?null:t,i=n.initialNextValue,s=i===void 0?null:i,a=n.iterator,o=n.map,l=o===void 0?zR:o,u=n.backward,c=u===void 0?UE:u,d=n.forward,h=d===void 0?UE:d,f=n.complete,p=f===void 0?Cc:f;this._prevValue=r,this._nextValue=s,this._error=null,this._map=l,this._backward=c,this._forward=h,this._iterator=a,this._complete=p}return Object.defineProperty(e.prototype,"prevValue",{get:function(){return this._map(this._prevValue)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextValue",{get:function(){return this._map(this._nextValue)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPrevious",{get:function(){return!!this._prevValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNext",{get:function(){return!!this._nextValue},enumerable:!1,configurable:!0}),e.prototype.prev=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:if(!this.hasPrevious)return[3,6];i.label=1;case 1:return i.trys.push([1,3,,4]),n=this._prevValue,t=this,[4,this._backward()];case 2:return t._prevValue=i.sent()||null,this._nextValue=n,[3,4];case 3:return r=i.sent(),this._error=r,[3,4];case 4:return[4,this._iterator(this)];case 5:return[2,i.sent()];case 6:this._complete(),i.label=7;case 7:return[2]}})})},e.prototype.next=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:if(!this.hasNext)return[3,6];i.label=1;case 1:return i.trys.push([1,3,,4]),n=this._nextValue,t=this,[4,this._forward()];case 2:return t._nextValue=i.sent()||null,this._prevValue=n,[3,4];case 3:return r=i.sent(),this._error=r,[3,4];case 4:return[4,this._iterator(this)];case 5:return[2,i.sent()];case 6:this._complete(),i.label=7;case 7:return[2]}})})},e.prototype.stop=function(){this._prevValue=null,this._nextValue=null,this._complete()},e}(),Av=function(){function e(n){var t=n.condition,r=t===void 0?{}:t,i=n.backward,s=i!==void 0&&i,a=n.blockManager,o=n.indexer;this.condition=r,this.backward=s,this._blockManager=a,this._indexer=o}return e.prototype.findOptimizedStartPosition=function(){var n=this,t=["=","/eq",">",">=","/gt","/gte"],r=["=","/eq","<","<=","/lt","/lte"];if(this.backward){var i=this._indexer.origin.length-1;if(typeof this.condition!="function")for(var s in this._indexer.fields){var a=this._indexer.fields[s],o=1;if(a[0]==="-"&&(a=a.slice(1),o=-1),this.condition[a]){if(typeof this.condition[a]=="object"){var l=o>0?r:t;for(var u in this.condition[a])if(l.includes(u)){for(var c=i;c>=0;c--)if(o*ea(this._indexer.origin[c].columnValues[s],this.condition[a][u])<=0){i=c;break}}}else for(c=i;c>=0;c--)if(o*ea(this._indexer.origin[c].columnValues[s],this.condition[a])<=0){i=c;break}}}return Math.min(i+1,this._indexer.origin.length-1)}var d=0;if(typeof this.condition!="function")for(var h=function(m){var b=f._indexer.fields[m],v=1;if(b[0]==="-"&&(b=b.slice(1),v=-1),f.condition[b]){if(typeof f.condition[b]=="object")Object.keys(f.condition[b]).forEach(function(E){if((v>0?t:r).includes(E)){for(var S=d;S=0){d=S;break}}});else for(var _=d;_=0){d=_;break}}},f=this,s=0;s"u"?[3,4]:[4,fetch(r)]):[3,5];case 2:return[4,d.sent().blob()];case 3:return[2,d.sent()];case 4:for(s=[],a=atob(r.split(",")[1]),o=0;o-1){var i=this._items[r];return t===Cs.PERSISTENT&&(i.state=gr.PERSISTENT),t!==Cs.NO_CACHE&&this.put(i),i}return null},e.prototype.put=function(n){var t,r;if(this._limit>0){var i=this._items.map(function(d){return d.key}).indexOf(n.key);if(i>-1)HE.includes(this._items[i].state)&&HE.includes(n.state)?(this._items.splice(i,1),this._items.push(n)):(this._items[i].state=n.state,this._items[i].value=n.value);else{this._items.push(n);var s=this._items.filter(function(d){return d.state===gr.VOLATILE}),a=s.length-this._limit;if(a>0){var o=[];try{for(var l=ge(this._items),u=l.next();!u.done;u=l.next()){var c=u.value;c.state===gr.VOLATILE&&a>0?a--:o.push(c)}}catch(d){t={error:d}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}this._items=o}}}},e.prototype.remove=function(n){var t=this._items.map(function(r){return r.key}).indexOf(n);t>-1&&this._items.splice(t,1)},e.prototype.clearByCondition=function(n){this._items=this._items.filter(function(t){return!n(t)})},e.prototype.clear=function(n){n===void 0&&(n=!1),this._items=n?[]:this._items.filter(function(t){return t.state!==gr.VOLATILE})},e}(),KR=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.store;this._requests=[],this._onCommit=new Map,this._onWrite=new Map,this._onError=new Map,this.dbname=t,this.collectionName=r,this.metadataKey=function(s,a){return"".concat(ol(s,a),"/trans.metadata")}(t,r),this.recordsetKey=function(s,a){return"".concat(ol(s,a),"/trans.recordset")}(t,r),this._store=i}return Object.defineProperty(e.prototype,"generation",{get:function(){return this._metadata?this._metadata.generation:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"requestCount",{get:function(){return this._requests.length},enumerable:!1,configurable:!0}),e.prototype._getReducedRecordset=function(n){return n===void 0&&(n=[]),y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._store.get(this.recordsetKey)];case 1:return(t=r.sent()||[]).push.apply(t,Fe([],Me(n),!1)),[2,this._reduceRecordSet(t)]}})})},e.prototype._reduceRecordSet=function(n){for(var t=[],r={},i=n.length-1;i>=0;i--){for(var s=n[i],a=[],o=s.requests.length-1;o>=0;o--){var l=s.requests[o],u=l.data;r[u.key]||(a.unshift(l),r[u.key]=!0)}a.length>0&&(s.requests=a,t.unshift(s))}return t},e.prototype._applyRecord=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:r=Fi.get(this.dbname),i=t.generation,s=t.requests,a=null,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this._store.setMany(s.map(function(f){return M(M({},f.data),{generation:i})}))];case 2:for(o=h.sent(),l=0;l0))return[3,4];for(t=[],r={},l=n.length-1;l>=0;l--)i=n[l],c=i.data,r[c.key]||(r[c.key]=!0,t.unshift(i));return s={generation:this.generation,requests:t},[4,this._getReducedRecordset([s])];case 1:return a=p.sent(),[4,this._store.set({key:this.recordsetKey,value:a})];case 2:return p.sent(),this._metadata.generation++,[4,this._store.set({key:this.metadataKey,value:this._metadata})];case 3:for(p.sent(),o=Fi.get(this.dbname),l=0;l0?(i=this.createBlockId(n,r),[4,t.find(this._store,i)]):[3,4];case 2:if((s=o.sent())&&(a=wf.createFromCacheItem(s),a==null?void 0:a.getItemByKey(n)))return[2,a];o.label=3;case 3:return r--,[3,1];case 4:return[2,null]}})})},e.prototype.getFromBlock=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._findBlock(n)];case 1:return[2,(t=r.sent())?t.getItemByKey(n):null]}})})},e.prototype.putToBlock=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return r=ih.get(this.dbname),i=this.createBlockId(n),s=Math.floor(this._store.itemSizeLimit/r.itemSizeLimit),[4,Fi.get(this.dbname).find(this._store,i)];case 1:return a=l.sent(),(o=a?wf.createFromCacheItem(a):new wf({blockId:i,keyName:this.keyName,items:[],limit:s}))!=null&&o.add(t)?(this._transaction.requestWrite({key:o.blockId,value:o.serialize()}),[2,!0]):[2,!1]}})})},e.prototype.removeFromBlock=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._findBlock(n)];case 1:return(t=r.sent())&&t.remove(n)?(this._transaction.requestWrite({key:t.blockId,value:t.serialize()}),[2,!0]):[2,!1]}})})},e.prototype.clearAllBlocks=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=xv(this.dbname,this.collectionName),[4,this._store.getAllKeys()];case 1:return t=i.sent(),r=t.filter(function(s){return s.startsWith(n)}),[4,this._store.removeMany(r)];case 2:return i.sent(),[4,this._transaction.clear()];case 3:return i.sent(),Fi.get(this.dbname).clearByCondition(function(s){return s.key.startsWith(n)}),[2]}})})},e}(),Nl={},pa=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.keyName,s=n.fields,a=n.transaction,o=n.store,l=this;this._origin=[],this._table=[];var u=function(c,d,h){return"".concat(ol(c,d),"/index.").concat(h)}(t,r,s.join(">"));return Nl[u]||(this.dbname=t,this.collectionName=r,this.keyName=i,this.fields=s,this.indexerKey=u,this._transaction=a,this._store=o,this._transaction.on(Xo.COMMIT,this.indexerKey,function(){return l.commit()}),this._transaction.on(Xo.ERROR,this.indexerKey,function(){return l.abort()})),Nl[u]}return e.createKey=function(n){return n.join(">")},e.parseKey=function(n){return n.split(">")},e.clearIndexerMap=function(){for(var n in Nl)delete Nl[n]},e.prototype._addItem=function(n){var t=n[this.keyName],r=this.getColumnValues(n),i=Me(this.indexOf(r),2),s=i[0];return i[1]?!this._table[s].keys.includes(t)&&(this._table[s].keys.push(t),!0):(this._table.splice(s,0,{columnValues:r,keys:[t]}),!0)},e.prototype._removeItem=function(n){var t=n[this.keyName],r=this.getColumnValues(n),i=Me(this.indexOf(r),2),s=i[0];if(i[1]){var a=this._table[s].keys.indexOf(t);if(a>-1)return this._table[s].keys.splice(a,1),this._table[s].keys.length===0&&this._table.splice(s,1),!0}return!1},Object.defineProperty(e.prototype,"origin",{get:function(){return this._origin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"table",{get:function(){return this._table},enumerable:!1,configurable:!0}),e.prototype.getColumnValues=function(n){var t,r,i,s,a=[];try{for(var o=ge(this.fields),l=o.next();!l.done;l=o.next()){var u=l.value;if(u[0]==="-"&&(u=u.slice(1)),i=n[u],s=void 0,s=typeof i,i!==null&&s!=="undefined"&&s!=="boolean"&&s!=="number"&&s!=="string")throw ot.indexTypesNotMatch;a.push(n[u])}}catch(c){t={error:c}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return a},e.prototype.diff=function(n,t){for(var r in this.fields){var i=this.fields[r][0]==="-"?-1:1,s=ea(n[r],t[r]);if(s!==0)return i*s}return 0},e.prototype.indexOf=function(n){if(this._table.length>0){for(var t=0,r=this._table.length-1;t<=r;){var i=Math.floor((t+r)/2),s=this.diff(n,this._table[i].columnValues);if(s>0)t=i+1;else{if(!(s<0))return[i,!0];r=i-1}}return[t,!1]}return[0,!1]},e.prototype.ensure=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v;return g(this,function(_){switch(_.label){case 0:return[4,(n=Fi.get(this.dbname)).find(this._store,this.indexerKey,Cs.PERSISTENT)];case 1:return(t=_.sent())?[3,11]:(r=xv(this.dbname,this.collectionName),[4,this._store.getAllKeys()]);case 2:i=_.sent(),_.label=3;case 3:_.trys.push([3,8,9,10]),s=ge(i),a=s.next(),_.label=4;case 4:return a.done?[3,7]:(o=a.value).startsWith(r)?[4,n.find(this._store,o,Cs.NO_CACHE)]:[3,6];case 5:if(l=_.sent(),u=wf.createFromCacheItem(l))try{for(b=void 0,c=ge(u.items),d=c.next();!d.done;d=c.next())h=d.value,this._addItem(h)}catch(E){b={error:E}}finally{try{d&&!d.done&&(v=c.return)&&v.call(c)}finally{if(b)throw b.error}}_.label=6;case 6:return a=s.next(),[3,4];case 7:return[3,10];case 8:return f=_.sent(),p={error:f},[3,10];case 9:try{a&&!a.done&&(m=s.return)&&m.call(s)}finally{if(p)throw p.error}return[7];case 10:return this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[3,12];case 11:this._origin=t.value,this._table=$r(this._origin),_.label=12;case 12:return Nl[this.indexerKey]=this,[2]}})})},e.prototype.drop=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return Fi.get(this.dbname).remove(this.indexerKey),[4,this._store.remove(this.indexerKey)];case 1:return n.sent(),delete Nl[this.indexerKey],[2]}})})},e.prototype.addItem=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return this._addItem(n)&&this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.removeItem=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return this._removeItem(n)&&this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this._table=[],this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.commit=function(){this._origin=this._table,this._table=$r(this._origin)},e.prototype.abort=function(){this._table=$r(this._origin)},e}(),y0=function(){return typeof document<"u"&&typeof navigator<"u"&&navigator.product!=="ReactNative"},jE=function(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(n==="x"?t:3&t|8).toString(16)})};(function(e){e[e.PROCESSING=0]="PROCESSING",e[e.DONE=1]="DONE"})(Jc||(Jc={})),function(e){e.NEWNODE="newnode",e.REMOVENODE="removenode",e.CLAIM_HOST="claimhost",e.SYNC_HOST="synchost",e.REQUEST_LOCK="requestlock",e.ACQUIRE_LOCK="acquirelock",e.RELEASE_LOCK="releaselock"}(pr||(pr={}));var Ji,$_={},x2=function(){function e(n,t){t===void 0&&(t={});var r=this;return this._state=Jc.PROCESSING,this._queue=[],this._activationQueue=[],$_[n]&&!t.forceCreate||(this.nodeId=jE(),this.key=n,y0()&&(t.startAsInvisible?this.registerNode():document.visibilityState==="visible"?this.claimHost():this.registerNode(),document.addEventListener("visibilitychange",function(){document.visibilityState==="visible"&&r.claimHost()}),window.addEventListener("message",function(i){var s,a,o=i.data;if(o!=null&&o.isNestDbMessage){var l=o.nodeId,u=o.requestId,c=o.key,d=o.op,h=o.data;if(l!==r.nodeId&&c===r.key)switch(d){case pr.NEWNODE:r._sendSync();break;case pr.CLAIM_HOST:r._sendSync(),r._hostId=l;break;case pr.SYNC_HOST:if(!r.isInSync){r._activationTimeout&&clearTimeout(r._activationTimeout);var f=h,p=f.currentItemRequestId,m=f.queue,b=function(S){var T=r._queue.findIndex(function(N){return N.requestId===S.requestId});T<0&&r._requestLock({isNestDbMessage:!0,nodeId:S.nodeId,requestId:S.requestId,key:r.key,op:pr.REQUEST_LOCK,ts:S.ts})};try{for(var v=ge(m),_=v.next();!_.done;_=v.next())b(_.value)}catch(S){s={error:S}}finally{try{_&&!_.done&&(a=v.return)&&a.call(v)}finally{if(s)throw s.error}}r._currentItem=r._queue.find(function(S){return S.requestId===p}),r._completeSync()}break;case pr.REMOVENODE:r._queue=r._queue.filter(function(S){return S.nodeId!==o.nodeId}),r._currentItem&&r._currentItem.nodeId===o.nodeId&&(r._currentItem=void 0,r._acquire(r._queue[0]));break;case pr.REQUEST_LOCK:r._requestLock(o);break;case pr.ACQUIRE_LOCK:var E=r._queue.find(function(S){return S.requestId===u});r._acquire(E);break;case pr.RELEASE_LOCK:r._release(u)}}}),window.addEventListener("beforeunload",function(){r._send(pr.REMOVENODE)})),$_[n]=this),$_[n]}return Object.defineProperty(e.prototype,"locked",{get:function(){return!!this._currentItem},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isHost",{get:function(){return this._hostId===this.nodeId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInSync",{get:function(){return this._state==Jc.DONE},enumerable:!1,configurable:!0}),e.prototype._send=function(n,t){var r;t===void 0&&(t={});var i={isNestDbMessage:!0,nodeId:this.nodeId,requestId:(r=t==null?void 0:t.requestId)!==null&&r!==void 0?r:jE(),key:this.key,op:n,data:t.data,ts:Date.now()};return y0()&&window.postMessage(i,"*"),i},e.prototype._acquire=function(n){n?(this._currentItem=n,this._currentItem.onAcquired&&this._currentItem.onAcquired(n.requestId)):this._currentItem=void 0},e.prototype._release=function(n){if(this._currentItem&&this._currentItem.requestId===n){var t=this._currentItem;this._currentItem=void 0,t.nodeId===this.nodeId&&this._send(pr.RELEASE_LOCK,{requestId:t.requestId});var r=this._queue.findIndex(function(i){return i.requestId===n});r>-1&&this._queue.splice(r,1),t.onReleased&&t.onReleased(n)}},e.prototype._requestLock=function(n){var t=this;return new Promise(function(r){var i={nodeId:n.nodeId,requestId:n.requestId,ts:n.ts,onAcquired:function(o){t.isHost&&t._send(pr.ACQUIRE_LOCK,{requestId:o}),r()},onReleased:function(){t._acquire(t._queue[0])}},s=!1;for(var a in t._queue)if(t._queue[a].ts>i.ts){t._queue.splice(parseInt(a),0,i),s=!0;break}s||t._queue.push(i),t._currentItem||t._acquire(t._queue[0])})},e.prototype._sendSync=function(){var n;this.isHost&&this._send(pr.SYNC_HOST,{data:{currentItemRequestId:(n=this._currentItem)===null||n===void 0?void 0:n.requestId,queue:this._queue.map(function(t){return{nodeId:t.nodeId,requestId:t.requestId,ts:t.ts}})}})},e.prototype._waitUntilSyncCompleted=function(){return y(this,void 0,void 0,function(){var n=this;return g(this,function(t){return this.isHost&&!this.isInSync?[2,new Promise(function(r){n._activationQueue.push(r)})]:[2]})})},e.prototype._waitSync=function(){var n=this;this.isInSync||(this._activationTimeout=setTimeout(function(){n._completeSync()},8))},e.prototype._completeSync=function(){this.isInSync||(this._state=Jc.DONE,this._activationQueue.forEach(function(n){return n()}),this._activationQueue=[])},e.prototype.registerNode=function(){this._send(pr.NEWNODE),this._waitSync()},e.prototype.claimHost=function(){this._hostId=this.nodeId,this._send(pr.CLAIM_HOST),this._waitSync()},e.prototype.lock=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return[4,this._waitUntilSyncCompleted()];case 1:return t.sent(),n=this._send(pr.REQUEST_LOCK),[4,this._requestLock(n)];case 2:return t.sent(),[2]}})})},e.prototype.unlock=function(){var n;!((n=this._currentItem)===null||n===void 0)&&n.requestId&&this._release(this._currentItem.requestId)},e}(),G_=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.keyName,s=n.keyHash,a=n.indexes,o=n.store,l=this;this._state=Lo.INIT,this._indexers=[],this.dbname=t,this.name=r,this.keyName=i,this.indexes=Fe([[i]],Me(a.filter(function(u){return pa.createKey(u)!==l.keyName})),!1),this._keyHash=s,this._store=o,this._mutex=new x2(function(u,c){return"".concat(ol(u,c),".lock")}(t,r)),this._blobContainer=new WR({dbname:t,collectionName:r,store:o}),this._transaction=new KR({dbname:t,collectionName:r,store:o})}return e.metadataOf=function(n,t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=B_(n,t),[4,r.get(i)];case 1:return[2,s.sent()]}})})},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReady",{get:function(){return this._state===Lo.READY},enumerable:!1,configurable:!0}),e.prototype.init=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o,l,u,c,d,h,f,p,m=this;return g(this,function(b){switch(b.label){case 0:return[4,this._mutex.lock()];case 1:b.sent(),b.label=2;case 2:return b.trys.push([2,9,,10]),n=ih.get(this.dbname),[4,e.metadataOf(this.dbname,this.name,this._store)];case 3:return t=b.sent(),this._metadata=t||{keyName:this.keyName,blockLevel:1,blockHashBase:n.blockHashBase,blockHashMultiplier:n.blockHashMultiplier,blockHashConstant:n.blockHashConstant,indexes:this.indexes},[4,this._transaction.init()];case 4:b.sent(),this._blockManager=new QR({dbname:this.dbname,collectionName:this.name,hashFunction:this._keyHash,metadata:this._metadata,transaction:this._transaction,store:this._store}),r=Fe([],Me(this.indexes),!1),i=[],s=r.map(function(v){return pa.createKey(v)}),a=t?t.indexes.map(function(v){return pa.createKey(v)}):[];try{for(o=ge(a),l=o.next();!l.done;l=o.next())u=l.value,s.includes(u)||i.push(pa.parseKey(u))}catch(v){f={error:v}}finally{try{l&&!l.done&&(p=o.return)&&p.call(o)}finally{if(f)throw f.error}}return(c=[]).push.apply(c,Fe([],Me(r.map(function(v){var _=new pa({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:v,transaction:m._transaction,store:m._store});return m._indexers.push(_),_.ensure()})),!1)),c.push.apply(c,Fe([],Me(i.map(function(v){return new pa({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:v,transaction:m._transaction,store:m._store}).drop()})),!1)),[4,Promise.all(c)];case 5:return b.sent(),[4,this._transaction.commit()];case 6:return b.sent(),s.sort().join(",")===a.sort().join(",")?[3,8]:(d=B_(this.dbname,this.name),this._metadata.indexes=r,[4,this._store.set({key:d,value:this._metadata})]);case 7:b.sent(),b.label=8;case 8:return this._state=Lo.READY,this._mutex.unlock(),[3,10];case 9:throw h=b.sent(),this._mutex.unlock(),h;case 10:return[2]}})})},e.prototype.close=function(){this._state=Lo.CLOSED},e.prototype._hasPropertyOfKeyName=function(n){var t=n[this.keyName];return typeof t=="string"&&!!t},e.prototype._getIndexerBy=function(n){var t,r;n===void 0&&(n=null),n||(n=[this.keyName]);var i=pa.createKey(n);try{for(var s=ge(this._indexers),a=s.next();!a.done;a=s.next()){var o=a.value;if(i===pa.createKey(o.fields))return o}}catch(l){t={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}throw ot.indexTableIsRequired},e.prototype._upgradeBlockLevel=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=B_(this.dbname,this.name),this._metadata.blockLevel++,[4,this._store.set({key:n,value:this._metadata})];case 1:return t.sent(),[2]}})})},e.prototype._requestInsert=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return l.sent()?[3,13]:[4,this._blockManager.putToBlock(t,n)];case 2:return l.sent()?[3,5]:[4,this._upgradeBlockLevel()];case 3:return l.sent(),[4,this._blockManager.putToBlock(t,n)];case 4:l.sent(),l.label=5;case 5:l.trys.push([5,10,11,12]),r=ge(this._indexers),i=r.next(),l.label=6;case 6:return i.done?[3,9]:[4,i.value.addItem(n)];case 7:l.sent(),l.label=8;case 8:return i=r.next(),[3,6];case 9:return[3,12];case 10:return s=l.sent(),a={error:s},[3,12];case 11:try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(a)throw a.error}return[7];case 12:return[3,14];case 13:throw ot.collectionInsertDuplicate;case 14:return[2]}})})},e.prototype._requestUpsert=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d,h,f,p;return g(this,function(m){switch(m.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return(r=m.sent())?[3,13]:[4,this._blockManager.putToBlock(t,n)];case 2:return m.sent()?[3,5]:[4,this._upgradeBlockLevel()];case 3:return m.sent(),[4,this._blockManager.putToBlock(t,n)];case 4:m.sent(),m.label=5;case 5:m.trys.push([5,10,11,12]),i=ge(this._indexers),s=i.next(),m.label=6;case 6:return s.done?[3,9]:[4,(u=s.value).addItem(n)];case 7:m.sent(),m.label=8;case 8:return s=i.next(),[3,6];case 9:return[3,12];case 10:return a=m.sent(),d={error:a},[3,12];case 11:try{s&&!s.done&&(h=i.return)&&h.call(i)}finally{if(d)throw d.error}return[7];case 12:return[3,23];case 13:return[4,this._blockManager.putToBlock(t,n)];case 14:m.sent(),m.label=15;case 15:m.trys.push([15,21,22,23]),o=ge(this._indexers),l=o.next(),m.label=16;case 16:return l.done?[3,20]:(u=l.value).diff(u.getColumnValues(r),u.getColumnValues(n))===0?[3,19]:[4,u.removeItem(r)];case 17:return m.sent(),[4,u.addItem(n)];case 18:m.sent(),m.label=19;case 19:return l=o.next(),[3,16];case 20:return[3,23];case 21:return c=m.sent(),f={error:c},[3,23];case 22:try{l&&!l.done&&(p=o.return)&&p.call(o)}finally{if(f)throw f.error}return[7];case 23:return[2]}})})},e.prototype._requestUpdate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return(r=c.sent())?[4,this._blockManager.putToBlock(t,n)]:[3,11];case 2:c.sent(),c.label=3;case 3:c.trys.push([3,9,10,11]),i=ge(this._indexers),s=i.next(),c.label=4;case 4:return s.done?[3,8]:(a=s.value).diff(a.getColumnValues(r),a.getColumnValues(n))===0?[3,7]:[4,a.removeItem(r)];case 5:return c.sent(),[4,a.addItem(n)];case 6:c.sent(),c.label=7;case 7:return s=i.next(),[3,4];case 8:return[3,11];case 9:return o=c.sent(),l={error:o},[3,11];case 10:try{s&&!s.done&&(u=i.return)&&u.call(i)}finally{if(l)throw l.error}return[7];case 11:return[2]}})})},e.prototype._requestRemove=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return[4,this._blockManager.getFromBlock(n)];case 1:return(t=l.sent())?[4,this._blockManager.removeFromBlock(n)]:[3,10];case 2:l.sent(),l.label=3;case 3:l.trys.push([3,8,9,10]),r=ge(this._indexers),i=r.next(),l.label=4;case 4:return i.done?[3,7]:[4,i.value.removeItem(t)];case 5:l.sent(),l.label=6;case 6:return i=r.next(),[3,4];case 7:return[3,10];case 8:return s=l.sent(),a={error:s},[3,10];case 9:try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(a)throw a.error}return[7];case 10:return[2]}})})},e.prototype._requestClear=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return[4,this._blockManager.clearAllBlocks()];case 1:a.sent(),a.label=2;case 2:a.trys.push([2,7,8,9]),n=ge(this._indexers),t=n.next(),a.label=3;case 3:return t.done?[3,6]:[4,t.value.clear()];case 4:a.sent(),a.label=5;case 5:return t=n.next(),[3,3];case 6:return[3,9];case 7:return r=a.sent(),i={error:r},[3,9];case 8:try{t&&!t.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}return[7];case 9:return[2]}})})},e.prototype.getByKey=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,6];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this._blockManager.getFromBlock(n)];case 3:return t=i.sent(),this._mutex.unlock(),[2,$r(t)];case 4:throw r=i.sent(),this._mutex.unlock(),r;case 5:return[3,7];case 6:throw ot.collectionNotReady;case 7:return[2]}})})},e.prototype.query=function(n){if(n===void 0&&(n={}),this.isReady)return new qR({condition:n.where,mutex:this._mutex,blockManager:this._blockManager,indexer:this._getIndexerBy(n.index),backward:!!n.backward});throw ot.collectionNotReady},e.prototype.insertOne=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw ot.collectionKeyNotGiven;return[4,this._requestInsert($r(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.insertMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u=this;return g(this,function(c){switch(c.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:c.sent(),c.label=2;case 2:if(c.trys.push([2,12,,14]),n.some(function(d){return!u._hasPropertyOfKeyName(d)}))throw ot.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=ge(n),r=t.next(),c.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this._requestInsert($r(i))]);case 5:c.sent(),c.label=6;case 6:return r=t.next(),[3,4];case 7:return[3,10];case 8:return s=c.sent(),o={error:s},[3,10];case 9:try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(o)throw o.error}return[7];case 10:return[4,this._transaction.commit()];case 11:return c.sent(),this._mutex.unlock(),[2,n];case 12:return a=c.sent(),[4,this._transaction.clear()];case 13:throw c.sent(),this._mutex.unlock(),a;case 14:return[3,16];case 15:throw ot.collectionNotReady;case 16:return[2]}})})},e.prototype.upsertOne=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw ot.collectionKeyNotGiven;return[4,this._requestUpsert($r(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.upsertMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u=this;return g(this,function(c){switch(c.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:c.sent(),c.label=2;case 2:if(c.trys.push([2,12,,14]),n.some(function(d){return!u._hasPropertyOfKeyName(d)}))throw ot.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=ge(n),r=t.next(),c.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this._requestUpsert($r(i))]);case 5:c.sent(),c.label=6;case 6:return r=t.next(),[3,4];case 7:return[3,10];case 8:return s=c.sent(),o={error:s},[3,10];case 9:try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(o)throw o.error}return[7];case 10:return[4,this._transaction.commit()];case 11:return c.sent(),this._mutex.unlock(),[2,n];case 12:return a=c.sent(),[4,this._transaction.clear()];case 13:throw c.sent(),this._mutex.unlock(),a;case 14:return[3,16];case 15:throw ot.collectionNotReady;case 16:return[2]}})})},e.prototype.update=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw ot.collectionKeyNotGiven;return[4,this._requestUpdate($r(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.updateIf=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v=this;return g(this,function(_){switch(_.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,16];case 1:_.sent(),_.label=2;case 2:return _.trys.push([2,13,,15]),r=n.where,i=r===void 0?{}:r,s=n.index,a=s===void 0?null:s,o=n.backward,l=o!==void 0&&o,u=[],[4,new Av({condition:i,blockManager:this._blockManager,backward:l,indexer:this._getIndexerBy(a)}).each(function(E){return y(v,void 0,void 0,function(){var S,T;return g(this,function(N){if(E.error)throw E.stop(),E.error;if(E.hasNext){if(S=E.nextValue,Zo(i,S)&&t.set){if(typeof t.set!="function")for(T in t.set)S[T]=t.set[T];else t.set(S);u.push(S)}E.next()}else E.stop();return[2]})})})];case 3:_.sent(),_.label=4;case 4:_.trys.push([4,9,10,11]),c=ge(u),d=c.next(),_.label=5;case 5:return d.done?[3,8]:(h=d.value,[4,this._requestUpdate($r(h))]);case 6:_.sent(),_.label=7;case 7:return d=c.next(),[3,5];case 8:return[3,11];case 9:return f=_.sent(),m={error:f},[3,11];case 10:try{d&&!d.done&&(b=c.return)&&b.call(c)}finally{if(m)throw m.error}return[7];case 11:return[4,this._transaction.commit()];case 12:return _.sent(),this._mutex.unlock(),[2,u];case 13:return p=_.sent(),[4,this._transaction.clear()];case 14:throw _.sent(),this._mutex.unlock(),p;case 15:return[3,17];case 16:throw this._transaction.clear(),ot.collectionNotReady;case 17:return[2]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,5,,7]),[4,this._requestRemove(n)];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[3,7];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.removeIf=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d,h,f,p,m,b=this;return g(this,function(v){switch(v.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:v.sent(),v.label=2;case 2:return v.trys.push([2,13,,14]),t=n.where,r=t===void 0?{}:t,i=n.index,s=i===void 0?null:i,a=n.backward,o=a!==void 0&&a,l=[],[4,new Av({condition:r,blockManager:this._blockManager,backward:o,indexer:this._getIndexerBy(s)}).each(function(_){return y(b,void 0,void 0,function(){var E,S;return g(this,function(T){if(_.error)throw _.stop(),_.error;return _.hasNext?(E=_.nextValue,Zo(r,E)&&(S=E[this.keyName],l.push(S)),_.next()):_.stop(),[2]})})})];case 3:v.sent(),v.label=4;case 4:v.trys.push([4,9,10,11]),u=ge(l),c=u.next(),v.label=5;case 5:return c.done?[3,8]:(d=c.value,[4,this._requestRemove(d)]);case 6:v.sent(),v.label=7;case 7:return c=u.next(),[3,5];case 8:return[3,11];case 9:return h=v.sent(),p={error:h},[3,11];case 10:try{c&&!c.done&&(m=u.return)&&m.call(u)}finally{if(p)throw p.error}return[7];case 11:return[4,this._transaction.commit()];case 12:return v.sent(),this._mutex.unlock(),[2,l];case 13:throw f=v.sent(),this._mutex.unlock(),f;case 14:return[3,16];case 15:throw this._transaction.clear(),ot.collectionNotReady;case 16:return[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,5,,7]),[4,this._requestClear()];case 3:return t.sent(),[4,this._transaction.commit()];case 4:return t.sent(),this._mutex.unlock(),[3,7];case 5:return n=t.sent(),[4,this._transaction.clear()];case 6:throw t.sent(),this._mutex.unlock(),n;case 7:return[3,9];case 8:throw ot.collectionNotReady;case 9:return[2]}})})},e.prototype.getBlob=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._blobContainer.get(n)];case 1:return[2,t.sent()]}})})},e.prototype.saveBlob=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._blobContainer.save(n,t)];case 1:return[2,r.sent()]}})})},e.prototype.removeBlob=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._blobContainer.remove(n)];case 1:return t.sent(),[2]}})})},e.prototype.removeAllBlobs=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._blobContainer.clear()];case 1:return n.sent(),[2]}})})},e}(),z_="[NESTDB]",Wh=!0,vo=function(){function e(){}return e.off=function(){Wh=!1},e.log=function(){for(var n=[],t=0;t1?[4,Promise.all(this._generateShardPostfixArray(s==null?void 0:s.shards).map(function(c){return y(l,void 0,void 0,function(){var d,h;return g(this,function(f){switch(f.label){case 0:return c>0?(d=this._getRawKey(n,".".concat(c)),[4,this._getRaw(d)]):[3,2];case 1:if(!(h=f.sent()))throw ot.storeBrokenIntegrity;return[2,h.data];case 2:return[2,i]}})})}))]:[3,4];case 3:return o=u.sent(),[3,5];case 4:o=[i],u.label=5;case 5:return a=o,[2,this.encryption.decrypt(JSON.parse(a.join("")))];case 6:return u.sent(),[2,null];case 7:return[2,null]}})})},e.prototype.set=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return t=this._shardify(n),[4,this._setRaw(t)];case 1:return r.sent(),[2,M({},n.value)]}})})},e.prototype.setMany=function(n){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return t=[],[4,this._setRaw(t.concat.apply(t,Fe([],Me(n.map(function(s){return r._shardify(s)})),!1)))];case 1:return i.sent(),[2,n.map(function(s){return s.value})]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t,r,i,s=this;return g(this,function(a){switch(a.label){case 0:return t=this._getRawKey(n,".0"),[4,this._getRaw(t)];case 1:return(r=a.sent())?(i=r.metadata,[4,this._removeRaw(this._generateShardPostfixArray(i==null?void 0:i.shards).map(function(o){return s._getRawKey(n,".".concat(o))}))]):[3,3];case 2:return a.sent(),[2,!0];case 3:return[2,!1]}})})},e.prototype.removeMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:t=[],r=function(f){var p,m,b;return g(this,function(v){switch(v.label){case 0:return p=i._getRawKey(f,".0"),[4,i._getRaw(p)];case 1:return(m=v.sent())&&(b=m.metadata,t.push.apply(t,Fe([],Me(i._generateShardPostfixArray(b==null?void 0:b.shards).map(function(_){return d._getRawKey(f,".".concat(_))})),!1))),[2]}})},i=this,h.label=1;case 1:h.trys.push([1,6,7,8]),s=ge(n),a=s.next(),h.label=2;case 2:return a.done?[3,5]:(o=a.value,[5,r(o)]);case 3:h.sent(),h.label=4;case 4:return a=s.next(),[3,2];case 5:return[3,8];case 6:return l=h.sent(),u={error:l},[3,8];case 7:try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 8:return t.length>0?[4,this._removeRaw(t)]:[3,10];case 9:h.sent(),h.label=10;case 10:return[2,n]}})})},e}(),Lr={},So=function(e){function n(t){t===void 0&&(t={});var r,i=this;i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:4194304}))||this;var s=t.delay,a=s===void 0?1:s;return i.delay=a,i.observer={},i}return w(n,e),Object.defineProperty(n.prototype,"rawData",{get:function(){return Lr[this.dbname]},set:function(t){Lr[this.dbname]=t},enumerable:!1,configurable:!0}),n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(Lr[this.dbname])return[2,Object.keys(Lr[this.dbname])];throw ot.storeNotAvailable})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Lr[this.dbname]?[4,Vh(this.delay)]:[3,2];case 1:return r.sent(),[2,Lr[this.dbname][t]?M({key:t},Lr[this.dbname][t]):null];case 2:throw ot.storeNotAvailable}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:return Lr[this.dbname]?[4,Vh(this.delay)]:[3,2];case 1:d.sent();try{for(r=ge(t),i=r.next();!i.done;i=r.next())s=i.value,a=s.key,o=s.data,l=s.metadata,Lr[this.dbname][a]=Object.freeze({data:o,metadata:l})}catch(h){u={error:h}}finally{try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(u)throw u.error}}return[3,3];case 2:throw ot.storeNotAvailable;case 3:return[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return Lr[this.dbname]?[4,Vh(this.delay)]:[3,2];case 1:l.sent();try{for(r=ge(t),i=r.next();!i.done;i=r.next())s=i.value,Lr[this.dbname][s]&&delete Lr[this.dbname][s]}catch(u){a={error:u}}finally{try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(a)throw a.error}}return[3,3];case 2:throw ot.storeNotAvailable;case 3:return[2]}})})},n.prototype.observe=function(t,r,i){var s=this;this.observer[t]||(this.observer[t]={}),r.forEach(function(a){return s.observer[t][a]=i})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,Lr[this.dbname]||(Lr[this.dbname]={}),[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.set=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){if((r=this.observer[t.key])&&typeof r.set=="function"&&(i=r.set()))throw i;return[2,e.prototype.set.call(this,t)]})})},n.prototype.setMany=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){try{for(r=ge(t),i=r.next();!i.done;i=r.next())if(s=i.value,(a=this.observer[s.key])&&typeof a.set=="function"&&(o=a.set()))throw o}catch(d){l={error:d}}finally{try{i&&!i.done&&(u=r.return)&&u.call(r)}finally{if(l)throw l.error}}return[2,e.prototype.setMany.call(this,t)]})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,Vh(this.delay)];case 1:return t.sent(),Lr[this.dbname]={},[2]}})})},n}(Sp),BE="NestDBStore";(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.OPENING=1]="OPENING",e[e.OPEN=2]="OPEN",e[e.CLOSED=3]="CLOSED"})(Ji||(Ji={}));var Ss,ZR=function(e){function n(t){t===void 0&&(t={});var r,i=this;return(i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:104857600}))||this)._storeName=BE,i._state=Ji.UNINITIALIZED,i._openJobQueue=[],i._window=typeof window<"u"?window:void 0,i._indexedDb=i._window?i._window.indexedDB||i._window.mozIndexedDB||i._window.webkitIndexedDB||i._window.msIndexedDB:void 0,i}return w(n,e),Object.defineProperty(n.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),n.prototype.isTransactionInactiveError=function(t){return t instanceof Error&&t.message.includes("The transaction is inactive")},n.prototype._putToObjectStore=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,new Promise(function(s,a){var o=t.put(r);o.addEventListener("success",function(l){s(l.target.result)}),o.addEventListener("error",function(){a("Failed to write.")})})]})})},n.prototype._deleteFromObjectStore=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,new Promise(function(s,a){var o=t.delete(r);o.addEventListener("success",function(){return s(r)}),o.addEventListener("error",function(l){return a(l.target.error)})})]})})},n.prototype._openDatabase=function(t){var r=this;return new Promise(function(i,s){if(r._indexedDb){r._state=Ji.OPENING;var a=r._indexedDb.open(t);a.addEventListener("upgradeneeded",function(o){o.target.result.createObjectStore(BE,{keyPath:"key"})}),a.addEventListener("success",function(o){r._state=Ji.OPEN,r._database=o.target.result,r._openJobQueue.forEach(function(l){return l()}),r._openJobQueue=[],r._database.onclose=function(){r._database=void 0,r._state=Ji.OPENING,setTimeout(function(){r._openDatabase(t)},5)},i(r._database)}),a.addEventListener("error",function(o){r._state=Ji.UNINITIALIZED,s(o.target.error)})}else s(ot.storeNotAvailable)})},n.prototype._getObjectStore=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this._database?[2,this._database.transaction(this._storeName,t).objectStore(this._storeName)]:[3,1];case 1:switch(this._state){case Ji.UNINITIALIZED:case Ji.OPEN:return[3,2];case Ji.OPENING:case Ji.CLOSED:return[3,3]}return[3,4];case 2:throw ot.storeNotInitialized;case 3:return[2,new Promise(function(s){r._openJobQueue.push(function(){return s(r._getObjectStore(t))})})];case 4:return[4,this._getObjectStore(t)];case 5:return[2,i.sent()]}})})},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._getObjectStore("readonly")];case 1:return t=r.sent(),[4,new Promise(function(i,s){var a=t.getAllKeys();a.addEventListener("success",function(o){i(o.target.result)}),a.addEventListener("error",function(o){return s(o.target.error)})})];case 2:return[2,r.sent()]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._getObjectStore("readonly")];case 1:return r=i.sent(),[4,new Promise(function(s,a){var o=r.get(t);o.addEventListener("success",function(l){var u;s((u=l==null?void 0:l.target)===null||u===void 0?void 0:u.result)}),o.addEventListener("error",function(l){return a(l.target.error)})})];case 2:return[2,i.sent()]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:r=h.sent(),h.label=2;case 2:return h.trys.push([2,4,,15]),[4,Promise.all(t.map(function(f){return d._putToObjectStore(r,f)}))];case 3:return h.sent(),[3,15];case 4:if(i=h.sent(),!this.isTransactionInactiveError(i))return[3,13];h.label=5;case 5:h.trys.push([5,10,11,12]),s=ge(t),a=s.next(),h.label=6;case 6:return a.done?[3,9]:(o=a.value,[4,this._putToObjectStore(r,o)]);case 7:h.sent(),h.label=8;case 8:return a=s.next(),[3,6];case 9:return[3,12];case 10:return l=h.sent(),u={error:l},[3,12];case 11:try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 12:return[3,14];case 13:throw i;case 14:return[3,15];case 15:return[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:r=h.sent(),h.label=2;case 2:return h.trys.push([2,4,,15]),[4,Promise.all(t.map(function(f){return d._deleteFromObjectStore(r,f)}))];case 3:return h.sent(),[3,15];case 4:if(i=h.sent(),!this.isTransactionInactiveError(i))return[3,13];h.label=5;case 5:h.trys.push([5,10,11,12]),s=ge(t),a=s.next(),h.label=6;case 6:return a.done?[3,9]:(o=a.value,[4,this._deleteFromObjectStore(r,o)]);case 7:h.sent(),h.label=8;case 8:return a=s.next(),[3,6];case 9:return[3,12];case 10:return l=h.sent(),u={error:l},[3,12];case 11:try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 12:return[3,14];case 13:throw i;case 14:return[3,15];case 15:return[2]}})})},n.prototype._triggerDatabaseClose=function(){this._database&&this._database.onclose&&this._database.onclose(new Event("dummy"))},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:if(!((t=typeof window<"u"?window:null)!=null&&t.indexedDB||t!=null&&t.mozIndexedDB||t!=null&&t.webkitIndexedDB||t!=null&&t.msIndexedDB))return[3,6];if(this._indexedDb=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,!this._window||!y0())return[3,4];if(!(y0()&&navigator.userAgent&&navigator.userAgent.includes("Edge/")))return[3,1];if(!this._window.indexedDB&&(t.PointerEvent||t.MSPointerEvent))throw ot.storeNotAvailableInPrivateBrowsing;return[3,3];case 1:return[4,new Promise(function(s,a){if(r._indexedDb)try{var o=r._indexedDb.open("_testMozilla");o.onerror=function(){return a(ot.storeNotAvailableInPrivateBrowsing)},o.onsuccess=function(l){if(l.target.result.close(),r._indexedDb){var u=r._indexedDb.deleteDatabase("_testMozilla");u.onerror=function(){return s()},u.onsuccess=function(){return s()}}else a(ot.storeNotAvailable)}}catch{a(ot.storeNotAvailableInPrivateBrowsing)}else a(ot.storeNotAvailable)})];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:throw ot.storeNotAvailable;case 5:return[3,7];case 6:throw ot.storeNotAvailable;case 7:return[2]}})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this.checkAvailability()];case 1:return r.sent(),[4,this._openDatabase(t)];case 2:return r.sent(),[4,this._resetIfEncryptionChanged()];case 3:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:return t=r.sent(),[4,new Promise(function(i,s){var a=t.clear();a.addEventListener("success",function(){return i()}),a.addEventListener("error",function(o){return s(o.target.error)})})];case 2:return[2,r.sent()]}})})},n}(Sp),XR=function(e){function n(t){var r=this,i=t.AsyncStorage,s=t.itemSizeLimit,a=s===void 0?2097152:s,o=j6(t,["AsyncStorage","itemSizeLimit"]);return(r=e.call(this,M(M({},o),{itemSizeLimit:a}))||this)._asyncStorage=i,r}return w(n,e),n.prototype._isBelonging=function(t){return t.startsWith("".concat(this.dbname,"/"))},n.prototype._getActualKey=function(t){return"".concat(this.dbname,"/").concat(t)},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.getAllKeys()];case 1:return t=i.sent(),[2,t.filter(function(s){return r._isBelonging(s)}).map(function(s){return s.substring("".concat(r.dbname,"/").length)})]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.getItem(this._getActualKey(t))];case 1:return[2,(r=i.sent())?JSON.parse(r):null]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:r=[];try{for(i=ge(t),s=i.next();!s.done;s=i.next())a=s.value,o=a.key,a.data.length<=this.adjustedItemSizeLimit&&r.push([this._getActualKey(o),JSON.stringify(a)])}catch(d){l={error:d}}finally{try{s&&!s.done&&(u=i.return)&&u.call(i)}finally{if(l)throw l.error}}return[4,this._asyncStorage.multiSet(r)];case 1:return c.sent(),[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.multiRemove(t.map(function(s){return r._getActualKey(s)}))];case 1:return i.sent(),[2]}})})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(!this._asyncStorage)throw ot.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this.getAllKeys()];case 1:return t=r.sent(),[4,this.removeMany(t)];case 2:return r.sent(),[2]}})})},n}(Sp),JR=function(e){function n(t){var r,i=this;return(i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:6291456}))||this)._mmkv=t.MMKV,i}return w(n,e),n.prototype._isBelonging=function(t){return t.startsWith("".concat(this.dbname,"/"))},n.prototype._getActualKey=function(t){return"".concat(this.dbname,"/").concat(t)},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._mmkv.getAllKeys()];case 1:return t=i.sent(),[2,t.filter(function(s){return r._isBelonging(s)}).map(function(s){return s.substring("".concat(r.dbname,"/").length)})]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._mmkv.getString(this._getActualKey(t))];case 1:return[2,(r=i.sent())?JSON.parse(r):null]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){try{for(r=ge(t),i=r.next();!i.done;i=r.next())s=i.value,a=s.key,s.data.length<=this.adjustedItemSizeLimit&&this._mmkv.set(this._getActualKey(a),JSON.stringify(s))}catch(c){o={error:c}}finally{try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(o)throw o.error}}return[2]})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o;return g(this,function(l){try{for(r=ge(t),i=r.next();!i.done;i=r.next())s=i.value,this._mmkv.delete(this._getActualKey(s))}catch(u){a={error:u}}finally{try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(a)throw a.error}}return[2]})})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(!this._mmkv)throw ot.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this.getAllKeys()];case 1:return t=r.sent(),[4,this.removeMany(t)];case 2:return r.sent(),[2]}})})},n}(Sp);(function(e){e.INIT="INIT",e.OPENING="OPENING",e.OPENED="OPENED",e.CLOSED="CLOSED"})(Ss||(Ss={}));var Ys,ek=function(){function e(n){var t=n.name,r=n.version,i=n.store,s=n.config;this.name=t,this._version=r,this._state=Ss.INIT,this._config=s||new ih({dbname:t}),this._store=i,this._event={success:Cc,error:Cc,storeReplaced:Cc,upgrade:PE},this._collections=new Map,this._globalMutex=new x2("".concat(this.name,".lock")),this._config.disableLogger&&vo.off(),new Fi({dbname:t,limit:this._config.cacheLimit})}return Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"store",{get:function(){return this._store},enumerable:!1,configurable:!0}),e.prototype.estimateUsage=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,(t=this._store,y(void 0,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,t.usage()];case 1:return[2,r.sent()]}})}))];case 1:return[2,n.sent()]}var t})})},e.prototype.commitSchema=function(n){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return this._state!==Ss.OPENING?[3,2]:[4,Promise.all(n.map(function(i){return y(t,void 0,void 0,function(){var s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return s=i.collectionName,a=i.keyName,o=i.index,l=o===void 0?[]:o,this._collections.has(s)||this._collections.set(s,new G_({dbname:this.name,collectionName:s,keyName:a,indexes:l,store:this._store})),(u=this._collections.get(s))?[4,u.init()]:[3,2];case 1:c.sent(),c.label=2;case 2:return[2]}})})}))];case 1:return r.sent(),[3,3];case 2:throw ot.databaseSchemaNotOnUpgrade;case 3:return[2]}})})},e.prototype.open=function(){var n;return y(this,void 0,void 0,function(){var t,r,i,s,a=this;return g(this,function(o){switch(o.label){case 0:return[4,this._globalMutex.lock()];case 1:if(o.sent(),this._state===Ss.OPENED)return[3,12];this._state=Ss.OPENING,o.label=2;case 2:return o.trys.push([2,5,,12]),[4,this._store.init(this.name)];case 3:return o.sent(),l=this.name,t="".concat(Mv(l),".metadata"),r={version:0,collectionNames:[]},[4,this._store.get(t)];case 4:return i=(n=o.sent())!==null&&n!==void 0?n:r,[2,new Promise(function(u,c){var d=function(f){i.version0&&!this.customTypesFilter.includes("*")&&!this.customTypesFilter.includes(n.customType)||this.senderUserIdsFilter&&this.senderUserIdsFilter.length>0&&(!(n instanceof Ht)||!this.senderUserIdsFilter.includes(n.sender.userId)))return!1;if(n instanceof vr)switch(this.replyType){case Bn.NONE:if(n.parentMessageId>0)return!1;break;case Bn.ONLY_REPLY_TO_CHANNEL:if(n instanceof Ht&&n.parentMessageId>0&&!n.replyToChannel)return!1}return!0},e}();(function(e){e.CHANNEL_LATEST="channel_latest",e.NEWEST_CHILD_MESSAGE="newest_child_message"})(Yn||(Yn={}));var ed,Os=function(e){switch(e){case Yn.CHANNEL_LATEST:return["channelUrl","-createdAt","-messageId"];case Yn.NEWEST_CHILD_MESSAGE:return["channelUrl","-parentMessageId","-createdAt","-messageId"]}},nk=function(){return["channelUrl","-createdAt","-notificationId"]},rk=M(M({},nT),{scheduledAt:void 0}),ik=function(e){return iT(e)&&k("number",e.scheduledAt,!0)},sk=M(M({},bp),{scheduledAt:0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),ak=function(e){return Cp(e)&&k("number",e.scheduledAt)&&(Er(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||e.thumbnailSizes.every(function(n){return k("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},mT="UnsentMessage",ok="reqId",Kh={},ll=function(e){function n(t){var r=e.call(this,t)||this;return r._mutex=new x2("unsendmessagecache.lock"),Kh[t]=r,r}return w(n,e),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return R.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Kh[t]&&!r||(Kh[t]=new n(t)),Kh[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb,r=t==null?void 0:t.collection(mT);if(!r)throw L.databaseError;return r},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){if(t.messageId>0)throw L.invalidParameters;var r,i=M({},t.serialize());return t instanceof sr?(t.messageParams&&(i.messageParams=bE(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=(r=t.scheduledInfo.scheduledMessageParams,M(M({},bE(r)),{scheduledAt:r.scheduledAt})))):t instanceof nn?(t.messageParams&&(i.messageParams=CE(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=function(s){return M(M({},CE(s)),{scheduledAt:s.scheduledAt})}(t.scheduledInfo.scheduledMessageParams))):t instanceof yi&&t.messageParams&&(i.messageParams=function(s){return be({fileInfoList:s.fileInfoList,isReplyToChannel:s.isReplyToChannel,pushNotificationDeliveryOption:s.pushNotificationDeliveryOption})}(t.messageParams)),i},n.prototype._deserialize=function(t){return t=M(M({},t),{messageId:parseInt(t.messageId)}),Ln.of(this._iid).buildMessageFromSerializedData(t)},n.prototype._deserializeWithMessageCreateParams=function(t){var r,i,s;return y(this,void 0,void 0,function(){var a,o,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:return a=Ln.of(this._iid),o=this._deserialize(t),t.messageParams?o instanceof sr?(u=t.messageParams,o.messageParams=a.buildUserMessageCreateParamsFromSerializedData(u,o),[3,6]):[3,1]:[3,6];case 1:return o instanceof nn?(u=t.messageParams).fileKey&&typeof u.fileKey=="string"&&F_((r=u.fileType)!==null&&r!==void 0?r:"")?(l=u,[4,this.collection.getBlob(u.fileKey)]):[3,3]:[3,4];case 2:l.file=(i=f.sent())!==null&&i!==void 0?i:void 0,f.label=3;case 3:return o.messageParams=a.buildFileMessageCreateParamsFromSerializedData(u,o),[3,6];case 4:return o instanceof yi&&(u=t.messageParams)&&u.fileInfoList?(o.messageParams=a.buildMultipleFilesMessageCreateParamsFromSerializedData(u,o),[4,Promise.all(o.messageParams.fileInfoList.map(function(p){return y(h,void 0,void 0,function(){var m,b,v,_,E;return g(this,function(S){switch(S.label){case 0:return typeof((b=p._uploadedMetaData)===null||b===void 0?void 0:b.fileKey)=="string"&&F_((_=(v=p._uploadedMetaData)===null||v===void 0?void 0:v.fileType)!==null&&_!==void 0?_:"")?(m=p,[4,this.collection.getBlob(p._uploadedMetaData.fileKey)]):[3,2];case 1:m.file=(E=S.sent())!==null&&E!==void 0?E:void 0,S.label=2;case 2:return[2]}})})}))]):[3,6];case 5:f.sent(),f.label=6;case 6:return o.scheduledInfo&&t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams?o instanceof sr?(c=t.scheduledInfo.scheduledMessageParams,o.scheduledInfo.scheduledMessageParams=a.buildScheduledUserMessageCreateParamsFromSerializedData(c,o),[3,10]):[3,7]:[3,10];case 7:return o instanceof nn?(c=t.scheduledInfo.scheduledMessageParams).fileKey&&typeof c.fileKey=="string"&&typeof c.fileType=="string"&&F_(c.fileType)?(d=c,[4,this.collection.getBlob(c.fileKey)]):[3,9]:[3,10];case 8:d.file=(s=f.sent())!==null&&s!==void 0?s:void 0,f.label=9;case 9:o.scheduledInfo.scheduledMessageParams=a.buildScheduledFileMessageCreateParamsFromSerializedData(c,o),f.label=10;case 10:return[2,o]}})})},n.prototype._getFileInfoBlobKey=function(t,r){return"".concat(t,".").concat(r)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey("".concat(t))]:[3,2];case 1:if(r=i.sent())return[2,this._deserializeWithMessageCreateParams(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.filter,s=i===void 0?new Us:i,a=t.order,o=a===void 0?Yn.CHANNEL_LATEST:a,l=t.sendingStatus,u=t.backward,c=u!==void 0&&u,d=t.parentMessageId;return y(this,void 0,void 0,function(){var h,f,p,m,b=this;return g(this,function(v){switch(v.label){case 0:return this.localCacheEnabled?(h=Os(o),f={"/where":function(_){return!!(o!==Yn.NEWEST_CHILD_MESSAGE||d&&_.parentMessageId!==0&&_.parentMessageId===d)&&s.match(b._deserialize(_))}},r&&(f.channelUrl=r),l&&(f.sendingStatus=l),p={where:f,index:h,backward:c},[4,this.collection.query(p)]):[3,3];case 1:return[4,v.sent().fetch({})];case 2:return m=v.sent(),[2,Promise.all(m.map(function(_){return y(b,void 0,void 0,function(){return g(this,function(E){switch(E.label){case 0:return[4,this._deserializeWithMessageCreateParams(_)];case 1:return[2,E.sent()]}})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new Us),y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this.fetch({filter:r,order:Yn.NEWEST_CHILD_MESSAGE,channelUrl:t.channelUrl,backward:!1,parentMessageId:t.messageId})];case 1:return[2,i.sent()]}})})},n.prototype.upsert=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var a;return g(this,function(o){switch(o.label){case 0:return s instanceof nn||s instanceof yi?[4,this._mutex.lock()]:[3,4];case 1:return o.sent(),[4,this.saveBlob(s)];case 2:return o.sent(),[4,this._mutex.unlock()];case 3:o.sent(),o.label=4;case 4:return a=this._serialize(s),[4,this.collection.upsertOne(a)];case 5:return o.sent(),[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.upsertChildMessages=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var a;return g(this,function(o){switch(o.label){case 0:return a=[],s.threadInfo&&s.threadInfo.replyCount>0?[4,this.getAllChildMessages(s)]:[3,2];case 1:a=o.sent(),o.label=2;case 2:return a.length>0?(a.forEach(function(l){return l.applyParentMessage(s)}),[4,this.upsert(a)]):[3,4];case 3:o.sent(),o.label=4;case 4:return[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ge(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove(s)]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return a=u.sent(),o={error:a},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t}})]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.saveBlob=function(t){return y(this,void 0,void 0,function(){var r,i,s,a=this;return g(this,function(o){switch(o.label){case 0:return t instanceof nn?t.messageParams&&(s=t.messageParams).file&&Cf(s.file)?[4,this.collection.saveBlob(s.file,t.reqId)]:[3,2]:[3,5];case 1:i=o.sent(),s.fileKey=i,s.fileType=Yo.BLOB,o.label=2;case 2:return t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(r=t.scheduledInfo.scheduledMessageParams).file&&Cf(r.file)?[4,this.collection.saveBlob(r.file,t.reqId)]:[3,4];case 3:i=o.sent(),r.fileKey=i,r.fileType=Yo.BLOB,o.label=4;case 4:return[3,7];case 5:return t instanceof yi&&(s=t.messageParams)&&s.fileInfoList&&Array.isArray(s.fileInfoList)?[4,Promise.all(s.fileInfoList.map(function(l,u){return y(a,void 0,void 0,function(){var c;return g(this,function(d){switch(d.label){case 0:return l.file&&Cf(l.file)?[4,this.collection.saveBlob(l.file,this._getFileInfoBlobKey(t.reqId,u))]:[3,2];case 1:c=d.sent(),l._uploadedMetaData||(l._uploadedMetaData={}),l._uploadedMetaData.fileKey=c,l._uploadedMetaData.fileType=Yo.BLOB,d.label=2;case 2:return[2]}})})}))]:[3,7];case 6:o.sent(),o.label=7;case 7:return[2]}})})},n}(Jn),Qh={},nu=function(e){function n(t){var r=e.call(this,t)||this;return Qh[t]=r,r}return w(n,e),Object.defineProperty(n.prototype,"_sdkState",{get:function(){return R.of(this._iid).sdkState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return R.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return ll.of(this._iid)},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Qh[t]&&!r||(Qh[t]=new n(t)),Qh[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return Q(!!t).throw(L.databaseError),t.collection(Iv)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){return M(M({},t.serialize()),{messageId:"".concat(t.messageId)})},n.prototype._deserialize=function(t){return t=M(M({},t),{messageId:parseInt(t.messageId)}),Ln.of(this._iid).buildMessageFromSerializedData(t)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey("".concat(t))]:[3,2];case 1:if(r=i.sent())return[2,this._deserialize(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.token,s=t.limit,a=s===void 0?100:s,o=t.filter,l=o===void 0?new Us:o,u=t.order,c=u===void 0?Yn.CHANNEL_LATEST:u,d=t.backward,h=d!==void 0&&d,f=t.parentMessageId,p=t.isPollOnly,m=p!==void 0&&p,b=t.exactMatch,v=b!==void 0&&b,_=t.inclusive,E=_===void 0||_;return y(this,void 0,void 0,function(){var S,T,N,I=this;return g(this,function(x){switch(x.label){case 0:return this.localCacheEnabled?(S=Os(c),T={where:{channelUrl:r,"/where":function(A){if(i)switch(c){case Yn.CHANNEL_LATEST:if(v&&A.createdAt!==i)return!1;if(h){if(E&&A.createdAti||!E&&A.createdAt>=i)return!1;break;case Yn.NEWEST_CHILD_MESSAGE:if(!f||A.parentMessageId===0||A.parentMessageId!==f)return!1}return!(m&&!A._poll)&&l.match(I._deserialize(A))}},index:S,backward:h},[4,this.collection.query(T)]):[3,3];case 1:return[4,x.sent().fetch({limit:a??void 0})];case 2:return N=x.sent(),[2,Promise.all(N.map(function(A){return y(I,void 0,void 0,function(){return g(this,function(O){return[2,this._deserialize(A)]})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new Us),y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this.fetch({channelUrl:t.channelUrl,token:Date.now(),limit:null,backward:!1,filter:r,order:Yn.NEWEST_CHILD_MESSAGE,parentMessageId:t.messageId})];case 1:return[2,i.sent()]}})})},n.prototype.upsert=function(t){var r;return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:return this.localCacheEnabled?[4,this.saveBlobs(t)]:[3,13];case 1:f.sent(),f.label=2;case 2:f.trys.push([2,7,8,9]),i=ge(t),s=i.next(),f.label=3;case 3:return s.done?[3,6]:(a=s.value,!((r=a.threadInfo)===null||r===void 0)&&r._isUpdateRequired?[4,this.get(a.messageId)]:[3,5]);case 4:(o=f.sent())!=null&&o.threadInfo&&a.threadInfo._updateFrom(o.threadInfo),f.label=5;case 5:return s=i.next(),[3,3];case 6:return[3,9];case 7:return l=f.sent(),c={error:l},[3,9];case 8:try{s&&!s.done&&(d=i.return)&&d.call(i)}finally{if(c)throw c.error}return[7];case 9:return u=t.map(function(p){return h._serialize(p)}),[4,this.collection.upsertMany(u)];case 10:return f.sent(),[4,this.upsertChildMessages(t)];case 11:return f.sent(),[4,this._unsentMessageCache.upsertChildMessages(t)];case 12:f.sent(),f.label=13;case 13:return[2]}})})},n.prototype.upsertChildMessages=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var a,o;return g(this,function(l){switch(l.label){case 0:return a=[],!((o=s.threadInfo)===null||o===void 0)&&o.replyCount&&s.threadInfo.replyCount>0?[4,this.getAllChildMessages(s)]:[3,2];case 1:a=l.sent(),l.label=2;case 2:return a.length>0?(a.forEach(function(u){return u.applyParentMessage(s)}),[4,this.upsert(a)]):[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ge(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove("".concat(s))]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return a=u.sent(),o={error:a},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:Os(Yn.CHANNEL_LATEST)})]:[3,6];case 1:return i.sent(),[4,(r=this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 2:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 3:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 4:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 5:i.sent(),i.label=6;case 6:return[2]}})})},n.prototype.removeUnderOffset=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:Os(Yn.CHANNEL_LATEST)})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.countBetween=function(t,r,i){return y(this,void 0,void 0,function(){var s,a=this;return g(this,function(o){switch(o.label){case 0:return this.localCacheEnabled?(s=Os(Yn.CHANNEL_LATEST),[4,this.collection.query({where:{channelUrl:t,"/where":function(l){var u=a._deserialize(l);return i.includes(u.createdAt)&&r.match(u)}},index:s}).count()]):[3,2];case 1:return[2,o.sent()];case 2:return[2,0]}})})},n.prototype.saveBlobs=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var a,o;return g(this,function(l){switch(l.label){case 0:return s instanceof nn&&s.messageParams&&(a=s.messageParams).file&&Cf(a.file)?[4,this.collection.saveBlob(a.file,s.reqId)]:[3,2];case 1:o=l.sent(),a.fileKey=o,l.label=2;case 2:return[2]}})})}))];case 1:return i.sent(),[2]}})})},n.prototype._getGroupChannelPreferenceSize=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=0,[4,(i=this._cacheContext.preference).get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 1:return s=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 2:return a=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 3:return o=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 4:return l=u.sent(),s&&(r+=JSON.stringify(s).length),a&&(r+=JSON.stringify(a).length),o&&(r+=JSON.stringify(o).length),l&&(r+=JSON.stringify(l).length),[2,r]}})})},n}(Jn),Yh={},lk=function(e){function n(t){var r=e.call(this,t)||this;return Yh[t]=r,r}return w(n,e),Object.defineProperty(n.prototype,"_sdkState",{get:function(){return R.of(this._iid).sdkState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return R.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Yh[t]&&!r||(Yh[t]=new n(t)),Yh[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return Q(!!t).throw(L.databaseError),t.collection(pT)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){return M({},t.serialize())},n.prototype._deserialize=function(t){return Ln.of(this._iid).buildMessageFromSerializedData(t)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey(t)]:[3,2];case 1:if(r=i.sent())return[2,this._deserialize(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.token,s=t.limit,a=s===void 0?100:s,o=t.filter,l=o===void 0?new Us:o,u=t.backward,c=u!==void 0&&u,d=t.exactMatch,h=d!==void 0&&d,f=t.inclusive,p=f===void 0||f;return y(this,void 0,void 0,function(){var m,b=this;return g(this,function(v){switch(v.label){case 0:return this.localCacheEnabled?(m={where:{channelUrl:r,"/where":function(_){if(i){if(h&&_.createdAt!==i)return!1;if(c){if(p&&_.createdAti||!p&&_.createdAt>=i)return!1}return l.match(b._deserialize(_))}},index:["channelUrl","-createdAt","-notificationId"],backward:c},[4,this.collection.query(m)]):[3,3];case 1:return[4,v.sent().fetch({limit:a??void 0})];case 2:return[2,v.sent().map(function(_){return b._deserialize(_)})];case 3:return[2,[]]}})})},n.prototype.upsert=function(t){return y(this,void 0,void 0,function(){var r,i=this;return g(this,function(s){switch(s.label){case 0:return this.localCacheEnabled?(r=t.map(function(a){return i._serialize(a)}),[4,this.collection.upsertMany(r)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ge(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove(s)]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return a=u.sent(),o={error:a},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},n.prototype.markAsReadByTimestamp=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,messageStatus:ko.SENT,createdAt:{"<":r}}},{set:{messageStatus:ko.READ}})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.markAsReadByMessageIds=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,notificationId:{"/in":r},messageStatus:ko.SENT}},{set:{messageStatus:ko.READ}})]:[3,2];case 1:return[2,i.sent().length];case 2:return[2,0]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:["channelUrl","-createdAt","-notificationId"]})]:[3,6];case 1:return i.sent(),[4,(r=this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 2:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 3:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 4:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 5:i.sent(),i.label=6;case 6:return[2]}})})},n.prototype.removeUnderOffset=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:Os(Yn.CHANNEL_LATEST)})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.countBetween=function(t,r,i){return y(this,void 0,void 0,function(){var s,a=this;return g(this,function(o){switch(o.label){case 0:return this.localCacheEnabled?(s=["channelUrl","-createdAt","-notificationId"],[4,this.collection.query({where:{channelUrl:t,"/where":function(l){var u=a._deserialize(l);return i.includes(u.createdAt)&&r.match(u)}},index:s}).count()]):[3,2];case 1:return[2,o.sent()];case 2:return[2,0]}})})},n}(Jn),nc={},vT=function(e){function n(t){var r=e.call(this,t)||this;return r._observers=new Map,r._dispatcherContext=r._dispatcher.on(function(i){return y(r,void 0,void 0,function(){var s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x=this;return g(this,function(A){switch(A.label){case 0:return i instanceof wt?(s=i.messages,I=i.source,c=i.isWebSocketEventComing,a=s.filter(function(O){return O instanceof vr&&O.channelType!==et.OPEN&&O.messageId>0}),o=s.filter(function(O){return O instanceof vr&&O.channelType!==et.OPEN&&O.messageId===0}),l=s.filter(function(O){return O instanceof al}),a.length>0?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._messageCache.upsert(a)];case 1:return O.sent(),[4,this._unsentMessageCache.remove(a.map(function(U){return U instanceof Ht?U.reqId:null}).filter(function(U){return U!==null}))];case 2:return O.sent(),[2]}})})})]:[3,2]):[3,7];case 1:A.sent(),c||this._broadcastUpdateEvent(a,I),A.label=2;case 2:return o.length>0?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._unsentMessageCache.upsert(o)];case 1:return O.sent(),[2]}})})})]:[3,4];case 3:A.sent(),c||this._broadcastUpdateEvent(o,I),A.label=4;case 4:return l.length>0?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._notificationCache.upsert(l)];case 1:return O.sent(),[2]}})})})]:[3,6];case 5:A.sent(),c||this._broadcastUpdateEvent(l,I),A.label=6;case 6:return[3,24];case 7:return i instanceof T2?(u=i.messageIds,I=i.source,c=i.isWebSocketEventComing,d=u.filter(function(O){return typeof O=="number"}),h=u.filter(function(O){return typeof O=="string"}),[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return d.length>0?[4,this._messageCache.remove(d)]:[3,2];case 1:O.sent(),O.label=2;case 2:return h.length>0?[4,this._notificationCache.remove(h)]:[3,4];case 3:O.sent(),O.label=4;case 4:return[2]}})})})]):[3,9];case 8:return A.sent(),c||this._broadcastRemoveEvent(u,I),[3,24];case 9:return i instanceof Hw?(f=i.reqId,I=i.source,[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._unsentMessageCache.remove([f])];case 1:return O.sent(),[2]}})})})]):[3,11];case 10:return A.sent(),this._broadcastRemoveUnsentEvent(f,I),[3,24];case 11:return i instanceof jw?(p=i.polls,I=i.source,this._cacheContext.localCacheEnabled?(m=p.map(function(O){return O.messageId}),[4,Promise.all(m.map(function(O){return x._messageCache.get(O)}))]):[3,14]):[3,15];case 12:return(b=A.sent().filter(function(O){return O})).length>0&&p.forEach(function(O){var U=b.find(function(W){return W.messageId===O.messageId});U&&U.applyPoll(O)}),[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._messageCache.upsert(b)];case 1:return[2,O.sent()]}})})})];case 13:A.sent(),A.label=14;case 14:return this._broadcastPollChangeLogEvent(p,I),[3,24];case 15:return i instanceof Bw?(v=i.event,I=i.source,[4,this._messageCache.get(v.messageId)]):[3,19];case 16:return(_=A.sent())&&_.isUserMessage()&&_.poll&&_.poll.applyPollUpdateEvent(v)?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._messageCache.upsert([_])];case 1:return[2,O.sent()]}})})})]:[3,18];case 17:A.sent(),A.label=18;case 18:return this._broadcastPollUpdateEvent(v,I),[3,24];case 19:return i instanceof N2?(E=i.event,I=i.source,[4,this._messageCache.get(E.messageId)]):[3,23];case 20:return(S=A.sent())&&S.isUserMessage()&&S.poll&&S.poll.applyPollVoteEvent(E)?[4,Lt(function(){return y(x,void 0,void 0,function(){return g(this,function(O){switch(O.label){case 0:return[4,this._messageCache.upsert([S])];case 1:return[2,O.sent()]}})})})]:[3,22];case 21:A.sent(),A.label=22;case 22:return this._broadcastPollVoteEvent(E,I),[3,24];case 23:i instanceof Pw?(T=i.event,I=i.source,T.messageId>0&&this._broadcastReactionUpdateEvent(T,I)):i instanceof Fw&&(N=i.event,I=i.source,this._broadcastThreadUpdateEvent(N,I)),A.label=24;case 24:return[2]}})})}),r}return w(n,e),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return R.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_dispatcher",{get:function(){return R.of(this._iid).dispatcher},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_messageCache",{get:function(){return nu.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return ll.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_notificationCache",{get:function(){return lk.of(this._iid)},enumerable:!1,configurable:!0}),n.of=function(t,r){var i;return r===void 0&&(r=!1),nc[t]&&!r||(nc[t]&&((i=nc[t]._dispatcherContext)===null||i===void 0||i.close()),nc[t]=new n(t)),nc[t]},n.prototype._broadcastUpdateEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onUpdate&&l.onUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastPollChangeLogEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onPollChangeLogUpdate&&l.onPollChangeLogUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastPollUpdateEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onPollUpdate&&l.onPollUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastPollVoteEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onPollVote&&l.onPollVote(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastRemoveEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onRemove&&l.onRemove(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastRemoveUnsentEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onRemoveUnsent&&l.onRemoveUnsent(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastReactionUpdateEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onReactionUpdate&&l.onReactionUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype._broadcastThreadUpdateEvent=function(t,r){var i,s;try{for(var a=ge(this._observers.values()),o=a.next();!o.done;o=a.next()){var l=o.value;l.onThreadInfoUpdate&&l.onThreadInfoUpdate(t,r)}}catch(u){i={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}},n.prototype.subscribe=function(t,r){this._observers.set(t,r)},n.prototype.unsubscribe=function(t){this._observers.delete(t)},n.prototype.unsubscribeAll=function(){this._observers.clear()},n}(Jn),uk=function(e){function n(t){var r=this,i=t.reverse,s=i!==void 0&&i,a=t.limit,o=a===void 0?20:a,l=t.keys,u=t.token;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(iw),r.params=be({token:u,limit:o,reverse:s,order:dv.UPDATED_AT,show_ui_template:!0,show_color_variables:!0,keys:l}),r}return w(n,e),n}(Z),ck=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.next,a=r.has_more,o=a!==void 0&&a,l=r.templates;return i.nextToken=s,i.hasMore=o,i.templates=l.map(function(u){return{template:JSON.stringify(u)}}),i}return w(n,e),n}(le),dk=function(e){function n(t){var r=this,i=t.key;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(iw,"/").concat(i),r}return w(n,e),n}(Z),hk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.template=JSON.stringify(r),i}return w(n,e),n}(le),$E={},Ln=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.requestQueue,a=t.onlineDetector,o=t.cacheContext;this._iid=n,this._sdkState=r,this._requestQueue=s,this._dispatcher=i,this._cacheContext=o,nu.of(n),ll.of(n),vT.of(n),this.fileMessageQueue=new lO(n,{sdkState:r,dispatcher:i,requestQueue:s,onlineDetector:a,cacheContext:o}),$E[n]=this}return e.of=function(n){return $E[n]},e.prototype.buildMessageFromSerializedData=function(n){var t=Ko(n);if(t.notificationId)return new al(this._iid,al.payloadify(t));switch(t.messageType){case Tt.USER:return new sr(this._iid,sr.payloadify(t));case Tt.FILE:return yi._isMultipleFilesMessageSerializedData(t)?new yi(this._iid,yi.payloadify(t)):new nn(this._iid,nn.payloadify(t));case Tt.ADMIN:return new Lu(this._iid,Lu.payloadify(t))}throw L.invalidParameters},e.prototype.buildUserMessageCreateParamsFromSerializedData=function(n,t){return be(Ie({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,message:t.message,translationTargetLanguages:Object.keys(t.translations),pollId:n.pollId}))},e.prototype.buildFileMessageCreateParamsFromSerializedData=function(n,t){var r;return be(Ie({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,file:n.file,fileKey:n.fileKey,fileUrl:t.plainUrl,fileName:t.name,fileSize:t.size,mimeType:t.type,thumbnailSizes:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){return{maxWidth:i.width,maxHeight:i.height}}),fileType:n.fileType,requireAuth:t.requireAuth}))},e.prototype.buildMultipleFilesMessageCreateParamsFromSerializedData=function(n,t){var r=this;return be({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,fileInfoList:n.fileInfoList.map(function(i){return new g0(r._iid,i)})})},e.prototype.buildScheduledUserMessageCreateParamsFromSerializedData=function(n,t){return M(M({},this.buildUserMessageCreateParamsFromSerializedData(n,t)),{scheduledAt:n.scheduledAt})},e.prototype.buildScheduledFileMessageCreateParamsFromSerializedData=function(n,t){return M(M({},this.buildFileMessageCreateParamsFromSerializedData(n,t)),{scheduledAt:n.scheduledAt})},e.prototype.buildSenderFromSerializedData=function(n){var t=Ko(n);return new ku(this._iid,ku.payloadify(t))},e.prototype.getMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new uO(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(cO).message]}})})},e.prototype.getScheduledMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new fO(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(pO).message]}})})},e.prototype.getMessagesByMessageId=function(n,t,r,i,s){return s===void 0&&(s=z.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var a,o,l;return g(this,function(u){switch(u.label){case 0:return a=new $h(M(M({channelType:t,channelUrl:n,token:String(r)},Zc),i)),[4,this._requestQueue.send(a)];case 1:return o=u.sent(),l=o.as(Gh).messages,this._dispatcher.dispatch(new wt({messages:l,source:s})),[2,l]}})})},e.prototype.getMessagesByTimestamp=function(n,t,r,i,s){return s===void 0&&(s=z.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var a,o,l;return g(this,function(u){switch(u.label){case 0:return a=new $h(M(M({channelType:t,channelUrl:n,timestamp:r},Zc),i)),[4,this._requestQueue.send(a)];case 1:return o=u.sent(),l=o.as(Gh).messages,this._dispatcher.dispatch(new wt({messages:l,source:s})),[2,l]}})})},e.prototype._getMessagesByTimestampForCollection=function(n,t,r,i,s,a,o){return s===void 0&&(s=z.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return l=new $h(M(M(M({channelType:t,channelUrl:n,timestamp:r},Zc),i),{checkingHasNext:a,checkingContinuousMessages:o})),[4,this._requestQueue.send(l)];case 1:return u=p.sent(),c=u.as(Gh),d=c.messages,h=c.isContinuousMessages,f=c.hasNext,this._dispatcher.dispatch(new wt({messages:d,source:s})),[2,{messages:d,isContinuousMessages:h,hasNext:f}]}})})},e.prototype.getThreadedMessagesByTimestamp=function(n,t,r,i){return i===void 0&&(i=z.REQUEST_THREADED_MESSAGE),y(this,void 0,void 0,function(){var s,a,o,l;return g(this,function(u){switch(u.label){case 0:return s=new $h(M(M(M({channelUrl:n.channelUrl,channelType:n.channelType,timestamp:t},rh),r),{replyType:Bn.ALL,parentMessageId:n.messageId,includeThreadInfo:!0})),[4,this._requestQueue.send(s)];case 1:return a=u.sent(),o=a.as(Gh).messages,(l=o.slice(1)).forEach(function(c){c.parentMessage=n}),this._dispatcher.dispatch(new wt({messages:l,source:i})),[2,{parentMessage:o[0],threadedMessages:l}]}})})},e.prototype.getMessageTemplatesByToken=function(n,t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=new uk(M({token:n},t)),[4,this._requestQueue.send(r)];case 1:return i=u.sent(),s=i.as(ck),a=s.hasMore,o=s.nextToken,l=s.templates,[2,{hasMore:a,token:o,templates:l}]}})})},e.prototype.getMessageTemplate=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new dk({key:n}),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,{template:r.as(hk).template}]}})})},e.prototype.getMessageChangelogs=function(n,t,r,i,s){return s===void 0&&(s=z.REQUEST_MESSAGE_CHANGELOGS),y(this,void 0,void 0,function(){var a,o,l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return a=new dO(be(Ie(M(M({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null},Cv),i)))),[4,this._requestQueue.send(a)];case 1:return o=p.sent(),l=o.as(hO),u=l.updatedMessages,c=l.deletedMessagesInfo,d=l.hasMore,h=l.nextToken,f=c.map(function(m){return m.messageId}),u.length>0&&this._dispatcher.dispatch(new wt({messages:u,source:s})),f.length>0&&this._dispatcher.dispatch(new T2({messageIds:f,source:s})),[2,{updatedMessages:u,deletedMessageIds:f,hasMore:d,token:h}]}})})},e}(),gT=function(e){function n(t,r){var i=e.call(this,t)||this;i.targetMessageId=0;var s=r.thread_info,a=r.parent_message_id,o=r.channel_url,l=r.channel_type;return s&&k("object",s)&&k("number",a)&&k("string",o)&&k("string",l)&&(i.threadInfo=new v0(t,s),i.targetMessageId=a,i.channelUrl=o,i.channelType=l),i}return w(n,e),n}(Jn),fk={channelUrl:"",channelType:et.BASE,messageId:0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1},pk=function(e){function n(t){var r=t.channelCustomType,i=t.keyword,s=t.limit,a=t.reverse,o=t.exactMatch,l=t.channelUrl,u=t.order,c=t.messageTimestampFrom,d=t.messageTimestampTo,h=t.advancedQuery,f=t.targetFields,p=t.nextToken,m=e.call(this)||this;return m.method=Y.GET,m.path="".concat(J6,"/messages"),m.params={custom_type:r,query:i,limit:s,reverse:a,exact_match:o,channel_url:l,message_ts_from:c,message_ts_to:d,sort_field:u,advanced_query:h,target_fields:f,after:p},m}return w(n,e),n}(Z),_k=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.messages=r.results.map(function(s){return wr(t,s)}),i.hasNext=r.has_next,i.nextToken=r.end_cursor,i.totalCount=r.total_count,i}return w(n,e),n}(le);(function(e){e.SCORE="score",e.TIMESTAMP="ts"})(ed||(ed={}));var mk=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f=this;return(f=e.call(this,t,r)||this).keyword="",f.reverse=!1,f.exactMatch=!1,f.channelUrl="",f.channelCustomType="",f.messageTimestampFrom=null,f.messageTimestampTo=null,f.order=ed.SCORE,f.advancedQuery=!1,f.targetFields=null,f._nextToken="",f.totalCount=-1,f.keyword=r.keyword,f.reverse=(i=r.reverse)!==null&&i!==void 0&&i,f.exactMatch=(s=r.exactMatch)!==null&&s!==void 0&&s,f.channelUrl=(a=r.channelUrl)!==null&&a!==void 0?a:"",f.channelCustomType=(o=r.channelCustomType)!==null&&o!==void 0?o:"",f.messageTimestampFrom=(l=r.messageTimestampFrom)!==null&&l!==void 0?l:null,f.messageTimestampTo=(u=r.messageTimestampTo)!==null&&u!==void 0?u:null,f.order=(c=r.order)!==null&&c!==void 0?c:ed.SCORE,f.advancedQuery=(d=r.advancedQuery)!==null&&d!==void 0&&d,f.targetFields=(h=r.targetFields)!==null&&h!==void 0?h:null,f}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.keyword)&&this.keyword.length>0&&k("boolean",this.reverse)&&k("boolean",this.exactMatch)&&k("string",this.channelUrl)&&k("string",this.channelCustomType)&&(k("number",this.messageTimestampFrom)||this.messageTimestampFrom===null)&&(k("number",this.messageTimestampTo)||this.messageTimestampTo===null)&&Ve(ed,this.order)&&k("boolean",this.advancedQuery)&&Qe("string",this.targetFields,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new pk(Ie(M(M({},this),{nextToken:this._nextToken?this._nextToken:null}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=c.sent(),s=i.as(_k),a=s.messages,o=s.hasNext,l=s.nextToken,u=s.totalCount,this._nextToken=l,this._hasNext=o,this._isLoading=!1,this.totalCount=u,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),vk=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.limit,a=t.token,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/parent_thread_message"),o.params=be(Ie({limit:s,token:a})),o}return w(n,e),n}(Z),gk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.next,i.messages=r.messages.map(function(s){return wr(t,s)}),i}return w(n,e),n}(le),yk=function(e){function n(t,r,i,s){var a=e.call(this,t,r,i,s)||this;return a._edge="",a}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new vk({channelType:this.channelType,channelUrl:this.channelUrl,token:this._edge,limit:this.limit}),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(gk),a=s.messages,o=s.token,this._edge=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),Ek={channelUrl:"",scheduledMessageId:0},bk={reverse:!1,limit:20},Ck=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="message",t}return w(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,a=r.sessionManager,o=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:a,requestQueue:o,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new Ln(t,{sdkState:i,dispatcher:s,requestQueue:o,onlineDetector:u,cacheContext:c})},n.prototype.buildMessageFromSerializedData=function(t){return this._manager.buildMessageFromSerializedData(t)},n.prototype.buildSenderFromSerializedData=function(t){return this._manager.buildSenderFromSerializedData(t)},n.prototype.getMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return r=M(M({},fk),t),Q(function(a){return k("string",a.channelUrl)&&Ve(et,a.channelType)&&k("number",a.messageId)&&k("boolean",a.includeReactions,!0)&&k("boolean",a.includeMetaArray,!0)&&k("boolean",a.includeParentMessageInfo,!0)&&k("boolean",a.includeThreadInfo,!0)}(r)).throw(L.invalidParameters),[4,this._manager.getMessage(r)];case 1:if((i=s.sent())instanceof vr||i instanceof al||i===null)return[2,i];throw"Unknown message type is given."}})})},n.prototype.getScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},Ek),t),Q(function(s){return k("string",s.channelUrl)&&s.channelUrl!==""&&k("number",s.scheduledMessageId)&&s.scheduledMessageId>0}(r)).throw(L.invalidParameters),[2,this._manager.getScheduledMessage(r)]})})},n.prototype.getMessageTemplatesByToken=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){return i=M(M({},bk),r),Q(k("string",t,!0)&&function(a){return k("boolean",a.reverse,!0)&&k("number",a.limit,!0)&&Qe("string",a.keys,!0)}(i)).throw(L.invalidParameters),[2,this._manager.getMessageTemplatesByToken(t,i)]})})},n.prototype.getMessageTemplate=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(k("string",t)).throw(L.invalidParameters),[2,this._manager.getMessageTemplate(t)]})})},n}(w2),Bt,td,Ov;(function(e){e.LATEST_LAST_MESSAGE="latest_last_message",e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"})(Bt||(Bt={})),function(e){e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"}(td||(td={})),function(e){e.CREATED_AT="created_at",e.SCHEDULED_AT="scheduled_at"}(Ov||(Ov={}));var Rd,Tf=function(e){switch(e){case Bt.LATEST_LAST_MESSAGE:return["-lastMessageUpdatedAt","-createdAt","syncIndex"];case Bt.CHRONOLOGICAL:return["-createdAt","syncIndex"];case Bt.CHANNEL_NAME_ALPHABETICAL:return["name"];default:return["-lastMessageUpdatedAt","-createdAt","syncIndex"]}},yT=function(e){function n(t){var r=t.message,i=e.call(this)||this;return i.message=r,i}return w(n,e),n}(At),GE={},Sc=function(){function e(n,t){var r=t.localCacheEnabled,i=t.enableAutoResend,s=t.dispatcher,a=t.sdkState,o=t.logger,l=this;this._iid=n,GE[n]=this,this._localCacheEnabled=r,this._enableAutoResend=i,this._isProcessingAutoResend=!1,this._autoResendQueue=[],this._dispatcher=s,this._logger=o,this._sdkState=a,this._localCacheEnabled&&s.on(function(u){if(u instanceof Ii)switch(u.stateType){case lt.CONNECTED:l._isProcessingAutoResend||l.processAutoResendRegisteredPendingMessages().then(function(){return l._processNextAutoResend()});break;case lt.INTERNAL_DISCONNECTED:case lt.EXTERNAL_DISCONNECTED:l._isProcessingAutoResend=!1}})}return e.of=function(n){return GE[n]},e.prototype.processNonAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return this._enableAutoResend?[4,this._fetchAllCachedPendingMessages()]:[2];case 1:n=o.sent();try{for(t=ge(n),r=t.next();!r.done;r=t.next())(i=r.value).errorCode===0&&(this._logger.debug("cached pending message is not auto-resend registered. changing its sending status to failed: ",i.reqId),i.sendingStatus=ht.FAILED,i.errorCode=Ae.ACK_TIMEOUT,this._dispatcher.dispatch(new wt({messages:[i],source:z.LOCAL_MESSAGE_FAILED})))}catch(l){s={error:l}}finally{try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(s)throw s.error}}return[2]}})})},e.prototype.processAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:n=u.sent();try{for(t=ge(n),r=t.next();!r.done;r=t.next())i=r.value,this._enableAutoResend&&i.errorCode&&s0(i.errorCode)&&(s=new Date().getTime(),a=i.createdAt+2592e5,this._enableAutoResend&&s<=a?this._autoResendQueue.map(function(c){return c.reqId}).indexOf(i.reqId)<0&&this._autoResendQueue.push(i):(this._logger.debug("auto-resend registered pending messaged expired. expiration date: ",new Date(a).toLocaleString()),i.sendingStatus=ht.FAILED,this._dispatcher.dispatch(new wt({messages:[i],source:z.LOCAL_MESSAGE_FAILED}))))}catch(c){o={error:c}}finally{try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(o)throw o.error}}return[2]}})})},e.prototype.completeCurrentAndProcessNextAutoResend=function(n){if(this._localCacheEnabled&&this._enableAutoResend&&(n.sendingStatus===ht.SUCCEEDED||n.sendingStatus===ht.FAILED&&!s0(n.errorCode))){var t=this.indexOf(n);t>=0&&this._autoResendQueue.splice(t,1),t===0&&this._processNextAutoResend()}},e.prototype._fetchAllCachedPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t;return g(this,function(r){switch(r.label){case 0:return n=ll.of(this._iid),(t=new Us).replyType=Bn.ALL,[4,n.fetch({sendingStatus:ht.PENDING,backward:!0,filter:t})];case 1:return[2,r.sent()]}})})},e.prototype.indexOf=function(n){return this._autoResendQueue.length>0?this._autoResendQueue.map(function(t){return t.reqId}).indexOf(n.reqId):-1},e.prototype._isNotInQueue=function(n){return this._autoResendQueue.map(function(t){return t.reqId}).indexOf(n.reqId)===-1},e.prototype._processNextAutoResend=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){if(this._localCacheEnabled&&this._enableAutoResend&&this._sdkState.appState==="foreground")try{this._autoResendQueue.length>0?(this._isProcessingAutoResend||(this._logger.debug("auto-resend queue started."),this._isProcessingAutoResend=!0),n=this._autoResendQueue[0],this._dispatcher.dispatch(new yT({message:n})),this._logger.debug("processing auto-resend for message request id: ",n.reqId)):(this._logger.debug("auto-resend queue finished."),this._isProcessingAutoResend=!1)}catch(r){this._logger.warn("process auto-resend error: ",r),this._isProcessingAutoResend=!1}return[2]})})},e}();(function(e){e[e.USER_BLOCK=20001]="USER_BLOCK",e[e.USER_UNBLOCK=2e4]="USER_UNBLOCK",e[e.FRIEND_DISCOVERED=20900]="FRIEND_DISCOVERED"})(Rd||(Rd={}));var E0=function(){function e(n){this.category=n.cat,this.data=n.data}return e.getDataAsUserBlockEvent=function(n,t){var r=t.data,i=r.blocker,s=r.blockee;return{blocker:new Ze(n,i),blockee:new Ze(n,s)}},e.getDataAsFriendDiscoveredEvent=function(n,t){var r=t.data.friend_discoveries;return{friendDiscoveries:Array.isArray(r)?r.map(function(i){return new Ze(n,i)}):[]}},e}(),ET=function(e){function n(t,r){var i=r.userId,s=e.call(this)||this;return s._iid=t,s.userId=i,s}return w(n,e),n}(At),bT=function(e){function n(){return e.call(this)||this}return w(n,e),n}(At),CT=function(e){function n(t,r,i){var s=e.call(this,t,"USEV",i)||this;return s.event=new E0(i),s}return w(n,e),n}(Et),Sk=function(e,n){this.pollId=0,this.messageId=0,this.pollId=n.poll.id,this.messageId=n.poll.message_id,this._iid=e,this._payload=n},tn;(function(e){e[e.NONE=0]="NONE",e[e.CHANNEL_ENTER=10102]="CHANNEL_ENTER",e[e.CHANNEL_EXIT=10103]="CHANNEL_EXIT",e[e.USER_CHANNEL_MUTE=10201]="USER_CHANNEL_MUTE",e[e.USER_CHANNEL_UNMUTE=10200]="USER_CHANNEL_UNMUTE",e[e.USER_CHANNEL_BAN=10601]="USER_CHANNEL_BAN",e[e.USER_CHANNEL_UNBAN=10600]="USER_CHANNEL_UNBAN",e[e.CHANNEL_FREEZE=10701]="CHANNEL_FREEZE",e[e.CHANNEL_UNFREEZE=10700]="CHANNEL_UNFREEZE",e[e.TYPING_START=10900]="TYPING_START",e[e.TYPING_END=10901]="TYPING_END",e[e.CHANNEL_JOIN=1e4]="CHANNEL_JOIN",e[e.CHANNEL_LEAVE=10001]="CHANNEL_LEAVE",e[e.CHANNEL_OPERATOR_UPDATE=10002]="CHANNEL_OPERATOR_UPDATE",e[e.CHANNEL_INVITE=10020]="CHANNEL_INVITE",e[e.CHANNEL_ACCEPT_INVITE=10021]="CHANNEL_ACCEPT_INVITE",e[e.CHANNEL_DECLINE_INVITE=10022]="CHANNEL_DECLINE_INVITE",e[e.CHANNEL_PROP_CHANGED=11e3]="CHANNEL_PROP_CHANGED",e[e.CHANNEL_DELETED=12e3]="CHANNEL_DELETED",e[e.CHANNEL_META_DATA_CHANGED=11100]="CHANNEL_META_DATA_CHANGED",e[e.CHANNEL_META_COUNTERS_CHANGED=11200]="CHANNEL_META_COUNTERS_CHANGED",e[e.CHANNEL_HIDE=13e3]="CHANNEL_HIDE",e[e.CHANNEL_UNHIDE=13001]="CHANNEL_UNHIDE",e[e.PINNED_MESSAGE_CHANGED=11300]="PINNED_MESSAGE_CHANGED"})(tn||(tn={}));var wk=function(){function e(n){var t;this.channelUrl=n.channel_url,this.channelType=n.channel_type,this.category=n.cat,this.data=(t=n.data)!==null&&t!==void 0?t:{},this.ts=n.ts}return Object.defineProperty(e.prototype,"isGroupChannelEvent",{get:function(){return this.channelType===et.GROUP},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpenChannelEvent",{get:function(){return this.channelType===et.OPEN},enumerable:!1,configurable:!0}),e}(),$u=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.event=new wk(i),s}return w(n,e),n}(Et),Tk=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,a=i.data.operators,o=a===void 0?[]:a;return s.operators=o.map(function(l){return new Ze(s._iid,l)}),s}return w(n,e),n}($u),Nk=function(e){function n(t,r){var i=e.call(this,t)||this;return i._logger=r.logger,i._sdkState=r.sdkState,i._sessionManager=r.sessionManager,i._requestQueue=r.requestQueue,i._dispatcher=r.dispatcher,i._cacheContext=r.cacheContext,i._channelType=r.channelType,i}return w(n,e),Object.defineProperty(n.prototype,"_messageBroadcast",{get:function(){return vT.of(this._iid)},enumerable:!1,configurable:!0}),n.prototype.subscribeMessageEvent=function(t,r){this._messageBroadcast.subscribe(t,r)},n.prototype.unsubscribeMessageEvent=function(t){this._messageBroadcast.unsubscribe(t)},n.prototype.getMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2,null]})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return g(this,function(s){return[2,[]]})})},n.prototype.getMessagesFromCache=function(t,r,i,s,a,o){return y(this,void 0,void 0,function(){return g(this,function(l){return[2,[]]})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(a){return[2,[]]})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(a){return[2,0]})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,[]]})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},n}(Jn),Ik=function(e){function n(t,r,i){var s,a,o,l,u=this;(u=e.call(this,t,"ADMM",i)||this).message=new Lu(t,i);var c=R.of(t).sdkState;return u.isMentioned=Au(u.message.mentionType,(o=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(a=u.message.mentionedUsers)===null||a===void 0?void 0:a.map(function(d){return d.userId}))!==null&&o!==void 0?o:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return w(n,e),n}(Et),Ak=function(e){function n(t,r,i){var s,a,o,l,u,c=this;(c=e.call(this,t,"AEDI",i)||this).message=new Lu(t,i);var d=R.of(t).sdkState;return c.mentionCountChange=m2({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(o=(a=i.old_values)===null||a===void 0?void 0:a.mentioned_user_ids)!==null&&o!==void 0?o:[]},Ie({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return w(n,e),n}(Et),Mk=function(e){function n(t,r,i){var s=e.call(this,t,"MRCT",i)||this;return s.channelUrl=i.channel_url,s.channelType=i.channel_type,s.event=new I2(i),s}return w(n,e),n}(Et),xk=function(e){function n(t,r,i){var s=e.call(this,t,"MTHD",i)||this;return s.event=new gT(t,i),s}return w(n,e),n}(Et),Ok=function(e){function n(t,r,i){var s=e.call(this,t,"MCNT",i)||this;return s.groupChannelMemberCounts=i.group_channels.map(function(a){return{channelUrl:a.channel_url,memberCount:a.member_count,joinedMemberCount:a.joined_member_count,updatedAt:a.ts}}),s.openChannelMemberCounts=i.open_channels.map(function(a){return{channelUrl:a.channel_url,participantCount:a.participant_count,updatedAt:a.ts}}),s}return w(n,e),n}(Et),Rk=function(e){function n(t,r,i){var s=e.call(this,t,"PEDI",i)||this;return s.event=new Sk(t,i),s.status=yv(i.poll.status)||i.poll.status,s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return w(n,e),n}(Et),qt;(function(e){e.NONE="none",e.JOINED="joined",e.INVITED="invited",e.LEFT="left"})(qt||(qt={}));var Ds,Gr,qr,Xa,ss,b0,na,kd,mi=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.state=null,i.role=null,i.isMuted=!1,i.isBlockedByMe=!1,i.isBlockingMe=!1,i.state=Ve(qt,r.state)?r.state:null,i.role=Ve(Bi,r.role)?r.role:null,typeof r.is_muted=="boolean"&&(i.isMuted=r.is_muted),typeof r.is_blocked_by_me=="boolean"&&(i.isBlockedByMe=r.is_blocked_by_me),typeof r.is_blocking_me=="boolean"&&(i.isBlockingMe=r.is_blocking_me),i}return w(n,e),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{state:t.state,role:t.role,is_muted:t.isMuted,is_blocked_by_me:t.isBlockedByMe,is_blocking_me:t.isBlockingMe})))},n}(ml),kk=function(e){function n(t,r){var i,s,a=this;return(a=e.call(this,t)||this).channelUrl=(i=r.channel_url)!==null&&i!==void 0?i:"",a.channelType=(s=r.channel_type)!==null&&s!==void 0?s:et.GROUP,a.member=new Ze(a._iid,r.user),a.deliveryAt=r.ts,a}return w(n,e),n}(Jn);(function(e){e.ALL="all",e.PUBLIC="public",e.PRIVATE="private"})(Ds||(Ds={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(Gr||(Gr={})),function(e){e.ALL="all",e.SUPER="super",e.NON_SUPER="nonsuper",e.BROADCAST_ONLY="broadcast_only",e.EXCLUSIVE_ONLY="exclusive_only"}(qr||(qr={})),function(e){e.ALL="all",e.UNREAD_MESSAGE="unread_message"}(Xa||(Xa={})),function(e){e.ALL="all",e.UNHIDDEN="unhidden_only",e.HIDDEN="hidden_only",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(ss||(ss={})),function(e){e.ALL="all",e.OPERATOR="operator",e.NONOPERATOR="nonoperator"}(b0||(b0={})),function(e){e.AND="AND",e.OR="OR"}(na||(na={})),function(e){e.MEMBER_NICKNAME="member_nickname",e.CHANNEL_NAME="channel_name"}(kd||(kd={}));var xn,ST=function(){function e(n){var t,r,i,s,a,o,l,u,c,d,h,f,p,m;this._searchFilter=null,this._userIdsFilter=null,this.includeEmpty=(t=n==null?void 0:n.includeEmpty)!==null&&t!==void 0&&t,this.nicknameContainsFilter=(r=n==null?void 0:n.nicknameContainsFilter)!==null&&r!==void 0?r:null,this.nicknameStartsWithFilter=(i=n==null?void 0:n.nicknameStartsWithFilter)!==null&&i!==void 0?i:null,this.nicknameExactMatchFilter=(s=n==null?void 0:n.nicknameExactMatchFilter)!==null&&s!==void 0?s:null,this.channelNameContainsFilter=(a=n==null?void 0:n.channelNameContainsFilter)!==null&&a!==void 0?a:"",this.myMemberStateFilter=(o=n==null?void 0:n.myMemberStateFilter)!==null&&o!==void 0?o:Gr.ALL,this.customTypesFilter=(l=n==null?void 0:n.customTypesFilter)!==null&&l!==void 0?l:null,this.channelUrlsFilter=(u=n==null?void 0:n.channelUrlsFilter)!==null&&u!==void 0?u:null,this.superChannelFilter=(c=n==null?void 0:n.superChannelFilter)!==null&&c!==void 0?c:qr.ALL,this.publicChannelFilter=(d=n==null?void 0:n.publicChannelFilter)!==null&&d!==void 0?d:Ds.ALL,this.customTypeStartsWithFilter=(h=n==null?void 0:n.customTypeStartsWithFilter)!==null&&h!==void 0?h:null,this.unreadChannelFilter=(f=n==null?void 0:n.unreadChannelFilter)!==null&&f!==void 0?f:Xa.ALL,this.hiddenChannelFilter=(p=n==null?void 0:n.hiddenChannelFilter)!==null&&p!==void 0?p:ss.UNHIDDEN,this.includeFrozen=(m=n==null?void 0:n.includeFrozen)===null||m===void 0||m,n!=null&&n.createdAfter&&(this.createdAfter=n.createdAfter),n!=null&&n.createdBefore&&(this.createdBefore=n.createdBefore)}return e.prototype._isFriend=function(n){return!(!n||!n.friendDiscoveryKey&&!n.friendName)},Object.defineProperty(e.prototype,"searchFilter",{get:function(){return this._searchFilter},enumerable:!1,configurable:!0}),e.prototype.setSearchFilter=function(n,t){Array.isArray(n)&&n.length!==0&&typeof t=="string"&&t&&(this._searchFilter={query:t,fields:n})},Object.defineProperty(e.prototype,"userIdsFilter",{get:function(){return this._userIdsFilter},enumerable:!1,configurable:!0}),e.prototype.setUserIdsFilter=function(n,t,r){r===void 0&&(r=na.AND),this._userIdsFilter={userIds:n,includeMode:t,queryType:r}},e.prototype.clone=function(){var n,t=new e;this.searchFilter&&t.setSearchFilter(this.searchFilter.fields,(n=this.searchFilter.query)!==null&&n!==void 0?n:void 0),this.userIdsFilter&&t.setUserIdsFilter(this.userIdsFilter.userIds,this.userIdsFilter.includeMode,this.userIdsFilter.queryType);var r=JSON.parse(JSON.stringify(this));return Object.keys(r).forEach(function(i){t[i]=r[i]}),t},e.prototype.match=function(n,t){if(this._searchFilter){var r=this._searchFilter,i=r.query,s=r.fields;if(i&&s&&s.length>0&&!s.some(function(p){switch(p){case kd.CHANNEL_NAME:return n.name.toLowerCase().includes(i.toLowerCase());case kd.MEMBER_NICKNAME:return n.members.some(function(m){return m.nickname.toLowerCase().includes(i.toLowerCase())});default:return!0}}))return!1}if(this._userIdsFilter){var a=this._userIdsFilter,o=a.userIds,l=a.includeMode,u=a.queryType,c=n.members.map(function(p){return p.userId});if(l){if(o.length>0)switch(u){case na.AND:if(o.some(function(p){return!c.includes(p)}))return!1;break;case na.OR:if(o.every(function(p){return!c.includes(p)}))return!1}}else if(o.includes(t)||o.push(t),n.members.length>o.length||!V6(o,c))return!1}if(!this.includeEmpty&&!n.lastMessage||!this.includeFrozen&&n.isFrozen||this.customTypesFilter&&this.customTypesFilter.length>0&&!this.customTypesFilter.includes("*")&&!this.customTypesFilter.includes(n.customType)||this.customTypeStartsWithFilter&&!new RegExp("^".concat(this.customTypeStartsWithFilter)).test(n.customType)||this.channelNameContainsFilter&&!n.name.toLowerCase().includes(this.channelNameContainsFilter.toLowerCase()))return!1;if(this.nicknameContainsFilter){var d=this.nicknameContainsFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase().includes(d)}))return!1}if(this.nicknameStartsWithFilter){var h=this.nicknameStartsWithFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase().startsWith(h)}))return!1}if(this.nicknameExactMatchFilter){var f=this.nicknameExactMatchFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase()!=f}))return!1}if(this.channelUrlsFilter&&this.channelUrlsFilter.length>0&&!this.channelUrlsFilter.includes(n.url))return!1;if(this.myMemberStateFilter)switch(this.myMemberStateFilter){case Gr.ALL:if(n.myMemberState==="none")return!1;break;case Gr.JOINED:if(n.myMemberState!=="joined")return!1;break;case Gr.INVITED:if(n.myMemberState!=="invited")return!1;break;case Gr.INVITED_BY_FRIEND:if(n.myMemberState!=="invited"||!this._isFriend(n.inviter))return!1;break;case Gr.INVITED_BY_NON_FRIEND:if(n.myMemberState!=="invited"||this._isFriend(n.inviter))return!1}if(this.hiddenChannelFilter)switch(this.hiddenChannelFilter){case ss.UNHIDDEN:if(n.isHidden||n.hiddenState!=="unhidden")return!1;break;case ss.HIDDEN:if(!n.isHidden)return!1;break;case ss.HIDDEN_ALLOW_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_allow_auto_unhide")return!1;break;case ss.HIDDEN_PREVENT_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_prevent_auto_unhide")return!1}if(this.unreadChannelFilter&&this.unreadChannelFilter===Xa.UNREAD_MESSAGE&&n.unreadMessageCount===0)return!1;if(this.publicChannelFilter)switch(this.publicChannelFilter){case Ds.PUBLIC:if(!n.isPublic)return!1;break;case Ds.PRIVATE:if(n.isPublic)return!1}if(this.superChannelFilter)switch(this.superChannelFilter){case qr.SUPER:if(!n.isSuper)return!1;break;case qr.NON_SUPER:if(n.isSuper)return!1}return!(this.createdAfter&&n.createdAtthis.createdBefore)},e}(),Lk=function(e){function n(t,r){var i=r.sdkState,s=r.cacheContext,a=e.call(this,t)||this;return a._channels=new Map,a._sdkState=i,a._cacheContext=s,a}return w(n,e),Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return Q(!!t).throw(L.databaseError),t.collection(hT)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t,r){return r===void 0&&(r=0),M(M({},t.serialize()),{lastMessageUpdatedAt:t.lastMessage?t.lastMessage.createdAt:0,syncIndex:r})},n.prototype._deserialize=function(t){return Rn.of(this._iid).buildGroupChannelFromSerializedData(t)},Object.defineProperty(n.prototype,"channels",{get:function(){return Fe([],Me(this._channels.values()),!1)},enumerable:!1,configurable:!0}),n.prototype.isCachedInMemory=function(t){return this._channels.has(t)},n.prototype.filterOffsetChanged=function(t){var r=this;return t.filter(function(i){if(r._channels.has(i.url))return r._channels.get(i.url).messageOffsetTimestamp0||h&&h===E.url)return!1;break;case Bt.CHRONOLOGICAL:if(!o&&E.createdAt>r||o&&E.createdAtr||o&&E.lastMessageUpdatedAtu._messageCollectionLastAccessedAt&&Object.assign(u,{_messageCollectionLastAccessedAt:void 0}),u.cachedMetaData&&r&&(c._updateCachedMetaData(u.cachedMetaData,r),Object.assign(u,{_cachedMetaData:void 0})),c._update(u),i.push(c)}else o._channels.set(u.url,u),i.push(u)}),!this.localCacheEnabled)return[3,2];for(s=[],a=0;a0?[4,this.upsert(s)]:[3,2];case 1:x.sent(),x.label=2;case 2:return[2]}})})},n.prototype.block=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._setBlockStateOfAllChannels(t,r,!0)];case 1:return i.sent(),[2]}})})},n.prototype.unblock=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._setBlockStateOfAllChannels(t,r,!1)];case 1:return i.sent(),[2]}})})},n.prototype.markAsRead=function(t,r){return r===void 0&&(r=Fe([],Me(this._channels.keys()),!1)),y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:i=[],h.label=1;case 1:h.trys.push([1,6,7,8]),s=ge(r),a=s.next(),h.label=2;case 2:return a.done?[3,5]:(o=a.value,[4,this.get(o)]);case 3:(l=h.sent())!=null&&l._updateUnreadMemberState(this._sdkState.userId,t)&&(l._updateUnreadCount(0,0),i.push(l)),h.label=4;case 4:return a=s.next(),[3,2];case 5:return[3,8];case 6:return u=h.sent(),c={error:u},[3,8];case 7:try{a&&!a.done&&(d=s.return)&&d.call(s)}finally{if(c)throw c.error}return[7];case 8:return i.length>0?[4,this.upsert(i)]:[3,10];case 9:h.sent(),h.label=10;case 10:return[2]}})})},n}(Jn),Nf={invitedUserIds:void 0,channelUrl:void 0,coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isSuper:void 0,isBroadcast:void 0,isExclusive:void 0,isPublic:void 0,isDiscoverable:void 0,isStrict:void 0,isEphemeral:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},Rv=function(e){return Qe("string",e.invitedUserIds,!0)&&k("string",e.channelUrl,!0)&&k("string",e.coverUrl,!0)&&(Er(e.coverImage)||k("string",e.coverImage,!0))&&k("boolean",e.isDistinct,!0)&&k("boolean",e.isSuper,!0)&&k("boolean",e.isBroadcast,!0)&&k("boolean",e.isExclusive,!0)&&k("boolean",e.isPublic,!0)&&k("boolean",e.isStrict,!0)&&k("boolean",e.isDiscoverable,!0)&&k("boolean",e.isEphemeral,!0)&&k("string",e.accessCode,!0)&&k("string",e.name,!0)&&k("string",e.data,!0)&&k("string",e.customType,!0)&&Qe("string",e.operatorUserIds,!0)&&k("number",e.messageSurvivalSeconds,!0)},C0={customTypes:void 0,includeEmpty:!1,includeFrozen:!0,includeChatNotification:!1},kv=function(e){return Qe("string",e.customTypes,!0)&&k("boolean",e.includeEmpty)&&k("boolean",e.includeFrozen)&&k("boolean",e.includeChatNotification)},wT={myMemberStateFilter:Gr.ALL},TT=function(e){return Ve(Gr,e.myMemberStateFilter)};(function(e){e.GROUP_CHANNEL_UNREAD_MENTION_COUNT="group_channel_unread_mention_count",e.NONSUPER_UNREAD_MENTION_COUNT="non_super_group_channel_unread_mention_count",e.SUPER_UNREAD_MENTION_COUNT="super_group_channel_unread_mention_count",e.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT="group_channel_unread_message_count",e.NONSUPER_UNREAD_MESSAGE_COUNT="non_super_group_channel_unread_message_count",e.SUPER_UNREAD_MESSAGE_COUNT="super_group_channel_unread_message_count",e.GROUP_CHANNEL_INVITATION_COUNT="group_channel_invitation_count",e.NONSUPER_INVITATION_COUNT="non_super_group_channel_invitation_count",e.SUPER_INVITATION_COUNT="super_group_channel_invitation_count"})(xn||(xn={}));var Dk={keys:[]},Uk={channelCustomTypesFilter:void 0,superChannelFilter:qr.ALL},Pk=function(e){return Qe("string",e.channelCustomTypesFilter,!0)&&Ve(qr,e.superChannelFilter)},Fk={channelUrl:void 0,scheduledStatus:void 0,messageTypeFilter:ar.ALL};M({},z);var If=function(e){return e.startsWith("EVENT_")||e===z.SYNC_CHANNEL_CHANGELOGS||e===z.REFRESH_CHANNEL},We=function(e){function n(t){var r=t.channels,i=t.context,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=t.ts,l=e.call(this)||this;return l.channels=r,l.context=i,l.isWebSocketEventComing=a,l.ts=o,l}return w(n,e),n}(At),$s=function(e){function n(t){var r=t.channelUrls,i=t.context,s=t.isWebSocketEventComing,a=s!==void 0&&s,o=e.call(this)||this;return o.channelUrls=r,o.context=i,o.isWebSocketEventComing=a,o}return w(n,e),n}(At),Hk=function(){function e(n){var t=n.groupChannelCache,r=n.messageCache,i=n.unsentMessageCache,s=n.dispatcher,a=this;this._observers=new Map,s.on(function(o){return y(a,void 0,void 0,function(){var l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x,A,O=this;return g(this,function(U){switch(U.label){case 0:if(!(o instanceof We))return[3,19];if(l=o.channels,S=o.context,T=o.isWebSocketEventComing,u=l.filter(function(W){return W instanceof Si}),S.source!==z.EVENT_CHANNEL_RESET_HISTORY&&S.source!==z.EVENT_CHANNEL_HIDDEN)return[3,9];U.label=1;case 1:U.trys.push([1,6,7,8]),c=ge(u),d=c.next(),U.label=2;case 2:return d.done?[3,5]:(b=d.value,[4,r.removeUnderOffset(b.url,b.messageOffsetTimestamp)]);case 3:U.sent(),U.label=4;case 4:return d=c.next(),[3,2];case 5:return[3,8];case 6:return h=U.sent(),N={error:h},[3,8];case 7:try{d&&!d.done&&(I=c.return)&&I.call(c)}finally{if(N)throw N.error}return[7];case 8:return[3,17];case 9:f=t.filterOffsetChanged(u),U.label=10;case 10:U.trys.push([10,15,16,17]),p=ge(f),m=p.next(),U.label=11;case 11:return m.done?[3,14]:(b=m.value,[4,r.removeUnderOffset(b.url,b.messageOffsetTimestamp)]);case 12:U.sent(),U.label=13;case 13:return m=p.next(),[3,11];case 14:return[3,17];case 15:return v=U.sent(),x={error:v},[3,17];case 16:try{m&&!m.done&&(A=p.return)&&A.call(p)}finally{if(x)throw x.error}return[7];case 17:return[4,t.upsert(u,o.ts)];case 18:return _=U.sent(),T||this._broadcastUpdateEvent(_,S),[3,24];case 19:return o instanceof $s?(E=o.channelUrls,S=o.context,T=o.isWebSocketEventComing,[4,t.remove(E)]):[3,22];case 20:return U.sent(),[4,Lt(function(){return y(O,void 0,void 0,function(){var W,P,J,V,H,we;return g(this,function(q){switch(q.label){case 0:q.trys.push([0,6,7,8]),W=ge(E),P=W.next(),q.label=1;case 1:return P.done?[3,5]:(J=P.value,[4,r.removeMessagesOfChannel(J)]);case 2:return q.sent(),[4,i.removeMessagesOfChannel(J)];case 3:q.sent(),q.label=4;case 4:return P=W.next(),[3,1];case 5:return[3,8];case 6:return V=q.sent(),H={error:V},[3,8];case 7:try{P&&!P.done&&(we=W.return)&&we.call(W)}finally{if(H)throw H.error}return[7];case 8:return[2]}})})})];case 21:return U.sent(),T||this._broadcastRemoveEvent(E,S),[3,24];case 22:return o instanceof ET?[4,t.fetch({token:Number.MAX_SAFE_INTEGER,limit:Number.MAX_SAFE_INTEGER})]:[3,24];case 23:U.sent(),U.label=24;case 24:return[2]}})})})}return e.prototype._broadcastUpdateEvent=function(n,t){var r,i;try{for(var s=ge(this._observers.values()),a=s.next();!a.done;a=s.next()){var o=a.value;o.onUpdate&&o.onUpdate(n,t)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype._broadcastRemoveEvent=function(n,t){var r,i;try{for(var s=ge(this._observers.values()),a=s.next();!a.done;a=s.next()){var o=a.value;o.onRemove&&o.onRemove(n,t)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype.subscribe=function(n,t){this._observers.set(n,t)},e.prototype.unsubscribe=function(n){this._observers.delete(n)},e.prototype.unsubscribeAll=function(){this._observers.clear()},e}(),jk=function(e){function n(t){var r=t.userId,i=t.ts,s=t.token,a=t.filter,o=t.includeChatNotification,l=o!==void 0&&o,u=e.call(this)||this,c=M(M({},C0),a),d=c.customTypes,h=c.includeEmpty,f=c.includeFrozen;return u.method=Y.GET,u.path="".concat(tt,"/").concat(encodeURIComponent(r),"/my_group_channels/changelogs"),u.params=be(Ie({show_delivery_receipt:!0,show_member:!0,show_read_receipt:!0,change_ts:i||null,token:s,custom_types:d,show_empty:h,show_frozen:f,include_chat_notification:l})),u}return w(n,e),n}(Z),Bk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedChannels=r.updated.map(function(s){return new Si(t,Object.assign(s,{ts:r.ts}))}),i.deletedChannelUrls=r.deleted,i.hasMore=r.has_more,i.token=r.next,i.ts=r.ts,i}return w(n,e),n}(le),Lv=function(e){function n(t){var r=t.channelUrl,i=t.isInternalCall,s=e.call(this)||this;return s.method=Y.GET,s.path="".concat(i?Z6:cr,"/").concat(encodeURIComponent(r)),s.params={show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0},s}return w(n,e),n}(Z),Dv=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i}return w(n,e),n}(le),Il={includeEmpty:!1,includeFrozen:!0,includeMetaData:!0,includeChatNotification:!1,channelUrlsFilter:void 0,customTypesFilter:void 0,customTypeStartsWithFilter:void 0,nicknameContainsFilter:void 0,nicknameStartsWithFilter:void 0,nicknameExactMatchFilter:void 0,channelNameContainsFilter:void 0,myMemberStateFilter:Gr.ALL,unreadChannelFilter:Xa.ALL,superChannelFilter:qr.ALL,publicChannelFilter:Ds.ALL,hiddenChannelFilter:ss.ALL,userIdsFilter:{userIds:[],includeMode:!0,queryType:na.AND},searchFilter:{query:void 0,fields:[]},metadataKey:void 0,metadataValues:void 0,metadataOrderKeyFilter:void 0,metadataValueStartsWith:void 0,order:Bt.LATEST_LAST_MESSAGE,createdAfter:void 0,createdBefore:void 0},$k=function(e){function n(t){var r=this,i=t.userId,s=t.token,a=t.limit,o=t.order,l=t.includeEmpty,u=t.myMemberStateFilter,c=t.superChannelFilter,d=t.publicChannelFilter,h=t.unreadChannelFilter,f=t.nicknameContainsFilter,p=t.nicknameStartsWithFilter,m=t.nicknameExactMatchFilter,b=t.channelNameContainsFilter,v=t.channelUrlsFilter,_=t.customTypesFilter,E=t.customTypeStartsWithFilter,S=t.hiddenChannelFilter,T=t.metadataOrderKeyFilter,N=t.metadataKey,I=t.metadataValues,x=t.metadataValueStartsWith,A=t.includeFrozen,O=t.includeMetaData,U=t.searchFilter,W=t.userIdsFilter,P=t.includeChatNotification,J=P!==void 0&&P,V=t.includeLeftChannel,H=V!==void 0&&V,we=t.createdAfter,q=t.createdBefore;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(tt,"/").concat(encodeURIComponent(i),"/my_group_channels"),r.params=be({token:s,limit:a,order:o??Il.order,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:l??Il.includeEmpty,member_state_filter:u??Il.myMemberStateFilter,super_mode:c??Il.superChannelFilter,public_mode:d??Il.publicChannelFilter,unread_filter:h??Il.unreadChannelFilter,members_nickname_contains:f,members_nickname_startswith:p,members_nickname:m,name_contains:b,channel_urls:v,custom_types:_,custom_type_startswith:E,hidden_mode:S,metadata_order_key:T,metadata_key:N,metadata_values:I,metadata_value_startswith:x,show_frozen:A,show_metadata:O,include_chat_notification:J,include_left_channel:H,created_after:we,created_before:q}),U&&U.query&&U.fields&&(r.params.search_query=U.query,r.params.search_fields=U.fields),W&&W.userIds&&W.userIds.length>0&&(W.includeMode?(r.params.members_include_in=W.userIds,r.params.query_type=W.queryType.toUpperCase()):r.params.members_exactly_in=W.userIds),r}return w(n,e),n}(Z),Gk=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.channels=[];var s=r.next,a=r.channels,o=r.ts;return i.token=s,a&&a.length>0&&(i.channels=a.map(function(l){return l.ts=o,new Si(t,l)})),i.ts=o??0,i}return w(n,e),n}(le),zk=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,a=i.myMemberStateFilter;return s.method=Y.GET,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/group_channel_count"),s.params={state:a??Gr.ALL},s}return w(n,e),n}(Z),Vk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.groupChannelCount=r.group_channel_count,i}return w(n,e),n}(le),qk=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,a=i.keys;return s.method=Y.GET,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/unread_item_count"),s.params=be({item_keys:a}),s}return w(n,e),n}(Z),Wk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return typeof r[xn.GROUP_CHANNEL_UNREAD_MENTION_COUNT]=="number"&&(i.groupChannelUnreadMentionCount=r[xn.GROUP_CHANNEL_UNREAD_MENTION_COUNT]),typeof r[xn.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]=="number"&&(i.groupChannelUnreadMessageCount=r[xn.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]),typeof r[xn.GROUP_CHANNEL_INVITATION_COUNT]=="number"&&(i.groupChannelInvitationCount=r[xn.GROUP_CHANNEL_INVITATION_COUNT]),typeof r[xn.SUPER_UNREAD_MENTION_COUNT]=="number"&&(i.superGroupChannelUnreadMentionCount=r[xn.SUPER_UNREAD_MENTION_COUNT]),typeof r[xn.SUPER_UNREAD_MESSAGE_COUNT]=="number"&&(i.superGroupChannelUnreadMessageCount=r[xn.SUPER_UNREAD_MESSAGE_COUNT]),typeof r[xn.SUPER_INVITATION_COUNT]=="number"&&(i.superGroupChannelInvitationCount=r[xn.SUPER_INVITATION_COUNT]),typeof r[xn.NONSUPER_UNREAD_MENTION_COUNT]=="number"&&(i.nonSuperGroupChannelUnreadMentionCount=r[xn.NONSUPER_UNREAD_MENTION_COUNT]),typeof r[xn.NONSUPER_UNREAD_MESSAGE_COUNT]=="number"&&(i.nonSuperGroupChannelUnreadMessageCount=r[xn.NONSUPER_UNREAD_MESSAGE_COUNT]),typeof r[xn.NONSUPER_INVITATION_COUNT]=="number"&&(i.nonSuperGroupChannelInvitationCount=r[xn.NONSUPER_INVITATION_COUNT]),i}return w(n,e),n}(le),Kk=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/unread_channel_count"),i}return w(n,e),n}(Z),Qk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.unreadCount=r.unread_count,i}return w(n,e),n}(le),Yk=function(e){function n(t){var r=t.userId,i=t.filter,s=t.includeFeedChannel,a=s!==void 0&&s,o=e.call(this)||this,l=i.channelCustomTypesFilter,u=i.superChannelFilter;return o.method=Y.GET,o.path="".concat(tt,"/").concat(encodeURIComponent(r),"/unread_message_count"),o.params={super_mode:u??qr.ALL,custom_types:l,include_feed_channel:a},o}return w(n,e),n}(Z),Zk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.unreadCount=r.unread_count,i.unreadFeedCount=r.unread_feed_count,i}return w(n,e),n}(le),Xk=function(e){function n(t){var r=t.channelUrl,i=t.scheduledStatus,s=t.messageTypeFilter,a=e.call(this)||this;return a.method=Y.GET,a.path="".concat(rw,"/count"),a.params={channel_url:r,status:eL(i)},s&&(a.params.message_type=s),a}return w(n,e),n}(Z),Jk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.count=r.count,i}return w(n,e),n}(le),eL=function(e){if(!e)return[];var n=[];return e.forEach(function(t){switch(t){case Ua.PENDING:n.push(_i.PENDING);break;case Ua.SENT:n.push(_i.IN_QUEUE),n.push(_i.SENT);break;case Ua.CANCELED:n.push(_i.CANCELED);break;case Ua.FAILED:n.push(_i.FAILED)}}),n},tL=function(e){function n(t){var r=this,i=t.userId,s=t.channelUrl,a=t.coverUrl,o=t.coverImage,l=t.isDistinct,u=t.isSuper,c=t.isBroadcast,d=t.isPublic,h=t.isExclusive,f=t.isDiscoverable,p=t.isStrict,m=t.isEphemeral,b=t.accessCode,v=t.name,_=t.data,E=t.customType,S=t.messageSurvivalSeconds,T=t.invitedUserIds,N=t.operatorUserIds;return(r=e.call(this)||this).method=Y.POST,r.path=cr,r.params=be({user_ids:Fe([i],Me(T??[]),!1).filter(function(I,x,A){return x===A.indexOf(I)}),channel_url:s,cover_url:a,cover_file:o,is_distinct:l,is_super:u,is_broadcast:c,is_exclusive:h,is_public:d,is_discoverable:f,strict:p,is_ephemeral:m,access_code:b,name:v,data:_,custom_type:E,operator_ids:N,message_survival_seconds:S}),r}return w(n,e),n}(Z),nL=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).channel=new Si(t,r),s.isCreated=(i=r.is_created)===null||i===void 0||i,s}return w(n,e),n}(le),zE=function(e){function n(t){var r=t.userId,i=t.channelUrls,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/mark_as_read_all"),s.params={channel_urls:i},s}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var rL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,a=t.accessCode;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/join"),r.params={user_id:s,access_code:a},r}return w(n,e),n}(Z),iL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i}return w(n,e),n}(le),sL=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,a=i.data,o=a.member_count,l=o===void 0?0:o,u=a.joined_member_count,c=u===void 0?0:u,d=a.users,h=d===void 0?null:d;return s.memberCount=l,s.joinedMemberCount=c,s.members=Array.isArray(h)?h.map(function(f){return new mi(t,f)}):[new mi(t,i.data)],s}return w(n,e),n}($u),aL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,a=t.shouldRemoveOperatorStatus;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/leave"),r.params={user_id:s,should_remove_operator_status:a},r}return w(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}w(n,e)})(le);var oL=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,a=i.data,o=a.member_count,l=o===void 0?0:o,u=a.joined_member_count,c=u===void 0?0:u;return s.memberCount=l,s.joinedMemberCount=c,s.member=new mi(s._iid,i.data),s}return w(n,e),n}($u),lL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userIds;return(r=e.call(this)||this).method=Y.POST,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/invite"),r.params={user_ids:s},r}return w(n,e),n}(Z),uL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i}return w(n,e),n}(le),cL=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this;s.inviter=null;var a=i.data,o=a.member_count,l=o===void 0?0:o,u=a.joined_member_count,c=u===void 0?0:u,d=a.inviter,h=a.invitees,f=h===void 0?[]:h;return s.memberCount=l,s.joinedMemberCount=c,d&&Object.keys(d).length>0&&(s.inviter=new Ze(t,d)),s.invitees=f.map(function(p){return new mi(t,p)}),s}return w(n,e),n}($u),dL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/decline"),r.params={user_id:s},r}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i.channel.myMemberState=qt.NONE,i}w(n,e)})(le);var hL=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,a=i.data,o=a.member_count,l=a.joined_member_count,u=a.inviter,c=a.invitee;return s.memberCount=o??0,s.joinedMemberCount=l??0,s.inviter=new Ze(t,u),s.invitee=new mi(t,c),s}return w(n,e),n}($u),Uv={hidePreviousMessages:!1,allowAutoUnhide:!0},fL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,a=t.hidePreviousMessages,o=t.allowAutoUnhide;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/hide"),r.params={user_id:s,hide_previous_messages:a??Uv.hidePreviousMessages,allow_auto_unhide:o??Uv.allowAutoUnhide},r}return w(n,e),n}(Z),pL=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts_message_offset;return i.messageOffsetTimestamp=s,i}return w(n,e),n}(le),_L=function(e){function n(t,r,i){var s,a,o,l=this;return(l=e.call(this,t,"SYEV",i)||this).allowAutoUnhide=null,l.hidePreviousMessages=null,l.messageOffsetTimestamp=null,i.data&&(l.allowAutoUnhide=(s=i.data.allow_auto_unhide)!==null&&s!==void 0?s:null,l.hidePreviousMessages=(a=i.data.hide_previous_messages)!==null&&a!==void 0?a:null),l.messageOffsetTimestamp=(o=i.ts_message_offset)!==null&&o!==void 0?o:null,l}return w(n,e),n}(Et),mL=function(e){function n(t){var r=t.channelUrl,i=t.time;return e.call(this,{code:"TPST",ackRequired:!1,payload:{channel_url:r,time:i}})||this}return w(n,e),n}(Rr),vL=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ze(t,i.data),s}return w(n,e),n}(Et),gL=function(e){function n(t){var r=t.channelUrl,i=t.time;return e.call(this,{code:"TPEN",ackRequired:!1,payload:{channel_url:r,time:i}})||this}return w(n,e),n}(Rr),yL=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ze(t,i.data),s}return w(n,e),n}(Et),EL=function(e){function n(t){var r=t.channelUrl,i=t.messageId;return e.call(this,{code:"MACK",ackRequired:!1,payload:{channel_url:r,msg_id:i}})||this}return w(n,e),n}(Rr),NT=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x,A,O,U=this;return(U=e.call(this,t,r)||this).includeEmpty=!1,U.includeFrozen=!0,U.includeMetaData=!0,U.includeChatNotification=!1,U.channelUrlsFilter=null,U.customTypesFilter=null,U.customTypeStartsWithFilter=null,U.nicknameContainsFilter=null,U.nicknameStartsWithFilter=null,U.nicknameExactMatchFilter=null,U.channelNameContainsFilter="",U.myMemberStateFilter=Gr.ALL,U.unreadChannelFilter=Xa.ALL,U.superChannelFilter=qr.ALL,U.publicChannelFilter=Ds.ALL,U.hiddenChannelFilter=ss.UNHIDDEN,U.searchFilter={fields:[],query:null},U.userIdsFilter={userIds:[],includeMode:!0,queryType:na.AND},U.metadataKey=null,U.metadataValues=null,U.metadataOrderKeyFilter=null,U.metadataValueStartsWith=null,U.order=Bt.LATEST_LAST_MESSAGE,U.includeEmpty=(i=r.includeEmpty)!==null&&i!==void 0&&i,U.includeFrozen=(s=r.includeFrozen)===null||s===void 0||s,U.includeMetaData=(a=r.includeMetaData)===null||a===void 0||a,U.includeChatNotification=(o=r.includeChatNotification)!==null&&o!==void 0&&o,U.channelUrlsFilter=(l=r.channelUrlsFilter)!==null&&l!==void 0?l:null,U.customTypesFilter=(u=r.customTypesFilter)!==null&&u!==void 0?u:null,U.customTypeStartsWithFilter=(c=r.customTypeStartsWithFilter)!==null&&c!==void 0?c:"",U.nicknameContainsFilter=(d=r.nicknameContainsFilter)!==null&&d!==void 0?d:null,U.nicknameStartsWithFilter=(h=r.nicknameStartsWithFilter)!==null&&h!==void 0?h:null,U.nicknameExactMatchFilter=(f=r.nicknameExactMatchFilter)!==null&&f!==void 0?f:null,U.channelNameContainsFilter=(p=r.channelNameContainsFilter)!==null&&p!==void 0?p:"",U.myMemberStateFilter=(m=r.myMemberStateFilter)!==null&&m!==void 0?m:Gr.ALL,U.unreadChannelFilter=(b=r.unreadChannelFilter)!==null&&b!==void 0?b:Xa.ALL,U.superChannelFilter=(v=r.superChannelFilter)!==null&&v!==void 0?v:qr.ALL,U.publicChannelFilter=(_=r.publicChannelFilter)!==null&&_!==void 0?_:Ds.ALL,U.hiddenChannelFilter=(E=r.hiddenChannelFilter)!==null&&E!==void 0?E:ss.UNHIDDEN,U.searchFilter=(S=r.searchFilter)!==null&&S!==void 0?S:{fields:[],query:null},U.userIdsFilter=(T=r.userIdsFilter)!==null&&T!==void 0?T:{userIds:[],includeMode:!0,queryType:na.AND},U.metadataKey=(N=r.metadataKey)!==null&&N!==void 0?N:null,U.metadataValues=(I=r.metadataValues)!==null&&I!==void 0?I:null,U.metadataOrderKeyFilter=(x=r.metadataOrderKeyFilter)!==null&&x!==void 0?x:null,U.metadataValueStartsWith=(A=r.metadataValueStartsWith)!==null&&A!==void 0?A:null,U.order=(O=r.order)!==null&&O!==void 0?O:Bt.LATEST_LAST_MESSAGE,r.createdAfter&&(U.createdAfter=r.createdAfter),r.createdBefore&&(U.createdBefore=r.createdBefore),U}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeEmpty)&&k("boolean",this.includeFrozen)&&k("boolean",this.includeMetaData)&&k("string",this.channelNameContainsFilter)&&Qe("string",this.channelUrlsFilter,!0)&&Qe("string",this.customTypesFilter,!0)&&k("string",this.customTypeStartsWithFilter)&&k("string",this.nicknameContainsFilter,!0)&&k("string",this.nicknameStartsWithFilter,!0)&&k("string",this.nicknameExactMatchFilter,!0)&&Ve(Gr,this.myMemberStateFilter)&&Ve(qr,this.superChannelFilter)&&Ve(Ds,this.publicChannelFilter)&&Ve(Xa,this.unreadChannelFilter)&&Ve(ss,this.hiddenChannelFilter)&&Qe(kd,this.searchFilter.fields)&&k("string",this.searchFilter.query,!0)&&Qe("string",this.userIdsFilter.userIds)&&k("boolean",this.userIdsFilter.includeMode)&&Ve(na,this.userIdsFilter.queryType)&&Ve(Bt,this.order)&&k("string",this.metadataOrderKeyFilter,!0)&&k("string",this.metadataKey,!0)&&Qe("string",this.metadataValues,!0)&&k("string",this.metadataValueStartsWith,!0)&&My(this.createdAfter,!0)&&My(this.createdBefore,!0)},n.prototype.serialize=function(){return nh(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,Rn.of(this._iid).getMyGroupChannels(this._token,Ie(M({},this)),this.limit,z.REQUEST_CHANNEL,!0)]):[3,2]:[3,5];case 1:return t=s.sent(),r=t.channels,i=t.token,this._token=i,this._hasNext=!!i,this._isLoading=!1,[2,r];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),bL=function(e){function n(t,r,i){var s,a=this;return(a=e.call(this,t,"SYEV",i)||this).pinnedMessageIds=[],a.latestPinnedMessage=null,a.ts=0,i.data&&(a.pinnedMessageIds=(s=i.data.pinned_message_ids)!==null&&s!==void 0?s:[],a.latestPinnedMessage=i.data.latest_pinned_message?wr(t,M({},i.data.latest_pinned_message)):null),a.ts=i.ts,a}return w(n,e),n}(Et),CL=function(e){function n(t){var r=t.channelUrl,i=t.userId,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(cr,"/").concat(encodeURIComponent(r),"/messages/mark_as_delivered"),s.params=be({userId:i}),s}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var Ws,SL=function(e){function n(t,r,i){var s=e.call(this,t,"DLVR",i)||this;return s.channelUrl=i.channel_url,s.deliveredStateUpdate=i.updated,s}return w(n,e),n}(Et),Ms=function(){function e(n){var t=n.top,r=t===void 0?Number.MAX_SAFE_INTEGER:t,i=n.bottom,s=i===void 0?0:i;this.top=r,this.bottom=s}return e.prototype.includes=function(){for(var n=this,t=[],r=0;r0&&$e.onMentionReceived&&$e.onMentionReceived(m,f)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=6;case 6:return[3,79];case 7:return S=t.as(uM),Ce=S.channelUrl,ze=S.channelType,T=S.messageId,N=S.silent,I=S.messageCreatedAt,x=S.senderId,ze!==et.GROUP?[3,9]:[4,this.getChannel(Ce,!0)];case 8:A=Je.sent(),O=x===this._sdkState.userId,N||O||I>0&&A.myLastRead0&&A._updateUnreadCount(A.unreadMessageCount-1,0),this._dispatcher.dispatch(new T2({messageIds:[T],source:z.EVENT_MESSAGE_DELETED})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onMessageDeleted&&$e.onMessageDeleted(A,T)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=9;case 9:return[3,79];case 10:return(U=t.as(Xw).readStatus).channelType!==et.GROUP?[3,12]:(H=this._groupChannelCache.isCachedInMemory(U.channelUrl),[4,this.getChannel(U.channelUrl,!0)]);case 11:W=Je.sent(),H&&W._updateUnreadMemberState(U.reader.userId,U.readAt),U.reader.userId===this._sdkState.userId?H?(W.unreadMessageCount>0||W.unreadMentionCount>0)&&(W._updateUnreadCount(0,0),this._dispatcher.dispatch(new We({channels:[W],context:{source:z.EVENT_CHANNEL_READ}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onChannelChanged&&$e.onChannelChanged(W)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})):W.unreadMessageCount!==0&&W.unreadMentionCount!==0||(this._dispatcher.dispatch(new We({channels:[W],context:{source:z.EVENT_CHANNEL_READ}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onChannelChanged&&$e.onChannelChanged(W)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})):(this._dispatcher.dispatch(new We({channels:[W],context:{source:z.EVENT_CHANNEL_READ}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onUnreadMemberStatusUpdated&&$e.onUnreadMemberStatusUpdated(W)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})),Je.label=12;case 12:return[3,79];case 13:return P=t.as(SL),Ce=P.channelUrl,J=P.deliveredStateUpdate,V=J===void 0?{}:J,H=this._groupChannelCache.isCachedInMemory(Ce),[4,this.getChannel(Ce,!0)];case 14:return we=Je.sent(),H&&Object.keys(V).forEach(function(K){we._updateUndeliveredMemberState(K,V[K])}),Object.keys(V).some(function(K){return K!==dt._sdkState.userId})&&(this._dispatcher.dispatch(new We({channels:[we],context:{source:z.EVENT_CHANNEL_DELIVERED}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onUndeliveredMemberStatusUpdated&&$e.onUndeliveredMemberStatusUpdated(we)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})),[3,79];case 15:return q=t.as(Mk),Ce=q.channelUrl,ze=q.channelType,ee=q.event,ze!==et.GROUP?[3,18]:[4,this.getChannel(Ce,!0)];case 16:return ie=Je.sent(),[4,this.getMessageFromCache(ee.messageId)];case 17:(oe=Je.sent())?oe instanceof vr&&(oe.applyReactionEvent(ee),this._dispatcher.dispatch(new wt({messages:[oe],source:z.EVENT_MESSAGE_REACTION_UPDATED}))):this._dispatcher.dispatch(new Pw({event:ee,source:z.EVENT_MESSAGE_REACTION_UPDATED})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onReactionUpdated&&$e.onReactionUpdated(ie,ee)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=18;case 18:return[3,79];case 19:return(Ne=t.as(xk).event).channelType!==et.GROUP?[3,22]:[4,this.getChannel(Ne.channelUrl,!0)];case 20:return X=Je.sent(),[4,this.getMessageFromCache(Ne.targetMessageId)];case 21:(oe=Je.sent())?oe instanceof vr&&(oe.applyThreadInfoUpdateEvent(Ne),this._dispatcher.dispatch(new wt({messages:[oe],source:z.EVENT_MESSAGE_THREADINFO_UPDATED}))):this._dispatcher.dispatch(new Fw({event:Ne,source:z.EVENT_MESSAGE_THREADINFO_UPDATED})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onThreadInfoUpdated&&$e.onThreadInfoUpdated(X,Ne)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=22;case 22:return[3,79];case 23:te=t.as(Ok).groupChannelMemberCounts,ce=[],Je.label=24;case 24:Je.trys.push([24,29,30,31]),$=ge(te),ke=$.next(),Je.label=25;case 25:return ke.done?[3,28]:(B=ke.value,Ce=B.channelUrl,un=B.memberCount,cn=B.joinedMemberCount,ae=B.updatedAt,[4,this.getChannelFromCache(Ce)]);case 26:(de=Je.sent())&&de._setLatestMemberCount(un,cn,ae)&&ce.push(de),Je.label=27;case 27:return ke=$.next(),[3,25];case 28:return[3,31];case 29:return Ee=Je.sent(),Hp={error:Ee},[3,31];case 30:try{ke&&!ke.done&&(i1=$.return)&&i1.call($)}finally{if(Hp)throw Hp.error}return[7];case 31:return ce.length>0&&(this._dispatcher.dispatch(new We({channels:ce,context:{source:z.EVENT_CHANNEL_MEMBER_COUNT_UPDATED}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onChannelMemberCountChanged&&$e.onChannelMemberCountChanged(ce)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})})),[3,79];case 32:return se=t.as(Rk),he=se.event,fe=se.status,Ce=se.channelUrl,ze=se.channelType,Ce&&ze===et.GROUP?[4,this.getChannel(Ce,!0)]:[3,34];case 33:ve=Je.sent(),this._dispatcher.dispatch(new Bw({event:he,source:z.EVENT_POLL_UPDATED})),Ue(fe===Lx?function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onPollDeleted&&$e.onPollDeleted(ve,he.pollId)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}:function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onPollUpdated&&$e.onPollUpdated(ve,he)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=34;case 34:return[3,79];case 35:return me=t.as(cT),pe=me.event,Ce=me.channelUrl,ze=me.channelType,Ce&&ze===et.GROUP?[4,this.getChannel(Ce,!0)]:[3,37];case 36:ue=Je.sent(),this._dispatcher.dispatch(new N2({event:pe,source:z.EVENT_POLL_VOTED})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onPollVoted&&$e.onPollVoted(ue,pe)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Je.label=37;case 37:return[3,79];case 38:if(!(ne=t.as($u).event).isGroupChannelEvent)return[3,77];switch(ne.category){case tn.CHANNEL_JOIN:return[3,39];case tn.CHANNEL_LEAVE:return[3,41];case tn.CHANNEL_OPERATOR_UPDATE:return[3,45];case tn.CHANNEL_INVITE:return[3,47];case tn.CHANNEL_DECLINE_INVITE:return[3,49];case tn.TYPING_START:case tn.TYPING_END:return[3,51];case tn.USER_CHANNEL_MUTE:case tn.USER_CHANNEL_UNMUTE:return[3,53];case tn.USER_CHANNEL_BAN:return[3,55];case tn.USER_CHANNEL_UNBAN:return[3,59];case tn.CHANNEL_FREEZE:case tn.CHANNEL_UNFREEZE:return[3,61];case tn.CHANNEL_HIDE:return[3,63];case tn.CHANNEL_UNHIDE:return[3,65];case tn.CHANNEL_DELETED:return[3,67];case tn.CHANNEL_PROP_CHANGED:return[3,69];case tn.CHANNEL_META_DATA_CHANGED:return[3,71];case tn.CHANNEL_META_COUNTERS_CHANGED:return[3,73];case tn.PINNED_MESSAGE_CHANGED:return[3,75]}return[3,77];case 39:return[4,this.getChannel(ne.channelUrl,!0)];case 40:return xe=Je.sent(),Le=t.as(sL),re=Le.memberCount,Re=Le.joinedMemberCount,st=Le.members,Xe=!1,st.forEach(function(K){xe.isExclusive||xe.isSuper||xe.isBroadcast?Xe=Xe||xe._setLatestMemberCount(re,Re,ne.ts):(K.state=qt.JOINED,xe.addMember(K,ne.ts),dt._updateJoinedMemberCount(xe)),K.userId===dt._sdkState.userId&&(xe.myMemberState=qt.JOINED)}),this._dispatcher.dispatch(new We({channels:[xe],context:{source:z.EVENT_CHANNEL_JOINED,users:st}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){var $e,De;try{for(var Ge=ge(st),Ft=Ge.next();!Ft.done;Ft=Ge.next()){var ft=Ft.value;j.onUserJoined&&j.onUserJoined(xe,ft)}}catch(hI){$e={error:hI}}finally{try{Ft&&!Ft.done&&(De=Ge.return)&&De.call(Ge)}finally{if($e)throw $e.error}}xe.isBroadcast&&Xe&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([xe])}),[2]})})}),[3,77];case 41:return(Vn=this._leftChannels.get(ne.channelUrl))?(ct=Vn.channel,[3,44]):[3,42];case 42:return[4,this.getChannel(ne.channelUrl,!0)];case 43:ct=Je.sent(),Je.label=44;case 44:return He=ct,$t=t.as(oL),un=$t.memberCount,cn=$t.joinedMemberCount,yt=$t.member,_n=!1,Ut=R.of(this._iid).appInfo,He.isExclusive||He.isSuper||He.isBroadcast?_n=He._setLatestMemberCount(un,cn,ne.ts):(Ut!=null&&Ut.enabledChannelMemberShipHistory?((Xt=He.members.find(function(K){return K.userId===yt.userId}))&&(Xt.state=qt.LEFT),He.memberCount=un):He.removeMember(yt),this._updateJoinedMemberCount(He)),yt.userId===this._sdkState.userId?(He.myMemberState=qt.NONE,He.invitedAt=0,He.joinedAt=0,He._updateUnreadCount(0,0),He.isPublic?this._dispatcher.dispatch(new We({channels:[He],context:{source:z.EVENT_CHANNEL_LEFT,user:yt}})):(this._markAsLeave(He),this._dispatcher.dispatch(new $s({channelUrls:[He.url],context:{source:z.EVENT_CHANNEL_LEFT,user:yt}})))):this._dispatcher.dispatch(new We({channels:[He],context:{source:z.EVENT_CHANNEL_LEFT,user:yt}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserLeft&&j.onUserLeft(He,yt),He.isBroadcast&&_n&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([He])}),[2]})})}),[3,77];case 45:return[4,this.getChannel(ne.channelUrl,!0)];case 46:an=Je.sent(),Nt=t.as(Tk).operators,on=Nt.map(function(K){return K.userId});try{for(ln=ge(an.members),Un=ln.next();!Un.done;Un=ln.next())(Jt=Un.value).role=on.includes(Jt.userId)?Bi.OPERATOR:Bi.NONE}catch(K){jp={error:K}}finally{try{Un&&!Un.done&&(s1=ln.return)&&s1.call(ln)}finally{if(jp)throw jp.error}}return an.myRole=on.includes(this._sdkState.userId)?Bi.OPERATOR:Bi.NONE,this._dispatcher.dispatch(new We({channels:[an],context:{source:z.EVENT_CHANNEL_OPERATOR_UPDATED,operators:Nt}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onOperatorUpdated&&j.onOperatorUpdated(an,Nt)}),[2]})})}),[3,77];case 47:return[4,this.getChannel(ne.channelUrl,!0)];case 48:Gt=Je.sent(),mt=t.as(cL),un=mt.memberCount,cn=mt.joinedMemberCount,mn=mt.inviter,($n=mt.invitees).forEach(function(K){return K.state=qt.INVITED});try{for(Gn=ge($n),wn=Gn.next();!wn.done;wn=Gn.next())zn=wn.value,Gt.isExclusive||Gt.isSuper||Gt.isBroadcast?Gt._setLatestMemberCount(un,cn,ne.ts):Gt.addMember(zn,ne.ts),this._sdkState.userId===zn.userId&&(Gt.hiddenState=mr.UNHIDDEN,Gt.myMemberState!==qt.JOINED&&(Gt.myMemberState=qt.INVITED),Gt.invitedAt=ne.ts)}catch(K){Bp={error:K}}finally{try{wn&&!wn.done&&(a1=Gn.return)&&a1.call(Gn)}finally{if(Bp)throw Bp.error}}return this._dispatcher.dispatch(new We({channels:[Gt],context:{source:z.EVENT_CHANNEL_INVITED,inviter:mn,invitees:$n}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserReceivedInvitation&&j.onUserReceivedInvitation(Gt,mn,$n)}),[2]})})}),[3,77];case 49:return[4,this.getChannel(ne.channelUrl,!0)];case 50:return kt=Je.sent(),Pn=t.as(hL),un=Pn.memberCount,cn=Pn.joinedMemberCount,Fn=Pn.inviter,Tn=Pn.invitee,kt.isExclusive||kt.isSuper||kt.isBroadcast?kt._setLatestMemberCount(un,cn,ne.ts):kt.removeMember(Tn),this._sdkState.userId===Tn.userId?(kt.invitedAt=0,kt.myMemberState=qt.NONE,kt.isPublic?this._dispatcher.dispatch(new We({channels:[kt],context:{source:z.EVENT_CHANNEL_DECLINED_INVITE,inviter:Fn,invitee:Tn}})):this._dispatcher.dispatch(new $s({channelUrls:[kt.url],context:{source:z.EVENT_CHANNEL_DECLINED_INVITE,inviter:Fn,invitee:Tn}}))):this._dispatcher.dispatch(new We({channels:[kt],context:{source:z.EVENT_CHANNEL_DECLINED_INVITE,inviter:Fn,invitee:Tn}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserDeclinedInvitation&&j.onUserDeclinedInvitation(kt,Fn,Tn)}),[2]})})}),[3,77];case 51:return[4,this.getChannel(ne.channelUrl,!0)];case 52:return Mt=Je.sent(),Hn=ne.category===tn.TYPING_START,dr=t.as(Hn?vL:yL).user,Mt._updateTypingStatus(dr,Hn?ne.ts:0),this._dispatcher.dispatch(new We({channels:[Mt],context:{source:z.EVENT_CHANNEL_TYPING_STATUS_UPDATE}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onTypingStatusUpdated&&j.onTypingStatusUpdated(Mt)}),[2]})})}),[3,77];case 53:return[4,this.getChannel(ne.channelUrl,!0)];case 54:vn=Je.sent(),Nn=ne.category===tn.USER_CHANNEL_MUTE,(In=t.as(Nn?VO:WO).user).userId===this._sdkState.userId&&(vn.myMutedState=Nn?Ns.MUTED:Ns.UNMUTED,vn._myMutedRemainingTime=In.restrictionInfo.remainingDuration);try{for(Pt=ge(vn.members),An=Pt.next();!An.done;An=Pt.next())if((Jt=An.value).userId===In.userId){Jt.isMuted=Nn;break}}catch(K){$p={error:K}}finally{try{An&&!An.done&&(o1=Pt.return)&&o1.call(Pt)}finally{if($p)throw $p.error}}return this._dispatcher.dispatch(new We({channels:[vn],context:{source:Nn?z.EVENT_CHANNEL_MUTED:z.EVENT_CHANNEL_UNMUTED,user:In}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){Nn?j.onUserMuted&&j.onUserMuted(vn,In):j.onUserUnmuted&&j.onUserUnmuted(vn,In)}),[2]})})}),[3,77];case 55:return(Vn=this._leftChannels.get(ne.channelUrl))?(hr=Vn.channel,[3,58]):[3,56];case 56:return[4,this.getChannel(ne.channelUrl,!0)];case 57:hr=Je.sent(),Je.label=58;case 58:return qn=hr,this._markAsLeave(qn),Pe=t.as(QO).user,Pe.userId===this._sdkState.userId&&this._dispatcher.dispatch(new $s({channelUrls:[qn.url],context:{source:z.EVENT_CHANNEL_BANNED,user:Pe}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserBanned&&j.onUserBanned(qn,Pe)}),[2]})})}),[3,77];case 59:return[4,this.getChannel(ne.channelUrl,!0)];case 60:return F=Je.sent(),_e=t.as(ZO).user,_e.userId===this._sdkState.userId&&this._dispatcher.dispatch(new $s({channelUrls:[F.url],context:{source:z.EVENT_CHANNEL_UNBANNED,user:_e}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onUserUnbanned&&j.onUserUnbanned(F,_e)}),[2]})})}),[3,77];case 61:return[4,this.getChannel(ne.channelUrl,!0)];case 62:return Oe=Je.sent(),qe=t.as(XO).freeze,Oe.isFrozen=qe,this._dispatcher.dispatch(new We({channels:[Oe],context:{source:qe?z.EVENT_CHANNEL_FROZEN:z.EVENT_CHANNEL_UNFROZEN}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){qe?j.onChannelFrozen&&j.onChannelFrozen(Oe):j.onChannelUnfrozen&&j.onChannelUnfrozen(Oe)}),[2]})})}),[3,77];case 63:return[4,this.getChannel(ne.channelUrl,!0)];case 64:return bt=Je.sent(),gn=t.as(_L),er=gn.allowAutoUnhide,tr=gn.hidePreviousMessages,Fs=gn.messageOffsetTimestamp,er!==null&&(bt.hiddenState=er?mr.HIDDEN_ALLOW_AUTO_UNHIDE:mr.HIDDEN_PREVENT_AUTO_UNHIDE),tr!==null&&tr&&bt._updateUnreadCount(0,0),Fs!==null&&(bt.messageOffsetTimestamp=Fs),this._dispatcher.dispatch(new We({channels:[bt],context:{source:z.EVENT_CHANNEL_HIDDEN}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onChannelHidden&&j.onChannelHidden(bt)}),[2]})})}),[3,77];case 65:return[4,this.getChannel(ne.channelUrl,!0)];case 66:return(Wn=Je.sent()).hiddenState=mr.UNHIDDEN,this._dispatcher.dispatch(new We({channels:[Wn],context:{source:z.EVENT_CHANNEL_UNHIDDEN}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(Wn)}),[2]})})}),[3,77];case 67:return[4,this.getChannel(ne.channelUrl,!0)];case 68:return yl=Je.sent(),this._dispatcher.dispatch(new $s({channelUrls:[ne.channelUrl],context:{source:z.EVENT_CHANNEL_DELETED}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onChannelDeleted&&j.onChannelDeleted(yl.url,yl.channelType)}),[2]})})}),[3,77];case 69:return[4,this.getChannelWithoutCache(ne.channelUrl,!0)];case 70:return El=Je.sent(),this._dispatcher.dispatch(new We({channels:[El],context:{source:z.EVENT_CHANNEL_UPDATED}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(El)}),[2]})})}),[3,77];case 71:return[4,this.getChannel(ne.channelUrl,!0)];case 72:return fs=Je.sent(),oh=t.as(LO),bl=oh.created,Cl=oh.updated,Sl=oh.deleted,bl&&(fs._upsertCachedMetaData(bl,ne.ts),this._dispatcher.dispatch(new We({channels:[fs],context:{source:z.EVENT_CHANNEL_METADATA_CREATED,metaData:bl}}))),Cl&&(fs._upsertCachedMetaData(Cl,ne.ts),this._dispatcher.dispatch(new We({channels:[fs],context:{source:z.EVENT_CHANNEL_METADATA_UPDATED,metaData:Cl}}))),Sl&&(fs._removeFromCachedMetaData(Sl,ne.ts),this._dispatcher.dispatch(new We({channels:[fs],context:{source:z.EVENT_CHANNEL_METADATA_DELETED,metaDataKeys:Sl}}))),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){bl&&j.onMetaDataCreated&&j.onMetaDataCreated(fs,bl),Cl&&j.onMetaDataUpdated&&j.onMetaDataUpdated(fs,Cl),Sl&&j.onMetaDataDeleted&&j.onMetaDataDeleted(fs,Sl)}),[2]})})}),[3,77];case 73:return[4,this.getChannel(ne.channelUrl,!0)];case 74:return uo=Je.sent(),lh=t.as(BO),zu=lh.created,Vu=lh.updated,qu=lh.deleted,zu&&this._dispatcher.dispatch(new We({channels:[uo],context:{source:z.EVENT_CHANNEL_METACOUNTER_CREATED,metaCounters:zu}})),Vu&&this._dispatcher.dispatch(new We({channels:[uo],context:{source:z.EVENT_CHANNEL_METACOUNTER_UPDATED,metaCounters:Vu}})),qu&&this._dispatcher.dispatch(new We({channels:[uo],context:{source:z.EVENT_CHANNEL_METACOUNTER_DELETED,metaCounterKeys:qu}})),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){zu&&j.onMetaCounterCreated&&j.onMetaCounterCreated(uo,zu),Vu&&j.onMetaCounterUpdated&&j.onMetaCounterUpdated(uo,Vu),qu&&j.onMetaCounterDeleted&&j.onMetaCounterDeleted(uo,qu)}),[2]})})}),[3,77];case 75:return[4,this.getChannel(ne.channelUrl,!0)];case 76:return ha=Je.sent(),uh=t.as(bL),e1=uh.pinnedMessageIds,t1=uh.latestPinnedMessage,(n1=uh.ts)>ha._pinnedMessagesUpdatedAt&&(ha.pinnedMessageIds=e1,ha.lastPinnedMessage=t1,ha._pinnedMessagesUpdatedAt=n1,this._dispatcher.dispatch(new We({channels:[ha],context:{source:z.EVENT_PINNED_MESSAGE_UPDATED}})),Ue(function(){return y(dt,void 0,void 0,function(){var K,j,$e,De,Ge;return g(this,function(Ft){try{for(K=ge(this._groupChannelHandlers.values()),j=K.next();!j.done;j=K.next())($e=j.value).onChannelChanged&&$e.onChannelChanged(ha)}catch(ft){De={error:ft}}finally{try{j&&!j.done&&(Ge=K.return)&&Ge.call(K)}finally{if(De)throw De.error}}return[2]})})}),Ue(function(){return y(dt,void 0,void 0,function(){return g(this,function(K){return this._groupChannelHandlers.forEach(function(j){j.onPinnedMessageUpdated&&j.onPinnedMessageUpdated(ha)}),[2]})})})),[3,77];case 77:return[3,79];case 78:switch((Lp=t.as(CT).event).category){case Rd.USER_BLOCK:Dp=E0.getDataAsUserBlockEvent(this._iid,Lp),ch=Dp.blocker,dh=Dp.blockee,this._groupChannelCache.block(ch.userId,dh.userId);break;case Rd.USER_UNBLOCK:Up=E0.getDataAsUserBlockEvent(this._iid,Lp),ch=Up.blocker,dh=Up.blockee,this._groupChannelCache.unblock(ch.userId,dh.userId)}return[3,79];case 79:return[3,81];case 80:if(Pp=Je.sent(),zr(Pp))throw Pp;return[3,81];case 81:return[2]}})})},n.prototype._markAsLeave=function(t){var r,i=this,s=(r=this._leftChannels.get(t.url))!==null&&r!==void 0?r:{channel:t,ref:0};s.ref++,this._leftChannels.set(t.url,s),setTimeout(function(){s.ref--,s.ref===0&&i._leftChannels.delete(t.url)},1e4)},n.prototype.addHandler=function(t,r){this._groupChannelHandlers.set(t,r)},n.prototype.removeHandler=function(t){this._groupChannelHandlers.delete(t)},n.prototype.clearHandler=function(){this._groupChannelHandlers.clear()},n.prototype.subscribeChannelEvent=function(t,r){this._groupChannelBroadcast.subscribe(t,r)},n.prototype.unsubscribeChannelEvent=function(t){this._groupChannelBroadcast.unsubscribe(t)},n.prototype._updateJoinedMemberCount=function(t){t.joinedMemberCount=t.members.filter(function(r){return r.state===qt.JOINED}).length},n.prototype.getChannel=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:Q(k("string",t)).throw(L.invalidParameters),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.getChannelFromCache(t)];case 2:return(i=s.sent())?[2,i]:[3,4];case 3:return s.sent(),[3,4];case 4:return[4,this.getChannelWithoutCache(t,r)];case 5:return[2,s.sent()]}})})},n.prototype.getChannelWithoutCache=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(k("string",t)).throw(L.invalidParameters),i=new Lv({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(i)];case 1:switch(s=u.sent(),a=s.as(Dv).channel,o=a.unreadMessageCount,l=a.unreadMentionCount,a.myCountPreference){case fi.UNREAD_MESSAGE_COUNT_ONLY:l=0;break;case fi.UNREAD_MENTION_COUNT_ONLY:o=0;break;case fi.OFF:o=0,l=0}return a._updateUnreadCount(o,l),[4,this.upsertChannelsToCache([a])];case 2:return[2,u.sent()[0]]}})})},n.prototype.refreshChannel=function(t,r,i){return r===void 0&&(r=!0),i===void 0&&(i=z.REFRESH_CHANNEL),y(this,void 0,void 0,function(){var s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),s=new Lv({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(s)];case 1:return a=c.sent(),(o=a.as(Dv).channel).myMemberState!==qt.NONE?[3,2]:(this._dispatcher.dispatch(new $s({channelUrls:[o.url],context:{source:i}})),[3,4]);case 2:return[4,this.upsertChannelsToCache([o])];case 3:l=c.sent(),this._dispatcher.dispatch(new We({channels:l,context:{source:i}})),c.label=4;case 4:return[3,6];case 5:return(u=c.sent()).code!==Ae.NON_AUTHORIZED&&u.code!==Ae.NOT_FOUND_IN_DATABASE||this._dispatcher.dispatch(new $s({channelUrls:[t],context:{source:i}})),[3,6];case 6:return[2]}})})},n.prototype.getMyGroupChannels=function(t,r,i,s,a){return s===void 0&&(s=z.REQUEST_CHANNEL),a===void 0&&(a=!1),y(this,void 0,void 0,function(){var o,l,u,c,d,h,f,p,m;return g(this,function(b){switch(b.label){case 0:return r.createdAfter&&(r.createdAfter=Math.floor(r.createdAfter/1e3)),r.createdBefore&&(r.createdBefore=Math.floor(r.createdBefore/1e3)),o=!1,a&&(l=R.of(this._iid),u=l.appInfo,(c=l.cacheContext)&&!c.localCacheEnabled&&(u!=null&&u.enabledChannelMemberShipHistory)&&(u!=null&&u.applicationAttributes.includes("left_user_view_support"))&&(o=!0)),d=new $k(M(M({},r),{userId:this._sdkState.userId,token:t,limit:i,includeLeftChannel:a&&o})),[4,this._requestQueue.send(d)];case 1:return h=b.sent(),f=h.as(Gk),p=f.channels,m=f.token,this._dispatcher.dispatch(new We({channels:p,context:{source:s}})),[2,{channels:p,token:m}]}})})},n.prototype.getMyGroupChannelChangeLogs=function(t,r,i){return i===void 0&&(i=z.REQUEST_CHANNEL_CHANGELOGS),y(this,void 0,void 0,function(){var s,a,o,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return s=M(M({},C0),r),Q((k("string",t)||k("number",t))&&kv(s)).throw(L.invalidParameters),a=new jk(Ie({userId:this._sdkState.userId,ts:typeof t=="number"?t:null,token:typeof t=="string"?t:null,filter:s})),[4,this._requestQueue.send(a)];case 1:return o=f.sent(),l=o.as(Bk),u=l.updatedChannels,c=l.deletedChannelUrls,d=l.hasMore,h=l.ts,u.length>0&&this._dispatcher.dispatch(new We({channels:u,context:{source:i},ts:h})),c.length>0&&this._dispatcher.dispatch(new $s({channelUrls:c,context:{source:i}})),[2,{updatedChannels:u,deletedChannelUrls:c,hasMore:d,token:l.token}]}})})},n.prototype.getGroupChannelCount=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(a){switch(a.label){case 0:return r=M(M({},wT),t),Q(TT(r)).throw(L.invalidParameters),i=new zk({userId:this._sdkState.userId,filter:r}),[4,this._requestQueue.send(i)];case 1:return s=a.sent(),[2,s.as(Vk).groupChannelCount]}})})},n.prototype.getUnreadItemCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_;return g(this,function(E){switch(E.label){case 0:return r=M(M({},Dk),t),Q(function(S){return Qe(xn,S.keys)}(r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new qk({userId:s.userId,filter:r}),[4,a.send(o)];case 1:return l=E.sent(),u=l.as(Wk),c=u.groupChannelUnreadMentionCount,d=u.groupChannelUnreadMessageCount,h=u.groupChannelInvitationCount,f=u.superGroupChannelUnreadMentionCount,p=u.superGroupChannelUnreadMessageCount,m=u.superGroupChannelInvitationCount,b=u.nonSuperGroupChannelUnreadMentionCount,v=u.nonSuperGroupChannelUnreadMessageCount,_=u.nonSuperGroupChannelInvitationCount,[2,be({groupChannelUnreadMentionCount:c,groupChannelUnreadMessageCount:d,groupChannelInvitationCount:h,superGroupChannelUnreadMentionCount:f,superGroupChannelUnreadMessageCount:p,superGroupChannelInvitationCount:m,nonSuperGroupChannelUnreadMentionCount:b,nonSuperGroupChannelUnreadMessageCount:v,nonSuperGroupChannelInvitationCount:_})]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new Kk({userId:r.userId}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(Qk).unreadCount]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=M(M({},Uk),t),Q(Pk(r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new Yk({userId:s.userId,filter:r}),[4,a.send(o)];case 1:return l=u.sent(),[2,l.as(Zk).unreadCount]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=M(M({},Fk),t),Q(function(l){return k("string",l.channelUrl,!0)&&Qe(Ua,l.scheduledStatus,!0)&&Ve(ar,l.messageTypeFilter)}(r)).throw(L.invalidParameters),i=R.of(this._iid).requestQueue,s=new Xk(r),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(Jk).count]}})})},n.prototype.getSubscribedTotalUnreadMessageCount=function(){var t=R.of(this._iid).subscribedUnreadMessageCount;return t.all>=0?t.all:0},n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){var t=0,r=R.of(this._iid).subscribedUnreadMessageCount;return Object.keys(r.customTypes).forEach(function(i){t+=r.customTypes[i]}),t},n.prototype.getSubscribedCustomTypeUnreadMessageCount=function(t){var r;return(r=R.of(this._iid).subscribedUnreadMessageCount.customTypes[t])!==null&&r!==void 0?r:0},n.prototype.createChannel=function(t){return y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=M(M({},Nf),t),Q(Rv(r)).throw(L.invalidParameters),r.isPublic||(r.accessCode=void 0),i=new tL(M({userId:this._sdkState.userId},r)),[4,this._requestQueue.send(i)];case 1:return s=o.sent(),a=s.as(nL).channel,[4,this.upsertChannelsToCache([a])];case 2:return o.sent(),[2,a]}})})},n.prototype.markAsReadAll=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return t=Date.now(),Q(t-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=t,r=new zE({userId:this._sdkState.userId}),[4,this._requestQueue.send(r)];case 1:c.sent(),i=this._groupChannelCache.channels;try{for(s=ge(i),a=s.next();!a.done;a=s.next())(o=a.value)._updateUnreadMemberState(this._sdkState.userId,t),o._updateUnreadCount(0,0)}catch(d){l={error:d}}finally{try{a&&!a.done&&(u=s.return)&&u.call(s)}finally{if(l)throw l.error}}return i.length>0?[4,this.upsertChannelsToCache(i)]:[3,3];case 2:c.sent(),c.label=3;case 3:return[2]}})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return r=Date.now(),Q(Qe("string",t)&&r-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=r,i=new zE({userId:this._sdkState.userId,channelUrls:t}),[4,this._requestQueue.send(i)];case 1:h.sent(),s=this._groupChannelCache.channels,a=[];try{for(o=ge(s),l=o.next();!l.done;l=o.next())u=l.value,t.includes(u.url)&&(u._updateUnreadMemberState(this._sdkState.userId,r),u._updateUnreadCount(0,0),a.push(u))}catch(f){c={error:f}}finally{try{l&&!l.done&&(d=o.return)&&d.call(o)}finally{if(c)throw c.error}}return a.length>0?[4,this.upsertChannelsToCache(a)]:[3,3];case 2:h.sent(),h.label=3;case 3:return[2]}})})},n.prototype.markAsDelivered=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n.prototype.getMessageFromCache=function(t){var r;return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._messageCache.get(t)];case 1:return[2,(r=i.sent())!==null&&r!==void 0?r:null]}})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return g(this,function(s){switch(s.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,filter:i,exactMatch:!0})];case 1:return[2,s.sent()]}})})},n.prototype.getMessagesFromCache=function(t,r,i,s,a,o){return a===void 0&&(a=fT),o===void 0&&(o=!0),y(this,void 0,void 0,function(){return g(this,function(l){switch(l.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,limit:a,filter:s,backward:i==="next",inclusive:o})];case 1:return[2,l.sent()]}})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(a){switch(a.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,limit:s,filter:i,backward:!1,isPollOnly:!0})];case 1:return[2,a.sent()]}})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(a){switch(a.label){case 0:return[4,this._messageCache.countBetween(t,r,new Ms({top:i,bottom:s}))];case 1:return[2,a.sent()]}})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._unsentMessageCache.fetch({channelUrl:t,filter:r})];case 1:return[2,i.sent()]}})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._unsentMessageCache.remove([t])];case 1:return r.sent(),[2]}})})},n}(Nk),li=function(e,n){return n instanceof Ht?e.findIndex(function(t){return t instanceof Ht&&n.isIdentical(t)}):e.findIndex(function(t){return t.isIdentical(n)})},rc=function(e,n){return e.findIndex(function(t){return t instanceof vr?t.messageId===n:t instanceof al?t.notificationId===n:void 0})},V_=function(e,n){if(e.length>0){for(var t=0,r=e.length-1,i=Math.floor((t+r)/2);t0)r=i,i=Math.floor((t+r)/2);else{if(!(s<0))return i;t=i+1,i=Math.floor((t+r)/2)}}return e[i].createdAt>n.createdAt?i:i+1}return e.length};(function(e){e[e.IDLE=0]="IDLE",e[e.RUNNING=1]="RUNNING",e[e.END=2]="END"})(Ws||(Ws={}));var S0,io=function(e){function n(t,r,i,s){var a=e.call(this)||this;return a._state=Ws.IDLE,a._retryCount=0,a._retryLimit=3,a.priority=0,a._worker=r,a}return w(n,e),Object.defineProperty(n.prototype,"isIdle",{get:function(){return this._state===Ws.IDLE},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRunning",{get:function(){return this._state===Ws.RUNNING},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isDone",{get:function(){return this._state===Ws.END},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"retryCount",{get:function(){return this._retryCount},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"retryLimit",{get:function(){return this._retryLimit},enumerable:!1,configurable:!0}),n.prototype._run=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:if(!this.isRunning)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._worker(t)];case 2:return r=s.sent(),this._retryCount=0,this.dispatch("progress",r),r.hasNext?this._run(r.nextToken):this.end(),[3,4];case 3:return i=s.sent(),this.dispatch("error",i),this._retryCount0&&(E=_.map(function(J){return J.createdAt}),!((O=this._metadata)===null||O===void 0)&&(T=O.range).intersect.apply(T,Fe([],Me(E),!1))?this.extendRange(_):this._metadata={range:new Ms({top:Math.min.apply(Math,Fe([],Me(E),!1)),bottom:Math.max.apply(Math,Fe([],Me(E),!1))}),previousComplete:!1}),v.hasNext=_.length>=this._limit&&this._prevSyncLoopCount<1,this._metadata&&(v.nextToken=this._metadata.range.top,this._metadata.previousComplete=_.length0&&(E=_.map(function(P){return P.createdAt}),!((A=this._metadata)===null||A===void 0)&&(T=A.range).intersect.apply(T,Fe([],Me(E),!1))?this.extendRange(_):this._metadata={range:new Ms({top:Math.min.apply(Math,Fe([],Me(E),!1)),bottom:Math.max.apply(Math,Fe([],Me(E),!1))}),previousComplete:!1}),v.hasNext=_.length>=this._limit,this._metadata&&(v.nextToken=this._metadata.range.bottom),f.debug("message background next sync progress",v),[4,this.saveMetadata()];case 4:return W.sent(),[3,7];case 5:throw S=W.sent(),f.debug("message background next sync error",S),S;case 6:return p.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:r.url,measured_on:"back_sync",event:"cache_fetch",max_db_size:(U=(O=d.localCacheConfig)===null||O===void 0?void 0:O.maxSize)!==null&&U!==void 0?U:0,use_local_cache:d.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[2,v]}})})}),this._connectionEventContext=h.on(function(b){b instanceof Ii&&(b.stateType===lt.CONNECTED?a.resume():a.pause())})}return e.of=function(n,t){return Yi[n]||(Yi[n]={}),Yi[n][t.url]||(Yi[n][t.url]=new e({_iid:n,channel:t})),Yi[n][t.url].ref++,Yi[n][t.url]},e.clear=function(n,t){Yi[n]&&Yi[n][t]&&(Yi[n][t].close(),delete Yi[n])},Object.defineProperty(e.prototype,"range",{get:function(){var n,t;return(t=(n=this._metadata)===null||n===void 0?void 0:n.range)!==null&&t!==void 0?t:new Ms({})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousComplete",{get:function(){var n;return!!(!((n=this._metadata)===null||n===void 0)&&n.previousComplete)},enumerable:!1,configurable:!0}),e.prototype.isWrappingMessages=function(n){var t;return(t=this.range)===null||t===void 0?void 0:t.includes.apply(t,Fe([],Me(n.map(function(r){return r.createdAt})),!1))},e.prototype.extendRange=function(n){var t;this._metadata&&(t=this._metadata.range).extends.apply(t,Fe([],Me(n.map(function(r){return r.createdAt})),!1))},e.prototype.loadMetadata=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this._metadata?[3,2]:[4,R.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:t=r.sent(),this._metadata=t?{range:new Ms(t.range),previousComplete:t.previousComplete}:{range:new Ms({}),previousComplete:!1},r.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(n){var t,r,i,s;n===void 0&&(n=Date.now());var a=R.of(this._iid),o=a.logger;a.sessionManager.session.hasSession&&(o.debug("message background sync resume()"),this._prevSyncLoopCount=0,this._metadata&&this._metadata.previousComplete||this._prevSync.start((r=(t=this._metadata)===null||t===void 0?void 0:t.range.top)!==null&&r!==void 0?r:n),this._nextSync.start((s=(i=this._metadata)===null||i===void 0?void 0:i.range.bottom)!==null&&s!==void 0?s:n))},e.prototype.pause=function(){R.of(this._iid).logger.debug("message background sync stop()"),this._prevSync.stop(),this._nextSync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Yi[this._iid][this._channel.url])},e}(),Zi={},TL=function(){function e(n){var t=n._iid,r=n.channel,i=n.includeParams,s=this;this.ref=0,this._iid=t,this._channel=r,this._includeParams=i;var a,o,l=R.of(this._iid),u=l.logger,c=l.sdkState,d=l.dispatcher;this._metadataKey=(a=c.userId,o=r.url,"sendbird:".concat(a,"@groupchannel/").concat(o,"/message/changelogs.meta"));var h=function(f,p){return"sendbird:".concat(f,"@groupchannel/").concat(p,"/message/changelogs")}(c.userId,this._channel.url);this._sync=new io(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S;return g(this,function(T){switch(T.label){case 0:return f={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:T.sent(),u.debug("message changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),T.label=2;case 2:return T.trys.push([2,5,,8]),[4,Ln.of(this._iid).getMessageChangelogs(this._channel.url,this._channel.channelType,this._metadata.token,M({replyType:Bn.ALL},this._includeParams),z.SYNC_MESSAGE_CHANGELOGS)];case 3:return p=T.sent(),m=p.updatedMessages,b=p.deletedMessageIds,v=p.hasMore,_=p.token,f.hasNext=v,f.nextToken=_,(m.length>0||b.length>0)&&this._metadata&&(this._metadata.token=_),u.debug("message changelog sync progress",f),[4,this.saveMetadata()];case 4:return T.sent(),[3,8];case 5:return E=T.sent(),u.debug("message changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,7];case 6:T.sent(),T.label=7;case 7:throw E;case 8:return[2,f]}})})}),this._connectionEventContext=d.on(function(f){f instanceof Ii&&(f.stateType===lt.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return Zi[n]||(Zi[n]={}),Zi[n][t.url]||(Zi[n][t.url]=new e({_iid:n,channel:t,includeParams:r})),Zi[n][t.url].ref++,Zi[n][t.url]},e.clear=function(n,t){Zi[n]&&Zi[n][t]&&(Zi[n][t].close(),delete Zi[n])},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return this._metadata?[3,2]:(n=R.of(this._iid),t=n.cacheContext,r=n.firstConnectedAt,[4,t.preference.get(this._metadataKey)]);case 1:i=s.sent(),this._metadata={token:i?i.token:r},s.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){var n=R.of(this._iid),t=n.logger;n.sessionManager.session.hasSession&&(t.debug("message changelog sync resume()"),this._sync.start(0))},e.prototype.pause=function(){R.of(this._iid).logger.debug("message changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Zi[this._iid][this._channel.url])},e}(),fo={},NL=function(){function e(n){var t=n._iid,r=n.channel,i=n.hasPollMessage,s=this;this.ref=0,this._iid=t,this._channel=r;var a,o,l=R.of(this._iid),u=l.logger,c=l.sdkState,d=l.dispatcher;this._metadataKey=(a=c.userId,o=r.url,"sendbird:".concat(a,"@groupchannel/").concat(o,"/poll/changelogs.meta"));var h=function(f,p){return"sendbird:".concat(f,"@groupchannel/").concat(p,"/poll/changelogs")}(c.userId,this._channel.url);this._sync=new io(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S;return g(this,function(T){switch(T.label){case 0:return f={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:return T.sent(),u.debug("poll changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),(p=!this._metadata||!this._metadata.token)?[4,i()]:[3,3];case 2:p=!T.sent(),T.label=3;case 3:if(p)return[2,{hasNext:!1,nextToken:0}];this._metadata||(m=R.of(this._iid).firstConnectedAt,this._metadata={token:m}),T.label=4;case 4:return T.trys.push([4,7,,10]),[4,p0.of(this._iid).getPollChangeLogs(this._channel.url,this._channel.channelType,this._metadata.token)];case 5:return b=T.sent(),v=b.hasMore,_=b.token,f.hasNext=v,f.nextToken=_,this._metadata.token=_,u.debug("poll changelog sync progress",f),[4,this.saveMetadata()];case 6:return T.sent(),[3,10];case 7:return E=T.sent(),u.debug("poll changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,9];case 8:T.sent(),T.label=9;case 9:throw E;case 10:return[2,f]}})})}),this._connectionEventContext=d.on(function(f){f instanceof Ii&&(f.stateType===lt.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return fo[n]||(fo[n]={}),fo[n][t.url]||(fo[n][t.url]=new e({_iid:n,channel:t,hasPollMessage:r})),fo[n][t.url].ref++,fo[n][t.url]},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,R.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:n=t.sent(),this._metadata=n?{token:n.token}:void 0,t.label=2;case 2:return[2]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){R.of(this._iid).logger.debug("poll changelog sync resume()"),this._sync.start(0)},e.prototype.pause=function(){R.of(this._iid).logger.debug("poll changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete fo[this._iid][this._channel.url])},e}(),IL=function(e){function n(t){var r,i,s,a,o,l,u,c,d,h,f=this;return(f=e.call(this)||this).method=Y.GET,f.path="".concat(nt(t.channelType),"/").concat(t.channelUrl,"/messages_gap"),f.params=be({prev_start_ts:t.prevStart,prev_end_ts:t.prevEnd,prev_cache_count:t.prevCount,next_start_ts:t.nextStart,next_end_ts:t.nextEnd,next_cache_count:t.nextCount,huge_gap_threshold:(r=t.threshold)!==null&&r!==void 0?r:null,reverse:!0,custom_types:(i=t.customTypes)!==null&&i!==void 0?i:["*"],message_type:(s=t.messageType)!==null&&s!==void 0?s:null,include_reply_type:(a=t.replyType)!==null&&a!==void 0?a:Bn.NONE,include_reactions:(o=t.includeReactions)===null||o===void 0||o,include_meta_array:(l=t.includeMetaArray)===null||l===void 0||l,include_thread_info:(u=t.includeThreadInfo)===null||u===void 0||u,include_parent_message_info:(c=t.includeParentMessageInfo)===null||c===void 0||c,with_sorted_meta_array:(d=t.includeMetaArray)===null||d===void 0||d,show_subchannel_messages_only:(h=t.showSubchannelMessagesOnly)!==null&&h!==void 0&&h,include_poll_details:!0,checking_continuous_messages:t.checkingContinuousMessages}),f}return w(n,e),n}(Z),AL=function(e){function n(t,r){var i,s,a,o,l,u,c=this;return(c=e.call(this,t,r)||this).isHugeGap=r.is_huge_gap,c.prevMessages=((i=r.prev_messages)!==null&&i!==void 0?i:[]).map(function(d){return wr(t,d)}),c.prevHasMore=(s=r.prev_hasmore)!==null&&s!==void 0&&s,c.isContinuousPrevMessages=(a=r.is_continuous_prev_messages)!==null&&a!==void 0&&a,c.nextMessages=((o=r.next_messages)!==null&&o!==void 0?o:[]).map(function(d){return wr(t,d)}),c.nextHasmore=(l=r.next_hasmore)!==null&&l!==void 0&&l,c.isContinuousNextMessages=(u=r.is_continuous_next_messages)!==null&&u!==void 0&&u,c}return w(n,e),n}(le),VE={includeMetaArray:!0,includeReactions:!0,includeThreadInfo:!0,includeParentMessageInfo:!0};(function(e){e.CACHE_AND_REPLACE_BY_API="cache_and_replace_by_api"})(S0||(S0={}));var nd,rd,id,ML=function(){function e(){this._onCacheResult=Ke,this._onApiResult=Ke}return e.prototype._invokeResponse=function(n,t,r){var i=this;Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(s){switch(n){case"local":this._onCacheResult(t,r);break;case"remote":this._onApiResult(t,r)}return[2]})})})},e.prototype.onCacheResult=function(n){return this._onCacheResult=n,this},e.prototype.onApiResult=function(n){return this._onApiResult=n,this},e}(),xL=function(){function e(n,t){var r=t.filter,i=t.startingPoint,s=t.limit,a=t.prevResultLimit,o=t.nextResultLimit,l=t.channel,u=t.channelManager,c=t.disableBackgroundSync,d=c!==void 0&&c,h=this;this._messages=[],this._unsentMessages=[],this._isLoadingPrevious=!1,this._isLoadingNext=!1,this._iid=n,this._key="mc-".concat(la()),this._isDisposed=!1,this.filter=r??new Us,this._channel=l,this._syncRange=new Ms({}),this._hasPrevious=!0,this._hasNext=!0,this._startingPoint=typeof i=="number"&&Number.isFinite(i)?i:Number.MAX_SAFE_INTEGER,this._limit=s||fT,this._prevResultLimit=a??Math.floor(this._limit/2),this._nextResultLimit=o??Math.floor(this._limit/2),this._channelManager=u,this._channelManager.subscribeChannelEvent(this._key,{onUpdate:function(v,_){var E=_.source,S=v.findIndex(function(T){return T.isIdentical(h.channel)});S>=0&&(h._replaceChannelOfCollection(v[S]),h.channel._runIfHandleableWithGroupChannel(function(T){switch(E){case z.EVENT_CHANNEL_UPDATED:for(var N=!1,I=0;I=T.messageOffsetTimestamp){N=!0;var x=I;if(x>0){var A=h._messages.splice(0,x);h._removeMessagesFromView(A.map(function(W){return h.keyOf(W)}),z.EVENT_MESSAGE_OFFSET_UPDATED)}break}!N&&h._messages.length>0&&h._removeMessagesFromView(h._messages.map(function(W){return h.keyOf(W)}),z.EVENT_MESSAGE_OFFSET_UPDATED);break;case z.EVENT_CHANNEL_UNMUTED:var O=R.of(h._iid).sdkState,U=_.user;O.userId===U.userId&&h._clearCheckMyMutedTimer();break;case z.EVENT_CHANNEL_MUTED:O=R.of(h._iid).sdkState,U=_.user,O.userId===U.userId&&T._myMutedRemainingTime!==-1&&h._startCheckMyMutedTimer(T._myMutedRemainingTime);break;case z.EVENT_CHANNEL_LEFT:T.isPublic&&h._clearCheckMyMutedTimer()}Ue(function(){return y(h,void 0,void 0,function(){var W;return g(this,function(P){return If(E)&&(!((W=this._handler)===null||W===void 0)&&W.onChannelUpdated)&&this._handler.onChannelUpdated(_,this.channel),[2]})})})}),h._postprocessChannelUpdateEvent(v[S],E))},onRemove:function(v,_){var E=v.indexOf(h.channel.url);E>=0&&(h._clearCheckMyMutedTimer(),Ue(function(){return y(h,void 0,void 0,function(){var S;return g(this,function(T){return!((S=this._handler)===null||S===void 0)&&S.onChannelDeleted&&this._handler.onChannelDeleted(_,this.channel.url),[2]})})}),h._postprocessChannelRemoveEvent(v[E]))}}),this._channelManager.subscribeMessageEvent(this._key,{onUpdate:function(v,_){var E,S,T=[],N=[];try{for(var I=ge(v),x=I.next();!x.done;x=I.next()){var A=x.value;A.channelUrl===h._channel.url&&(h.filter.match(A)?T.push(A):N.push(h.keyOf(A)))}}catch(O){E={error:O}}finally{try{x&&!x.done&&(S=I.return)&&S.call(I)}finally{if(E)throw E.error}}if(qs(_)){if(T.length>0)switch(_){case z.LOCAL_MESSAGE_CANCELED:case z.LOCAL_MESSAGE_RESEND_STARTED:case z.EVENT_MESSAGE_SENT_FAILED:case z.EVENT_MESSAGE_SENT_SUCCESS:case z.EVENT_MESSAGE_UPDATED:case z.EVENT_MESSAGE_THREADINFO_UPDATED:case z.EVENT_MESSAGE_REACTION_UPDATED:case z.EVENT_MESSAGE_FEEDBACK_ADDED:case z.EVENT_MESSAGE_FEEDBACK_UPDATED:case z.EVENT_MESSAGE_FEEDBACK_DELETED:case z.SYNC_MESSAGE_CHANGELOGS:h._updateMessagesToView(T,_);break;case z.EVENT_MESSAGE_SENT_PENDING:h._addMessagesToView(T,_);break;case z.EVENT_MESSAGE_RECEIVED:h.hasNext||h._addMessagesToView(T,_);break;case z.SYNC_MESSAGE_FILL:h._addMessagesToView(T,_)}N.length>0&&h._removeMessagesFromView(N,_)}h._postprocessMessageUpdateEvent(v,_)},onRemove:function(v,_){h._removeMessagesFromView(v,_),h._postprocessMessageRemoveEvent(v)},onRemoveUnsent:function(v,_){h._removeUnsentMessageFromView(v,_)},onPollChangeLogUpdate:function(v,_){h._updatePollsToView(v,_)},onPollUpdate:function(v,_){h._applyPollUpdateEventToView(v,_)},onPollVote:function(v,_){h._applyPollVoteEventToView(v,_)},onReactionUpdate:function(v,_){h._applyReactionEventToView(v,_)},onThreadInfoUpdate:function(v,_){h._applyThreadInfoEventToView(v,_)}});var f=R.of(this._iid),p=f.cacheContext,m=f.dispatcher;this._channel._updateMessageCollectionLastAccessedAt(),m.dispatch(new We({channels:[this._channel],context:{source:z.CHANNEL_LASTACCESSEDAT_UPDATED}})),!d&&this._shouldStartBackgroundSync()&&(this._backgroundSync=wL.of(this._iid,this._channel),this._backgroundSync.resume(this._startingPoint)),this._changelogSync=TL.of(this._iid,this._channel,this.changelogIncludeParams),this._changelogSync.resume(),this._pollChangelogSync=NL.of(this._iid,this._channel,this._hasPollMessage.bind(this)),this._pollChangelogSync.resume(),this._prevFill=new io(this._key,function(v){return y(h,void 0,void 0,function(){var _,E,S,T,N,I,x;return g(this,function(A){switch(A.label){case 0:return[4,this._getRemoteMessages(v,{prevLimit:this._prevResultLimit,source:z.SYNC_MESSAGE_FILL,checkingContinuousMessages:p.localCacheEnabled})];case 1:return _=A.sent(),E=_.messages,S=_.isContinuousMessages,E.length>0?(T=Math.min.apply(Math,Fe([],Me(E.map(function(O){return O.createdAt})),!1)),this._syncRange.extends(T),S&&((N=this._backgroundSync)===null||N===void 0||N.range.extends(T)),[2,{hasNext:E.length>=this._prevResultLimit&&this.viewTop0?(T=Math.max.apply(Math,Fe([],Me(E.map(function(O){return O.createdAt})),!1)),this._syncRange.extends(T),S&&((N=this._backgroundSync)===null||N===void 0||N.range.extends(T)),[2,{hasNext:!(E.length>=this._nextResultLimit&&this._hasNext)||this.viewBottom>T,nextToken:this._syncRange.bottom}]):(b.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(x=(I=p.localCacheConfig)===null||I===void 0?void 0:I.maxSize)!==null&&x!==void 0?x:0,use_local_cache:p.localCacheEnabled,starting_point:0,message_init_policy:""}})),[2,{hasNext:!1,nextToken:0}])}})})}),this._connectionEventContext=m.on(function(v){if(v instanceof Ii)switch(v.stateType){case lt.CONNECTED:Lt(function(){return y(h,void 0,void 0,function(){return g(this,function(_){return this._activate(),[2]})})});break;case lt.LOGOUT:h.dispose();break;default:h._clearCheckMyMutedTimer(),h._prevFill.stop(),h._nextFill.stop()}});var b=R.of(this._iid).statManager;b.put(new Ou({type:St.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{message:!0}}}))}return e.prototype.keyOf=function(n){return 0},Object.defineProperty(e.prototype,"changelogIncludeParams",{get:function(){return{includeReactions:!0,includeThreadInfo:!0,includeMetaArray:!0,includeParentMessageInfo:!0}},enumerable:!1,configurable:!0}),e.prototype._postprocessChannelUpdateEvent=function(n,t){},e.prototype._postprocessChannelRemoveEvent=function(n){},e.prototype._postprocessMessageUpdateEvent=function(n,t){},e.prototype._postprocessMessageRemoveEvent=function(n){},Object.defineProperty(e.prototype,"channel",{get:function(){return this._channel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"succeededMessages",{get:function(){return Fe([],Me(this._messages),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"failedMessages",{get:function(){return this._unsentMessages.filter(function(n){return n.sendingStatus===ht.FAILED})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pendingMessages",{get:function(){return this._unsentMessages.filter(function(n){return n.sendingStatus===ht.PENDING})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPrevious",{get:function(){return this._hasPrevious},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewTop",{get:function(){return Math.min.apply(Math,Fe(Fe([],Me(this._messages.map(function(n){return n.createdAt})),!1),[Number.MAX_SAFE_INTEGER],!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewBottom",{get:function(){return Math.max.apply(Math,Fe(Fe([],Me(this._messages.map(function(n){return n.createdAt})),!1),[0],!1))},enumerable:!1,configurable:!0}),e.prototype._activate=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return R.of(this._iid).logger.debug("check huge gap"),this._checkHugeGap(),[4,this._refreshChannel(z.SYNC_CHANNEL_CHANGELOGS)];case 1:return n.sent(),[2]}})})},e.prototype._replaceChannelOfCollection=function(n){this._channel.isGroupChannel()?this._channel=n:this._channel.isFeedChannel()&&(this._channel._groupChannel=n._groupChannel)},e.prototype._shouldStartBackgroundSync=function(){var n=R.of(this._iid).cacheContext;return this.channel.isGroupChannel()?n.localCacheEnabled&&!this.channel.isSuper:n.localCacheEnabled},e.prototype._setBaseMessageCollectionHandler=function(n){this._handler=n},e.prototype._filterUnderOffsetMessage=function(n){return n},e.prototype._updateChildMessagesInView=function(n){var t=[];return this._messages.forEach(function(r){r instanceof vr&&r.parentMessageId===n.messageId&&r.applyParentMessage(n)&&t.push(r)}),t},e.prototype._updatePollsToView=function(n,t){var r,i,s=this,a=[];try{for(var o=ge(n),l=o.next();!l.done;l=o.next()){var u=l.value,c=rc(this._messages,u.messageId);if(c>=0){var d=this._messages[c];d.isUserMessage()&&d.applyPoll(u),a.push(d)}}}catch(h){r={error:h}}finally{try{l&&!l.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a.length>0&&qs(t)&&Ue(function(){return y(s,void 0,void 0,function(){var h,f,p;return g(this,function(m){return h={source:t},a.length>0&&((p=(f=this._handler).onMessagesUpdated)===null||p===void 0||p.call(f,h,this.channel,a)),[2]})})}),a},e.prototype._applyPollUpdateEventToView=function(n,t){var r=this,i=rc(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollUpdateEvent(n)&&qs(t)&&Ue(function(){return y(r,void 0,void 0,function(){var a,o,l;return g(this,function(u){return a={source:t},(l=(o=this._handler)===null||o===void 0?void 0:o.onMessagesUpdated)===null||l===void 0||l.call(o,a,this.channel,[s]),[2]})})})}},e.prototype._applyPollVoteEventToView=function(n,t){var r=this,i=rc(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollVoteEvent(n)&&qs(t)&&Ue(function(){return y(r,void 0,void 0,function(){var a,o,l;return g(this,function(u){return a={source:t},(l=(o=this._handler)===null||o===void 0?void 0:o.onMessagesUpdated)===null||l===void 0||l.call(o,a,this.channel,[s]),[2]})})})}},e.prototype._applyReactionEventToView=function(n,t){var r=this,i=rc(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&qs(t)&&(s.applyReactionEvent(n),Ue(function(){return y(r,void 0,void 0,function(){var a,o,l;return g(this,function(u){return a={source:t},(l=(o=this._handler)===null||o===void 0?void 0:o.onMessagesUpdated)===null||l===void 0||l.call(o,a,this.channel,[s]),[2]})})}))}},e.prototype._applyThreadInfoEventToView=function(n,t){var r=this,i=rc(this._messages,n.targetMessageId);if(i>=0){var s=this._messages[i];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&qs(t)&&(s.applyThreadInfoUpdateEvent(n),Ue(function(){return y(r,void 0,void 0,function(){var a,o,l;return g(this,function(u){return a={source:t},(l=(o=this._handler)===null||o===void 0?void 0:o.onMessagesUpdated)===null||l===void 0||l.call(o,a,this.channel,[s]),[2]})})}))}},e.prototype._removeMessagesFromView=function(n,t){var r,i,s=this,a=[],o=[],l=function(h){var f=u._messages.findIndex(function(m){return s.keyOf(m)===h});if(f>=0){var p=u._messages[f];a.push(u.keyOf(p)),o.push(p),u._messages.splice(f,1)}},u=this;try{for(var c=ge(n),d=c.next();!d.done;d=c.next())l(d.value)}catch(h){r={error:h}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return qs(t)&&o.length>0&&Ue(function(){return y(s,void 0,void 0,function(){var h,f,p;return g(this,function(m){return h={source:t},(p=(f=this._handler)===null||f===void 0?void 0:f.onMessagesDeleted)===null||p===void 0||p.call(f,h,this.channel,a,o),[2]})})}),a},e.prototype._removeUnsentMessageFromView=function(n,t){var r=this._unsentMessages.findIndex(function(i){return i.reqId===n});r>=0&&this._unsentMessages.splice(r,1)},e.prototype._getLocalMessages=function(n,t){var r=t.prevLimit,i=r===void 0?0:r,s=t.nextLimit,a=s===void 0?0:s,o=t.inclusive,l=o===void 0||o;return y(this,void 0,void 0,function(){var u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return u=[],l?[4,this._channelManager.getExactlyMatchingMessagesForTokenFromCache(this._channel.url,n,this.filter)]:[3,2];case 1:u=p.sent(),p.label=2;case 2:return i>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,n,"prev",this.filter,i,!1)]:[3,4];case 3:return d=p.sent(),[3,5];case 4:d=[],p.label=5;case 5:return c=d,a>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,n,"next",this.filter,a,!1)]:[3,7];case 6:return f=p.sent(),[3,8];case 7:f=[],p.label=8;case 8:return h=f,[2,Fe(Fe(Fe([],Me(u),!1),Me(c),!1),Me(h),!1).sort(function(m,b){return b.createdAt-m.createdAt})]}})})},e.prototype._getRemoteMessages=function(n,t){var r=t.prevLimit,i=r===void 0?0:r,s=t.nextLimit,a=s===void 0?0:s,o=t.source,l=o===void 0?z.REQUEST_MESSAGE:o,u=t.reverse,c=u!==void 0&&u,d=t.checkingHasNext,h=d!==void 0&&d,f=t.checkingContinuousMessages,p=f!==void 0&&f;return y(this,void 0,void 0,function(){var m,b;return g(this,function(v){switch(v.label){case 0:return m=Ln.of(this._iid),i>0||a>0?[4,m._getMessagesByTimestampForCollection(this._channel.url,this._channel.channelType,n,Ie(M(M(M({},this.filter),VE),{isInclusive:!0,reverse:c,prevResultSize:i,nextResultSize:a})),l,h,p)]:[3,2];case 1:return b=v.sent(),[3,3];case 2:b={messages:[],isContinuousMessages:!1},v.label=3;case 3:return[2,b]}})})},e.prototype._checkHugeGap=function(){var n,t,r,i,s;return y(this,void 0,void 0,function(){var a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x,A,O,U,W,P,J,V=this;return g(this,function(H){switch(H.label){case 0:return a=R.of(this._iid),o=a.dispatcher,l=a.requestQueue,u=a.cacheContext,c=a.statManager,d=a.logger,this._messages.length>0?(h=this._syncRange.top,f=this.viewTop,p=this._syncRange.bottom,m=this.hasNext?this.viewBottom:Number.MAX_SAFE_INTEGER,[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,f,h)]):[3,8];case 1:return b=H.sent(),[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,p,m)];case 2:v=H.sent(),H.label=3;case 3:return H.trys.push([3,5,6,7]),[4,gp(function(){return y(V,void 0,void 0,function(){var we,q,ee,ie,Ne,X,oe,te,ce,$,ke,B,ae,de,Ee,se,he,fe=this;return g(this,function(ve){switch(ve.label){case 0:return we=new IL(M(M({channelUrl:this._channel.url,channelType:this._channel.channelType,prevStart:f,prevEnd:h,prevCount:b,nextStart:p,nextEnd:m,nextCount:v,checkingContinuousMessages:u.localCacheEnabled},this.filter),VE)),[4,l.send(we)];case 1:return q=ve.sent(),ee=q.as(AL),ie=ee.isHugeGap,Ne=ee.prevMessages,X=Ne===void 0?[]:Ne,oe=ee.prevHasMore,te=ee.isContinuousPrevMessages,ce=ee.nextMessages,$=ce===void 0?[]:ce,ke=ee.nextHasmore,B=ee.isContinuousNextMessages,ie?Ue(function(){return y(fe,void 0,void 0,function(){var me;return g(this,function(pe){return!((me=this._handler)===null||me===void 0)&&me.onHugeGapDetected&&this._handler.onHugeGapDetected(),[2]})})}):(ae=this.viewTop,de=this.viewBottom,Ee=Math.min.apply(Math,Fe([Number.MAX_SAFE_INTEGER,ae],Me(X.map(function(me){return me.createdAt})),!1)),se=Math.max.apply(Math,Fe([0,de],Me($.map(function(me){return me.createdAt})),!1)),o.dispatch(new wt({messages:X,source:z.SYNC_MESSAGE_FILL})),o.dispatch(new wt({messages:$,source:z.SYNC_MESSAGE_FILL})),this._syncRange.extends(Ee,se),(te||B)&&((he=this._backgroundSync)===null||he===void 0||he.range.extends(Ee,se)),oe&&this._prevFill.start(Ee),ke&&this._nextFill.start(se)),[2]}})})},1)];case 4:return H.sent(),[3,7];case 5:return _=H.sent(),d.debug("Failed HugeGap Check ",_),[3,7];case 6:return c.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(t=(n=u.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:u.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[3,13];case 8:E=Date.now(),H.label=9;case 9:return H.trys.push([9,11,12,13]),[4,this._getRemoteMessages(E,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit,source:z.SYNC_MESSAGE_FILL,checkingHasNext:!0,checkingContinuousMessages:u.localCacheEnabled})];case 10:if(S=H.sent(),T=S.messages,N=S.isContinuousMessages,I=S.hasNext,T.length>0){for(x=T.map(function(we){return we.createdAt}),A=0,O=0,U=0;U=E&&O++;this._hasPrevious=A>=this._prevResultLimit,this._hasNext=I??O>=this._nextResultLimit,(J=this._syncRange).extends.apply(J,Fe([],Me(x),!1)),N&&((r=this._backgroundSync)===null||r===void 0||r.range.extends(this._syncRange.top,this._syncRange.bottom)),this._addMessagesToView(T,z.SYNC_MESSAGE_FILL)}else this._hasPrevious=!1,this._hasNext=!1;return[3,13];case 11:return(P=H.sent())instanceof L&&P.code===Ae.NOT_FOUND_IN_DATABASE&&(this._hasPrevious=!1,this._hasNext=!1),[3,13];case 12:return c.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(s=(i=u.localCacheConfig)===null||i===void 0?void 0:i.maxSize)!==null&&s!==void 0?s:0,use_local_cache:u.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 13:return[2]}})})},e.prototype._loadUnsentMessages=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=this,[4,this._channelManager.getUnsentMessagesFromCache(this._channel.url,this.filter)];case 1:return n._unsentMessages=t.sent(),[2]}})})},e.prototype._hasPollMessage=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._channelManager.getPollMessagesFromCache(this._channel.url,Date.now()+6e5,this.filter,1)];case 1:return n.sent().length>0?[2,!0]:[2,!1]}})})},e.prototype._refreshChannel=function(n){var t=this;Lt(function(){return y(t,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._channelManager.refreshChannel(this.channel.url,!0,n)];case 1:return r.sent(),[2]}})})})},e.prototype._startCheckMyMutedTimer=function(n){var t=this;this._clearCheckMyMutedTimer(),this._checkMyMutedStateTimer=setTimeout(function(){return y(t,void 0,void 0,function(){var r,i,s,a=this;return g(this,function(o){switch(o.label){case 0:this._checkMyMutedStateTimer=void 0,r=!0,o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,this._channel.getMyMutedInfo()];case 2:return i=o.sent(),r=!i.isMuted,[3,5];case 3:return o.sent(),r=!0,[3,5];case 4:return r&&(s=R.of(this._iid).sessionManager,this.channel._runIfHandleableWithGroupChannel(function(l){var u,c;l.myMutedState=Ns.UNMUTED;var d={source:z.EVENT_CHANNEL_UNMUTED,user:s.currentUser};(c=(u=a._handler)===null||u===void 0?void 0:u.onChannelUpdated)===null||c===void 0||c.call(u,d,a.channel)})),[7];case 5:return[2]}})})},n+1e3)},e.prototype._clearCheckMyMutedTimer=function(){this._checkMyMutedStateTimer&&(clearTimeout(this._checkMyMutedStateTimer),this._checkMyMutedStateTimer=void 0)},e.prototype.initialize=function(n){var t=this,r=new ML;this._messages=[],this._unsentMessages=[],this._syncRange=new Ms({}),this._hasNext=!0,this._hasPrevious=!0,this._refreshChannel(z.REFRESH_CHANNEL);var i=R.of(this._iid),s=i.cacheContext,a=i.statManager;return n===S0.CACHE_AND_REPLACE_BY_API&&this._getLocalMessages(this._startingPoint,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit}).then(function(o){return y(t,void 0,void 0,function(){var l;return g(this,function(u){switch(u.label){case 0:return l=this._filterUnderOffsetMessage(o),this._addMessagesToView(l,z.REQUEST_MESSAGE),[4,this._loadUnsentMessages()];case 1:return u.sent(),r._invokeResponse("local",null,l),[2]}})})}).catch(function(o){if(zr(o))throw o;r._invokeResponse("local",o,null)}).finally(function(){var o=R.of(t._iid).cacheContext;t._getRemoteMessages(t._startingPoint,{prevLimit:t._prevResultLimit,nextLimit:t._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:o.localCacheEnabled}).then(function(l){var u,c,d,h,f,p,m=l.messages,b=l.isContinuousMessages,v=l.hasNext,_=t._filterUnderOffsetMessage(m),E=!0;if(t._messages.length===_.length){for(var S=t._messages.map(function(O){return t.keyOf(O)}),T=0;T<_.length;T++)if(!S.includes(t.keyOf(_[T]))){E=!1;break}}else E=!1;if(t._messages=[],_.length>0){var N=_.map(function(O){return O.createdAt}),I=0,x=0;for(T=0;Tt._startingPoint&&x++}t._hasPrevious=I>=t._prevResultLimit,t._hasNext=v??x>=t._nextResultLimit,(u=t._syncRange).extends.apply(u,Fe([],Me(_.map(function(O){return O.createdAt})),!1)),b&&((c=t._backgroundSync)===null||c===void 0||c.range.extends(t._syncRange.top,t._syncRange.bottom)),t._addMessagesToView(_,z.REQUEST_MESSAGE)}else t._hasPrevious=!1,t._hasNext=!1;a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:t.channel.url,starting_point:t._startingPoint,measured_on:"initial_load",event:E?"cache_hit":"cache_miss",max_db_size:(h=(d=o.localCacheConfig)===null||d===void 0?void 0:d.maxSize)!==null&&h!==void 0?h:0,message_init_policy:n,use_local_cache:o.localCacheEnabled,collection_id:t._key}})),a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:t.channel.url,starting_point:t._startingPoint,measured_on:"initial_load",event:"cache_fetch",max_db_size:(p=(f=o.localCacheConfig)===null||f===void 0?void 0:f.maxSize)!==null&&p!==void 0?p:0,message_init_policy:n,use_local_cache:o.localCacheEnabled,collection_id:t._key}})),r._invokeResponse("remote",null,_)}).catch(function(l){if(zr(l))throw l;r._invokeResponse("remote",l,null)})}),a.put(new Ou({type:St.FEATURE_LOCALCACHE,data:{use_local_cache:s.localCacheEnabled,collection_interface:{message_init_policy:n}}})),r},e.prototype.loadPrevious=function(){var n,t,r;return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Ae.COLLECTION_DISPOSED,message:"Collection has been disposed."});return i=R.of(this._iid),s=i.cacheContext,a=i.statManager,o=i.logger,this._hasPrevious?this._isLoadingPrevious?(o.warn("Messages are already fetching."),[2,[]]):(this._isLoadingPrevious=!0,l=this.viewTop,u=[],[4,Lt(function(){return y(h,void 0,void 0,function(){var p;return g(this,function(m){switch(m.label){case 0:return p=this._filterUnderOffsetMessage,[4,this._getLocalMessages(l,{prevLimit:this._prevResultLimit,inclusive:!1})];case 1:return u=p.apply(this,[m.sent()]),[2]}})})})]):[2,[]];case 1:return f.sent(),c=u.length>=this._prevResultLimit,a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:s.localCacheEnabled&&c?"cache_hit":"cache_miss",max_db_size:(t=(n=s.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),c&&(!((r=this._backgroundSync)===null||r===void 0)&&r.isWrappingMessages(u))?[3,3]:(d=!1,[4,Lt(function(){return y(h,void 0,void 0,function(){var p,m,b,v,_,E,S,T=this;return g(this,function(N){switch(N.label){case 0:return p=R.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{prevLimit:this._prevResultLimit,reverse:!0,checkingContinuousMessages:p.localCacheEnabled})];case 1:return m=N.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,Fe([],Me(u.map(function(I){return I.createdAt})),!1)),!((v=this._backgroundSync)===null||v===void 0)&&v.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.top))),u=u.filter(function(I){return li(T._messages,I)<0}),this._hasPrevious=u.length>=this._prevResultLimit,d&&a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:"cache_fetch",max_db_size:(S=(E=p.localCacheConfig)===null||E===void 0?void 0:E.maxSize)!==null&&S!==void 0?S:0,use_local_cache:p.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(u,z.REQUEST_MESSAGE),[3,4];case 3:this._hasPrevious=u.length>=this._prevResultLimit,u.length>0&&this._addMessagesToView(u,z.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingPrevious=!1,[2,u]}})})},e.prototype.loadNext=function(){var n,t,r;return y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Ae.COLLECTION_DISPOSED,message:"Collection has been disposed."});return i=R.of(this._iid),s=i.cacheContext,a=i.statManager,o=i.logger,this._hasNext?this._isLoadingNext?(o.warn("Messages are already fetching."),[2,[]]):(this._isLoadingNext=!0,l=this.viewBottom,u=[],[4,Lt(function(){return y(h,void 0,void 0,function(){var p;return g(this,function(m){switch(m.label){case 0:return p=this._filterUnderOffsetMessage,[4,this._getLocalMessages(l,{nextLimit:this._nextResultLimit,inclusive:!1})];case 1:return u=p.apply(this,[m.sent()]),[2]}})})})]):[2,[]];case 1:return f.sent(),c=u.length>=this._nextResultLimit,a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:s.localCacheEnabled&&c?"cache_hit":"cache_miss",max_db_size:(t=(n=s.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),c&&(!((r=this._backgroundSync)===null||r===void 0)&&r.isWrappingMessages(u))?[3,3]:(d=!1,[4,Lt(function(){return y(h,void 0,void 0,function(){var p,m,b,v,_,E,S,T,N=this;return g(this,function(I){switch(I.label){case 0:return p=R.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{nextLimit:this._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:p.localCacheEnabled})];case 1:return m=I.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,Fe([],Me(u.map(function(x){return x.createdAt})),!1)),!((v=this._backgroundSync)===null||v===void 0)&&v.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.bottom))),u=u.filter(function(x){return li(N._messages,x)<0}),this._hasNext=(E=m.hasNext)!==null&&E!==void 0?E:u.length>=this._nextResultLimit,d&&a.put(new Vt({type:St.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:"cache_fetch",max_db_size:(T=(S=p.localCacheConfig)===null||S===void 0?void 0:S.maxSize)!==null&&T!==void 0?T:0,use_local_cache:p.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(u,z.REQUEST_MESSAGE),[3,4];case 3:this._hasNext=u.length>=this._nextResultLimit,u.length>0&&this._addMessagesToView(u,z.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingNext=!1,[2,u]}})})},e.prototype.removeFailedMessage=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:if(this._isDisposed)throw new L({code:Ae.COLLECTION_DISPOSED,message:"Collection has been disposed."});return[4,this._channelManager.removeFailedMessageFromCache(n)];case 1:return r.sent(),(t=this._unsentMessages.findIndex(function(i){return i.reqId===n}))>-1&&this._unsentMessages.splice(t,1),[2]}})})},e.prototype.dispose=function(){var n,t,r,i=this;if(!this._isDisposed){this._isDisposed=!0;var s=R.of(this._iid),a=s.cacheContext,o=s.dispatcher;this._messages=[],this._clearCheckMyMutedTimer(),this._channel._runIfHandleableWithGroupChannel(function(l){l.myMemberState!==qt.NONE&&(i._channel._updateMessageCollectionLastAccessedAt(),o.dispatch(new We({channels:[i._channel],context:{source:z.CHANNEL_LASTACCESSEDAT_UPDATED}})))}),a.localCacheEnabled&&(this._prevFill.stop(),this._nextFill.stop()),(n=this._backgroundSync)===null||n===void 0||n.close(),(t=this._changelogSync)===null||t===void 0||t.close(),(r=this._pollChangelogSync)===null||r===void 0||r.close(),this._channelManager.unsubscribeChannelEvent(this._key),this._channelManager.unsubscribeMessageEvent(this._key),this._connectionEventContext&&this._connectionEventContext.close()}},e}(),OL=function(e){function n(t,r){return e.call(this,t,M(M({},r),{channelManager:Rn.of(t)}))||this}return w(n,e),n.prototype.keyOf=function(t){return t.messageId},n.prototype.initialize=function(t){var r=this;return Lt(function(){return y(r,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return[4,this.channel.getMyMutedInfo()];case 1:return(i=s.sent()).isMuted&&i.remainingDuration!==-1&&this._startCheckMyMutedTimer(i.remainingDuration),[2]}})})}),e.prototype.initialize.call(this,t)},n.prototype.setMessageCollectionHandler=function(t){this._setBaseMessageCollectionHandler(t)},n.prototype._activate=function(){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return[4,e.prototype._activate.call(this)];case 1:return r.sent(),[4,Lt(function(){return y(t,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return[4,this.channel.getMyMutedInfo()];case 1:return(i=s.sent()).isMuted&&i.remainingDuration!==-1&&this._startCheckMyMutedTimer(i.remainingDuration),[2]}})})})];case 2:return r.sent(),[2]}})})},n.prototype._addMessagesToView=function(t,r){var i,s,a=this,o=this._filterUnderOffsetMessage(t),l=[],u=[];try{for(var c=ge(o),d=c.next();!d.done;d=c.next()){var h=d.value;if(r===z.SYNC_MESSAGE_FILL)if(h.messageId>0){if((b=li(this._messages,h))<0){li(this._unsentMessages,h)<0&&l.push(h);var f=V_(this._messages,h);this._messages.splice(f,0,h)}}else h instanceof Ht&&(b=li(this._unsentMessages,h))<0&&li(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h));else if(h.messageId>0){if((b=li(this._messages,h))<0){var p=li(this._unsentMessages,h);p<0?l.push(h):(this._unsentMessages.splice(p,1),u.push(h)),f=V_(this._messages,h),this._messages.splice(f,0,h)}else u.push(h),this._messages[b]=h;if(h.updatedAt>0){var m=this._updateChildMessagesInView(h);u.push.apply(u,Fe([],Me(m),!1))}}else if(h instanceof Ht){var b;(b=li(this._unsentMessages,h))<0?li(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h)):(u.push(h),this._unsentMessages[b]=h)}}}catch(v){i={error:v}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}qs(r)&&Ue(function(){return y(a,void 0,void 0,function(){var v,_,E,S,T;return g(this,function(N){return v={source:r},l.length>0&&((E=(_=this._handler)===null||_===void 0?void 0:_.onMessagesAdded)===null||E===void 0||E.call(_,v,this.channel,l)),u.length>0&&((T=(S=this._handler)===null||S===void 0?void 0:S.onMessagesUpdated)===null||T===void 0||T.call(S,v,this.channel,u)),[2]})})})},n.prototype._updateMessagesToView=function(t,r){var i,s,a=this,o=[],l=[],u=[];try{for(var c=ge(t),d=c.next();!d.done;d=c.next()){var h,f=d.value;if(f.messageId>0)if((h=li(this._messages,f))>=0)l.push(f),this._messages[h]=f;else{var p=li(this._unsentMessages,f);if(p>=0){var m=Me(this._unsentMessages.splice(p,1),1)[0];if(this.hasNext&&m)u.push(m);else{l.push(f);var b=V_(this._messages,f);this._messages.splice(b,0,f)}}else{var v=this._messages.map(function(_){return _.createdAt});(f.createdAtMath.max.apply(Math,Fe([],Me(v),!1))&&!this._hasNext)&&o.push(f)}}else f instanceof Ht&&(h=li(this._unsentMessages,f))>=0&&(l.push(f),this._unsentMessages[h]=f)}}catch(_){i={error:_}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}return qs(r)&&Ue(function(){return y(a,void 0,void 0,function(){var _,E,S,T,N;return g(this,function(I){return _={source:r},l.length>0?(S=(E=this._handler)===null||E===void 0?void 0:E.onMessagesUpdated)===null||S===void 0||S.call(E,_,this.channel,l):u.length>0?(N=(T=this._handler)===null||T===void 0?void 0:T.onMessagesDeleted)===null||N===void 0||N.call(T,_,this.channel,[],u):o.length>0&&this._addMessagesToView(o,r),[2]})})}),l},n}(xL),RL={coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isPublic:void 0,isDiscoverable:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},kL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.token,a=t.limit,o=t.order,l=t.mutedMemberFilter,u=t.memberStateFilter,c=t.nicknameStartsWithFilter,d=t.operatorFilter;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/members"),r.params={token:s,limit:a,order:o,muted_member_filter:l,member_state_filter:u,nickname_startswith:c,operator_filter:d,show_member_is_muted:!0,show_read_receipt:!0,show_delivery_receipt:!0},r}return w(n,e),n}(Z),LL=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.members=[];var s=r.next,a=r.members;return i.token=s,a&&a.length>0&&(i.members=a.map(function(o){return new mi(t,o)})),i}return w(n,e),n}(le);(function(e){e.ALL="all",e.MUTED="muted",e.UNMUTED="unmuted"})(nd||(nd={})),function(e){e.MEMBER_NICKNAME_ALPHABETICAL="member_nickname_alphabetical",e.OPERATOR_THEN_MEMBER_ALPHABETICAL="operator_then_member_alphabetical"}(rd||(rd={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(id||(id={}));var DL=function(e){function n(t,r,i){var s,a,o,l,u=this;return(u=e.call(this,t,r,et.GROUP,i)||this).mutedMemberFilter=nd.ALL,u.memberStateFilter=id.ALL,u.nicknameStartsWithFilter=null,u.operatorFilter=b0.ALL,u.order=rd.MEMBER_NICKNAME_ALPHABETICAL,u.mutedMemberFilter=(s=i.mutedMemberFilter)!==null&&s!==void 0?s:nd.ALL,u.memberStateFilter=(a=i.memberStateFilter)!==null&&a!==void 0?a:id.ALL,u.nicknameStartsWithFilter=(o=i.nicknameStartsWithFilter)!==null&&o!==void 0?o:null,u.order=(l=i.order)!==null&&l!==void 0?l:rd.MEMBER_NICKNAME_ALPHABETICAL,u}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&Ve(nd,this.mutedMemberFilter)&&Ve(id,this.memberStateFilter)&&(k("string",this.nicknameStartsWithFilter)||this.nicknameStartsWithFilter===null)&&Ve(b0,this.operatorFilter)&&Ve(rd,this.order)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new kL(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(LL),a=s.members,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca),UL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,a=t.accessCode;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/accept"),r.params={user_id:s,access_code:a},r}return w(n,e),n}(Z),PL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i.channel.myMemberState=qt.JOINED,i}return w(n,e),n}(le),FL=function(e){function n(t){var r=this,i=t.channelUrl,s=t.isDistinct,a=t.isPublic,o=t.isDiscoverable,l=t.coverUrl,u=t.coverImage,c=t.accessCode,d=t.name,h=t.data,f=t.customType,p=t.operatorUserIds,m=t.messageSurvivalSeconds;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i)),r.params=be({is_distinct:s,is_public:a,is_discoverable:o,name:d,data:h,custom_type:f,cover_url:l,cover_file:u,access_code:c,operator_ids:p,message_survival_seconds:m}),r}return w(n,e),n}(Z),HL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new Si(t,r),i}return w(n,e),n}(le),jL=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(cr,"/").concat(encodeURIComponent(i)),r}return w(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}w(n,e)})(le);var BL=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Y.DELETE,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/hide"),r}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var $L=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.countPreference,a=e.call(this)||this;return a.method=Y.PUT,a.path="".concat(tt,"/").concat(encodeURIComponent(r),"/count_preference/").concat(encodeURIComponent(i)),a.params={count_preference:s},a}return w(n,e),n}(Z),GL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.countPreference=r.count_preference,i}return w(n,e),n}(le),zL=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Y.PUT,r.path="".concat(cr,"/").concat(encodeURIComponent(i),"/reset_user_history"),r}return w(n,e),n}(Z),VL=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts_message_offset;return i.messageOffsetTimestamp=s,i}return w(n,e),n}(le),qL=M(M({},A2),{scheduledAt:void 0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),WL=M(M({},aT),{scheduledAt:void 0}),KL=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var a=[];t.mentionType===lr.USERS&&(t.mentionedUserIds?a=t.mentionedUserIds:t.mentionedUsers&&(a=t.mentionedUsers.map(function(c){return c.userId})));var o=t.channelType,l=t.channelUrl,u=t.scheduledMessageId;return s.method=Y.PUT,s.path="".concat(nt(o),"/").concat(encodeURIComponent(l),"/scheduled_messages/").concat(encodeURIComponent(u)),s.params=be(Ie({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Iu.FILE,url:t.fileUrl,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(c){return da.payloadify(c)}),custom_type:t.customType,data:t.data,require_auth:t.requireAuth,mention_type:t.mentionType,mentioned_user_ids:a,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(c){return br.payloadify(c)}),apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption})),s}return w(n,e),n}(Z),QL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new nn(t,r),i}return w(n,e),n}(le),YL=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===lr.USERS&&(t.mentionedUserIds?s=t.mentionedUserIds:t.mentionedUsers&&(s=t.mentionedUsers.map(function(u){return u.userId})));var a=t.channelType,o=t.channelUrl,l=t.scheduledMessageId;return i.method=Y.PUT,i.path="".concat(nt(a),"/").concat(encodeURIComponent(o),"/scheduled_messages/").concat(encodeURIComponent(l)),i.params=be(Ie({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Iu.USER,message:t.message,custom_type:t.customType,data:t.data,mention_type:t.mentionType,mentioned_user_ids:s,sorted_metaarray:(r=t.metaArrays)===null||r===void 0?void 0:r.map(function(u){return br.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?qi.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new sr(t,r),i}w(n,e)})(le);var ZL=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,a=t.scheduledMessageId;return r.method=Y.DELETE,r.path="".concat(nt(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(a)),r}return w(n,e),n}(Z),XL=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,a=t.scheduledMessageId;return r.method=Y.POST,r.path="".concat(nt(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(a),"/send_now"),r}return w(n,e),n}(Z),JL=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.pushTriggerOption,a=e.call(this)||this;return a.method=Y.PUT,a.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),a.params={push_trigger_option:s},a}return w(n,e),n}(Z),eD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i.enabled=r.enable,i}return w(n,e),n}(le),tD=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=e.call(this)||this;return s.method=Y.GET,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),s}return w(n,e),n}(Z),nD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i.enabled=r.enable,i}return w(n,e),n}(le),rD=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=e.call(this)||this;return a.method=Y.POST,a.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),a}return w(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}w(n,e)})(le);var iD=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,a=e.call(this)||this;return a.method=Y.DELETE,a.path="".concat(nt(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),a}return w(n,e),n}(Z);(function(e){function n(t,r){return e.call(this,t,r)||this}w(n,e)})(le);var fi,mr,sD=function(e){function n(t,r){var i=e.call(this,t)||this;return i.message=null,i.message=wr(t,r.message),i}return w(n,e),n}(Jn),aD=function(e){function n(t){var r=this,i=t.channelType,s=t.channelUrl,a=t.limit,o=t.token,l=t.includeReactions,u=t.includeMetaArray,c=t.includeParentMessageInfo,d=t.includeThreadInfo,h=t.includePollDetails;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(nt(i),"/").concat(encodeURIComponent(s),"/pinned_messages"),r.params=be({limit:a,token:o,include_reactions:l,with_sorted_meta_array:u,include_thread_info:d,include_parent_message_info:c,include_poll_details:h}),r}return w(n,e),n}(Z),oD=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.pinned_messages,a=r.has_more,o=r.next;return i.pinnedMessages=s.map(function(l){return new sD(t,l)}),i.hasMore=a,i.token=o,i}return w(n,e),n}(le),lD=function(e){function n(t,r,i,s){var a=e.call(this,t,r,i,s)||this;return a.includeMetaArray=s.includeMetaArray,a.includeReactions=s.includeReactions,a.includeParentMessageInfo=s.includeParentMessageInfo,a.includeThreadInfo=s.includeThreadInfo,a.includePollDetails=s.includePollDetails,a}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeMetaArray,!0)&&k("boolean",this.includeReactions,!0)&&k("boolean",this.includeParentMessageInfo,!0)&&k("boolean",this.includeThreadInfo,!0)&&k("boolean",this.includePollDetails,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new aD(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=u.sent(),s=i.as(oD),a=s.pinnedMessages,o=s.hasMore,l=s.token,this._token=l,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(ca);(function(e){e.ALL="all",e.UNREAD_MESSAGE_COUNT_ONLY="unread_message_count_only",e.UNREAD_MENTION_COUNT_ONLY="unread_mention_count_only",e.OFF="off"})(fi||(fi={})),function(e){e.UNHIDDEN="unhidden",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(mr||(mr={}));var Si=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x,A=this;return(A=e.call(this,t,r)||this)._unreadMemberStateMap=new Map,A._undeliveredMemberStateMap=new Map,A._typingStatus=new Map,A._lastMemberCountUpdated=0,A._typingStarted=0,A._typingEnded=0,A.isDistinct=!1,A.isSuper=!1,A.isBroadcast=!1,A.isExclusive=!1,A.isPublic=!1,A.isDiscoverable=!0,A.isChatNotification=!1,A.isAccessCodeRequired=!1,A.isPushEnabled=!1,A.unreadMessageCount=0,A.unreadMentionCount=0,A.totalUnreadReplyCount=0,A.members=[],A.memberCount=0,A.joinedMemberCount=0,A.hiddenState=mr.UNHIDDEN,A.lastMessage=null,A.messageOffsetTimestamp=0,A.messageSurvivalSeconds=-1,A.myMemberState=qt.NONE,A.myRole=Bi.NONE,A.myMutedState=Ns.UNMUTED,A.myLastRead=0,A.myCountPreference=fi.ALL,A.myPushTriggerOption=Ao.DEFAULT,A.inviter=null,A.invitedAt=0,A.joinedAt=0,A.pinnedMessageIds=[],A.lastPinnedMessage=null,A._pinnedMessagesUpdatedAt=0,A._myMutedRemainingTime=-1,A.channelType=et.GROUP,A.isDistinct=(s=r.is_distinct)!==null&&s!==void 0&&s,A.isSuper=(a=r.is_super)!==null&&a!==void 0&&a,A.isBroadcast=(o=r.is_broadcast)!==null&&o!==void 0&&o,A.isExclusive=(l=r.is_exclusive)!==null&&l!==void 0&&l,A.isPublic=(u=r.is_public)!==null&&u!==void 0&&u,A.isDiscoverable=(c=r.is_discoverable)!==null&&c!==void 0?c:A.isPublic,A.isChatNotification=(d=r.is_chat_notification)!==null&&d!==void 0&&d,A.isAccessCodeRequired=(h=r.is_access_code_required)!==null&&h!==void 0&&h,A.isPushEnabled=(f=r.is_push_enabled)!==null&&f!==void 0&&f,Array.isArray(r.members)&&(i=A.members).push.apply(i,Fe([],Me(r.members.map(function(O){return new mi(A._iid,O)})),!1)),A.memberCount=(p=r.member_count)!==null&&p!==void 0?p:0,A.joinedMemberCount=(m=r.joined_member_count)!==null&&m!==void 0?m:0,A.hiddenState=Ve(mr,r.hidden_state)?r.hidden_state:mr.UNHIDDEN,A.messageOffsetTimestamp=(b=r.ts_message_offset)!==null&&b!==void 0?b:0,A.messageSurvivalSeconds=(v=r.message_survival_seconds)!==null&&v!==void 0?v:-1,A.lastMessage=r.last_message?wr(A._iid,M({channel_type:A.channelType},r.last_message)):null,r.read_receipt&&Object.keys(r.read_receipt).forEach(function(O){k("number",r.read_receipt[O])&&A._updateUnreadMemberState(O,r.read_receipt[O])}),r.delivery_receipt&&Object.keys(r.delivery_receipt).forEach(function(O){k("number",r.delivery_receipt[O])&&A._updateUndeliveredMemberState(O,r.delivery_receipt[O])}),A.myMemberState=Ve(qt,r.member_state)?r.member_state:qt.NONE,A.myRole=Ve(Bi,r.my_role)?r.my_role:Bi.NONE,Ve(Ns,r.is_muted)?A.myMutedState=r.is_muted:k("boolean",r.is_muted)?A.myMutedState=r.is_muted?Ns.MUTED:Ns.UNMUTED:A.myMutedState=Ns.UNMUTED,A.myCountPreference=Ve(fi,r.count_preference)?r.count_preference:fi.ALL,A.myPushTriggerOption=Ve(Ao,r.push_trigger_option)?r.push_trigger_option:Ao.ALL,A.myLastRead=(_=r.user_last_read)!==null&&_!==void 0?_:0,A.inviter=r.inviter?new Ze(A._iid,r.inviter):null,A.invitedAt=(E=r.invited_at)!==null&&E!==void 0?E:0,A.joinedAt=(S=r.joined_ts)!==null&&S!==void 0?S:0,A._updateUnreadCount((T=r.unread_message_count)!==null&&T!==void 0?T:0,(N=r.unread_mention_count)!==null&&N!==void 0?N:0),A.totalUnreadReplyCount=(I=r.total_unread_thread_message_count)!==null&&I!==void 0?I:0,A.pinnedMessageIds=(x=r.pinned_message_ids)!==null&&x!==void 0?x:[],A.lastPinnedMessage=r.latest_pinned_message?wr(A._iid,M({channel_type:A.channelType},r.latest_pinned_message)):null,A}return w(n,e),Object.defineProperty(n.prototype,"isHidden",{get:function(){return this.hiddenState!==mr.UNHIDDEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isTyping",{get:function(){return this._typingStatus.size>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cachedUnreadMemberState",{get:function(){var t,r,i={};try{for(var s=ge(this._unreadMemberStateMap),a=s.next();!a.done;a=s.next()){var o=Me(a.value,2),l=o[0],u=o[1];i[l]=u}}catch(c){t={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cachedUndeliveredMemberState",{get:function(){var t,r,i={};try{for(var s=ge(this._undeliveredMemberStateMap),a=s.next();!a.done;a=s.next()){var o=Me(a.value,2),l=o[0],u=o[1];i[l]=u}}catch(c){t={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},enumerable:!1,configurable:!0}),n.payloadify=function(t){return be(Ie(M(M({},e.payloadify.call(this,t)),{is_access_code_required:t.isAccessCodeRequired,is_distinct:t.isDistinct,is_super:t.isSuper,is_broadcast:t.isBroadcast,is_exclusive:t.isExclusive,is_public:t.isPublic,is_discoverable:t.isDiscoverable,is_muted:t.myMutedState,is_push_enabled:t.isPushEnabled,unread_message_count:t.unreadMessageCount,unread_mention_count:t.unreadMentionCount,total_unread_thread_message_count:t.totalUnreadReplyCount,push_trigger_option:t.myPushTriggerOption,count_preference:t.myCountPreference,hidden_state:t.hiddenState,member_count:t.memberCount,joined_member_count:t.joinedMemberCount,member_state:t.myMemberState,my_role:t.myRole,user_last_read:t.myLastRead,ts_message_offset:t.messageOffsetTimestamp,message_survival_seconds:t.messageSurvivalSeconds,read_receipt:t.cachedUnreadMemberState,delivery_receipt:t.cachedUndeliveredMemberState,members:t.members.map(function(r){return mi.payloadify(r)}),last_message:t.lastMessage?vE(t.lastMessage):null,inviter:t.inviter?Ze.payloadify(t.inviter):null,invited_at:t.invitedAt,joined_ts:t.joinedAt,pinned_message_ids:t.pinnedMessageIds,latest_pinned_message:t.lastPinnedMessage?vE(t.lastPinnedMessage):null})))},n.prototype._shouldUpdateLastMessageWith=function(t){if(t.silent)return!1;var r=R.of(this._iid).appInfo;switch(r==null?void 0:r.lastMessageThreadingPolicy){case Ro.NONE:case Ro.INCLUDE_REPLY:break;case Ro.EXCLUDE_REPLY:if(t.parentMessageId>0)return!1;break;case Ro.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Ht&&t.parentMessageId>0&&!t.replyToChannel)return!1}return!this.lastMessage||this.lastMessage.createdAt0)return!1;break;case Oo.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Ht&&t.parentMessageId>0&&!t.replyToChannel)return!1}return!0},n.prototype._updateLastMessage=function(t){return!!this._shouldUpdateLastMessageWith(t)&&(this.lastMessage=t,!0)},n.prototype._updateUnreadCount=function(t,r){if(typeof t=="number"&&t>=0)if(this.myCountPreference===fi.ALL||this.myCountPreference===fi.UNREAD_MESSAGE_COUNT_ONLY)if(this.isExclusive||this.isSuper||this.isBroadcast){var i=R.of(this._iid).maxSuperGroupChannelUnreadCount;this.unreadMessageCount=i&&t>=i?i:t}else this.unreadMessageCount=t;else this.unreadMessageCount=0;else this.unreadMessageCount=0;typeof r=="number"&&r>=0&&(this.myCountPreference===fi.ALL||this.myCountPreference===fi.UNREAD_MENTION_COUNT_ONLY)?this.unreadMentionCount=r:this.unreadMentionCount=0},n.prototype._updateUnreadMemberState=function(t,r){var i=this._unreadMemberStateMap.get(t);return(!i||i0?this._typingStatus.set(t.userId,{user:t,ts:r}):this._typingStatus.delete(t.userId)},n.prototype._clearTypingStatus=function(){this._typingStatus.clear(),this._typingStarted=0,this._typingEnded=0},n.prototype._setLatestMemberCount=function(t,r,i){var s=!1;return i>=this._lastMemberCountUpdated&&(this._lastMemberCountUpdated=i,s=t!==this.memberCount||r!==this.joinedMemberCount,this.memberCount=t,this.joinedMemberCount=r),s},n.prototype.isReadMessage=function(t){var r=R.of(this._iid).sdkState,i=this._unreadMemberStateMap.get(r.userId);return!!i&&i>=t.createdAt},n.prototype.serialize=function(){var t=this;return nh(this,function(r){r.cachedUnreadMemberState=t.cachedUnreadMemberState,r.cachedUndeliveredMemberState=t.cachedUndeliveredMemberState})},n.prototype.createMessageCollection=function(t){return t===void 0&&(t={}),new OL(this._iid,M(M({},t),{channel:this}))},n.prototype.createMemberListQuery=function(t){return t===void 0&&(t={}),new DL(this._iid,this.url,t)},n.prototype.createThreadedParentMessageListQuery=function(t){return t===void 0&&(t={}),new yk(this._iid,this.url,this.channelType,t)},n.prototype.createPinnedMessageListQuery=function(t){return t===void 0&&(t={}),new lD(this._iid,this.url,this.channelType,t)},n.prototype.addMember=function(t,r){if(r===void 0&&(r=0),!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var i=this.members.findIndex(function(a){return a.userId===t.userId});if(i>-1){var s=this.members[i];s.state===qt.JOINED&&(t.state=s.state),this.members.splice(i,1),this.memberCount--}this.members.push(t),this.memberCount++,this._updateUnreadMemberState(t.userId,r),this._updateUndeliveredMemberState(t.userId,r)}},n.prototype.removeMember=function(t){if(!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var r=t instanceof mi?t.userId:t,i=this.members.findIndex(function(s){return s.userId===r});if(i>-1)return this.members.splice(i,1),this.memberCount--,!0}return!1},n.prototype.getUnreadMemberCount=function(t){var r,i;if(t instanceof Ht&&!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var s=R.of(this._iid).sdkState,a=t.createdAt,o=0;try{for(var l=ge(this.members),u=l.next();!u.done;u=l.next()){var c=u.value;s.userId!==c.userId&&c.state===qt.JOINED&&t.sender.userId!==c.userId&&(this.cachedUnreadMemberState[c.userId]||0)=t.createdAt&&o.push(l)}}),o},n.prototype.getUnreadMembers=function(t,r){var i=this;r===void 0&&(r=!1);var s=R.of(this._iid).sdkState;if(!s.userId||this.isExclusive||this.isSuper||this.isBroadcast)return[];var a=t instanceof Ht?t.sender:null,o=[];return this.members.forEach(function(l){if(r||l.userId!==s.userId&&l.userId!==(a==null?void 0:a.userId)){var u=i._unreadMemberStateMap.get(l.userId);u&&u=r&&(t._typingStatus.delete(o),s=!0)}),s},n.prototype.refresh=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this._refresh()]})})},n.prototype._refresh=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return r=R.of(this._iid),i=r.requestQueue,s=r.dispatcher,a=new Lv({channelUrl:this.url}),[4,i.send(a)];case 1:return o=u.sent(),l=o.as(Dv).channel,this._update(l),t||s.dispatch(new We({channels:[l],context:{source:z.REFRESH_CHANNEL}})),[2,this]}})})},n.prototype.freeze=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,e.prototype.freeze.call(this)];case 1:return t.sent(),R.of(this._iid).dispatcher.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_FROZEN},isWebSocketEventComing:!0})),[2]}})})},n.prototype.unfreeze=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,e.prototype.unfreeze.call(this)];case 1:return t.sent(),R.of(this._iid).dispatcher.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_UNFROZEN},isWebSocketEventComing:!0})),[2]}})})},n.prototype.updateChannel=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return r=M(M({},RL),t),Q(function(d){return k("string",d.coverUrl,!0)&&(Er(d.coverImage)||k("string",d.coverImage,!0))&&k("boolean",d.isDistinct,!0)&&k("boolean",d.isPublic,!0)&&k("boolean",d.isDiscoverable,!0)&&k("string",d.accessCode,!0)&&k("string",d.name,!0)&&k("string",d.data,!0)&&k("string",d.customType,!0)&&Qe("string",d.operatorUserIds,!0)&&k("number",d.messageSurvivalSeconds,!0)}(r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.dispatcher,a=i.requestQueue,o=new FL(M({channelUrl:this.url},r)),[4,a.send(o)];case 1:return l=c.sent(),u=l.as(HL).channel,this._update(u),s.dispatch(new We({channels:[u],context:{source:z.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.invite=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(t.every(function(i){return i instanceof Ze})).throw(L.invalidParameters),[2,this.inviteWithUserIds(t.map(function(i){return i.userId}))]})})},n.prototype.inviteWithUserIds=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(Qe("string",t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.requestQueue,a=r.sessionManager,o=new lL({channelUrl:this.url,userIds:t}),[4,s.send(o)];case 1:return l=c.sent(),u=l.as(uL).channel,this._update(u),i.dispatch(new We({channels:[u],context:{source:z.EVENT_CHANNEL_INVITED,inviter:a.currentUser,invitees:[]},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.join=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(k("string",t,!0)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.sdkState,a=r.requestQueue,o=new rL({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,a.send(o)];case 1:return l=c.sent(),(u=l.as(iL).channel).myMemberState=this.myMemberState=qt.JOINED,this._update(u),i.dispatch(new We({channels:[u],context:{source:z.EVENT_CHANNEL_JOINED,users:[]},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.leave=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:return r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=new aL({channelUrl:this.url,userId:i.userId,shouldRemoveOperatorStatus:t}),[4,s.send(a)];case 1:return o.sent(),this.myMemberState=qt.NONE,[2]}})})},n.prototype.acceptInvitation=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(k("string",t,!0)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.sdkState,a=r.requestQueue,o=new UL({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,a.send(o)];case 1:return l=c.sent(),(u=l.as(PL).channel).myMemberState=this.myMemberState=qt.JOINED,this._update(u),i.dispatch(new We({channels:[u],context:{source:z.EVENT_CHANNEL_ACCEPTED_INVITE},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.declineInvitation=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new dL({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return a.sent(),this.myMemberState=qt.NONE,[2,this]}})})},n.prototype.sendUserMessage=function(t){var r=this,i=new Xr,s=R.of(this._iid).dispatcher,a=Sc.of(this._iid);return e.prototype.sendUserMessage.call(this,t).onPending(function(o){a.completeCurrentAndProcessNextAutoResend(o),i._trigger(o)}).onFailed(function(o,l){l&&a.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(o,l)}).onSucceeded(function(o){r.hiddenState===mr.HIDDEN_ALLOW_AUTO_UNHIDE&&(r.hiddenState=mr.UNHIDDEN),a.completeCurrentAndProcessNextAutoResend(o),r._updateLastMessage(o),Rn.of(r._iid).handlers.map(function(l){l.onChannelChanged&&l.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(o)}),i},n.prototype.updateUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o,l=this;return g(this,function(u){switch(u.label){case 0:return i=R.of(this._iid).dispatcher,[4,e.prototype.updateUserMessage.call(this,t,r)];case 1:return s=u.sent(),a=this._updateLastMessage(s),o=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,a=!0,o=!0),a&&(Rn.of(this._iid).handlers.map(function(c){c.onChannelChanged&&c.onChannelChanged(l)}),i.dispatch(new We({channels:[this],context:{source:o?z.EVENT_PINNED_MESSAGE_UPDATED:z.EVENT_MESSAGE_UPDATED}}))),o&&Rn.of(this._iid).handlers.map(function(c){c.onPinnedMessageUpdated&&c.onPinnedMessageUpdated(l)}),i.dispatch(new wt({messages:[s],source:z.EVENT_MESSAGE_UPDATED})),[2,s]}})})},n.prototype._autoResendUserMessage=function(t){var r=this,i=new Xr,s=R.of(this._iid).dispatcher,a=Sc.of(this._iid);return e.prototype._autoResendUserMessage.call(this,t).onPending(function(o){a.completeCurrentAndProcessNextAutoResend(o),i._trigger(o)}).onFailed(function(o,l){a.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(o,l)}).onSucceeded(function(o){var l=Rn.of(r._iid);a.completeCurrentAndProcessNextAutoResend(o),r._updateLastMessage(o),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(o)}),i},n.prototype.sendFileMessage=function(t){var r=this,i=new Xr,s=R.of(this._iid).dispatcher,a=Sc.of(this._iid);return e.prototype.sendFileMessage.call(this,t).onPending(function(o){a.completeCurrentAndProcessNextAutoResend(o),i._trigger(o)}).onFailed(function(o,l){l&&a.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(o,l)}).onSucceeded(function(o){var l=Rn.of(r._iid);a.completeCurrentAndProcessNextAutoResend(o),r._updateLastMessage(o),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(o)}),i},n.prototype.sendMultipleFilesMessage=function(t){var r=this,i=new Sf,s=R.of(this._iid).dispatcher;return e.prototype.sendMultipleFilesMessage.call(this,t).onPending(function(a){i._trigger(a)}).onFailed(function(a,o){i._triggerFailed(a,o)}).onSucceeded(function(a){var o=Rn.of(r._iid);r._updateLastMessage(a),o.handlers.map(function(l){l.onChannelChanged&&l.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(a)}).onFileUploaded(function(a,o,l,u){i._triggerOnFileUploaded(a,o,l,u)}),i},n.prototype.updateFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o,l=this;return g(this,function(u){switch(u.label){case 0:return i=R.of(this._iid).dispatcher,[4,e.prototype.updateFileMessage.call(this,t,r)];case 1:return s=u.sent(),a=this._updateLastMessage(s),o=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,a=!0,o=!0),a&&(Rn.of(this._iid).handlers.map(function(c){c.onChannelChanged&&c.onChannelChanged(l)}),i.dispatch(new We({channels:[this],context:{source:o?z.EVENT_PINNED_MESSAGE_UPDATED:z.EVENT_MESSAGE_UPDATED}}))),o&&Rn.of(this._iid).handlers.map(function(c){c.onPinnedMessageUpdated&&c.onPinnedMessageUpdated(l)}),i.dispatch(new wt({messages:[s],source:z.EVENT_MESSAGE_UPDATED})),[2,s]}})})},n.prototype._autoResendFileMessage=function(t){var r=this,i=new Xr,s=R.of(this._iid).dispatcher,a=Sc.of(this._iid);return e.prototype._autoResendFileMessage.call(this,t).onPending(function(o){a.completeCurrentAndProcessNextAutoResend(o),i._trigger(o)}).onFailed(function(o,l){a.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(o,l)}).onSucceeded(function(o){var l=Rn.of(r._iid);a.completeCurrentAndProcessNextAutoResend(o),r._updateLastMessage(o),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new We({channels:[r],context:{source:z.EVENT_MESSAGE_SENT}})),i._trigger(o)}),i},n.prototype.deleteMessage=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.deleteMessage.call(this,t)];case 1:return r.sent(),t.messageId===0&&t instanceof Ht&&R.of(this._iid).dispatcher.dispatch(new Hw({reqId:t.reqId,source:z.EVENT_MESSAGE_DELETED})),[2]}})})},n.prototype.hide=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:return r=M(M({},Uv),t),Q(function(h){return k("boolean",h.hidePreviousMessages,!0)&&k("boolean",h.allowAutoUnhide,!0)}(r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.dispatcher,a=i.sdkState,o=i.requestQueue,l=new fL(M({channelUrl:this.url,userId:a.userId},r)),[4,o.send(l)];case 1:return u=d.sent(),c=u.as(pL).messageOffsetTimestamp,this.hiddenState=r.allowAutoUnhide?mr.HIDDEN_ALLOW_AUTO_UNHIDE:mr.HIDDEN_PREVENT_AUTO_UNHIDE,r.hidePreviousMessages&&this._updateUnreadCount(0,0),c&&(this.messageOffsetTimestamp=c),s.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_HIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.unhide=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return t=R.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new BL({channelUrl:this.url}),[4,i.send(s)];case 1:return a.sent(),this.hiddenState=mr.UNHIDDEN,r.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_UNHIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.delete=function(){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=R.of(this._iid).requestQueue,r=new jL({channelUrl:this.url}),[4,t.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.markAsRead=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u=this;return g(this,function(c){switch(c.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.dispatcher,s=t.requestQueue,a=new Zx({channelUrl:this.url}),[4,s.send(a)];case 1:return o=c.sent(),l=o.as(Xw).readStatus,this._updateUnreadMemberState(r.userId,l.readAt),(this.unreadMessageCount>0||this.unreadMentionCount>0)&&(this._updateUnreadCount(0,0),Rn.of(this._iid).handlers.map(function(d){d.onChannelChanged&&d.onChannelChanged(u)})),i.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_READ}})),[2]}})})},n.prototype.markAsDelivered=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new CL({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},n.prototype.startTyping=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.requestQueue,i=t.typingIndicatorThrottle,(s=new Date().getTime())-this._typingStarted>=i?(this._typingStarted=s,this._typingEnded=0,a=new mL({channelUrl:this.url,time:this._typingStarted}),[4,r.send(a)]):[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})},n.prototype.endTyping=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.requestQueue,i=t.typingIndicatorThrottle,(s=new Date().getTime())-this._typingEnded>=i?(this._typingStarted=0,this._typingEnded=s,a=new gL({channelUrl:this.url,time:this._typingStarted}),[4,r.send(a)]):[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})},n.prototype.createScheduledUserMessage=function(t){t=M(M({},rk),t),Q(ik(t)).throw(L.invalidParameters);var r=new Xr;return this._createScheduledUserMessage(t,r),r},n.prototype.updateScheduledUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return i=M(M({},WL),r),Q(function(u){return oT(u)&&k("number",u.scheduledAt,!0)}(i)).throw(L.invalidParameters),s=R.of(this._iid).requestQueue,a=new YL(M({reqId:this._generateRequestId(),scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url},i)),[4,s.send(a)];case 1:return o=l.sent(),[2,o.as(uT).message]}})})},n.prototype.createScheduledFileMessage=function(t){var r=this;t=M(M({},sk),t),Q(ak(t)).throw(L.invalidParameters);var i=Date.now(),s=this._generateRequestId(),a=new Xr;return Br(kR).then(function(){var o=r._createPendingScheduledFileMessage(t,s,i);Ue(function(){return y(r,void 0,void 0,function(){return g(this,function(l){return[2,a._trigger(o)]})})})}),Er(t.file)?this._uploadFileAndUpdateParams(t).then(function(){return r._createScheduledFileMessage(t,a,s,i)}):this._createScheduledFileMessage(t,a,s,i),a},n.prototype.updateScheduledFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,a;return g(this,function(o){switch(o.label){case 0:return i=M(M({},qL),r),Q(function(l){return M2(l)&&k("number",l.scheduledAt,!0)&&(Er(l.file)||k("string",l.fileUrl))&&k("string",l.fileName,!0)&&k("string",l.mimeType,!0)&&k("number",l.fileSize,!0)&&(l.thumbnailSizes===null||l.thumbnailSizes===void 0||l.thumbnailSizes.every(function(u){return k("object",u)&&u.maxWidth>0&&u.maxHeight>0}))}(i)).throw(L.invalidParameters),Er(i.file)?[4,this._uploadFileAndUpdateParams(i)]:[3,2];case 1:o.sent(),o.label=2;case 2:return s=new KL(M({reqId:this._generateRequestId(),scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url},i)),[4,R.of(this._iid).requestQueue.send(s)];case 3:return a=o.sent(),[2,a.as(QL).message]}})})},n.prototype.cancelScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=new ZL({scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url}),[4,R.of(this._iid).requestQueue.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.sendScheduledMessageNow=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=new XL({scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url}),[4,R.of(this._iid).requestQueue.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.getMyPushTriggerOption=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new tD({userId:r.userId,channelUrl:this.url}),[4,i.send(s)];case 1:return a=l.sent(),o=a.as(nD).pushTriggerOption,this.myPushTriggerOption=o,[2,o]}})})},n.prototype.setMyPushTriggerOption=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(Ve(Ao,t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.sdkState,a=r.requestQueue,o=new JL({userId:s.userId,channelUrl:this.url,pushTriggerOption:t}),[4,a.send(o)];case 1:return l=c.sent(),u=l.as(eD).pushTriggerOption,this.myPushTriggerOption=u,i.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,u]}})})},n.prototype.setMyCountPreference=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(Ve(fi,t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.dispatcher,s=r.sdkState,a=r.requestQueue,o=new $L({channelUrl:this.url,userId:s.userId,countPreference:t}),[4,a.send(o)];case 1:return l=c.sent(),u=l.as(GL).countPreference,this.myCountPreference=u,this._updateUnreadCount(this.unreadMessageCount,this.unreadMentionCount),i.dispatch(new We({channels:[this],context:{source:z.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,u]}})})},n.prototype.resetMyHistory=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return t=R.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new zL({channelUrl:this.url}),[4,i.send(s)];case 1:return a=l.sent(),o=a.as(VL).messageOffsetTimestamp,this.messageOffsetTimestamp=o,this.lastMessage&&this.lastMessage.createdAt0).throw(L.invalidParameters),r=R.of(this._iid).requestQueue,i=new rD({channelType:this.channelType,channelUrl:this.url,messageId:t}),[4,r.send(i)];case 1:return s.sent(),[2]}})})},n.prototype.unpinMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return Q(k("number",t)&&t>0).throw(L.invalidParameters),r=R.of(this._iid).requestQueue,i=new iD({channelType:this.channelType,channelUrl:this.url,messageId:t}),[4,r.send(i)];case 1:return s.sent(),[2]}})})},n.prototype._uploadFileAndUpdateParams=function(t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return Er(t.file)?(r=R.of(this._iid).requestQueue,i=new _0({file:t.file,channelUrl:this.url,thumbnailSizes:t.thumbnailSizes,requestId:this._generateRequestId()}),[4,r.send(i)]):[3,2];case 1:s=f.sent(),a=s.as(m0),o=a.url,l=a.fileSize,u=l===void 0?t.fileSize:l,c=a.thumbnails,d=a.requireAuth,h=d!==void 0&&d,t.fileUrl=o,t.fileSize=u,t.requireAuth=h,t._thumbnails=c,f.label=2;case 2:return[2]}})})},n.prototype.resendMessage=function(t,r){var i,s=this;if(Q(t instanceof Ht&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var a=(i=t.messageParams)!==null&&i!==void 0?i:Sv(t),o=new Xr;return this._sendUserMessage(a,nr.RESEND,t.reqId).onPending(function(d){o._trigger(d)}).onFailed(function(d,h){o._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),o._trigger(d)}),o}if(t.isFileMessage()){var l=this._validateFailedFileMessageHasFile(t,r);Q(l).throw(L.invalidParameters),a=wv(t,r);var u=new Xr;return this._sendFileMessage(a,nr.RESEND,t.reqId).onPending(function(d){u._trigger(d)}).onFailed(function(d,h){u._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),u._trigger(d)}),u}if(t.isMultipleFilesMessage()){a=t.messageParams;var c=new Sf;return this._sendMultipleFilesMessage(a,nr.RESEND,t.reqId).onPending(function(d){c._trigger(d)}).onFailed(function(d,h){c._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),c._trigger(d)}).onFileUploaded(function(d,h,f,p){c._triggerOnFileUploaded(d,h,f,p)}),c}},n.prototype.copyMessage=function(t,r){var i=this;if(Q(t instanceof RE&&r instanceof Ht&&r.sendingStatus===ht.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),r.isUserMessage()){Q(!r.poll).throw(L.notSupportedError);var s=rT(r),a=new Xr;return t._sendUserMessage(s).onPending(function(u){a._trigger(u)}).onFailed(function(u,c){a._triggerFailed(u,c)}).onSucceeded(function(u){t.isGroupChannel()&&i._tryUpdateLastMessageAndCallEvents(t,u),a._trigger(u)}),a}if(r.isFileMessage()){s=sT(r);var o=new Xr;return t._sendFileMessage(s).onPending(function(u){o._trigger(u)}).onFailed(function(u,c){o._triggerFailed(u,c)}).onSucceeded(function(u){t.isGroupChannel()&&i._tryUpdateLastMessageAndCallEvents(t,u),o._trigger(u)}),o}if(r.isMultipleFilesMessage()){if(t.isGroupChannel()){s=xR(r);var l=new Sf;return t._sendMultipleFilesMessage(s,nr.COPY).onPending(function(u){l._trigger(u)}).onFailed(function(u,c){l._triggerFailed(u,c)}).onSucceeded(function(u){i._tryUpdateLastMessageAndCallEvents(t,u),l._trigger(u)}).onFileUploaded(function(u,c,d,h){l._triggerOnFileUploaded(u,c,d,h)}),l}throw L.channelTypeNotSupportedError}},n}(RE),uD=function(){this.onUserMuted=Ke,this.onUserUnmuted=Ke,this.onUserBanned=Ke,this.onUserUnbanned=Ke,this.onChannelChanged=Ke,this.onChannelDeleted=Ke,this.onChannelFrozen=Ke,this.onChannelUnfrozen=Ke,this.onOperatorUpdated=Ke,this.onChannelMemberCountChanged=Ke,this.onMetaDataCreated=Ke,this.onMetaDataUpdated=Ke,this.onMetaDataDeleted=Ke,this.onMetaCounterCreated=Ke,this.onMetaCounterUpdated=Ke,this.onMetaCounterDeleted=Ke,this.onMessageReceived=Ke,this.onMessageUpdated=Ke,this.onMessageDeleted=Ke,this.onMentionReceived=Ke,this.onReactionUpdated=Ke,this.onThreadInfoUpdated=Ke},sd,_a={},cD=function(){function e(n){var t=n._iid,r=n.limit,i=r===void 0?100:r,s=this;this.ref=0,this._iid=t,this._limit=i;var a,o=R.of(this._iid),l=o.sdkState,u=o.dispatcher,c=o.logger,d=o.cacheContext;this._metadataKey=(a=l.userId,"sendbird:".concat(a,"@groupchannel/sync.meta"));var h=function(f){return"sendbird:".concat(f,"@groupchannel/sync")}(l.userId);this._sync=new io(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S,T,N,I,x;return g(this,function(A){switch(A.label){case 0:return f={hasNext:!0,nextToken:""},[4,this.loadMetadata()];case 1:if(A.sent(),c.debug("channel background sync from",(T=this._metadata)===null||T===void 0?void 0:T.token),(N=this._metadata)===null||N===void 0?void 0:N.completed)return[3,13];A.label=2;case 2:if(A.trys.push([2,9,,12]),(p={includeEmpty:!0,order:Bt.CHRONOLOGICAL}).order!==Bt.LATEST_LAST_MESSAGE)return[3,6];A.label=3;case 3:return A.trys.push([3,5,,6]),[4,d.preference.get(b2(l.appId))];case 4:return m=A.sent(),p.includeChatNotification=!!m,[3,6];case 5:return A.sent(),p.includeChatNotification=!1,[3,6];case 6:return[4,Rn.of(this._iid).getMyGroupChannels((x=(I=this._metadata)===null||I===void 0?void 0:I.token)!==null&&x!==void 0?x:"",p,this._limit,z.SYNC_CHANNEL_BACKGROUND)];case 7:return b=A.sent(),v=b.channels,_=b.token,f.hasNext=v.length>=this._limit&&!!_,f.nextToken=_,this._metadata&&(this._metadata.token=_,(S=this._metadata.range).extends.apply(S,Fe([],Me(v.map(function(O){return O.createdAt})),!1)),this._metadata.completed=!f.hasNext),c.debug("channel background sync progress",f),[4,this.saveMetadata()];case 8:return A.sent(),[3,12];case 9:return E=A.sent(),c.debug("channel background sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetaData()]:[3,11];case 10:A.sent(),A.label=11;case 11:throw E;case 12:return[3,14];case 13:f.hasNext=!1,f.nextToken="",A.label=14;case 14:return[2,f]}})})}),this._connectionEventContext=u.on(function(f){f instanceof Ii&&(f.stateType===lt.CONNECTED?s.resume():s.pause())})}return e.of=function(n){return _a[n]||(_a[n]=new e({_iid:n})),_a[n].ref++,_a[n]},e.clear=function(n){_a[n]&&(_a[n].close(),delete _a[n])},Object.defineProperty(e.prototype,"range",{get:function(){var n,t;return(t=(n=this._metadata)===null||n===void 0?void 0:n.range)!==null&&t!==void 0?t:new Ms({})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"completed",{get:function(){var n;return!!(!((n=this._metadata)===null||n===void 0)&&n.completed)},enumerable:!1,configurable:!0}),e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,R.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:n=t.sent(),this._metadata={token:n?n.token:"",range:new Ms(n?n.range:{top:Number.MAX_SAFE_INTEGER,bottom:0}),completed:!!n&&n.completed},t.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetaData=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){var n,t,r=R.of(this._iid),i=r.logger;r.sessionManager.session.hasSession&&(i.debug("channel background sync resume()"),this._sync.start((t=(n=this._metadata)===null||n===void 0?void 0:n.token)!==null&&t!==void 0?t:""))},e.prototype.pause=function(){R.of(this._iid).logger.debug("channel background sync stop()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete _a[this._iid])},e}(),ma={},dD=function(){function e(n){var t=n._iid,r=this;this.ref=0,this._iid=t;var i,s=R.of(this._iid),a=s.logger,o=s.sdkState,l=s.dispatcher,u=s.cacheContext;this._metadataKey=(i=o.userId,"sendbird:".concat(i,"@groupchannel/changelogs.meta")),this._subscribers=new fl;var c=function(d){return"sendbird:".concat(d,"@groupchannel/changelogs")}(o.userId);this._sync=new io(c,function(){return y(r,void 0,void 0,function(){var d,h,f,p,m,b,v,_,E,S,T,N;return g(this,function(I){switch(I.label){case 0:return d={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:I.sent(),a.debug("channel changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),I.label=2;case 2:I.trys.push([2,9,,12]),h={includeEmpty:!0},I.label=3;case 3:return I.trys.push([3,5,,6]),[4,u.preference.get(b2(o.appId))];case 4:return f=I.sent(),h.includeChatNotification=!!f,[3,6];case 5:return I.sent(),h.includeChatNotification=!1,[3,6];case 6:return[4,Rn.of(this._iid).getMyGroupChannelChangeLogs((N=(T=this._metadata)===null||T===void 0?void 0:T.token)!==null&&N!==void 0?N:"",h,z.SYNC_CHANNEL_CHANGELOGS)];case 7:return p=I.sent(),m=p.updatedChannels,b=p.deletedChannelUrls,v=p.hasMore,_=p.token,this._subscribers.dispatch("progress",{updatedChannels:m,deletedChannelUrls:b,hasMore:v,token:_}),d.hasNext=v,d.nextToken=_,this._metadata&&(this._metadata.token=_),a.debug("channel changelog sync progress",d),[4,this.saveMetadata()];case 8:return I.sent(),[3,12];case 9:return E=I.sent(),a.debug("channel changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,11];case 10:I.sent(),I.label=11;case 11:throw E;case 12:return[2,d]}})})}),this._sync.on("stop",function(){r._subscribers.dispatch("pause")}),this._connectionEventContext=l.on(function(d){d instanceof Ii&&(d.stateType===lt.CONNECTED?r.resume():r.pause())})}return e.of=function(n){return ma[n]||(ma[n]=new e({_iid:n})),ma[n].ref++,ma[n]},e.clear=function(n){ma[n]&&(ma[n].close(),delete ma[n])},Object.defineProperty(e.prototype,"isRunning",{get:function(){return this._sync.isRunning},enumerable:!1,configurable:!0}),e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return this._metadata?[3,2]:(n=R.of(this._iid),t=n.cacheContext,r=n.firstConnectedAt,[4,t.preference.get(this._metadataKey)]);case 1:i=s.sent(),this._metadata={token:i?i.token:r},s.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,R.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,R.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.on=function(n,t){return this._subscribers.on(n,t)},e.prototype.resume=function(){R.of(this._iid).sessionManager.session.hasSession&&this._sync.start(0)},e.prototype.pause=function(){this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete ma[this._iid])},e}(),Af=function(e,n){return e.findIndex(function(t){return t.isIdentical(n)})},qE=function(e,n,t){if(e.length>0){for(var r=Af(e,n),i=0,s=e.length-1,a=Math.floor((i+s)/2);i0)s=a,a=Math.floor((i+s)/2);else{if(!(o<0))return{place:a,oldPosition:r};i=a+1,a=Math.floor((i+s)/2)}}return{place:WE(e[a],n,t)>=0?a:a+1,oldPosition:r}}return{place:e.length,oldPosition:-1}},WE=function(e,n,t){switch(t){case Bt.LATEST_LAST_MESSAGE:return e.lastMessage&&n.lastMessage?n.lastMessage.createdAt-e.lastMessage.createdAt:e.lastMessage?-1:n.lastMessage?1:n.createdAt-e.createdAt;case Bt.CHRONOLOGICAL:return n.createdAt-e.createdAt;case Bt.CHANNEL_NAME_ALPHABETICAL:var r=e.name.localeCompare(n.name);return r===0?e.createdAt-n.createdAt:r;default:return 0}},hD=function(){function e(n,t){var r=t.filter,i=r===void 0?new ST:r,s=t.order,a=s===void 0?Bt.LATEST_LAST_MESSAGE:s,o=t.limit,l=o===void 0?dT:o,u=t.includeChangesOnInitialLoad,c=u!==void 0&&u,d=this;this.channels=[],this._iid=n,this._key="gcc-".concat(la()),this._isDisposed=!1,this._isGetRemoteChannelsSucceeded=!0,this._includeChangesOnInitialLoad=c,this.filter=i,this.order=a,this._hasMore=!0,this._token="",this._limit=l;var h=R.of(this._iid),f=h.sdkState,p=h.cacheContext,m=h.dispatcher;p.localCacheEnabled&&(this._backgroundSync=cD.of(n),this._backgroundSync.resume()),this._changelogSync=dD.of(n),this._changelogSync.resume(),Rn.of(this._iid).subscribeChannelEvent(this._key,{onUpdate:function(b,v){var _=v.source;if(If(_)){var E=b.filter(function(T){return d.filter.match(T,f.userId)}),S=b.filter(function(T){return!d.filter.match(T,f.userId)}).map(function(T){return T.url});E.length>0&&d._addChannelsToView(E,v),S.length>0&&d._removeChannelsFromView(S,v)}},onRemove:function(b,v){d._removeChannelsFromView(b,v)}}),R.of(this._iid).statManager.put(new Ou({type:St.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{group_channel:!0}}})),m.on(function(b){b instanceof Ii&&(b.stateType===lt.CONNECTED?d._isGetRemoteChannelsSucceeded||y(d,void 0,void 0,function(){return g(this,function(v){switch(v.label){case 0:return[4,this._revokeLoadMore()];case 1:return v.sent(),[2]}})}):b.stateType===lt.LOGOUT&&d.dispose())})}return Object.defineProperty(e.prototype,"hasMore",{get:function(){return!this._isDisposed&&this._hasMore},enumerable:!1,configurable:!0}),e.prototype.setGroupChannelCollectionHandler=function(n){this._handler=n},e.prototype._addChannelsToView=function(n,t,r){var i,s,a,o,l=this;r===void 0&&(r=!1);var u=[],c=[],d=[];try{for(var h=ge(n),f=h.next();!f.done;f=h.next()){var p=f.value,m=Af(this.channels,p);m>=0&&this.channels.splice(m,1);var b=qE(this.channels,p,this.order).place;if(m<0)b===this.channels.length?!r&&this._hasMore||(u.push(p),this.channels.push(p)):(u.push(p),this.channels.splice(b,0,p));else switch(t.source){case z.EVENT_CHANNEL_UPDATED:case z.EVENT_MESSAGE_RECEIVED:case z.SYNC_CHANNEL_CHANGELOGS:case z.EVENT_MESSAGE_SENT:this.order===Bt.CHANNEL_NAME_ALPHABETICAL&&this._hasMore&&b===this.channels.length?d.push(p):(this.channels.splice(b,0,p),c.push(p));break;default:this.channels.splice(b,0,p),c.push(p)}}}catch(S){i={error:S}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}if(d.length>0)try{for(var v=ge(d),_=v.next();!_.done;_=v.next()){p=_.value;var E=Af(this.channels,p);E!==-1&&this.channels.splice(E,1)}}catch(S){a={error:S}}finally{try{_&&!_.done&&(o=v.return)&&o.call(v)}finally{if(a)throw a.error}}If(t.source)&&Ue(function(){return y(l,void 0,void 0,function(){var S,T,N;return g(this,function(I){return u.length>0&&(!((S=this._handler)===null||S===void 0)&&S.onChannelsAdded)&&this._handler.onChannelsAdded(t,u),c.length>0&&(!((T=this._handler)===null||T===void 0)&&T.onChannelsUpdated)&&this._handler.onChannelsUpdated(t,c),d.length>0&&(!((N=this._handler)===null||N===void 0)&&N.onChannelsDeleted)&&this._handler.onChannelsDeleted(t,d.map(function(x){return x.url})),[2]})})})},e.prototype._removeChannelsFromView=function(n,t){var r,i,s=this,a=[],o=function(d){var h=l.channels.findIndex(function(f){return f.url===d});h>=0&&(a.push(l.channels[h].url),l.channels.splice(h,1))},l=this;try{for(var u=ge(n),c=u.next();!c.done;c=u.next())o(c.value)}catch(d){r={error:d}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return If(t.source)&&a.length>0&&Ue(function(){return y(s,void 0,void 0,function(){var d;return g(this,function(h){return!((d=this._handler)===null||d===void 0)&&d.onChannelsDeleted&&this._handler.onChannelsDeleted(t,a),[2]})})}),a},e.prototype._getLocalChannels=function(){return y(this,void 0,void 0,function(){var n,t;return g(this,function(r){switch(r.label){case 0:return n=Rn.of(this._iid),t=this.channels.length>0?function(i,s){var a,o,l,u;switch(s){case Bt.LATEST_LAST_MESSAGE:return(o=(a=i.lastMessage)===null||a===void 0?void 0:a.createdAt)!==null&&o!==void 0?o:i.createdAt;case Bt.CHRONOLOGICAL:return i.createdAt;case Bt.CHANNEL_NAME_ALPHABETICAL:return i.name;default:return(u=(l=i.lastMessage)===null||l===void 0?void 0:l.createdAt)!==null&&u!==void 0?u:i.createdAt}}(this.channels[this.channels.length-1],this.order):null,[4,n.getChannelsFromCache(t,this.filter,this.order,this._limit,t?this.channels[this.channels.length-1].url:void 0)];case 1:return[2,r.sent()]}})})},e.prototype._getRemoteChannels=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return[4,Rn.of(this._iid).getMyGroupChannels(this._token,Ie(M(M({},this.filter),{order:this.order})),this._limit)];case 1:return n=i.sent(),t=n.channels,r=n.token,this._token=r,this._hasMore=!!r,[2,t]}})})},e.prototype._revokeLoadMore=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:if(this._isDisposed)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._getRemoteChannels()];case 2:return n=t.sent(),this._isGetRemoteChannelsSucceeded=!0,this._addChannelsToView(n,{source:z.REQUEST_CHANNEL},!0),[3,4];case 3:return t.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,4];case 4:return[2]}})})},e.prototype.loadMore=function(){var n;return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S=this;return g(this,function(T){switch(T.label){case 0:if(this._isDisposed)throw new L({code:Ae.COLLECTION_DISPOSED,message:"Collection has been disposed."});return t=null,this._includeChangesOnInitialLoad&&this.channels.length===0&&this._changelogSync.isRunning?[4,new Promise(function(N){S._changelogSyncSubscriberContext=S._changelogSync.on("progress",function(I){return N(I)}).on("pause",function(){return N(null)})})]:[3,2];case 1:t=T.sent(),(n=this._changelogSyncSubscriberContext)===null||n===void 0||n.close(),T.label=2;case 2:return r=[],this._hasMore?(i=R.of(this._iid),s=i.cacheContext,a=i.connectionManager,!s.localCacheEnabled||a.isConnected&&!this._backgroundSync.completed?[3,4]:[4,Lt(function(){return y(S,void 0,void 0,function(){return g(this,function(N){switch(N.label){case 0:return[4,this._getLocalChannels()];case 1:return r=N.sent(),[2]}})})})]):[3,8];case 3:return T.sent(),this._hasMore=r.length>=this._limit,[3,7];case 4:return T.trys.push([4,6,,7]),[4,this._getRemoteChannels()];case 5:return r=T.sent(),this._isGetRemoteChannelsSucceeded=!0,[3,7];case 6:return T.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,7];case 7:this._addChannelsToView(r,{source:z.REQUEST_CHANNEL},!0),T.label=8;case 8:if(t){try{for(o=ge(t.updatedChannels),l=o.next();!l.done;l=o.next())u=l.value,(m=Af(r,u))>=0?r[m]=u:(c=qE(r,u,this.order).place,r.splice(c,0,u))}catch(N){b={error:N}}finally{try{l&&!l.done&&(v=o.return)&&v.call(o)}finally{if(b)throw b.error}}d=r.map(function(N){return N.url});try{for(h=ge(t.deletedChannelUrls),f=h.next();!f.done;f=h.next())p=f.value,(m=d.indexOf(p))>=0&&(r.splice(m,1),d.splice(m,1))}catch(N){_={error:N}}finally{try{f&&!f.done&&(E=h.return)&&E.call(h)}finally{if(_)throw _.error}}}return[2,r]}})})},e.prototype.dispose=function(){var n,t,r;this._isDisposed||(this._isDisposed=!0,this.channels.length>0&&this.channels.splice(0,this.channels.length),(n=this._backgroundSync)===null||n===void 0||n.close(),(t=this._changelogSync)===null||t===void 0||t.close(),(r=this._changelogSyncSubscriberContext)===null||r===void 0||r.close(),Rn.of(this._iid).unsubscribeChannelEvent(this._key))},e}(),fD=function(e){function n(t){var r=this,i=t.token,s=t.limit,a=t.order,o=t.includeEmpty,l=t.membershipFilter,u=t.channelNameContainsFilter,c=t.channelUrlsFilter,d=t.customTypesFilter,h=t.customTypeStartsWithFilter,f=t.superChannelFilter,p=t.metadataOrderKeyFilter,m=t.metadataKey,b=t.metadataValues,v=t.metadataValueStartsWith,_=t.includeFrozen,E=t.includeMetaData;return(r=e.call(this)||this).method=Y.GET,r.path=cr,r.params=be(Ie({token:i,limit:s,order:a,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:o,public_mode:Ds.PUBLIC,public_membership_mode:l,name_contains:u,channel_urls:c,custom_types:d,custom_type_startswith:h,super_mode:f,metadata_order_key:p,metadata_key:m,metadata_values:b,metadata_value_startswith:v,show_frozen:_,show_metadata:E})),r}return w(n,e),n}(Z),pD=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.channels=[];var s=r.next,a=r.channels,o=r.ts;return i.token=s,a&&a.length>0&&(i.channels=a.map(function(l){return l.ts=o,new Si(t,l)})),i.ts=typeof o=="number"?o:0,i}return w(n,e),n}(le);(function(e){e.ALL="all",e.JOINED="joined"})(sd||(sd={}));var _D=function(e){function n(t,r){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_=this;return(_=e.call(this,t,r)||this).includeEmpty=!1,_.includeFrozen=!0,_.includeMetaData=!0,_.channelUrlsFilter=null,_.customTypesFilter=null,_.customTypeStartsWithFilter=null,_.channelNameContainsFilter=null,_.membershipFilter=sd.ALL,_.superChannelFilter=qr.ALL,_.metadataKey=null,_.metadataValues=null,_.metadataOrderKeyFilter=null,_.metadataValueStartsWith=null,_.order=td.CHRONOLOGICAL,_.includeEmpty=(i=r.includeEmpty)!==null&&i!==void 0&&i,_.includeFrozen=(s=r.includeFrozen)===null||s===void 0||s,_.includeMetaData=(a=r.includeMetaData)===null||a===void 0||a,_.channelUrlsFilter=(o=r.channelUrlsFilter)!==null&&o!==void 0?o:null,_.customTypesFilter=(l=r.customTypesFilter)!==null&&l!==void 0?l:null,_.customTypeStartsWithFilter=(u=r.customTypeStartsWithFilter)!==null&&u!==void 0?u:null,_.channelNameContainsFilter=(c=r.channelNameContainsFilter)!==null&&c!==void 0?c:null,_.membershipFilter=(d=r.membershipFilter)!==null&&d!==void 0?d:sd.ALL,_.superChannelFilter=(h=r.superChannelFilter)!==null&&h!==void 0?h:qr.ALL,_.metadataKey=(f=r.metadataKey)!==null&&f!==void 0?f:null,_.metadataValues=(p=r.metadataValues)!==null&&p!==void 0?p:null,_.metadataOrderKeyFilter=(m=r.metadataOrderKeyFilter)!==null&&m!==void 0?m:null,_.metadataValueStartsWith=(b=r.metadataValueStartsWith)!==null&&b!==void 0?b:null,_.order=(v=r.order)!==null&&v!==void 0?v:td.CHRONOLOGICAL,_}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeEmpty)&&k("boolean",this.includeFrozen)&&k("boolean",this.includeMetaData)&&k("string",this.channelNameContainsFilter,!0)&&Qe("string",this.channelUrlsFilter,!0)&&Qe("string",this.customTypesFilter,!0)&&k("string",this.customTypeStartsWithFilter,!0)&&Ve(sd,this.membershipFilter)&&Ve(qr,this.superChannelFilter)&&Ve(td,this.order)&&k("string",this.metadataOrderKeyFilter,!0)&&k("string",this.metadataKey,!0)&&Qe("string",this.metadataValues,!0)&&k("string",this.metadataValueStartsWith,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:(t=[],this._hasNext?(this._isLoading=!0,r=R.of(this._iid).requestQueue,i=new fD(Ie(M(M({},this),{token:this._token}))),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),a=s.as(pD),o=a.channels,l=a.token,this._token=l,this._hasNext=!!l,this._isLoading=!1,[2,o];case 2:return[2,t];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),O2=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return w(n,e),n}(function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.onUserJoined=Ke,t.onUserLeft=Ke,t.onUserReceivedInvitation=Ke,t.onUserDeclinedInvitation=Ke,t.onChannelHidden=Ke,t.onUnreadMemberStatusUpdated=Ke,t.onUndeliveredMemberStatusUpdated=Ke,t.onTypingStatusUpdated=Ke,t.onPollUpdated=Ke,t.onPollVoted=Ke,t.onPollDeleted=Ke,t.onPinnedMessageUpdated=Ke,t}return w(n,e),n}(uD)),mD=function(e){function n(t){var r=this,i=t.token,s=t.limit,a=t.order,o=t.reverse,l=t.channelUrl,u=t.messageTypeFilter,c=t.scheduledStatus;return(r=e.call(this)||this).method=Y.GET,r.path="".concat(rw),r.params=be(Ie({token:i,limit:s,reverse:o,channel_url:l,order:a,message_type:u,status:c})),r}return w(n,e),n}(Z),vD=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.scheduledMessages=[];var s=r.next,a=r.scheduled_messages;return i.token=s,i.scheduledMessages=a.map(function(o){return wr(t,o)}),i}return w(n,e),n}(le),gD=function(e){function n(t,r){var i,s,a,o,l,u=this;return(u=e.call(this,t,r)||this).channelUrl=null,u.order=null,u.reverse=!1,u.scheduledStatus=null,u.messageTypeFilter=ar.ALL,u.channelUrl=(i=r.channelUrl)!==null&&i!==void 0?i:null,u.order=(s=r.order)!==null&&s!==void 0?s:null,u.reverse=(a=r.reverse)!==null&&a!==void 0&&a,u.scheduledStatus=(o=r.scheduledStatus)!==null&&o!==void 0?o:null,u.messageTypeFilter=(l=r.messageTypeFilter)!==null&&l!==void 0?l:ar.ALL,u}return w(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.channelUrl,!0)&&(Ve(Ov,this.order)||this.order===null)&&k("boolean",this.reverse)&&(Qe(Ua,this.scheduledStatus)||this.scheduledStatus===null)&&Ve(ar,this.messageTypeFilter)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=R.of(this._iid).requestQueue,r=new mD(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(vD),a=s.scheduledMessages,o=s.token,this._token=o,this._hasNext=!!o,this._isLoading=!1,[2,a];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(lo),yD=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="groupChannel",t}return w(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,a=r.sessionManager,o=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:a,requestQueue:o,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new Rn(t,{sdkState:i,cacheContext:c,dispatcher:s,sessionManager:a,requestQueue:o,logger:l})},n.prototype.createGroupChannelCollection=function(t){return t===void 0&&(t={}),new hD(this._iid,t)},n.prototype.createMyGroupChannelListQuery=function(t){return t===void 0&&(t={}),new NT(this._iid,t)},n.prototype.createPublicGroupChannelListQuery=function(t){return t===void 0&&(t={}),new _D(this._iid,t)},n.prototype.createScheduledMessageListQuery=function(t){return t===void 0&&(t={}),new gD(this._iid,t)},n.prototype.addGroupChannelHandler=function(t,r){Q(k("string",t)&&r instanceof O2).throw(L.invalidParameters),this._manager.addHandler(t,r)},n.prototype.removeGroupChannelHandler=function(t){Q(k("string",t)).throw(L.invalidParameters),this._manager.removeHandler(t)},n.prototype.removeAllGroupChannelHandlers=function(){this._manager.clearHandler()},n.prototype.buildGroupChannelFromSerializedData=function(t){return this._manager.buildGroupChannelFromSerializedData(t)},n.prototype.buildGroupChannelListQueryFromSerializedData=function(t){return this._manager.buildGroupChannelListQueryFromSerializedData(t)},n.prototype.buildMemberFromSerializedData=function(t){return this._manager.buildMemberFromSerializedData(t)},n.prototype.getChannel=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(k("string",t)).throw(L.invalidParameters),[2,this._manager.getChannel(t)]})})},n.prototype.getChannelWithoutCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(k("string",t)).throw(L.invalidParameters),[2,this._manager.getChannelWithoutCache(t)]})})},n.prototype.getMyGroupChannelChangeLogsByToken=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},C0),r),Q(k("string",t)&&kv(i)).throw(L.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,i)];case 1:return[2,s.sent()]}})})},n.prototype.getMyGroupChannelChangeLogsByTimestamp=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},C0),r),Q(k("number",t)&&kv(i)).throw(L.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,i)];case 1:return[2,s.sent()]}})})},n.prototype.getGroupChannelCount=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},wT),t),Q(TT(r)).throw(L.invalidParameters),[2,this._manager.getGroupChannelCount(r)]})})},n.prototype.getUnreadItemCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getUnreadItemCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._manager.getTotalUnreadChannelCount()];case 1:return[2,t.sent()]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getTotalUnreadMessageCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getTotalScheduledMessageCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getSubscribedTotalUnreadMessageCount=function(){return this._manager.getSubscribedTotalUnreadMessageCount()},n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){return this._manager.getSubscribedCustomTypeTotalUnreadMessageCount()},n.prototype.getSubscribedCustomTypeUnreadMessageCount=function(t){return this._manager.getSubscribedCustomTypeUnreadMessageCount(t)},n.prototype.createChannel=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},Nf),t),Q(Rv(r)).throw(L.invalidParameters),[2,this._manager.createChannel(r)]})})},n.prototype.createDistinctChannelIfNotExist=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},Nf),t),Q(Rv(r)).throw(L.invalidParameters),r&&(r.isDistinct=!0),[2,this.createChannel(r)]})})},n.prototype.createChannelWithUserIds=function(t,r,i,s,a,o){return r===void 0&&(r=!1),a===void 0&&(a=""),o===void 0&&(o=""),y(this,void 0,void 0,function(){var l;return g(this,function(u){return l=M(M({},Nf),{invitedUserIds:t,isDistinct:r,name:i,data:a,customType:o}),typeof s=="string"?l.coverUrl=s:l.coverImage=s,[2,this.createChannel(l)]})})},n.prototype.markAsReadAll=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return this._manager.markAsReadAll(),[2]})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return Q(Qe("string",t)).throw(L.invalidParameters),this._manager.markAsReadWithChannelUrls(t),[2]})})},n.prototype.markAsDelivered=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Q(k("string",t)).throw(L.invalidParameters),[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n}(w2);const ic={reactions:"reactions",message_search_v3:"message_search_v3",enable_og_tag:"enable_og_tag",enable_message_threading:"enable_message_threading",allow_broadcast_channel:"allow_broadcast_channel",allow_super_group_channel:"allow_super_group_channel"},w0={collection:{groupChannel:{defaultLimit:20,defaultOrder:Bt.LATEST_LAST_MESSAGE,defaultIncludeEmpty:!1},message:{defaultLimit:{next:25,prev:25},searchLimit:{next:10,prev:10}}}};var ED=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):i(c.value).then(o,l)}u((r=r.apply(e,n||[])).next())})};const bD=(e,n)=>{D.useEffect(IT(e),n)},CD=(e,n)=>{D.useLayoutEffect(IT(e),n)},q_=e=>e(),IT=e=>()=>{const n=q_(e);return()=>{n&&(n instanceof Promise?q_(()=>ED(void 0,void 0,void 0,function*(){const t=yield n;t&&t()})):q_(n))}};let SD=0;function wD(){return D.useState(()=>`${SD++}`)[0]}const AT=(e,n,t)=>{const r=D.useRef(n),s=wD();r.current=n,D.useEffect(()=>{var a;const o=l=>(Object.keys(l).forEach(c=>{l[c]=(...d)=>{var h,f;return(f=(h=r.current)===null||h===void 0?void 0:h[c])===null||f===void 0?void 0:f.call(h,...d)}}),l);return(a=e==null?void 0:e.groupChannel)===null||a===void 0||a.addGroupChannelHandler(s,o(new O2)),()=>{var l;(l=e==null?void 0:e.groupChannel)===null||l===void 0||l.removeGroupChannelHandler(s)}},[e==null?void 0:e.groupChannel,s])};function En(e){const n=D.useRef(e);return n.current=e,D.useCallback((...t)=>n.current(...t),[n])}var TD=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="poll",t}return w(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,a=r.sessionManager,o=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:a,requestQueue:o,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new p0(t,{sdkState:i,dispatcher:s,sessionManager:a,requestQueue:o,logger:l,onlineDetector:u,cacheContext:c})},n.prototype.create=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},zx),t),Q(Gw(r)).throw(L.invalidParameters),[2,this._manager.create(r)]})})},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},qx),t),Q(Vw(r)).throw(L.invalidParameters),[2,this._manager.get(r)]})})},n.prototype.getOption=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},Vx),t),Q(zw(r)).throw(L.invalidParameters),[2,this._manager.getOption(r)]})})},n.prototype.buildPollFromSerializedData=function(t){return this._manager.buildPollFromSerializedData(t)},n}(w2),ND=function(e){return["-lastMessageUpdatedAt","-createdAt","syncIndex"]},KE=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return w(n,e),n}(At),MT=function(e){this.key=e.key,this.url=e.url},xT=function(e){this.id=e.id,this.name=e.name,this.url=e.url,this.emojis=e.emojis?e.emojis.map(function(n){return new MT(n)}):[]},ID=function(e){this.emojiHash=e.emoji_hash||"",this.emojiCategories=e.emoji_categories?e.emoji_categories.map(function(n){return new xT(n)}):[]},AD={profileImage:void 0,profileUrl:void 0,nickname:void 0},QE=function(e){return function(n,t){return y(void 0,void 0,void 0,function(){var r,i,s,a;return g(this,function(o){switch(o.label){case 0:switch(n){case 1:case 2:case 3:case 4:return[3,1];case 5:return[3,2];case 6:return[3,4]}return[3,11];case 1:return t(),[3,12];case 2:return[4,e.store.clear()];case 3:return o.sent(),t(),[3,12];case 4:return o.trys.push([4,9,,10]),r=function(l){return{v2:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:hT,keyName:SR,index:[Tf(Bt.LATEST_LAST_MESSAGE),Tf(Bt.CHRONOLOGICAL),Tf(Bt.CHANNEL_NAME_ALPHABETICAL)]},{collectionName:Iv,keyName:wR,index:[Os(Yn.CHANNEL_LATEST),Os(Yn.NEWEST_CHILD_MESSAGE)]},{collectionName:mT,keyName:ok,index:[Os(Yn.CHANNEL_LATEST),Os(Yn.NEWEST_CHILD_MESSAGE)]},{collectionName:NR,keyName:IR}])];case 1:return[2,u.sent()]}})})},v3:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:AR,keyName:MR,index:[ND()]}])];case 1:return[2,u.sent()]}})})},v4:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:pT,keyName:TR,index:[nk()]}])];case 1:return[2,u.sent()]}})})}}}(e),i=r.v2,s=r.v3,a=r.v4,[4,i()];case 5:return o.sent(),[4,s()];case 6:return o.sent(),[4,a()];case 7:return o.sent(),[4,e.collection(Iv).removeIf({where:{channelType:et.OPEN}})];case 8:case 9:return o.sent(),[3,10];case 10:return t(),[3,12];case 11:t(),o.label=12;case 12:return[2]}})})}},MD=function(){return typeof document<"u"?document.visibilityState:"visible"},xD=function(e){function n(t){var r=t.getVisibilityState,i=r===void 0?MD:r,s=t.initialState,a=s===void 0?"visible":s,o=t.isEnabled,l=o===void 0||o,u=t.pauseCheckDelay,c=u===void 0?3e4:u,d=e.call(this)||this;return d._pauseCheckDelay=3e4,d._currentState="visible",d._getVisibilityState=i,d._pauseCheckDelay=c,d._currentState=a,d._isEnabled=l,d._boundToggleState=d._toggleState.bind(d),d}return w(n,e),Object.defineProperty(n.prototype,"currentState",{get:function(){return this._currentState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isAvailable",{get:function(){return typeof window<"u"&&!!window.addEventListener&&!!window.removeEventListener},enumerable:!1,configurable:!0}),n.prototype._toggleState=function(){var t=this,r=this._getVisibilityState();r!=="hidden"?this._currentState==="hidden"&&(this._pauseDelayTimer&&(clearTimeout(this._pauseDelayTimer),this._pauseDelayTimer=void 0),this.dispatch("resume")):this._currentState!=="hidden"&&(this._pauseDelayTimer=setTimeout(function(){t._pauseDelayTimer=void 0,t.dispatch("pause")},this._pauseCheckDelay)),this._currentState=r},n.prototype.start=function(){this._isEnabled&&this.isAvailable&&(this._boundToggleState=this._toggleState.bind(this),window.addEventListener("visibilitychange",this._boundToggleState,{capture:!0}))},n.prototype.stop=function(){this._isEnabled&&this.isAvailable&&this._boundToggleState&&window.removeEventListener("visibilitychange",this._boundToggleState,{capture:!0})},n}(fl),OD=function(){function e(n){var t=n.logger,r=n.connectionDelegate,i=r===void 0?null:r,s=this;this._onlineWorker=function(){var a;return(a=s.connectionDelegate)===null||a===void 0?void 0:a.reconnect()},this._offlineWorker=function(){var a;return(a=s.connectionDelegate)===null||a===void 0?void 0:a.disconnect()},this.unsubscribes=[],this._onlineListener=function(a){if(s.isAvailableOnWeb)return window.addEventListener("online",a),function(){return window.removeEventListener("online",a,!1)}},this._offlineListener=function(a){if(s.isAvailableOnWeb)return window.addEventListener("offline",a),function(){return window.removeEventListener("offline",a,!1)}},this.logger=t,i&&(this.connectionDelegate=i)}return Object.defineProperty(e.prototype,"isAvailableOnWeb",{get:function(){return typeof window<"u"&&!!window.addEventListener&&"ononline"in window&&"onoffline"in window&&typeof navigator<"u"&&navigator.onLine!==void 0},enumerable:!1,configurable:!0}),e.prototype.setOnlineListener=function(n){n&&typeof n=="function"&&(this._onlineListener=n)},e.prototype.setOfflineListener=function(n){n&&typeof n=="function"&&(this._offlineListener=n)},e.prototype.start=function(){this.unsubscribes=[this._onlineListener(this._onlineWorker),this._offlineListener(this._offlineWorker)]},e.prototype.stop=function(){var n=this;this.unsubscribes.forEach(function(t){try{t==null||t()}catch(r){n.logger.warn(r.message)}}),this.unsubscribes=[]},e.prototype.isOnline=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this.isAvailableOnWeb?[2,navigator.onLine]:[2,new Promise(function(t){fetch("https://www.google.com",{method:Y.GET,mode:"no-cors"}).then(function(){return t(!0)}).catch(function(){return t(!1)})})]})})},e}(),YE=function(e){function n(t){var r=t.userId,i=t.nickname,s=t.profileUrl,a=t.profileImage,o=t.preferredLanguages,l=e.call(this)||this;return l.method=Y.PUT,l.path="".concat(tt,"/").concat(encodeURIComponent(r)),l.params=be(Ie({nickname:i,profile_url:s,profile_file:a,preferred_languages:o})),l}return w(n,e),n}(Z),ZE=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.user=new Ze(t,M({},r)),i}return w(n,e),n}(le),RD=function(e){function n(t){var r=t.userId,i=t.token,s=t.deviceOS,a=t.deviceManufacturer,o=t.systemPushEnabled,l=e.call(this)||this;return l.method=Y.POST,l.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/apns"),l.params=be({apns_device_token:i,always_push:!0,device_os:s,device_manufacturer:a,system_push_enabled:o}),l}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.type=r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,i.user=new Ze(t,r.user),i}w(n,e)})(le);var kD=function(e){function n(t){var r=t.userId,i=t.token,s=t.deviceOS,a=t.deviceManufacturer,o=t.systemPushEnabled,l=e.call(this)||this;return l.method=Y.POST,l.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/gcm"),l.params=be({gcm_reg_token:i,always_push:!0,device_os:s,device_manufacturer:a,system_push_enabled:o}),l}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.type=r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,i.user=new Ze(t,r.user),i}w(n,e)})(le);var LD=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/apns/").concat(encodeURIComponent(i)),s}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.user=new Ze(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}w(n,e)})(le);var DD=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/gcm/").concat(encodeURIComponent(i)),s}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.user=new Ze(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}w(n,e)})(le);var UD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.DELETE,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/apns"),i}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.type=r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,i.user=new Ze(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}w(n,e)})(le);var PD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.DELETE,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/gcm"),i}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.type=r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,i.user=new Ze(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}w(n,e)})(le);var FD=function(e){function n(t){var r=t.userId,i=t.type,s=t.token,a=t.ts,o=e.call(this)||this;return o.method=Y.GET,o.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/").concat(encodeURIComponent(i),"/device_tokens"),o.params={created_ts:a,token:s},o}return w(n,e),n}(Z),HD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTokens={type:r.type?kn[r.type.toLowerCase()]:kn.UNKNOWN,deviceTokens:r.device_tokens,hasMore:r.has_more,token:r.token},i}return w(n,e),n}(le),jD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),i}return w(n,e),n}(Z),BD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.autoAccept=r.auto_accept,i}return w(n,e),n}(le),$D=function(e){function n(t){var r=t.userId,i=t.willAutoAccept,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),s.params={auto_accept:i},s}return w(n,e),n}(Z),GD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.autoAccept=r.auto_accept,i}return w(n,e),n}(le),zD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),i}return w(n,e),n}(Z),VD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.preference={doNotDisturbOn:r.do_not_disturb,startHour:r.start_hour,startMin:r.start_min,endHour:r.end_hour,endMin:r.end_min,timezone:r.timezone},i}return w(n,e),n}(le),qD=function(e){function n(t){var r=t.userId,i=t.doNotDisturbOn,s=t.startHour,a=t.startMin,o=t.endHour,l=t.endMin,u=t.timezone,c=e.call(this)||this;return c.method=Y.PUT,c.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),c.params={do_not_disturb:i,start_hour:s,start_min:a,end_hour:o,end_min:l,timezone:u},c}return w(n,e),n}(Z),WD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.preference={doNotDisturbOn:r.do_not_disturb,startHour:r.start_hour,startMin:r.start_min,endHour:r.end_hour,endMin:r.end_min,timezone:r.timezone},i}return w(n,e),n}(le),KD=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),i}return w(n,e),n}(Z),QD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.snoozePeriod={isSnoozeOn:r.snooze_enabled},typeof r.snooze_start_ts=="number"&&(i.snoozePeriod.startTs=r.snooze_start_ts),typeof r.snooze_end_ts=="number"&&(i.snoozePeriod.endTs=r.snooze_end_ts),i}return w(n,e),n}(le),YD=function(e){function n(t){var r=t.userId,i=t.snoozeOn,s=t.startTs,a=t.endTs,o=e.call(this)||this;return o.method=Y.PUT,o.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),o.params={snooze_enabled:i,snooze_start_ts:s,snooze_end_ts:a},o}return w(n,e),n}(Z),ZD=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.snoozePeriod={isSnoozeOn:r.snooze_enabled},typeof r.snooze_start_ts=="number"&&(i.snoozePeriod.startTs=r.snooze_start_ts),typeof r.snooze_end_ts=="number"&&(i.snoozePeriod.endTs=r.snooze_end_ts),i}return w(n,e),n}(le),XD=function(e){function n(t){var r=t.userId,i=t.blockedUserId,s=e.call(this)||this;return s.method=Y.POST,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/block"),s.params={target_id:i},s}return w(n,e),n}(Z);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.user=new Ze(t,r),i}w(n,e)})(le);var JD=function(e){function n(t){var r=t.userId,i=t.unblockedUserId,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/block/").concat(encodeURIComponent(i)),s}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var e5=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),i}return w(n,e),n}(Z),t5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i}return w(n,e),n}(le),n5=function(e){function n(t){var r=t.userId,i=t.pushTriggerOption,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push_preference"),s.params={push_trigger_option:i},s}return w(n,e),n}(Z),r5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i}return w(n,e),n}(le),i5=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/template"),i}return w(n,e),n}(Z),s5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.name=r.name,i}return w(n,e),n}(le),a5=function(e){function n(t){var r=t.userId,i=t.templateName,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/push/template"),s.params={name:i},s}return w(n,e),n}(Z),o5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.name=r.name,i}return w(n,e),n}(le),l5=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Y.GET,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friends/changelogs"),s.params={token:i},s}return w(n,e),n}(Z),u5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.changelogs={addedUsers:r.added.map(function(s){return new Ze(t,s)}),updatedUsers:r.updated.map(function(s){return new Ze(t,s)}),deletedUserIds:r.deleted,hasMore:r.has_more,token:r.next},i}return w(n,e),n}(le),c5=function(e){function n(t){var r=t.userId,i=t.discoveries,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discoveries:i.map(function(a){return{friend_discovery_key:a.friendDiscoveryKey,friend_name:a.friendName}})},s}return w(n,e),n}(Z),d5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.friendDiscoveryRequestId=r.friend_discovery_request_id,i}return w(n,e),n}(le),h5=function(e){function n(t){var r=t.userId,i=t.discoveryKeys,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discovery_keys:i},s}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var f5=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Y.POST,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return w(n,e),n}(Z),p5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ze(t,s)}),i}return w(n,e),n}(le),_5=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Y.DELETE,s.path="".concat(tt,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var m5=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(tt,"/").concat(r,"/allow_friend_discovery"),i.params={},i}return w(n,e),n}(Z),v5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.allowFriendDiscovery=r.allow_friend_discovery,i}return w(n,e),n}(le),g5=function(e){function n(t){var r=t.userId,i=t.allowFriendDiscovery,s=e.call(this)||this;return s.method=Y.PUT,s.path="".concat(tt,"/").concat(r,"/allow_friend_discovery"),s.params={allow_friend_discovery:i},s}return w(n,e),n}(Z);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}w(n,e)})(le);var T0,y5=function(e){function n(){var t=e.call(this)||this;return t.method=Y.GET,t.path=nw,t}return w(n,e),n}(Z),E5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiContainer=new ID(r),i}return w(n,e),n}(le),b5=function(e){function n(t){var r=t.categoryId,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(nw,"/").concat(r),i}return w(n,e),n}(Z),C5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiCategory=new xT(r),i}return w(n,e),n}(le),S5=function(e){function n(t){var r=t.key,i=e.call(this)||this;return i.method=Y.GET,i.path="".concat(eM,"/").concat(r),i}return w(n,e),n}(Z),w5=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emoji=new MT(r),i}return w(n,e),n}(le),T5=function(e){function n(){var t=e.call(this)||this;return t.method=Y.GET,t.path="".concat(tM),t}return w(n,e),n}(Z),N5=function(e){function n(t,r){var i,s=this,a=r??{};return(s=e.call(this,t,r)||this).uikitConfiguration={string:JSON.stringify(a),json:a},s.updatedAt=(i=r==null?void 0:r.updated_at)!==null&&i!==void 0?i:0,s}return w(n,e),n}(le);(function(e){e.DELIVERED="DELIVERED",e.CLICKED="CLICKED"})(T0||(T0={}));var sc,XE=function(e){function n(t){var r=t.deviceToken,i=t.pushTrackingId,s=t.messageId,a=t.allowedPushNotification,o=t.channelKey,l=t.templateKey,u=t.eventType,c=t.notificationEventDeadline,d=e.call(this)||this;return d.method=Y.POST,d.path=rM,d.params=be({device_token:r,push_tracking_id:i,message_id:s,allowed_push_notification:a,channel_key:o,template_key:l,event_type:u,notification_event_deadline:c}),d}return w(n,e),n}(Z),I5=function(){function e(n,t,r){var i=this;this._storeInitialized=!1,this._iid=n,this.options=t;var s=R.of(n),a=s.sdkState,o=s.cacheContext,l=s.dispatcher,u=s.sessionManager,c=s.requestQueue,d=s.logger,h=s.userEventHandlers,f=s.appStateToggleEnabled;this._onlineDetector=new OD({logger:d,connectionDelegate:{reconnect:function(){return y(i,void 0,void 0,function(){var m,b,v,_,E,S;return g(this,function(T){switch(T.label){case 0:if(m=R.of(n),b=m.sdkState,v=m.connectionManager,(_=m.sessionManager).session.hasSession)return[3,5];T.label=1;case 1:return T.trys.push([1,3,,4]),[4,v.connect(_.session.authToken)];case 2:return T.sent(),[3,4];case 3:if(E=T.sent(),zr(E))throw E;return d.debug("connect failed by reconnect event = ",E),[3,4];case 4:return[3,9];case 5:if(b.appState!=="foreground")return[3,9];T.label=6;case 6:return T.trys.push([6,8,,9]),[4,v.resetAndReconnect()];case 7:return T.sent(),[3,9];case 8:if(S=T.sent(),zr(S))throw S;return d.debug("resetAndReconnect failed by reconnect event = ",S),[3,9];case 9:return l.dispatch(new KE),[2]}})})},disconnect:function(){Lt(function(){return y(i,void 0,void 0,function(){return g(this,function(m){switch(m.label){case 0:return[4,R.of(n).connectionManager.disconnect()];case 1:return m.sent(),[2]}})})})}}});var p=new Sc(n,{localCacheEnabled:o.localCacheEnabled,enableAutoResend:o.localCacheConfig.enableAutoResend,dispatcher:l,sdkState:a,logger:d});r.forEach(function(m){m.init(n,{sdkState:a,cacheContext:o,dispatcher:l,sessionManager:u,requestQueue:c,logger:d,onlineDetector:i._onlineDetector}),i[m.name]=m}),this._appStateChangeDetector=new xD({isEnabled:f}),this._appStateChangeDetector.on("resume",function(){d.debug("the page resumes from freeze"),i.setForegroundState()}).on("pause",function(){d.debug("the page freezes"),i.setBackgroundState()}),l.on(function(m){var b;if(m instanceof Ii)m.stateType===lt.CONNECTED&&p.processNonAutoResendRegisteredPendingMessages();else if(m instanceof Et){if(m.code==="USEV"){var v=m.as(CT).event;if(v.category===Rd.FRIEND_DISCOVERED){var _=E0.getDataAsFriendDiscoveredEvent(n,v).friendDiscoveries;Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(N){return[2,h.forEach(function(I){I.onFriendsDiscovered&&I.onFriendsDiscovered(_)})]})})})}}}else if(m instanceof Iw){var E=R.of(i._iid).subscribedUnreadMessageCount,S=!1,T=m.ts;typeof T=="number"&&T>E.ts&&(E.all!==m.all&&(S=!0),E.all=m.all>=0?m.all:0,m.customTypes&&Object.keys(m.customTypes).forEach(function(N){E.customTypes[N]!==m.customTypes[N]&&(S=!0),E.customTypes[N]=m.customTypes[N]}),S=S&&E.ts>0,E.ts=T),S&&Ue(function(){return y(i,void 0,void 0,function(){return g(this,function(N){return[2,h.forEach(function(I){I.onTotalUnreadMessageCountChanged&&I.onTotalUnreadMessageCountChanged({groupChannelCount:E.all,feedChannelCount:E.feed,customTypeUnreadCount:E.customTypes}),I.onTotalUnreadMessageCountUpdated&&I.onTotalUnreadMessageCountUpdated(E.all,E.customTypes)})]})})})}else m instanceof xw?(o.preference.set(i._getUserProfileCacheKey(a.userId),gv.payloadify(m.userProfile)),!((b=m.userProfile.appInfo.notificationInfo)===null||b===void 0)&&b.isEnabled&&o.preference.set(b2(i.appId),{value:!0})):m instanceof Mu&&m.error&&m.error.isSessionInvalidatedError&&(d.debug("session revoked."),i.disconnect())})}return e.init=function(n){var t=n.appId,r=n.appVersion,i=n.modules,s=i===void 0?[]:i,a=n.options,o=a===void 0?new JS:a,l=n.debugMode,u=l!==void 0&&l,c=n.customApiHost,d=n.customWebSocketHost,h=n.newInstance,f=h!==void 0&&h,p=n.logLevel,m=n.localCacheEnabled,b=m!==void 0&&m,v=n.localCacheConfig,_=v===void 0?new tw:v,E=n.localCacheEncryption,S=n.useAsyncStorageStore,T=S===void 0?null:S,N=n.useMMKVStorageStore,I=N===void 0?null:N,x=n.appStateToggleEnabled,A=x===void 0||x;if(!sc||f){var O="su-".concat(la()),U=E??{encrypt:function(H){return H},decrypt:function(H){return H}},W=new tk;W.level=p??Ys.WARN;var P=new So({encryption:U});u||(fv()?I?P=new JR({MMKV:I,encryption:U}):T&&(P=new XR({AsyncStorage:T,encryption:U}),W.warn("AsyncStorage store is deprecated due to the small size limit. Please use MMKVStorage store instead.")):P=new ZR({encryption:U})),new R(O,{appId:t,appVersion:r,options:o,apiHost:c??"https://api-".concat(t,".sendbird.com"),websocketHost:d??"wss://ws-".concat(t,".sendbird.com"),store:P,encryption:U,logger:W,localCacheEnabled:b,localCacheConfig:_,debugMode:u,appStateToggleEnabled:A});var J=[new Ck,new TD],V=new e(O,o,Fe(Fe([],Me(s),!1),Me(J),!1));return sc||(sc=V),V}return sc},Object.defineProperty(e,"instance",{get:function(){return sc},enumerable:!1,configurable:!0}),Object.defineProperty(e,"version",{get:function(){return ZS},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appId",{get:function(){return R.of(this._iid).sdkState.appId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appInfo",{get:function(){var n=R.of(this._iid).appInfo;return n??null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appVersion",{get:function(){var n;return(n=R.of(this._iid).sdkState.appVersion)!==null&&n!==void 0?n:""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debugMode",{get:function(){return!!R.of(this._iid).debugMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"logLevel",{get:function(){return R.of(this._iid).logger.level},set:function(n){R.of(this._iid).logger.level=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCacheEnabled",{get:function(){return R.of(this._iid).cacheContext.localCacheEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCacheConfig",{get:function(){var n=R.of(this._iid).cacheContext;return n.localCacheEnabled?n.localCacheConfig:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ekey",{get:function(){return R.of(this._iid).sessionManager.ekey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentUser",{get:function(){var n;return(n=R.of(this._iid).sessionManager.currentUser)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectionState",{get:function(){var n=R.of(this._iid).connectionManager;return n.isConnected?As.OPEN:n.isConnecting?As.CONNECTING:As.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastConnectedAt",{get:function(){var n=R.of(this._iid),t=n.connectedAt;return n.connectionManager.isConnected?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fcmPushToken",{get:function(){var n;return(n=this._fcmPushToken)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apnsPushToken",{get:function(){var n;return(n=this._apnsPushToken)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),e.prototype._getNestDBVersion=function(){return 7},e.prototype._getPreferenceCacheKey=function(n){return"sendbird@".concat(this.appId,"/").concat(n,".pref")},e.prototype._getUserProfileCacheKey=function(n){return"sendbird@".concat(this.appId,"/").concat(n,".profile")},e.prototype.getMemoryStoreForDebugging=function(){var n=R.of(this._iid),t=n.debugMode,r=n.cacheContext;if(t)return r.store instanceof So?r.store:null;throw L.debugModeRequired},e.prototype.addExtension=function(n,t){var r=R.of(this._iid).sdkState;["sb_uikit","sb_syncmanager","device-os-platform"].indexOf(n)>-1&&r.extensions&&(r.extensions[n]=t)},e.prototype.addSendbirdExtensions=function(n,t,r){var i,s,a=R.of(this._iid),o=a.logger,l=a.sdkState,u=new RegExp(lM);if(n.length===0)return o.debug("sb.addSendbirdExtensions() has failed because the given sendbirdExtensions is empty."),!1;if(n.find(function(m){return!u.test(m.version)}))return o.debug("sb.addSendbirdExtensions() has failed because the given version did not satisfy the SemVer specification."),!1;if(r)try{for(var c=ge(Object.entries(r)),d=c.next();!d.done;d=c.next()){var h=Me(d.value,2),f=h[0],p=h[1];if(/&|=/.test(f)||/&|=/.test(p))return o.debug("sb.addSendbirdExtensions() has failed because the given customData includes at least one invalid character: = or &."),!1}}catch(m){i={error:m}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}return l.sendbirdRuntimeEnvironment={sendbirdExtensions:n,deviceOS:t,customData:r},!0},e.prototype.setOnlineListener=function(n){this._onlineDetector.setOnlineListener(n)},e.prototype.setOfflineListener=function(n){this._onlineDetector.setOfflineListener(n)},e.prototype._safeInitializeStore=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:t=R.of(this._iid).cacheContext,r.label=1;case 1:return r.trys.push([1,3,,5]),[4,t.store.init(n)];case 2:return r.sent(),this._storeInitialized=!0,[3,5];case 3:return r.sent(),t.replaceStore(new So),[4,this._safeInitializeStore(n)];case 4:return r.sent(),[3,5];case 5:return[2]}})})},e.prototype.initializeCache=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l,u,c;return g(this,function(d){switch(d.label){case 0:if(t=R.of(this._iid),r=t.sdkState,i=t.cacheContext,s=t.dispatcher,a=t.logger,r.userId&&r.userId===n)return[3,11];if(o="sendbird@".concat(r.appId,"/").concat(n,".db"),!i.localCacheEnabled)return[3,9];d.label=1;case 1:return d.trys.push([1,6,,8]),i.nestdb&&i.nestdb.state!==Ss.CLOSED&&i.nestdb.name===o?[3,3]:(l="sendbird@".concat(r.appId,"/").concat(n,".db"),(u=i.nestdb=new ek({name:l,version:this._getNestDBVersion(),store:i.store,config:new ih({dbname:l,itemSizeLimit:61440})})).on("upgrade",QE(u)),u.on("storeReplaced",function(h){i.replaceStore(h),i.localCacheEnabled=!1,u.on("upgrade",QE(u))}),[4,u.open()]);case 2:return d.sent(),this._storeInitialized=!0,s.dispatch(new ET(this._iid,{userId:n})),[3,5];case 3:return[4,this._safeInitializeStore(o)];case 4:d.sent(),d.label=5;case 5:return r.userId=n,[3,8];case 6:return c=d.sent(),a.warn("Nest DB Open Failed. ",c),i.store instanceof So||(i.replaceStore(new So),i.localCacheEnabled=!1),[4,this._safeInitializeStore(o)];case 7:throw d.sent(),r.userId=n,L.databaseError;case 8:return[3,11];case 9:return[4,this._safeInitializeStore(o)];case 10:d.sent(),r.userId=n,d.label=11;case 11:return[2]}})})},e.prototype.getCacheDataSize=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return(n=R.of(this._iid).cacheContext).localCacheEnabled&&n.nestdb?[4,n.nestdb.estimateUsage()]:[3,2];case 1:return[2,t.sent()];case 2:return[2,0]}})})},e.prototype.clearCachedData=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return(n=R.of(this._iid).cacheContext).localCacheEnabled&&n.nestdb?[4,n.nestdb.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._storeInitialized?[4,n.preference.clear()]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}})})},e.prototype.clearCachedMessages=function(n){return y(this,void 0,void 0,function(){var t,r,i=this;return g(this,function(s){switch(s.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),t=nu.of(this._iid),r=ll.of(this._iid),t&&r?[4,Promise.all(n.map(function(a){return y(i,void 0,void 0,function(){return g(this,function(o){switch(o.label){case 0:return[4,t.removeMessagesOfChannel(a)];case 1:return o.sent(),[4,r.removeMessagesOfChannel(a)];case 2:return o.sent(),[2]}})})}))]:[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},e.prototype._setupPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.cacheContext,s=t.statManager,[4,i.preference.init(this._getPreferenceCacheKey(n),this._getNestDBVersion())];case 1:return o.sent(),[4,i.preference.get(this._getUserProfileCacheKey(n))];case 2:return(a=o.sent())&&new gv(this._iid,a).apply(),[4,s.init("sendbird@".concat(r.appId,"/").concat(n,".statlog"))];case 3:return o.sent(),[2]}})})},e.prototype._ready=function(n,t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i,s,a,o,l,u;return g(this,function(c){switch(c.label){case 0:return Q(k("string",n)&&k("string",t,!0)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.cacheContext,o=i.connectionManager,l=r.errorForOtherUser,s.userId&&s.userId!==n?l?[3,2]:[4,o.logout()]:[3,3];case 1:return c.sent(),[3,3];case 2:throw l;case 3:return c.trys.push([3,5,6,8]),[4,this.initializeCache(n)];case 4:return c.sent(),R.of(this._iid).dispatcher.dispatch(new bT),[3,8];case 5:return c.sent(),u=R.of(this._iid).logger,a.localCacheEnabled=!1,u.warn("Cache initialization failed - cache is not available."),[3,8];case 6:return[4,this._setupPreference(n)];case 7:return c.sent(),[7];case 8:return[2]}})})},e.prototype.authenticateFeed=function(n,t){var r;return y(this,void 0,void 0,function(){var i,s,a,o;return g(this,function(l){switch(l.label){case 0:return i=R.of(this._iid),s=i.sessionManager,a=i.connectionManager,[4,this._ready(n,t,{errorForOtherUser:a.isConnected?L.alreadyConnectedAsAnotherUser:void 0})];case 1:return l.sent(),!((r=s.session.services)===null||r===void 0)&&r.includes(Nd.CHAT)?[3,3]:(t||s.handler||(o=new kE,this.setSessionHandler(o)),[4,s.authenticateFeed(n,t)]);case 2:l.sent(),l.label=3;case 3:return[2,this.currentUser]}})})},e.prototype.connect=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._ready(n,t)];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,R.of(this._iid).connectionManager.connect(t)];case 3:return r.sent(),[3,5];case 4:return this._onlineDetector.start(),this._appStateChangeDetector.start(),[7];case 5:return[2,this.currentUser]}})})},e.prototype.reconnect=function(){var n=R.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.sessionManager.session.hasSession;return i&&(this._appStateChangeDetector.start(),this._onlineDetector.start(),t.resetAndReconnect().then(function(){r.appState="foreground"}).catch(function(){})),i},e.prototype.disconnect=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=R.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),i.cancelAll(),[4,t.logout()];case 1:return s.sent(),[4,this.clearCachedData()];case 2:return s.sent(),r.appState="foreground",[2]}})})},e.prototype.disconnectWebSocket=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=R.of(this._iid),t=n.connectionManager,r=n.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),r.cancelAll(),[4,t.disconnectWebSocket(!0)];case 1:return i.sent(),[2]}})})},e.prototype.setBackgroundState=function(){var n=R.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.logger;r.appState==="foreground"&&(r.appState="background",i.debug("going background state"),t.background().catch(function(s){i.debug("setBackgroundState error = ",s)}))},e.prototype.setForegroundState=function(){var n=R.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.dispatcher,s=n.logger;r.appState==="background"&&(r.appState="foreground",s.debug("going foreground state"),t.resetAndReconnect().catch(function(a){s.debug("setForgroundState error = ",a)}),i.dispatch(new KE))},e.prototype.setSessionHandler=function(n){Q(n instanceof kE).throw(L.invalidParameters),R.of(this._iid).sessionManager.handler=n},e.prototype.addUserEventHandler=function(n,t){Q(k("string",n)&&t instanceof LR).throw(L.invalidParameters),R.of(this._iid).userEventHandlers.set(n,t)},e.prototype.removeUserEventHandler=function(n){R.of(this._iid).userEventHandlers.delete(n)},e.prototype.removeAllUserEventHandler=function(){R.of(this._iid).userEventHandlers.clear()},e.prototype.addConnectionHandler=function(n,t){Q(k("string",n)&&t instanceof _T).throw(L.invalidParameters),R.of(this._iid).connectionHandlers.set(n,t)},e.prototype.removeConnectionHandler=function(n){R.of(this._iid).connectionHandlers.delete(n)},e.prototype.removeAllConnectionHandler=function(){R.of(this._iid).connectionHandlers.clear()},e.prototype.createApplicationUserListQuery=function(n){return n===void 0&&(n={}),new PR(this._iid,n)},e.prototype.createBlockedUserListQuery=function(n){return n===void 0&&(n={}),new jR(this._iid,n)},e.prototype.createFriendListQuery=function(n){return n===void 0&&(n={}),new GR(this._iid,n)},e.prototype.createMessageSearchQuery=function(n){return new mk(this._iid,n)},e.prototype.createPollListQuery=function(n){return new qw(this._iid,M({},n))},e.prototype.createPollVoterListQuery=function(n){return new Ww(this._iid,M({},n))},e.prototype.buildUserFromSerializedData=function(n){var t=Ko(n);return new Ze(this._iid,Ze.payloadify(t))},e.prototype.updateCurrentUserInfo=function(n){return n===void 0&&(n={}),y(this,void 0,void 0,function(){var t,r,i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return t=M(M({},AD),n),Q(function(c){return Er(c.profileImage,!0)&&k("string",c.profileUrl,!0)&&k("string",c.nickname,!0)}(t)).throw(L.invalidParameters),this.currentUser?(r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=new YE(M({userId:i.userId},t)),[4,s.send(a)]):[3,2];case 1:return o=u.sent(),l=o.as(ZE).user,this.currentUser&&(t.nickname&&(this.currentUser.nickname=l.nickname),(t.profileUrl||t.profileImage)&&(this.currentUser.plainProfileUrl=l.profileUrl)),[2,l];case 2:throw L.connectionRequired}})})},e.prototype.updateCurrentUserInfoWithPreferredLanguages=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o;return g(this,function(l){switch(l.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),this.currentUser?(t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new YE({userId:r.userId,preferredLanguages:n}),[4,i.send(s)]):[3,2];case 1:return a=l.sent(),o=a.as(ZE).user,this.currentUser&&(this.currentUser.preferredLanguages=o.preferredLanguages),[2,o];case 2:throw L.connectionRequired}})})},e.prototype.registerFCMPushTokenForCurrentUser=function(n,t){var r,i;return y(this,void 0,void 0,function(){var s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:if(Q(k("string",n)&&k("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&Q(Ve(Ui,t.deviceOS.platform,!0)&&k("string",t.deviceOS.version,!0)).throw(L.invalidParameters),!this.currentUser)return[3,6];s={deviceOS:"".concat(((r=t==null?void 0:t.deviceOS)===null||r===void 0?void 0:r.platform)||Ui.ANDROID,"-").concat(((i=t==null?void 0:t.deviceOS)===null||i===void 0?void 0:i.version)||"unknown"),deviceManufacturer:t==null?void 0:t.deviceManufacturer,systemPushEnabled:t==null?void 0:t.systemPushEnabled},h.label=1;case 1:return h.trys.push([1,4,,5]),a=R.of(this._iid),o=a.sessionManager,l=a.sdkState,u=a.requestQueue,o.hasDeviceToken(kn.FCM,n)?[2,Mr.SUCCESS]:(c=new kD({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,Lt(function(){return y(d,void 0,void 0,function(){return g(this,function(f){switch(f.label){case 0:return o.setDeviceToken(kn.FCM,n,s),[4,o.saveDeviceToken()];case 1:return f.sent(),[2]}})})})];case 3:return h.sent(),this._fcmPushToken="",[2,Mr.SUCCESS];case 4:return h.sent(),[2,Mr.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=n,[2,Mr.PENDING];case 7:return[2]}})})},e.prototype.unregisterFCMPushTokenForCurrentUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l=this;return g(this,function(u){switch(u.label){case 0:if(Q(k("string",n)).throw(L.invalidParameters),!this.currentUser)return[3,6];u.label=1;case 1:return u.trys.push([1,4,,5]),t=R.of(this._iid),r=t.sessionManager,i=t.sdkState,s=t.requestQueue,a=new DD({userId:i.userId,token:n}),[4,s.send(a)];case 2:return o=u.sent().lastDeletedAt,[4,Lt(function(){return y(l,void 0,void 0,function(){return g(this,function(c){switch(c.label){case 0:return r.unsetDeviceToken(kn.FCM,n),r.setDeviceTokenDeletedAt(o),[4,r.saveDeviceToken()];case 1:return c.sent(),[2]}})})})];case 3:return u.sent(),this._fcmPushToken="",[2,Mr.SUCCESS];case 4:return u.sent(),[2,Mr.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=n,[2,Mr.PENDING];case 7:return[2]}})})},e.prototype.unregisterFCMPushTokenAllForCurrentUser=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o=this;return g(this,function(l){switch(l.label){case 0:return this.currentUser?(n=R.of(this._iid),t=n.sessionManager,r=n.sdkState,i=n.requestQueue,s=new PD({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return a=l.sent().lastDeletedAt,[4,Lt(function(){return y(o,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return t.unsetDeviceTokens(kn.FCM),t.setDeviceTokenDeletedAt(a),[4,t.saveDeviceToken()];case 1:return u.sent(),[2]}})})})];case 2:l.sent(),l.label=3;case 3:return[2]}})})},e.prototype.registerAPNSPushTokenForCurrentUser=function(n,t){var r,i;return y(this,void 0,void 0,function(){var s,a,o,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:if(Q(k("string",n)&&k("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&Q(Ve(Ui,t.deviceOS.platform,!0)&&k("string",t.deviceOS.version,!0)).throw(L.invalidParameters),!this.currentUser)return[3,6];s={deviceOS:"".concat(((r=t==null?void 0:t.deviceOS)===null||r===void 0?void 0:r.platform)||Ui.IOS,"-").concat(((i=t==null?void 0:t.deviceOS)===null||i===void 0?void 0:i.version)||"unknown"),deviceManufacturer:t==null?void 0:t.deviceManufacturer,systemPushEnabled:t==null?void 0:t.systemPushEnabled},h.label=1;case 1:return h.trys.push([1,4,,5]),a=R.of(this._iid),o=a.sessionManager,l=a.sdkState,u=a.requestQueue,o.hasDeviceToken(kn.APNS,n)?[2,Mr.SUCCESS]:(c=new RD({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,Lt(function(){return y(d,void 0,void 0,function(){return g(this,function(f){switch(f.label){case 0:return o.setDeviceToken(kn.APNS,n,s),[4,o.saveDeviceToken()];case 1:return f.sent(),[2]}})})})];case 3:return h.sent(),this._apnsPushToken="",[2,Mr.SUCCESS];case 4:return h.sent(),[2,Mr.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=n,[2,Mr.PENDING];case 7:return[2]}})})},e.prototype.unregisterAPNSPushTokenForCurrentUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a,o,l=this;return g(this,function(u){switch(u.label){case 0:if(Q(k("string",n)).throw(L.invalidParameters),!this.currentUser)return[3,6];u.label=1;case 1:return u.trys.push([1,4,,5]),t=R.of(this._iid),r=t.sessionManager,i=t.sdkState,s=t.requestQueue,a=new LD({userId:i.userId,token:n}),[4,s.send(a)];case 2:return o=u.sent().lastDeletedAt,[4,Lt(function(){return y(l,void 0,void 0,function(){return g(this,function(c){switch(c.label){case 0:return r.unsetDeviceToken(kn.APNS,n),r.setDeviceTokenDeletedAt(o),[4,r.saveDeviceToken()];case 1:return c.sent(),[2]}})})})];case 3:return u.sent(),this._apnsPushToken="",[2,Mr.SUCCESS];case 4:return u.sent(),[2,Mr.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=n,[2,Mr.PENDING];case 7:return[2]}})})},e.prototype.unregisterAPNSPushTokenAllForCurrentUser=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,a,o=this;return g(this,function(l){switch(l.label){case 0:return this.currentUser?(n=R.of(this._iid),t=n.sessionManager,r=n.sdkState,i=n.requestQueue,s=new UD({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return a=l.sent().lastDeletedAt,[4,Lt(function(){return y(o,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return t.unsetDeviceTokens(kn.APNS),t.setDeviceTokenDeletedAt(a),[4,t.saveDeviceToken()];case 1:return u.sent(),[2]}})})})];case 2:l.sent(),l.label=3;case 3:return[2]}})})},e.prototype.markPushNotificationAsDelivered=function(n,t){var r;return t===void 0&&(t=!0),y(this,void 0,void 0,function(){var i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N;return g(this,function(I){switch(I.label){case 0:if(i=R.of(this._iid),s=i.logger,a=i.sessionManager,o=i.requestQueue,l=i.pushNotificationAckManager,s.debug("markPushNotificationAsDelivered:",n),u=T0.DELIVERED,c=l.parseData(n),d=c.pushTrackingId,h=c.sessionTopics,f=c.sessionKey,p=c.messageId,m=c.channelKey,b=c.templateKey,v=c.notificationEventDeadline,!f||!h.includes(f0.PUSH_ACKNOWLEDGEMENT))throw s.info("Can't use markPushNotificationAsDelivered() feature."),L.malformedDataError;if(l.isAcked(d,u))return s.info("already delivered push notification:",d),[2];_=!!m,E=t&&_,S=(r=a.deviceTokens[0])===null||r===void 0?void 0:r.token,T=new XE({deviceToken:S??"",pushTrackingId:d,eventType:u,messageId:p,channelKey:m,templateKey:b,notificationEventDeadline:v,allowedPushNotification:E}),f&&(T.headers["Session-Key"]=f),I.label=1;case 1:return I.trys.push([1,3,,4]),[4,o.send(T)];case 2:return I.sent(),l.markAsAcked(d,u),[3,4];case 3:throw N=I.sent(),s.debug("failed to mark push notification as delivered. push tracking id: ".concat(d,". error: ").concat(N)),N;case 4:return[2]}})})},e.prototype.markPushNotificationAsClicked=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E;return g(this,function(S){switch(S.label){case 0:if(r=R.of(this._iid),i=r.logger,s=r.sessionManager,a=r.requestQueue,o=r.pushNotificationAckManager,i.debug("markPushNotificationAsClicked:",n),l=T0.CLICKED,u=o.parseData(n),c=u.pushTrackingId,d=u.sessionTopics,h=u.sessionKey,f=u.messageId,p=u.channelKey,m=u.templateKey,b=u.notificationEventDeadline,!h||!d.includes(f0.PUSH_ACKNOWLEDGEMENT))throw i.info("Can't use markPushNotificationAsDelivered() feature."),L.malformedDataError;if(o.isAcked(c,l))return i.info("already clicked push notification:",c),[2];v=(t=s.deviceTokens[0])===null||t===void 0?void 0:t.token,_=new XE({deviceToken:v??"",pushTrackingId:c,eventType:l,messageId:f,channelKey:p,templateKey:m,notificationEventDeadline:b}),h&&(_.headers["Session-Key"]=h),S.label=1;case 1:return S.trys.push([1,3,,4]),[4,a.send(_)];case 2:return S.sent(),o.markAsAcked(c,l),[3,4];case 3:throw E=S.sent(),i.debug("failed to mark push notification as clicked. push tracking id: ".concat(c,". error: ").concat(E)),E;case 4:return[2]}})})},e.prototype.getChannelInvitationPreference=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new jD({userId:t.userId}),[4,r.send(i)];case 1:return s=a.sent(),[2,{autoAccept:s.as(BD).autoAccept}]}})})},e.prototype.setChannelInvitationPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(k("boolean",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new $D({userId:r.userId,willAutoAccept:n}),[4,i.send(s)];case 1:return a=o.sent(),[2,{autoAccept:a.as(GD).autoAccept}]}})})},e.prototype.getDoNotDisturb=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new zD({userId:t.userId}),[4,r.send(i)];case 1:return s=a.sent(),[2,s.as(VD).preference]}})})},e.prototype.setDoNotDisturb=function(n,t,r,i,s,a){return t===void 0&&(t=0),r===void 0&&(r=0),i===void 0&&(i=0),s===void 0&&(s=0),a===void 0&&(a=""),y(this,void 0,void 0,function(){var o,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return Q(k("boolean",n)&&k("number",t)&&k("number",r)&&k("number",i)&&k("number",s)&&k("string",a)).throw(L.invalidParameters),o=R.of(this._iid),l=o.sdkState,u=o.requestQueue,c=new qD({userId:l.userId,doNotDisturbOn:n,startHour:t,startMin:r,endHour:i,endMin:s,timezone:a}),[4,u.send(c)];case 1:return d=h.sent(),[2,d.as(WD).preference]}})})},e.prototype.getSnoozePeriod=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new KD({userId:t.userId}),[4,r.send(i)];case 1:return s=a.sent(),[2,s.as(QD).snoozePeriod]}})})},e.prototype.setSnoozePeriod=function(n,t,r){return t===void 0&&(t=0),r===void 0&&(r=0),y(this,void 0,void 0,function(){var i,s,a,o,l;return g(this,function(u){switch(u.label){case 0:return Q(k("boolean",n)&&k("number",t)&&k("number",r)).throw(L.invalidParameters),i=R.of(this._iid),s=i.sdkState,a=i.requestQueue,o=new YD({userId:s.userId,snoozeOn:n,startTs:t,endTs:r}),[4,a.send(o)];case 1:return l=u.sent(),[2,l.as(ZD).snoozePeriod]}})})},e.prototype.getMyPushTokensByToken=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,a,o,l,u,c,d,h,f,p;return g(this,function(m){switch(m.label){case 0:return Q(k("string",n)&&Ve(kn,t)).throw(L.invalidParameters),r=R.of(this._iid),i=r.sdkState,s=r.requestQueue,a=r.sessionManager,o=new FD({userId:i.userId,type:t,token:n}),[4,s.send(o)];case 1:l=m.sent(),u=l.as(HD).pushTokens;try{for(c=ge(u.deviceTokens),d=c.next();!d.done;d=c.next())h=d.value,a.setDeviceToken(u.type,h)}catch(b){f={error:b}}finally{try{d&&!d.done&&(p=c.return)&&p.call(c)}finally{if(f)throw f.error}}return[4,a.saveDeviceToken()];case 2:return m.sent(),[2,u]}})})},e.prototype.getPushTriggerOption=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new e5({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(t5).pushTriggerOption]}})})},e.prototype.setPushTriggerOption=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(Ve(Ao,n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new n5({userId:r.userId,pushTriggerOption:n}),[4,i.send(s)];case 1:return[2,a.sent().as(r5).pushTriggerOption]}})})},e.prototype.getPushTemplate=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new i5({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(s5).name]}})})},e.prototype.setPushTemplate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(Ve(uv,n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new a5({userId:r.userId,templateName:n}),[4,i.send(s)];case 1:return[2,a.sent().as(o5).name]}})})},e.prototype.blockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(n instanceof Ze||k("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new XD({userId:r.userId,blockedUserId:n instanceof Ze?n.userId:n}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},e.prototype.blockUserWithUserId=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.blockUser(n)]})})},e.prototype.unblockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(n instanceof Ze||k("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new JD({userId:r.userId,unblockedUserId:n instanceof Ze?n.userId:n}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},e.prototype.unblockUserWithUserId=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.unblockUser(n)]})})},e.prototype.getFriendChangeLogsByToken=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(k("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new l5({userId:r.userId,token:n}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(u5).changelogs]}})})},e.prototype.getAllowFriendDiscovery=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(a){switch(a.label){case 0:return n=R.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new m5({userId:t.userId}),[4,r.send(i)];case 1:return s=a.sent(),[2,s.as(v5).allowFriendDiscovery]}})})},e.prototype.setAllowFriendDiscovery=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(k("boolean",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new g5({userId:r.userId,allowFriendDiscovery:n}),[4,i.send(s)];case 1:return a.sent(),[2,n]}})})},e.prototype.uploadFriendDiscoveries=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new c5({userId:r.userId,discoveries:n}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(d5).friendDiscoveryRequestId]}})})},e.prototype.deleteFriendDiscovery=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteFriendDiscoveries([n])]})})},e.prototype.deleteFriendDiscoveries=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new h5({userId:r.userId,discoveryKeys:n}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},e.prototype.addFriends=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,a;return g(this,function(o){switch(o.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new f5({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return a=o.sent(),[2,a.as(p5).users]}})})},e.prototype.deleteFriend=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteFriends([n])]})})},e.prototype.deleteFriends=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(a){switch(a.label){case 0:return Q(Qe("string",n)).throw(L.invalidParameters),t=R.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new _5({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return a.sent(),[2]}})})},e.prototype.getAllEmoji=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=R.of(this._iid).requestQueue,t=new y5,[4,n.send(t)];case 1:return r=i.sent(),[2,r.as(E5).emojiContainer]}})})},e.prototype.getEmojiCategory=function(n){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return t=R.of(this._iid).requestQueue,r=new b5({categoryId:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(C5).emojiCategory]}})})},e.prototype.getEmoji=function(n){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return t=R.of(this._iid).requestQueue,r=new S5({key:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(w5).emoji]}})})},e.prototype.getUIKitConfiguration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=R.of(this._iid),Q(n.hasExtension("sb_uikit")).throw(L.notSupportedError),t=n.requestQueue,r=new T5,[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(N5).uikitConfiguration]}})})},e}();function A5(e,n){return!e||!n?!0:e.url!==n.url}function ul(e){return e!=null&&"sendingStatus"in e}function N0(e,n="##__USER_ID_IS_NOT_PROVIDED__##"){var t;return ul(e)?((t=e.sender)===null||t===void 0?void 0:t.userId)===n:!1}function M5(e,n){return N0(e,n)||e.isAdminMessage()?!1:e.updatedAt===0}function JE(e){return"sendingStatus"in e?e.sendingStatus==="succeeded"?String(e.messageId):e.reqId:String(e.messageId)}function rt(e){return typeof e=="boolean"}function Al(e,n){return n.includes(e)}function x5(e){return e instanceof Set}function e3(e){return!e||!Array.isArray(e)?!1:e.length!==0}function O5(e,n){return Object.prototype.toString.call(e)===Object.prototype.toString.call(n)}const R5=()=>{const[,e]=D.useState(0);return D.useCallback(()=>e(n=>n+1),[])};function Pv(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.map(t=>Pv(t));const n={};return Object.keys(e).forEach(t=>{const r=t.replace(/_\w/g,i=>i[1].toUpperCase());n[r]=Pv(e[t])}),n}function t3(e,n){return e.reduce((t,r)=>{const i=n(r);return t[i]=r,t},{})}var k5=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var t=k5(e,[]);switch(n.type){case"update_initialized":return t.initialized=n.value.status,t;case"update_refreshing":return t.refreshing=n.value.status,t;case"update_loading":return t.loading=n.value.status,t;case"update_messages":{const r=n.value.currentUserId;if(n.value.clearBeforeAction)t.messageMap=n3(n.value.messages);else{const i=n.value.messages.filter(a=>{var o;if(N0(a,r)){const l=(o=t.messageMap[a.reqId])!==null&&o!==void 0?o:t.messageMap[a.messageId];if(N0(l,r)){const u=D5(l,a);return u&&(delete t.messageMap[l.reqId],delete t.messageMap[l.messageId]),u}}return!0}),s=n3(i);t.messageMap=Object.assign(Object.assign({},t.messageMap),s)}return t}case"update_new_messages":{const r=n.value.currentUserId,i=n.value.messages.filter(s=>M5(s,r));return n.value.clearBeforeAction?t.newMessageMap=t3(i,JE):(i.map(a=>a.messageId).forEach(a=>delete t.newMessageMap[a]),t.newMessageMap=Object.assign(Object.assign({},t.newMessageMap),t3(i,JE))),t}case"delete_messages":case"delete_new_messages":{const r=n.type==="delete_messages"?"messageMap":"newMessageMap";return t[r]=Object.assign({},t[r]),n.value.messageIds.forEach(i=>{const s=t[r][i];s&&(ul(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),n.value.reqIds.forEach(i=>{const s=t[r][i];s&&(ul(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),t}}},n3=e=>e.reduce((n,t)=>(ul(t)?(n[t.reqId]=t,t.sendingStatus===ht.SUCCEEDED&&(n[t.messageId]=t)):n[t.messageId]=t,n),{}),D5=(e,n)=>e.sendingStatus===ht.SUCCEEDED?n.sendingStatus===ht.SUCCEEDED:e.sendingStatus!==n.sendingStatus,U5=(e=P5)=>{const[{initialized:n,loading:t,refreshing:r,messageMap:i,newMessageMap:s},a]=D.useReducer(L5,{initialized:!1,loading:!0,refreshing:!1,messageMap:{},newMessageMap:{}}),o=(b,v,_)=>{a({type:"update_messages",value:{messages:b,clearBeforeAction:v,currentUserId:_}})},l=(b,v)=>{a({type:"delete_messages",value:{messageIds:b,reqIds:v}})},u=(b,v,_)=>{a({type:"update_new_messages",value:{messages:b,clearBeforeAction:v,currentUserId:_}})},c=(b,v)=>{a({type:"delete_new_messages",value:{messageIds:b,reqIds:v}})},d=b=>{a({type:"update_initialized",value:{status:b}})},h=b=>{a({type:"update_loading",value:{status:b}})},f=b=>{a({type:"update_refreshing",value:{status:b}})},p=Object.values(s),m=D.useMemo(()=>Array.from(new Set(Object.values(i))).sort(e),[i]);return{updateInitialized:d,updateLoading:h,updateRefreshing:f,updateMessages:o,deleteMessages:l,initialized:n,loading:t,refreshing:r,messages:m,newMessages:p,updateNewMessages:u,deleteNewMessages:c}},r3=Math.floor(Number.MAX_SAFE_INTEGER/10);function P5(e,n){let t=0,r=0;return ul(e)&&e.sendingStatus!=="succeeded"&&(t=r3),ul(n)&&n.sendingStatus!=="succeeded"&&(r=r3),e.createdAt+t-(n.createdAt+r)}var Xi=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):i(c.value).then(o,l)}u((r=r.apply(e,n||[])).next())})};const F5=(e,n,t)=>{var r;const i={prevResultLimit:n.prev,nextResultLimit:n.next,startingPoint:t==null?void 0:t.startingPoint,replyType:t==null?void 0:t.replyType},s=(r=t==null?void 0:t.collectionCreator)===null||r===void 0?void 0:r.call(t,i);return s||e.createMessageCollection(Object.assign(Object.assign({},i),{filter:new Us(i)}))};function i3(e){return e{var r,i,s;const a=D.useRef(t);a.current=t;const o=D.useRef(n);o.current=n;const l=a.current.logger,u=(r=a.current.startingPoint)!==null&&r!==void 0?r:Number.MAX_SAFE_INTEGER,c=i3(u),d=D.useRef({prev:!1,next:!1}),h=R5(),f=D.useRef({initialized:!1,apiInitialized:!1,instance:null}),{initialized:p,loading:m,refreshing:b,messages:v,newMessages:_,updateMessages:E,updateNewMessages:S,deleteNewMessages:T,deleteMessages:N,updateInitialized:I,updateLoading:x,updateRefreshing:A}=U5(t==null?void 0:t.sortComparator),O=En(B=>{var ae,de,Ee,se;if(!o.current||!o.current.url)return(ae=l==null?void 0:l.error)===null||ae===void 0?void 0:ae.call(l,"[useGroupChannelMessages] channel is required");try{switch(B){case z.EVENT_MESSAGE_RECEIVED:case z.EVENT_MESSAGE_SENT_SUCCESS:case z.SYNC_MESSAGE_FILL:case void 0:(Ee=(de=a.current).markAsRead)===null||Ee===void 0||Ee.call(de,[o.current]);break}}catch(he){(se=l==null?void 0:l.warn)===null||se===void 0||se.call(l,"[useGroupChannelMessages/markAsReadBySource]",he)}}),U=En((B,ae)=>{var de,Ee,se,he,fe;const ve=ae.filter(me=>{var pe;return!N0(me,(pe=e.currentUser)===null||pe===void 0?void 0:pe.userId)});if(ve.length>0)switch(B){case z.EVENT_MESSAGE_RECEIVED:case z.SYNC_MESSAGE_FILL:{!((Ee=(de=a.current).shouldCountNewMessages)===null||Ee===void 0)&&Ee.call(de)&&S(ve,!1,(se=e.currentUser)===null||se===void 0?void 0:se.userId),(fe=(he=a.current).onMessagesReceived)===null||fe===void 0||fe.call(he,ve);break}}}),W=En((B,ae)=>Xi(void 0,void 0,void 0,function*(){return new Promise(de=>{var Ee,se;if(!o.current||!o.current.url)return(Ee=l==null?void 0:l.error)===null||Ee===void 0?void 0:Ee.call(l,"[useGroupChannelMessages] channel is required");f.current.instance&&f.current.instance.dispose(),O(),S([],!0,(se=e.currentUser)===null||se===void 0?void 0:se.userId);const he=()=>{var ve,me,pe;const{pendingMessages:Ce,failedMessages:ze}=(ve=f.current.instance)!==null&&ve!==void 0?ve:{};e3(Ce)&&E(Ce,!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),e3(ze)&&E(ze,!1,(pe=e.currentUser)===null||pe===void 0?void 0:pe.userId)},fe=F5(o.current,ae,Object.assign(Object.assign({},a.current),{startingPoint:B}));f.current={apiInitialized:!1,initialized:!1,instance:fe},fe.setMessageCollectionHandler({onMessagesAdded:(ve,me,pe)=>{var Ce;O(ve.source),U(ve.source,pe),E(pe,!1,(Ce=e.currentUser)===null||Ce===void 0?void 0:Ce.userId)},onMessagesUpdated:(ve,me,pe)=>{var Ce,ze,ue;O(ve.source),U(ve.source,pe),E(pe,!1,(Ce=e.currentUser)===null||Ce===void 0?void 0:Ce.userId),ve.source===z.EVENT_MESSAGE_UPDATED&&((ue=(ze=a.current).onMessagesUpdated)===null||ue===void 0||ue.call(ze,pe))},onMessagesDeleted:(ve,me,pe,Ce)=>{const ze=Ce.map(ne=>ne.messageId),ue=Ce.filter(ul).map(ne=>ne.reqId);N(ze,ue),T(ze,ue)},onChannelDeleted:(ve,me)=>{var pe,Ce;(Ce=(pe=a.current).onChannelDeleted)===null||Ce===void 0||Ce.call(pe,me)},onChannelUpdated:(ve,me)=>{var pe,Ce;h(),(Ce=(pe=a.current).onChannelUpdated)===null||Ce===void 0||Ce.call(pe,me)},onHugeGapDetected:()=>{W(Number.MAX_SAFE_INTEGER,w0.collection.message.defaultLimit)}}),fe.initialize(S0.CACHE_AND_REPLACE_BY_API).onCacheResult((ve,me)=>{var pe,Ce,ze;ve?e.isCacheEnabled&&((pe=l==null?void 0:l.error)===null||pe===void 0||pe.call(l,"[useGroupChannelMessages/onCacheResult]",ve)):me&&((Ce=l==null?void 0:l.debug)===null||Ce===void 0||Ce.call(l,"[useGroupChannelMessages/onCacheResult]","message length:",me.length),E(me,!0,(ze=e.currentUser)===null||ze===void 0?void 0:ze.userId),he(),me.length>0&&(f.current.initialized=!0,de()))}).onApiResult((ve,me)=>{var pe,Ce,ze,ue,ne;ve?(pe=l==null?void 0:l.warn)===null||pe===void 0||pe.call(l,"[useGroupChannelMessages/onApiResult]",ve):me&&((Ce=l==null?void 0:l.debug)===null||Ce===void 0||Ce.call(l,"[useGroupChannelMessages/onApiResult]","message length:",me.length),E(me,!0,(ze=e.currentUser)===null||ze===void 0?void 0:ze.userId),a.current.startingPoint||(ne=(ue=a.current).onMessagesReceived)===null||ne===void 0||ne.call(ue,me),e.isCacheEnabled&&he()),f.current.initialized=!0,f.current.apiInitialized=!0,de()})})}));AT(e,{onUserBanned(B,ae){var de,Ee,se;B.isGroupChannel()&&!A5(B,o.current)&&(ae.userId===((de=e.currentUser)===null||de===void 0?void 0:de.userId)?(se=(Ee=a.current).onCurrentUserBanned)===null||se===void 0||se.call(Ee):h())}}),D.useLayoutEffect(()=>{const B=setTimeout(()=>Xi(void 0,void 0,void 0,function*(){e.currentUser&&o.current&&(I(!1),x(!0),yield W(u,c),x(!1),I(!0))}));return()=>clearTimeout(B)},[e,(i=e.currentUser)===null||i===void 0?void 0:i.userId,(s=o.current)===null||s===void 0?void 0:s.url,a.current.replyType]),D.useEffect(()=>()=>{f.current.instance&&f.current.instance.dispose()},[]);const P=En(()=>Xi(void 0,void 0,void 0,function*(){e.currentUser&&o.current&&(A(!0),yield W(Number.MAX_SAFE_INTEGER,w0.collection.message.defaultLimit),A(!1))})),J=En(()=>Xi(void 0,void 0,void 0,function*(){var B;const ae=f.current.instance;if(ae!=null&&ae.hasPrevious&&!d.current.prev)try{d.current.prev=!0;const de=yield ae.loadPrevious();E(de,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.prev=!1}})),V=En(()=>{const{initialized:B,instance:ae}=f.current;return B&&ae?ae.hasPrevious:!1}),H=En(()=>Xi(void 0,void 0,void 0,function*(){var B;const ae=f.current.instance;if(ae!=null&&ae.hasNext&&!d.current.next)try{d.current.next=!0;const de=yield ae.loadNext();E(de,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.next=!1}})),we=En(()=>{const{initialized:B,apiInitialized:ae,instance:de}=f.current;return ae&&B&&de?de.hasNext:!1}),q=En((B,ae)=>{var de;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((Ee,se)=>{o.current.sendUserMessage(B).onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),ae==null||ae(he)}).onSucceeded(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),Ee(he)}).onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url&&E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),se(he)})})}),ee=En((B,ae)=>{var de;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((Ee,se)=>{o.current.sendFileMessage(B).onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),ae==null||ae(he)}).onSucceeded(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),Ee(he)}).onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url&&E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),se(he)})})}),ie=En((B,ae)=>Xi(void 0,void 0,void 0,function*(){var de;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise(Ee=>{const se=[];o.current.sendFileMessages(B).onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),ae==null||ae(he)}).onSucceeded(he=>{var fe;he.isFileMessage()&&he.channelUrl===o.current.url&&(E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),se.push(he)),se.length===B.length&&Ee(se)}).onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url?(E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),se.push(fe)):se.push(null),se.length===B.length&&Ee(se)})})})),Ne=En((B,ae)=>{var de;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((Ee,se)=>{o.current.sendMultipleFilesMessage(B).onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),ae==null||ae(he)}).onFileUploaded(()=>{h()}).onSucceeded(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),Ee(he)}).onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url&&E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),se(he)})})}),X=En((B,ae)=>Xi(void 0,void 0,void 0,function*(){var de,Ee;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const se=yield o.current.updateUserMessage(B,ae);return se.channelUrl===o.current.url&&E([se],!1,(Ee=e.currentUser)===null||Ee===void 0?void 0:Ee.userId),se})),oe=En((B,ae)=>Xi(void 0,void 0,void 0,function*(){var de,Ee;if(!o.current||!o.current.url)throw(de=l==null?void 0:l.error)===null||de===void 0||de.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const se=yield o.current.updateFileMessage(B,ae);return se.channelUrl===o.current.url&&E([se],!1,(Ee=e.currentUser)===null||Ee===void 0?void 0:Ee.userId),se})),te=En(B=>Xi(void 0,void 0,void 0,function*(){var ae;if(!o.current||!o.current.url)throw(ae=l==null?void 0:l.error)===null||ae===void 0||ae.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((de,Ee)=>{let se;B.isUserMessage()&&(se=o.current.resendMessage(B)),B.isFileMessage()&&(se=o.current.resendMessage(B)),B.isMultipleFilesMessage()&&(se=o.current.resendMessage(B)),se&&("onPending"in se&&se.onPending(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId)}),"onFileUploaded"in se&&se.onFileUploaded(()=>{h()}),"onSucceeded"in se&&se.onSucceeded(he=>{var fe;he.channelUrl===o.current.url&&E([he],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),de(he)}),"onFailed"in se&&se.onFailed((he,fe)=>{var ve;fe&&fe.channelUrl===o.current.url&&E([fe],!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),Ee(he)}))})})),ce=En(B=>Xi(void 0,void 0,void 0,function*(){var ae,de;if(!o.current||!o.current.url)throw(ae=l==null?void 0:l.error)===null||ae===void 0||ae.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");if(B.sendingStatus==="succeeded")B.isUserMessage()&&(yield o.current.deleteMessage(B)),B.isFileMessage()&&(yield o.current.deleteMessage(B)),B.isMultipleFilesMessage()&&(yield o.current.deleteMessage(B));else try{yield(de=f.current.instance)===null||de===void 0?void 0:de.removeFailedMessage(B.reqId)}finally{N([B.messageId],[B.reqId])}})),$=En(()=>{var B;S([],!0,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}),ke=En(B=>Xi(void 0,void 0,void 0,function*(){var ae;if(e.currentUser&&o.current){const de=i3(B);x(!0),E([],!0,(ae=e.currentUser)===null||ae===void 0?void 0:ae.userId),yield W(B,de),x(!1)}}));return{initialized:p,loading:m,refreshing:b,messages:v,newMessages:_,resetNewMessages:$,refresh:P,loadPrevious:J,hasPrevious:V,loadNext:H,hasNext:we,sendUserMessage:q,sendFileMessage:ee,sendFileMessages:ie,sendMultipleFilesMessage:Ne,updateUserMessage:X,updateFileMessage:oe,resendMessage:te,deleteMessage:ce,resetWithStartingPoint:ke,_dangerous_reducer_updateMessages:E,_dangerous_reducer_deleteMessages:N}},R2=e=>j5(e),j5=e=>e();function OT(e,n){const t=Object.assign({},e);return Object.keys(n).forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&O5(t[r],n[r])&&(typeof n[r]=="object"&&!Array.isArray(n[r])?t[r]=OT(t[r],n[r]):t[r]=n[r])}),t}const k2=()=>({common:{enableUsingDefaultUserProfile:!1},groupChannel:{channel:{enableMention:!1,enableOgtag:!0,enableReactions:!0,enableReactionsSupergroup:!1,enableTypingIndicator:!0,enableVoiceMessage:!1,input:{camera:{enablePhoto:!0,enableVideo:!0},enableDocument:!0,gallery:{enablePhoto:!0,enableVideo:!0}},replyType:"quote_reply",threadReplySelectType:"thread",typingIndicatorTypes:new Set(["text"]),enableFeedback:!1,enableSuggestedReplies:!1,showSuggestedRepliesFor:"last_message_only",suggestedRepliesDirection:"vertical"},channelList:{enableMessageReceiptStatus:!1,enableTypingIndicator:!1},setting:{enableMessageSearch:!1}},openChannel:{channel:{enableOgtag:!0,input:{camera:{enablePhoto:!0,enableVideo:!0},enableDocument:!0,gallery:{enablePhoto:!0,enableVideo:!0}}}}});function B5(e){return delete e.groupChannel.channel.typingIndicatorTypes,delete e.groupChannel.channel.enableFeedback,delete e.groupChannel.channel.enableSuggestedReplies,delete e.groupChannel.channel.showSuggestedRepliesFor,delete e.groupChannel.channel.suggestedRepliesDirection,e}const RT=()=>{const e=k2();return B5(e)},s3=k2(),$5=RT();var I0=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):i(c.value).then(o,l)}u((r=r.apply(e,n||[])).next())})};const Fv={items:{},getItem(e){var n;return I0(this,void 0,void 0,function*(){return(n=Fv.items[e])!==null&&n!==void 0?n:null})},setItem(e,n){return I0(this,void 0,void 0,function*(){Fv.items[e]=n})}};class G5{constructor(n){this.storage=n??Fv}init(n){return this.key=`sbu@${n}.uikitConfiguration`,this.get()}get safeKey(){if(!this.key)throw new Error("Please UIKitConfigManager.init() first");return this.key}update(n){return I0(this,void 0,void 0,function*(){const t=yield this.get(),r={updatedAt:n.updatedAt,configuration:OT(t.configuration,n.configuration)};return yield this.storage.setItem(this.safeKey,JSON.stringify(r)),r})}get(){return I0(this,void 0,void 0,function*(){const n={updatedAt:0,configuration:$5};try{const t=yield this.storage.getItem(this.safeKey);return t?JSON.parse(t):n}catch{return n}})}}function z5(e,n,t){var r,i;t.common&&rt((r=t.common)===null||r===void 0?void 0:r.enableUsingDefaultUserProfile)&&(e.enableUsingDefaultUserProfile=t.common.enableUsingDefaultUserProfile),n.common&&rt((i=n.common)===null||i===void 0?void 0:i.enableUsingDefaultUserProfile)&&(e.enableUsingDefaultUserProfile=n.common.enableUsingDefaultUserProfile)}function V5(e,n,t){q5(e,n,t),W5(e,n,t),K5(e,n,t),Q5(e,n,t)}function q5(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x,A,O,U,W,P,J,V,H,we,q,ee,ie,Ne,X,oe,te,ce,$,ke,B,ae,de,Ee,se,he,fe,ve,me,pe,Ce,ze,ue,ne,xe,Le,re,Re,st,Xe,He,ct,$t,yt,_n,Ut,Xt,an,Nt,on,ln,Un,Gt,mt,mn,$n,Gn,wn,zn,kt,Pn,un,cn,Fn,Tn,Mt,Hn,dr,vn,Nn,In,Pt,An,Jt,Vn,qn,hr,Pe,F,_e,Oe,qe;!((r=t.groupChannel)===null||r===void 0)&&r.channel&&rt((s=(i=t.groupChannel)===null||i===void 0?void 0:i.channel)===null||s===void 0?void 0:s.enableOgtag)&&(e.channel.enableOgtag=t.groupChannel.channel.enableOgtag),!((a=n.groupChannel)===null||a===void 0)&&a.channel&&rt((l=(o=n.groupChannel)===null||o===void 0?void 0:o.channel)===null||l===void 0?void 0:l.enableOgtag)&&(e.channel.enableOgtag=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.channel)===null||c===void 0?void 0:c.enableOgtag),!((d=t.groupChannel)===null||d===void 0)&&d.channel&&rt((f=(h=t.groupChannel)===null||h===void 0?void 0:h.channel)===null||f===void 0?void 0:f.enableTypingIndicator)&&(e.channel.enableTypingIndicator=(m=(p=t.groupChannel)===null||p===void 0?void 0:p.channel)===null||m===void 0?void 0:m.enableTypingIndicator),!((b=n.groupChannel)===null||b===void 0)&&b.channel&&rt((_=(v=n.groupChannel)===null||v===void 0?void 0:v.channel)===null||_===void 0?void 0:_.enableTypingIndicator)&&(e.channel.enableTypingIndicator=(S=(E=n.groupChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.enableTypingIndicator),!((T=t.groupChannel)===null||T===void 0)&&T.channel&&rt((I=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.enableReactions)&&(e.channel.enableReactions=(A=(x=t.groupChannel)===null||x===void 0?void 0:x.channel)===null||A===void 0?void 0:A.enableReactions),!((O=n.groupChannel)===null||O===void 0)&&O.channel&&rt((W=(U=n.groupChannel)===null||U===void 0?void 0:U.channel)===null||W===void 0?void 0:W.enableReactions)&&(e.channel.enableReactions=(J=(P=n.groupChannel)===null||P===void 0?void 0:P.channel)===null||J===void 0?void 0:J.enableReactions),!((V=t.groupChannel)===null||V===void 0)&&V.channel&&rt((we=(H=t.groupChannel)===null||H===void 0?void 0:H.channel)===null||we===void 0?void 0:we.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(ee=(q=t.groupChannel)===null||q===void 0?void 0:q.channel)===null||ee===void 0?void 0:ee.enableReactionsSupergroup),!((ie=n.groupChannel)===null||ie===void 0)&&ie.channel&&rt((X=(Ne=n.groupChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(te=(oe=n.groupChannel)===null||oe===void 0?void 0:oe.channel)===null||te===void 0?void 0:te.enableReactionsSupergroup),!((ce=t.groupChannel)===null||ce===void 0)&&ce.channel&&rt((ke=($=t.groupChannel)===null||$===void 0?void 0:$.channel)===null||ke===void 0?void 0:ke.enableMention)&&(e.channel.enableMention=(ae=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||ae===void 0?void 0:ae.enableMention),!((de=n.groupChannel)===null||de===void 0)&&de.channel&&rt((se=(Ee=n.groupChannel)===null||Ee===void 0?void 0:Ee.channel)===null||se===void 0?void 0:se.enableMention)&&(e.channel.enableMention=(fe=(he=n.groupChannel)===null||he===void 0?void 0:he.channel)===null||fe===void 0?void 0:fe.enableMention),!((ve=t.groupChannel)===null||ve===void 0)&&ve.channel&&Al((pe=(me=t.groupChannel)===null||me===void 0?void 0:me.channel)===null||pe===void 0?void 0:pe.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(ze=(Ce=t.groupChannel)===null||Ce===void 0?void 0:Ce.channel)===null||ze===void 0?void 0:ze.replyType),!((ue=n.groupChannel)===null||ue===void 0)&&ue.channel&&Al((xe=(ne=n.groupChannel)===null||ne===void 0?void 0:ne.channel)===null||xe===void 0?void 0:xe.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(re=(Le=n.groupChannel)===null||Le===void 0?void 0:Le.channel)===null||re===void 0?void 0:re.replyType),!((Re=t.groupChannel)===null||Re===void 0)&&Re.channel&&Al((Xe=(st=t.groupChannel)===null||st===void 0?void 0:st.channel)===null||Xe===void 0?void 0:Xe.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(ct=(He=t.groupChannel)===null||He===void 0?void 0:He.channel)===null||ct===void 0?void 0:ct.threadReplySelectType),!(($t=n.groupChannel)===null||$t===void 0)&&$t.channel&&Al((_n=(yt=n.groupChannel)===null||yt===void 0?void 0:yt.channel)===null||_n===void 0?void 0:_n.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(Xt=(Ut=n.groupChannel)===null||Ut===void 0?void 0:Ut.channel)===null||Xt===void 0?void 0:Xt.threadReplySelectType),!((an=t.groupChannel)===null||an===void 0)&&an.channel&&rt((on=(Nt=t.groupChannel)===null||Nt===void 0?void 0:Nt.channel)===null||on===void 0?void 0:on.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(Un=(ln=t.groupChannel)===null||ln===void 0?void 0:ln.channel)===null||Un===void 0?void 0:Un.enableVoiceMessage),!((Gt=n.groupChannel)===null||Gt===void 0)&&Gt.channel&&rt((mn=(mt=n.groupChannel)===null||mt===void 0?void 0:mt.channel)===null||mn===void 0?void 0:mn.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(Gn=($n=n.groupChannel)===null||$n===void 0?void 0:$n.channel)===null||Gn===void 0?void 0:Gn.enableVoiceMessage),!((wn=n.groupChannel)===null||wn===void 0)&&wn.channel&&x5((kt=(zn=n.groupChannel)===null||zn===void 0?void 0:zn.channel)===null||kt===void 0?void 0:kt.typingIndicatorTypes)&&(e.channel.typingIndicatorTypes=(un=(Pn=n.groupChannel)===null||Pn===void 0?void 0:Pn.channel)===null||un===void 0?void 0:un.typingIndicatorTypes),!((cn=n.groupChannel)===null||cn===void 0)&&cn.channel&&rt((Tn=(Fn=n.groupChannel)===null||Fn===void 0?void 0:Fn.channel)===null||Tn===void 0?void 0:Tn.enableFeedback)&&(e.channel.enableFeedback=(Hn=(Mt=n.groupChannel)===null||Mt===void 0?void 0:Mt.channel)===null||Hn===void 0?void 0:Hn.enableFeedback),!((dr=n.groupChannel)===null||dr===void 0)&&dr.channel&&rt((Nn=(vn=n.groupChannel)===null||vn===void 0?void 0:vn.channel)===null||Nn===void 0?void 0:Nn.enableSuggestedReplies)&&(e.channel.enableSuggestedReplies=(Pt=(In=n.groupChannel)===null||In===void 0?void 0:In.channel)===null||Pt===void 0?void 0:Pt.enableSuggestedReplies),!((An=n.groupChannel)===null||An===void 0)&&An.channel&&Al((Vn=(Jt=n.groupChannel)===null||Jt===void 0?void 0:Jt.channel)===null||Vn===void 0?void 0:Vn.showSuggestedRepliesFor,["all_messages","last_message_only"])&&(e.channel.showSuggestedRepliesFor=(hr=(qn=n.groupChannel)===null||qn===void 0?void 0:qn.channel)===null||hr===void 0?void 0:hr.showSuggestedRepliesFor),!((Pe=n.groupChannel)===null||Pe===void 0)&&Pe.channel&&Al((_e=(F=n.groupChannel)===null||F===void 0?void 0:F.channel)===null||_e===void 0?void 0:_e.suggestedRepliesDirection,["vertical","horizontal"])&&(e.channel.suggestedRepliesDirection=(qe=(Oe=n.groupChannel)===null||Oe===void 0?void 0:Oe.channel)===null||qe===void 0?void 0:qe.suggestedRepliesDirection)}function W5(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x,A,O,U,W,P,J,V,H,we,q,ee,ie,Ne,X,oe,te,ce,$,ke,B,ae,de,Ee,se,he,fe,ve,me,pe,Ce,ze,ue,ne,xe,Le,re,Re,st,Xe,He,ct,$t,yt,_n,Ut,Xt,an,Nt,on,ln,Un,Gt,mt,mn,$n,Gn,wn,zn,kt,Pn,un,cn,Fn,Tn,Mt,Hn,dr,vn,Nn,In,Pt,An,Jt,Vn,qn,hr,Pe,F,_e,Oe,qe,bt;!((i=(r=t.groupChannel)===null||r===void 0?void 0:r.channel)===null||i===void 0)&&i.input&&rt((o=(a=(s=t.groupChannel)===null||s===void 0?void 0:s.channel)===null||a===void 0?void 0:a.input)===null||o===void 0?void 0:o.enableDocument)&&(e.channel.input.enableDocument=(c=(u=(l=t.groupChannel)===null||l===void 0?void 0:l.channel)===null||u===void 0?void 0:u.input)===null||c===void 0?void 0:c.enableDocument),!((h=(d=n.groupChannel)===null||d===void 0?void 0:d.channel)===null||h===void 0)&&h.input&&rt((m=(p=(f=n.groupChannel)===null||f===void 0?void 0:f.channel)===null||p===void 0?void 0:p.input)===null||m===void 0?void 0:m.enableDocument)&&(e.channel.input.enableDocument=(_=(v=(b=n.groupChannel)===null||b===void 0?void 0:b.channel)===null||v===void 0?void 0:v.input)===null||_===void 0?void 0:_.enableDocument),!((T=(S=(E=t.groupChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.input)===null||T===void 0)&&T.camera&&rt((A=(x=(I=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.input)===null||x===void 0?void 0:x.camera)===null||A===void 0?void 0:A.enablePhoto)&&(e.channel.input.camera.enablePhoto=(P=(W=(U=(O=t.groupChannel)===null||O===void 0?void 0:O.channel)===null||U===void 0?void 0:U.input)===null||W===void 0?void 0:W.camera)===null||P===void 0?void 0:P.enablePhoto),!((H=(V=(J=n.groupChannel)===null||J===void 0?void 0:J.channel)===null||V===void 0?void 0:V.input)===null||H===void 0)&&H.camera&&rt((ie=(ee=(q=(we=n.groupChannel)===null||we===void 0?void 0:we.channel)===null||q===void 0?void 0:q.input)===null||ee===void 0?void 0:ee.camera)===null||ie===void 0?void 0:ie.enablePhoto)&&(e.channel.input.camera.enablePhoto=(te=(oe=(X=(Ne=n.groupChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.input)===null||oe===void 0?void 0:oe.camera)===null||te===void 0?void 0:te.enablePhoto),!((ke=($=(ce=t.groupChannel)===null||ce===void 0?void 0:ce.channel)===null||$===void 0?void 0:$.input)===null||ke===void 0)&&ke.camera&&rt((Ee=(de=(ae=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||ae===void 0?void 0:ae.input)===null||de===void 0?void 0:de.camera)===null||Ee===void 0?void 0:Ee.enableVideo)&&(e.channel.input.camera.enableVideo=(ve=(fe=(he=(se=t.groupChannel)===null||se===void 0?void 0:se.channel)===null||he===void 0?void 0:he.input)===null||fe===void 0?void 0:fe.camera)===null||ve===void 0?void 0:ve.enableVideo),!((Ce=(pe=(me=n.groupChannel)===null||me===void 0?void 0:me.channel)===null||pe===void 0?void 0:pe.input)===null||Ce===void 0)&&Ce.camera&&rt((xe=(ne=(ue=(ze=n.groupChannel)===null||ze===void 0?void 0:ze.channel)===null||ue===void 0?void 0:ue.input)===null||ne===void 0?void 0:ne.camera)===null||xe===void 0?void 0:xe.enableVideo)&&(e.channel.input.camera.enableVideo=(st=(Re=(re=(Le=n.groupChannel)===null||Le===void 0?void 0:Le.channel)===null||re===void 0?void 0:re.input)===null||Re===void 0?void 0:Re.camera)===null||st===void 0?void 0:st.enableVideo),!((ct=(He=(Xe=t.groupChannel)===null||Xe===void 0?void 0:Xe.channel)===null||He===void 0?void 0:He.input)===null||ct===void 0)&&ct.gallery&&rt((Ut=(_n=(yt=($t=t.groupChannel)===null||$t===void 0?void 0:$t.channel)===null||yt===void 0?void 0:yt.input)===null||_n===void 0?void 0:_n.gallery)===null||Ut===void 0?void 0:Ut.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(on=(Nt=(an=(Xt=t.groupChannel)===null||Xt===void 0?void 0:Xt.channel)===null||an===void 0?void 0:an.input)===null||Nt===void 0?void 0:Nt.gallery)===null||on===void 0?void 0:on.enablePhoto),!((Gt=(Un=(ln=n.groupChannel)===null||ln===void 0?void 0:ln.channel)===null||Un===void 0?void 0:Un.input)===null||Gt===void 0)&&Gt.gallery&&rt((Gn=($n=(mn=(mt=n.groupChannel)===null||mt===void 0?void 0:mt.channel)===null||mn===void 0?void 0:mn.input)===null||$n===void 0?void 0:$n.gallery)===null||Gn===void 0?void 0:Gn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(Pn=(kt=(zn=(wn=n.groupChannel)===null||wn===void 0?void 0:wn.channel)===null||zn===void 0?void 0:zn.input)===null||kt===void 0?void 0:kt.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto),!((Fn=(cn=(un=t.groupChannel)===null||un===void 0?void 0:un.channel)===null||cn===void 0?void 0:cn.input)===null||Fn===void 0)&&Fn.gallery&&rt((dr=(Hn=(Mt=(Tn=t.groupChannel)===null||Tn===void 0?void 0:Tn.channel)===null||Mt===void 0?void 0:Mt.input)===null||Hn===void 0?void 0:Hn.gallery)===null||dr===void 0?void 0:dr.enableVideo)&&(e.channel.input.gallery.enableVideo=(Pt=(In=(Nn=(vn=t.groupChannel)===null||vn===void 0?void 0:vn.channel)===null||Nn===void 0?void 0:Nn.input)===null||In===void 0?void 0:In.gallery)===null||Pt===void 0?void 0:Pt.enableVideo),!((Vn=(Jt=(An=n.groupChannel)===null||An===void 0?void 0:An.channel)===null||Jt===void 0?void 0:Jt.input)===null||Vn===void 0)&&Vn.gallery&&rt((F=(Pe=(hr=(qn=n.groupChannel)===null||qn===void 0?void 0:qn.channel)===null||hr===void 0?void 0:hr.input)===null||Pe===void 0?void 0:Pe.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(bt=(qe=(Oe=(_e=n.groupChannel)===null||_e===void 0?void 0:_e.channel)===null||Oe===void 0?void 0:Oe.input)===null||qe===void 0?void 0:qe.gallery)===null||bt===void 0?void 0:bt.enableVideo)}function K5(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S;!((r=t.groupChannel)===null||r===void 0)&&r.channelList&&rt((s=(i=t.groupChannel)===null||i===void 0?void 0:i.channelList)===null||s===void 0?void 0:s.enableTypingIndicator)&&(e.channelList.enableTypingIndicator=t.groupChannel.channelList.enableTypingIndicator),!((a=n.groupChannel)===null||a===void 0)&&a.channelList&&rt((l=(o=n.groupChannel)===null||o===void 0?void 0:o.channelList)===null||l===void 0?void 0:l.enableTypingIndicator)&&(e.channelList.enableTypingIndicator=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.channelList)===null||c===void 0?void 0:c.enableTypingIndicator),!((d=t.groupChannel)===null||d===void 0)&&d.channelList&&rt((f=(h=t.groupChannel)===null||h===void 0?void 0:h.channelList)===null||f===void 0?void 0:f.enableMessageReceiptStatus)&&(e.channelList.enableMessageReceiptStatus=(m=(p=t.groupChannel)===null||p===void 0?void 0:p.channelList)===null||m===void 0?void 0:m.enableMessageReceiptStatus),!((b=n.groupChannel)===null||b===void 0)&&b.channelList&&rt((_=(v=n.groupChannel)===null||v===void 0?void 0:v.channelList)===null||_===void 0?void 0:_.enableMessageReceiptStatus)&&(e.channelList.enableMessageReceiptStatus=(S=(E=n.groupChannel)===null||E===void 0?void 0:E.channelList)===null||S===void 0?void 0:S.enableMessageReceiptStatus)}function Q5(e,n,t){var r,i,s,a,o,l,u,c;!((r=t.groupChannel)===null||r===void 0)&&r.setting&&rt((s=(i=t.groupChannel)===null||i===void 0?void 0:i.setting)===null||s===void 0?void 0:s.enableMessageSearch)&&(e.setting.enableMessageSearch=t.groupChannel.setting.enableMessageSearch),!((a=n.groupChannel)===null||a===void 0)&&a.setting&&rt((l=(o=n.groupChannel)===null||o===void 0?void 0:o.setting)===null||l===void 0?void 0:l.enableMessageSearch)&&(e.setting.enableMessageSearch=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.setting)===null||c===void 0?void 0:c.enableMessageSearch)}function Y5(e,n,t){Z5(e,n,t),X5(e,n,t)}function Z5(e,n,t){var r,i,s,a,o,l,u,c;!((r=t.openChannel)===null||r===void 0)&&r.channel&&rt((s=(i=t.openChannel)===null||i===void 0?void 0:i.channel)===null||s===void 0?void 0:s.enableOgtag)&&(e.channel.enableOgtag=t.openChannel.channel.enableOgtag),!((a=n.openChannel)===null||a===void 0)&&a.channel&&rt((l=(o=n.openChannel)===null||o===void 0?void 0:o.channel)===null||l===void 0?void 0:l.enableOgtag)&&(e.channel.enableOgtag=(c=(u=n.openChannel)===null||u===void 0?void 0:u.channel)===null||c===void 0?void 0:c.enableOgtag)}function X5(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S,T,N,I,x,A,O,U,W,P,J,V,H,we,q,ee,ie,Ne,X,oe,te,ce,$,ke,B,ae,de,Ee,se,he,fe,ve,me,pe,Ce,ze,ue,ne,xe,Le,re,Re,st,Xe,He,ct,$t,yt,_n,Ut,Xt,an,Nt,on,ln,Un,Gt,mt,mn,$n,Gn,wn,zn,kt,Pn,un,cn,Fn,Tn,Mt,Hn,dr,vn,Nn,In,Pt,An,Jt,Vn,qn,hr,Pe,F,_e,Oe,qe,bt;!((i=(r=t.openChannel)===null||r===void 0?void 0:r.channel)===null||i===void 0)&&i.input&&rt((o=(a=(s=t.openChannel)===null||s===void 0?void 0:s.channel)===null||a===void 0?void 0:a.input)===null||o===void 0?void 0:o.enableDocument)&&(e.channel.input.enableDocument=(c=(u=(l=t.openChannel)===null||l===void 0?void 0:l.channel)===null||u===void 0?void 0:u.input)===null||c===void 0?void 0:c.enableDocument),!((h=(d=n.openChannel)===null||d===void 0?void 0:d.channel)===null||h===void 0)&&h.input&&rt((m=(p=(f=n.openChannel)===null||f===void 0?void 0:f.channel)===null||p===void 0?void 0:p.input)===null||m===void 0?void 0:m.enableDocument)&&(e.channel.input.enableDocument=(_=(v=(b=n.openChannel)===null||b===void 0?void 0:b.channel)===null||v===void 0?void 0:v.input)===null||_===void 0?void 0:_.enableDocument),!((T=(S=(E=t.openChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.input)===null||T===void 0)&&T.camera&&rt((A=(x=(I=(N=t.openChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.input)===null||x===void 0?void 0:x.camera)===null||A===void 0?void 0:A.enablePhoto)&&(e.channel.input.camera.enablePhoto=(P=(W=(U=(O=t.openChannel)===null||O===void 0?void 0:O.channel)===null||U===void 0?void 0:U.input)===null||W===void 0?void 0:W.camera)===null||P===void 0?void 0:P.enablePhoto),!((H=(V=(J=n.openChannel)===null||J===void 0?void 0:J.channel)===null||V===void 0?void 0:V.input)===null||H===void 0)&&H.camera&&rt((ie=(ee=(q=(we=n.openChannel)===null||we===void 0?void 0:we.channel)===null||q===void 0?void 0:q.input)===null||ee===void 0?void 0:ee.camera)===null||ie===void 0?void 0:ie.enablePhoto)&&(e.channel.input.camera.enablePhoto=(te=(oe=(X=(Ne=n.openChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.input)===null||oe===void 0?void 0:oe.camera)===null||te===void 0?void 0:te.enablePhoto),!((ke=($=(ce=t.openChannel)===null||ce===void 0?void 0:ce.channel)===null||$===void 0?void 0:$.input)===null||ke===void 0)&&ke.camera&&rt((Ee=(de=(ae=(B=t.openChannel)===null||B===void 0?void 0:B.channel)===null||ae===void 0?void 0:ae.input)===null||de===void 0?void 0:de.camera)===null||Ee===void 0?void 0:Ee.enableVideo)&&(e.channel.input.camera.enableVideo=(ve=(fe=(he=(se=t.openChannel)===null||se===void 0?void 0:se.channel)===null||he===void 0?void 0:he.input)===null||fe===void 0?void 0:fe.camera)===null||ve===void 0?void 0:ve.enableVideo),!((Ce=(pe=(me=n.openChannel)===null||me===void 0?void 0:me.channel)===null||pe===void 0?void 0:pe.input)===null||Ce===void 0)&&Ce.camera&&rt((xe=(ne=(ue=(ze=n.openChannel)===null||ze===void 0?void 0:ze.channel)===null||ue===void 0?void 0:ue.input)===null||ne===void 0?void 0:ne.camera)===null||xe===void 0?void 0:xe.enableVideo)&&(e.channel.input.camera.enableVideo=(st=(Re=(re=(Le=n.openChannel)===null||Le===void 0?void 0:Le.channel)===null||re===void 0?void 0:re.input)===null||Re===void 0?void 0:Re.camera)===null||st===void 0?void 0:st.enableVideo),!((ct=(He=(Xe=t.openChannel)===null||Xe===void 0?void 0:Xe.channel)===null||He===void 0?void 0:He.input)===null||ct===void 0)&&ct.gallery&&rt((Ut=(_n=(yt=($t=t.openChannel)===null||$t===void 0?void 0:$t.channel)===null||yt===void 0?void 0:yt.input)===null||_n===void 0?void 0:_n.gallery)===null||Ut===void 0?void 0:Ut.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(on=(Nt=(an=(Xt=t.openChannel)===null||Xt===void 0?void 0:Xt.channel)===null||an===void 0?void 0:an.input)===null||Nt===void 0?void 0:Nt.gallery)===null||on===void 0?void 0:on.enablePhoto),!((Gt=(Un=(ln=n.openChannel)===null||ln===void 0?void 0:ln.channel)===null||Un===void 0?void 0:Un.input)===null||Gt===void 0)&&Gt.gallery&&rt((Gn=($n=(mn=(mt=n.openChannel)===null||mt===void 0?void 0:mt.channel)===null||mn===void 0?void 0:mn.input)===null||$n===void 0?void 0:$n.gallery)===null||Gn===void 0?void 0:Gn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(Pn=(kt=(zn=(wn=n.openChannel)===null||wn===void 0?void 0:wn.channel)===null||zn===void 0?void 0:zn.input)===null||kt===void 0?void 0:kt.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto),!((Fn=(cn=(un=t.openChannel)===null||un===void 0?void 0:un.channel)===null||cn===void 0?void 0:cn.input)===null||Fn===void 0)&&Fn.gallery&&rt((dr=(Hn=(Mt=(Tn=t.openChannel)===null||Tn===void 0?void 0:Tn.channel)===null||Mt===void 0?void 0:Mt.input)===null||Hn===void 0?void 0:Hn.gallery)===null||dr===void 0?void 0:dr.enableVideo)&&(e.channel.input.gallery.enableVideo=(Pt=(In=(Nn=(vn=t.openChannel)===null||vn===void 0?void 0:vn.channel)===null||Nn===void 0?void 0:Nn.input)===null||In===void 0?void 0:In.gallery)===null||Pt===void 0?void 0:Pt.enableVideo),!((Vn=(Jt=(An=n.openChannel)===null||An===void 0?void 0:An.channel)===null||Jt===void 0?void 0:Jt.input)===null||Vn===void 0)&&Vn.gallery&&rt((F=(Pe=(hr=(qn=n.openChannel)===null||qn===void 0?void 0:qn.channel)===null||hr===void 0?void 0:hr.input)===null||Pe===void 0?void 0:Pe.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(bt=(qe=(Oe=(_e=n.openChannel)===null||_e===void 0?void 0:_e.channel)===null||Oe===void 0?void 0:Oe.input)===null||qe===void 0?void 0:qe.gallery)===null||bt===void 0?void 0:bt.enableVideo)}function J5(e,n){const t=k2();return z5(t.common,e,n),V5(t.groupChannel,e,n),Y5(t.openChannel,e,n),t}function eU(e){return typeof e=="object"&&"configuration"in e&&"updated_at"in e}var tU=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):i(c.value).then(o,l)}u((r=r.apply(e,n||[])).next())})};function ac(e){var n,t;return(t=(n=e.appInfo)===null||n===void 0?void 0:n.applicationAttributes)!==null&&t!==void 0?t:[]}const kT=D.createContext({initDashboardConfigs:()=>Promise.resolve(),configs:s3,configsWithAppAttr:()=>s3}),nU=({storage:e,children:n,localConfigs:t={}})=>{const[r,i]=D.useState(RT),[s]=D.useState(()=>new G5(e)),a=D.useCallback(u=>tU(void 0,void 0,void 0,function*(){const c=yield s.init(u.appId);if(u.appInfo&&u.appInfo.uikitConfigInfo.lastUpdatedAt===c.updatedAt)i(c.configuration);else try{const d=yield u.getUIKitConfiguration();if(eU(d.json)){const h=Pv(d.json),f=yield s.update(h);i(f.configuration)}}catch{i(c.configuration)}}),[s]),o=J5(t,r),l=En(u=>({groupChannel:{channel:{get enableReactions(){return o.groupChannel.channel.enableReactions&&ac(u).includes(ic.reactions)},get enableReactionsSupergroup(){return o.groupChannel.channel.enableReactionsSupergroup&&ac(u).includes(ic.reactions)},get enableOgtag(){return o.groupChannel.channel.enableOgtag&&ac(u).includes(ic.enable_og_tag)}},setting:{get enableMessageSearch(){return o.groupChannel.setting.enableMessageSearch&&ac(u).includes(ic.message_search_v3)}}},openChannel:{channel:{get enableOgtag(){return o.openChannel.channel.enableOgtag&&ac(u).includes(ic.enable_og_tag)}}}}));return Dt.createElement(kT.Provider,{value:{initDashboardConfigs:a,configs:o,configsWithAppAttr:l}},n)},rU=()=>D.useContext(kT),iU=Dt.createContext({disableUserProfile:!0,isOpenChannel:!1}),sU=({isOpenChannel:e=!1,disableUserProfile:n=!1,renderUserProfile:t,onUserProfileMessage:r,children:i})=>C.jsx(iU.Provider,{value:{isOpenChannel:e,disableUserProfile:n,renderUserProfile:t,onUserProfileMessage:r},children:i}),LT=Dt.createContext(null),aU="No sendbird state value available. Make sure you are rendering `` at the top of your app.";function pn(){const e=D.useContext(LT);if(!e)throw new Error(aU);return e}const oc="useToggleReactionCallback:";function oU(e,n){return D.useCallback((t,r,i)=>{if(!e){n==null||n.warning(`${oc} currentChannel doesn't exist`,e);return}i?e.deleteReaction(t,r).then(s=>{n==null||n.info(`${oc} Delete reaction success`,s)}).catch(s=>{n==null||n.warning(`${oc} Delete reaction failed`,s)}):e.addReaction(t,r).then(s=>{n==null||n.info(`${oc} Add reaction success`,s)}).catch(s=>{n==null||n.warning(`${oc} Add reaction failed`,s)})},[e])}function L2(e){return{lowerCase:e.toLowerCase(),upperCase:e.toUpperCase()}}function lU(e){return{lowerCase:e.toLowerCase(),upperCase:e.toUpperCase()}}function uU(e){return"sendingStatus"in e?e.sendingStatus==="succeeded"?String(e.messageId):e.reqId:String(e.messageId)}function cU(){var e,n;return((e=document.getElementById("sendbird-dropdown-portal"))==null?void 0:e.childElementCount)===0&&((n=document.getElementById("sendbird-emoji-list-portal"))==null?void 0:n.childElementCount)===0}function a3(e){var t;const n=(t=document.querySelectorAll(`[data-sb-created-at="${e}"]`))==null?void 0:t[0];return n instanceof HTMLElement?n.offsetTop:null}const A0=e=>e?e.isFrozen&&e.myRole!=="operator":!1,M0=e=>e?e.myMutedState==="muted":!1,x0=10,dU=1e3,hU=6e5,fU="Voice_message.mp3",pU="audio/mp3;sbu_type=voice",_U="KEY_VOICE_MESSAGE_DURATION",mU="KEY_INTERNAL_MESSAGE_TYPE",vU="voice/mp3",gU=10,yU=25*1024*1024,W_="sendbird_message_templates_token_key",Ml="sendbird_message_templates_key";function O0(e){"@babel/helpers - typeof";return O0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},O0(e)}function Tr(e,n){if(n.length1?"s":"")+" required, but only "+n.length+" present")}function EU(e){return Tr(1,arguments),e instanceof Date||O0(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function hs(e){Tr(1,arguments);var n=Object.prototype.toString.call(e);return e instanceof Date||O0(e)==="object"&&n==="[object Date]"?new Date(e.getTime()):typeof e=="number"||n==="[object Number]"?new Date(e):((typeof e=="string"||n==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function bU(e){if(Tr(1,arguments),!EU(e)&&typeof e!="number")return!1;var n=hs(e);return!isNaN(Number(n))}function cl(e){if(e===null||e===!0||e===!1)return NaN;var n=Number(e);return isNaN(n)?n:n<0?Math.ceil(n):Math.floor(n)}function CU(e,n){Tr(2,arguments);var t=hs(e).getTime(),r=cl(n);return new Date(t+r)}function SU(e,n){Tr(2,arguments);var t=cl(n);return CU(e,-t)}var wU=864e5;function TU(e){Tr(1,arguments);var n=hs(e),t=n.getTime();n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0);var r=n.getTime(),i=t-r;return Math.floor(i/wU)+1}function R0(e){Tr(1,arguments);var n=1,t=hs(e),r=t.getUTCDay(),i=(r=i.getTime()?t+1:n.getTime()>=a.getTime()?t:t-1}function NU(e){Tr(1,arguments);var n=DT(e),t=new Date(0);t.setUTCFullYear(n,0,4),t.setUTCHours(0,0,0,0);var r=R0(t);return r}var IU=6048e5;function AU(e){Tr(1,arguments);var n=hs(e),t=R0(n).getTime()-NU(n).getTime();return Math.round(t/IU)+1}var MU={};function wp(){return MU}function k0(e,n){var t,r,i,s,a,o,l,u;Tr(1,arguments);var c=wp(),d=cl((t=(r=(i=(s=n==null?void 0:n.weekStartsOn)!==null&&s!==void 0?s:n==null||(a=n.locale)===null||a===void 0||(o=a.options)===null||o===void 0?void 0:o.weekStartsOn)!==null&&i!==void 0?i:c.weekStartsOn)!==null&&r!==void 0?r:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&t!==void 0?t:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=hs(e),f=h.getUTCDay(),p=(f=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(d+1,0,f),p.setUTCHours(0,0,0,0);var m=k0(p,n),b=new Date(0);b.setUTCFullYear(d,0,f),b.setUTCHours(0,0,0,0);var v=k0(b,n);return c.getTime()>=m.getTime()?d+1:c.getTime()>=v.getTime()?d:d-1}function xU(e,n){var t,r,i,s,a,o,l,u;Tr(1,arguments);var c=wp(),d=cl((t=(r=(i=(s=n==null?void 0:n.firstWeekContainsDate)!==null&&s!==void 0?s:n==null||(a=n.locale)===null||a===void 0||(o=a.options)===null||o===void 0?void 0:o.firstWeekContainsDate)!==null&&i!==void 0?i:c.firstWeekContainsDate)!==null&&r!==void 0?r:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&t!==void 0?t:1),h=UT(e,n),f=new Date(0);f.setUTCFullYear(h,0,d),f.setUTCHours(0,0,0,0);var p=k0(f,n);return p}var OU=6048e5;function RU(e,n){Tr(1,arguments);var t=hs(e),r=k0(t,n).getTime()-xU(t,n).getTime();return Math.round(r/OU)+1}function xt(e,n){for(var t=e<0?"-":"",r=Math.abs(e).toString();r.length0?r:1-r;return xt(t==="yy"?i%100:i,t.length)},M:function(n,t){var r=n.getUTCMonth();return t==="M"?String(r+1):xt(r+1,2)},d:function(n,t){return xt(n.getUTCDate(),t.length)},a:function(n,t){var r=n.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(n,t){return xt(n.getUTCHours()%12||12,t.length)},H:function(n,t){return xt(n.getUTCHours(),t.length)},m:function(n,t){return xt(n.getUTCMinutes(),t.length)},s:function(n,t){return xt(n.getUTCSeconds(),t.length)},S:function(n,t){var r=t.length,i=n.getUTCMilliseconds(),s=Math.floor(i*Math.pow(10,r-3));return xt(s,t.length)}},xl={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},kU={G:function(n,t,r){var i=n.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(i,{width:"abbreviated"});case"GGGGG":return r.era(i,{width:"narrow"});case"GGGG":default:return r.era(i,{width:"wide"})}},y:function(n,t,r){if(t==="yo"){var i=n.getUTCFullYear(),s=i>0?i:1-i;return r.ordinalNumber(s,{unit:"year"})}return va.y(n,t)},Y:function(n,t,r,i){var s=UT(n,i),a=s>0?s:1-s;if(t==="YY"){var o=a%100;return xt(o,2)}return t==="Yo"?r.ordinalNumber(a,{unit:"year"}):xt(a,t.length)},R:function(n,t){var r=DT(n);return xt(r,t.length)},u:function(n,t){var r=n.getUTCFullYear();return xt(r,t.length)},Q:function(n,t,r){var i=Math.ceil((n.getUTCMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return xt(i,2);case"Qo":return r.ordinalNumber(i,{unit:"quarter"});case"QQQ":return r.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,r){var i=Math.ceil((n.getUTCMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return xt(i,2);case"qo":return r.ordinalNumber(i,{unit:"quarter"});case"qqq":return r.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,r){var i=n.getUTCMonth();switch(t){case"M":case"MM":return va.M(n,t);case"Mo":return r.ordinalNumber(i+1,{unit:"month"});case"MMM":return r.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,r){var i=n.getUTCMonth();switch(t){case"L":return String(i+1);case"LL":return xt(i+1,2);case"Lo":return r.ordinalNumber(i+1,{unit:"month"});case"LLL":return r.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,r,i){var s=RU(n,i);return t==="wo"?r.ordinalNumber(s,{unit:"week"}):xt(s,t.length)},I:function(n,t,r){var i=AU(n);return t==="Io"?r.ordinalNumber(i,{unit:"week"}):xt(i,t.length)},d:function(n,t,r){return t==="do"?r.ordinalNumber(n.getUTCDate(),{unit:"date"}):va.d(n,t)},D:function(n,t,r){var i=TU(n);return t==="Do"?r.ordinalNumber(i,{unit:"dayOfYear"}):xt(i,t.length)},E:function(n,t,r){var i=n.getUTCDay();switch(t){case"E":case"EE":case"EEE":return r.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(i,{width:"short",context:"formatting"});case"EEEE":default:return r.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,r,i){var s=n.getUTCDay(),a=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return xt(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,r,i){var s=n.getUTCDay(),a=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return xt(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,r){var i=n.getUTCDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return xt(s,t.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(i,{width:"short",context:"formatting"});case"iiii":default:return r.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,r){var i=n.getUTCHours(),s=i/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,t,r){var i=n.getUTCHours(),s;switch(i===12?s=xl.noon:i===0?s=xl.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,r){var i=n.getUTCHours(),s;switch(i>=17?s=xl.evening:i>=12?s=xl.afternoon:i>=4?s=xl.morning:s=xl.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,r){if(t==="ho"){var i=n.getUTCHours()%12;return i===0&&(i=12),r.ordinalNumber(i,{unit:"hour"})}return va.h(n,t)},H:function(n,t,r){return t==="Ho"?r.ordinalNumber(n.getUTCHours(),{unit:"hour"}):va.H(n,t)},K:function(n,t,r){var i=n.getUTCHours()%12;return t==="Ko"?r.ordinalNumber(i,{unit:"hour"}):xt(i,t.length)},k:function(n,t,r){var i=n.getUTCHours();return i===0&&(i=24),t==="ko"?r.ordinalNumber(i,{unit:"hour"}):xt(i,t.length)},m:function(n,t,r){return t==="mo"?r.ordinalNumber(n.getUTCMinutes(),{unit:"minute"}):va.m(n,t)},s:function(n,t,r){return t==="so"?r.ordinalNumber(n.getUTCSeconds(),{unit:"second"}):va.s(n,t)},S:function(n,t){return va.S(n,t)},X:function(n,t,r,i){var s=i._originalDate||n,a=s.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return l3(a);case"XXXX":case"XX":return go(a);case"XXXXX":case"XXX":default:return go(a,":")}},x:function(n,t,r,i){var s=i._originalDate||n,a=s.getTimezoneOffset();switch(t){case"x":return l3(a);case"xxxx":case"xx":return go(a);case"xxxxx":case"xxx":default:return go(a,":")}},O:function(n,t,r,i){var s=i._originalDate||n,a=s.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+o3(a,":");case"OOOO":default:return"GMT"+go(a,":")}},z:function(n,t,r,i){var s=i._originalDate||n,a=s.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+o3(a,":");case"zzzz":default:return"GMT"+go(a,":")}},t:function(n,t,r,i){var s=i._originalDate||n,a=Math.floor(s.getTime()/1e3);return xt(a,t.length)},T:function(n,t,r,i){var s=i._originalDate||n,a=s.getTime();return xt(a,t.length)}};function o3(e,n){var t=e>0?"-":"+",r=Math.abs(e),i=Math.floor(r/60),s=r%60;if(s===0)return t+String(i);var a=n;return t+String(i)+a+xt(s,2)}function l3(e,n){if(e%60===0){var t=e>0?"-":"+";return t+xt(Math.abs(e)/60,2)}return go(e,n)}function go(e,n){var t=n||"",r=e>0?"-":"+",i=Math.abs(e),s=xt(Math.floor(i/60),2),a=xt(i%60,2);return r+s+t+a}var u3=function(n,t){switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},PT=function(n,t){switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},LU=function(n,t){var r=n.match(/(P+)(p+)?/)||[],i=r[1],s=r[2];if(!s)return u3(n,t);var a;switch(i){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",u3(i,t)).replace("{{time}}",PT(s,t))},DU={p:PT,P:LU};function UU(e){var n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),e.getTime()-n.getTime()}var PU=["D","DD"],FU=["YY","YYYY"];function HU(e){return PU.indexOf(e)!==-1}function jU(e){return FU.indexOf(e)!==-1}function c3(e,n,t){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(n,"`) for formatting years to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(n,"`) for formatting years to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(n,"`) for formatting days of the month to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(n,"`) for formatting days of the month to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var BU={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},$U=function(n,t,r){var i,s=BU[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+i:i+" ago":i};function K_(e){return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=n.width?String(n.width):e.defaultWidth,r=e.formats[t]||e.formats[e.defaultWidth];return r}}var GU={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},zU={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},VU={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},qU={date:K_({formats:GU,defaultWidth:"full"}),time:K_({formats:zU,defaultWidth:"full"}),dateTime:K_({formats:VU,defaultWidth:"full"})},WU={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},KU=function(n,t,r,i){return WU[n]};function lc(e){return function(n,t){var r=t!=null&&t.context?String(t.context):"standalone",i;if(r==="formatting"&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,a=t!=null&&t.width?String(t.width):s;i=e.formattingValues[a]||e.formattingValues[s]}else{var o=e.defaultWidth,l=t!=null&&t.width?String(t.width):e.defaultWidth;i=e.values[l]||e.values[o]}var u=e.argumentCallback?e.argumentCallback(n):n;return i[u]}}var QU={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},YU={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ZU={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},XU={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},JU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},e7={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},t7=function(n,t){var r=Number(n),i=r%100;if(i>20||i<10)switch(i%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},n7={ordinalNumber:t7,era:lc({values:QU,defaultWidth:"wide"}),quarter:lc({values:YU,defaultWidth:"wide",argumentCallback:function(n){return n-1}}),month:lc({values:ZU,defaultWidth:"wide"}),day:lc({values:XU,defaultWidth:"wide"}),dayPeriod:lc({values:JU,defaultWidth:"wide",formattingValues:e7,defaultFormattingWidth:"wide"})};function uc(e){return function(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=n.match(i);if(!s)return null;var a=s[0],o=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(o)?i7(o,function(d){return d.test(a)}):r7(o,function(d){return d.test(a)}),u;u=e.valueCallback?e.valueCallback(l):l,u=t.valueCallback?t.valueCallback(u):u;var c=n.slice(a.length);return{value:u,rest:c}}}function r7(e,n){for(var t in e)if(e.hasOwnProperty(t)&&n(e[t]))return t}function i7(e,n){for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},r=n.match(e.matchPattern);if(!r)return null;var i=r[0],s=n.match(e.parsePattern);if(!s)return null;var a=e.valueCallback?e.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;var o=n.slice(i.length);return{value:a,rest:o}}}var a7=/^(\d+)(th|st|nd|rd)?/i,o7=/\d+/i,l7={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},u7={any:[/^b/i,/^(a|c)/i]},c7={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},d7={any:[/1/i,/2/i,/3/i,/4/i]},h7={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},f7={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},p7={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},_7={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},m7={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},v7={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},g7={ordinalNumber:s7({matchPattern:a7,parsePattern:o7,valueCallback:function(n){return parseInt(n,10)}}),era:uc({matchPatterns:l7,defaultMatchWidth:"wide",parsePatterns:u7,defaultParseWidth:"any"}),quarter:uc({matchPatterns:c7,defaultMatchWidth:"wide",parsePatterns:d7,defaultParseWidth:"any",valueCallback:function(n){return n+1}}),month:uc({matchPatterns:h7,defaultMatchWidth:"wide",parsePatterns:f7,defaultParseWidth:"any"}),day:uc({matchPatterns:p7,defaultMatchWidth:"wide",parsePatterns:_7,defaultParseWidth:"any"}),dayPeriod:uc({matchPatterns:m7,defaultMatchWidth:"any",parsePatterns:v7,defaultParseWidth:"any"})},FT={code:"en-US",formatDistance:$U,formatLong:qU,formatRelative:KU,localize:n7,match:g7,options:{weekStartsOn:0,firstWeekContainsDate:1}},y7=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,E7=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,b7=/^'([^]*?)'?$/,C7=/''/g,S7=/[a-zA-Z]/;function D2(e,n,t){var r,i,s,a,o,l,u,c,d,h,f,p,m,b,v,_,E,S;Tr(2,arguments);var T=String(n),N=wp(),I=(r=(i=t==null?void 0:t.locale)!==null&&i!==void 0?i:N.locale)!==null&&r!==void 0?r:FT,x=cl((s=(a=(o=(l=t==null?void 0:t.firstWeekContainsDate)!==null&&l!==void 0?l:t==null||(u=t.locale)===null||u===void 0||(c=u.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&o!==void 0?o:N.firstWeekContainsDate)!==null&&a!==void 0?a:(d=N.locale)===null||d===void 0||(h=d.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&s!==void 0?s:1);if(!(x>=1&&x<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var A=cl((f=(p=(m=(b=t==null?void 0:t.weekStartsOn)!==null&&b!==void 0?b:t==null||(v=t.locale)===null||v===void 0||(_=v.options)===null||_===void 0?void 0:_.weekStartsOn)!==null&&m!==void 0?m:N.weekStartsOn)!==null&&p!==void 0?p:(E=N.locale)===null||E===void 0||(S=E.options)===null||S===void 0?void 0:S.weekStartsOn)!==null&&f!==void 0?f:0);if(!(A>=0&&A<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!I.localize)throw new RangeError("locale must contain localize property");if(!I.formatLong)throw new RangeError("locale must contain formatLong property");var O=hs(e);if(!bU(O))throw new RangeError("Invalid time value");var U=UU(O),W=SU(O,U),P={firstWeekContainsDate:x,weekStartsOn:A,locale:I,_originalDate:O},J=T.match(E7).map(function(V){var H=V[0];if(H==="p"||H==="P"){var we=DU[H];return we(V,I.formatLong)}return V}).join("").match(y7).map(function(V){if(V==="''")return"'";var H=V[0];if(H==="'")return w7(V);var we=kU[H];if(we)return!(t!=null&&t.useAdditionalWeekYearTokens)&&jU(V)&&c3(V,n,String(e)),!(t!=null&&t.useAdditionalDayOfYearTokens)&&HU(V)&&c3(V,n,String(e)),we(W,V,I.localize,P);if(H.match(S7))throw new RangeError("Format string contains an unescaped latin alphabet character `"+H+"`");return V}).join("");return J}function w7(e){var n=e.match(b7);return n?n[1].replace(C7,"'"):e}const d3=(e,n,t)=>Math.abs(e-n)<=t;function T7(e,n,t={leading:!0,trailing:!1}){let r=null,i=null;return(...s)=>{if(r){i=s;return}t.leading?e(...s):i=s;const a=()=>{t.trailing&&i?(e(...i),i=null,r=setTimeout(a,n)):r=null};r=setTimeout(a,n)}}const N7=100;function HT(e,n){const t=D.useRef(n);t.current=n,D.useLayoutEffect(()=>{const r=e.current;if(r){const i=T7(()=>{const{scrollTop:s,scrollHeight:a,clientHeight:o}=r,l={distanceFromBottom:a-s-o};t.current.onReachedTop&&d3(s,0,x0)?t.current.onReachedTop(l):t.current.onReachedBottom&&d3(a,o+s,x0)?t.current.onReachedBottom(l):t.current.onInBetween&&t.current.onInBetween(l)},N7,{trailing:!0});return r.addEventListener("scroll",i),()=>r.removeEventListener("scroll",i)}},[e.current])}const jT=()=>{const e={};return{__getTopics:()=>e,subscribe:(n,t)=>(e[n]??(e[n]=new Set),e[n].add(t),{remove:()=>{e[n].delete(t)}}),publish:(n,t)=>{e[n]&&e[n].forEach(r=>{setTimeout(()=>r(t!==void 0?t:{}),0)})}}};function h3(e,n=!0){n?setTimeout(()=>{e()}):e()}function f3(e,n){return typeof n=="boolean"?n?"smooth":"auto":e}function I7(e){const n=D.useRef(null),t=D.useRef(0),[r]=D.useState(()=>jT()),[i,s]=D.useState(!1);return i===!1&&n.current&&n.current.scrollHeight<=n.current.clientHeight&&(t.current=0,s(!0)),D.useLayoutEffect(()=>{const a=[];return a.push(r.subscribe("scrollToBottom",({resolve:o,animated:l})=>{h3(()=>{n.current&&(n.current.scroll?n.current.scroll({top:n.current.scrollHeight,behavior:f3(e,l)}):n.current.scrollTop=n.current.scrollHeight,t.current=0,s(!0),o&&o())})})),a.push(r.subscribe("scroll",({top:o,animated:l,lazy:u,resolve:c})=>{h3(()=>{if(!n.current)return;const{scrollTop:d,scrollHeight:h,clientHeight:f}=n.current;n.current.scroll?n.current.scroll({top:o,behavior:f3(e,l)}):typeof o=="number"&&(n.current.scrollTop=o),t.current=Math.max(0,h-d-f),s(t.current===0),c&&c()},u)})),()=>{a.forEach(({remove:o})=>o())}},[e]),HT(n,{onReachedTop({distanceFromBottom:a}){s(!1),t.current=a},onInBetween({distanceFromBottom:a}){s(!1),t.current=a},onReachedBottom({distanceFromBottom:a}){s(!0),t.current=a}}),{scrollRef:n,scrollPubSub:r,isScrollBottomReached:i,setIsScrollBottomReached:s,scrollDistanceFromBottomRef:t}}var Hv=(e=>(e.USER_UPDATED="USER_UPDATED",e.SEND_MESSAGE_START="SEND_MESSAGE_START",e.SEND_MESSAGE_FAILED="SEND_MESSAGE_FAILED",e.SEND_USER_MESSAGE="SEND_USER_MESSAGE",e.SEND_FILE_MESSAGE="SEND_FILE_MESSAGE",e.ON_FILE_INFO_UPLOADED="ON_FILE_INFO_UPLOADED",e.UPDATE_USER_MESSAGE="UPDATE_USER_MESSAGE",e.DELETE_MESSAGE="DELETE_MESSAGE",e.LEAVE_CHANNEL="LEAVE_CHANNEL",e.CREATE_CHANNEL="CREATE_CHANNEL",e.UPDATE_OPEN_CHANNEL="UPDATE_OPEN_CHANNEL",e))(Hv||{});const cc=e=>e;function A7(e){const{onBeforeSendUserMessage:n=cc,onBeforeSendFileMessage:t=cc,onBeforeUpdateUserMessage:r=cc,onBeforeSendVoiceMessage:i=cc,onBeforeSendMultipleFilesMessage:s=cc,sendFileMessage:a,sendMultipleFilesMessage:o,sendUserMessage:l,updateUserMessage:u,scrollToBottom:c,quoteMessage:d,replyType:h}=e,f=D.useCallback(p=>{const m={...p};return e.quoteMessage&&h!=="NONE"&&(m.isReplyToChannel=!0,m.parentMessageId=d==null?void 0:d.messageId),m},[h,d]);return{sendUserMessage:D.useCallback(async p=>{const m=f(p),b=await n(m);return l(b,()=>c())},[f,l,c]),sendFileMessage:D.useCallback(async p=>{const m=f(p),b=await t(m);return a(b,()=>c())},[f,a,c]),sendMultipleFilesMessage:D.useCallback(async p=>{const m=f(p),b=await s(m);return o(b,()=>c())},[f,o,c]),sendVoiceMessage:D.useCallback(async(p,m)=>{const b=f({...p,fileName:fU,mimeType:pU,metaArrays:[new br({key:_U,value:[`${m}`]}),new br({key:mU,value:[vU]})]}),v=await i(b);return a(v,()=>c())},[f,a,c]),updateUserMessage:D.useCallback(async(p,m)=>{const b=f(m),v=await r(b);return u(p,v)},[f,u])}}const M7=()=>{const e=D.useRef({locked:!1,count:0}).current;return{lock(){e.locked=!0},async run(n){if(!(e.locked&&e.count>0))try{e.count++,await n()}catch{}},release(){e.locked=!1,e.count=0}}};function x7({channel:e,config:n,moduleLevel:t}){return!e||e.isBroadcast||e.isEphemeral?!1:e.isSuper?t??n.groupChannel.enableReactionsSupergroup:t??n.groupChannel.enableReactions}const BT=Dt.createContext(null),O7=e=>{const{channelUrl:n,children:t,isReactionEnabled:r,replyType:i,threadReplySelectType:s,isMessageGroupingEnabled:a=!0,isMultipleFilesMessageEnabled:o,showSearchIcon:l,disableMarkAsRead:u=!1,scrollBehavior:c="auto",startingPoint:d,animatedMessageId:h,messageListQueryParams:f,onBeforeSendUserMessage:p,onBeforeSendFileMessage:m,onBeforeSendVoiceMessage:b,onBeforeSendMultipleFilesMessage:v,onBeforeUpdateUserMessage:_,onBeforeDownloadFileMessage:E,onMessageAnimated:S,onBackClick:T,onChatHeaderActionClick:N,onReplyInThreadClick:I,onSearchClick:x,onQuoteMessageClick:A,renderUserMentionItem:O}=e,{config:U,stores:W}=pn(),{sdkStore:P}=W,{markAsReadScheduler:J,logger:V}=U,[H,we]=D.useState(null),[q,ee]=D.useState(null),[ie,Ne]=D.useState(null),[X,oe]=D.useState(null),{scrollRef:te,scrollPubSub:ce,scrollDistanceFromBottomRef:$,isScrollBottomReached:ke,setIsScrollBottomReached:B}=I7(c),ae=D.useRef(null),de=oU(ie,V),Ee=L2(i??U.groupChannel.replyType).upperCase,se=lU(s??U.groupChannel.threadReplySelectType).upperCase,he=R2(()=>Ee==="NONE"?Bn.NONE:Bn.ONLY_REPLY_TO_CHANNEL),fe=x7({channel:ie,config:U,moduleLevel:r}),ve=D.useMemo(()=>new Map(((ie==null?void 0:ie.members)??[]).map(({userId:ne,nickname:xe})=>[ne,xe])),[ie==null?void 0:ie.members]),me=M7(),pe=H5(P.sdk,ie,{startingPoint:d,replyType:he,collectionCreator:R7(ie,f),shouldCountNewMessages:()=>!ke,markAsRead:ne=>{!u&&$.current<=x0&&ne.forEach(xe=>J.push(xe))},onMessagesReceived:()=>{ke&&cU()&&ce.publish("scrollToBottom",{})},onChannelDeleted:()=>{Ne(null),oe(null)},onCurrentUserBanned:()=>{Ne(null),oe(null)},onChannelUpdated:ne=>Ne(ne),logger:V});HT(te,{async onReachedTop(){me.lock(),await me.run(async()=>{var xe,Le;if(!pe.hasPrevious())return;const ne={scrollTop:(xe=te.current)==null?void 0:xe.scrollTop,scrollHeight:(Le=te.current)==null?void 0:Le.scrollHeight};await pe.loadPrevious(),setTimeout(()=>{var Re;const re={scrollHeight:(Re=te.current)==null?void 0:Re.scrollHeight};if(ne.scrollHeight&&re.scrollHeight&&ne.scrollHeight{var xe,Le;if(!pe.hasNext())return;const ne={scrollTop:(xe=te.current)==null?void 0:xe.scrollTop,scrollHeight:(Le=te.current)==null?void 0:Le.scrollHeight};await pe.loadNext(),setTimeout(()=>{var Re;const re={scrollHeight:(Re=te.current)==null?void 0:Re.scrollHeight};ne.scrollHeight&&re.scrollHeight&&ne.scrollHeight{var ne;if(P.initialized&&n)try{const xe=await P.sdk.groupChannel.getChannel(n);Ne(xe),oe(null)}catch(xe){Ne(null),oe(xe),(ne=V==null?void 0:V.error)==null||ne.call(V,"GroupChannelProvider: error when fetching channel",xe)}finally{we(null),ee(null)}},[P.initialized,P.sdk,n]),CD(async()=>{pe.initialized&&(me.lock(),await me.run(()=>new Promise(Le=>{ce.publish("scrollToBottom",{resolve:Le,animated:!1})})),me.release());const ne=Le=>{Le.channel.url===n&&ce.publish("scrollToBottom",{})},xe=[U.pubSub.subscribe(Hv.SEND_USER_MESSAGE,ne),U.pubSub.subscribe(Hv.SEND_FILE_MESSAGE,ne)];return()=>{xe.forEach(Le=>Le.remove()),ce.publish("scrollToBottom",{animated:!1})}},[pe.initialized,n]),D.useEffect(()=>{typeof d=="number"&&ze(d,0,!1,!1)},[d]),D.useEffect(()=>{h&&ee(h)},[h]);const Ce=En(async ne=>{te.current&&(ee(null),B(!0),U.isOnline&&pe.hasNext()?(await pe.resetWithStartingPoint(Number.MAX_SAFE_INTEGER),ce.publish("scrollToBottom",{animated:ne})):ce.publish("scrollToBottom",{animated:ne}),ie&&!pe.hasNext()&&(pe.resetNewMessages(),u||J.push(ie)))}),ze=En(async(ne,xe,Le,re)=>{const Re=te.current,st=Re==null?void 0:Re.parentNode,Xe={activate(){!Re||!st||(Re.style.pointerEvents="auto",st.style.cursor="auto")},deactivate(){!Re||!st||(Re.style.pointerEvents="none",st.style.cursor="wait")}};Xe.deactivate(),ee(null);const He=pe.messages.find(ct=>ct.messageId===xe||ct.createdAt===ne);if(He){const ct=a3(He.createdAt);ct&&ce.publish("scroll",{top:ct,animated:re}),(Le??!0)&&ee(xe)}else await pe.resetWithStartingPoint(ne),setTimeout(()=>{const ct=a3(ne);ct&&ce.publish("scroll",{top:ct,lazy:!1,animated:re}),(Le??!0)&&ee(xe)});Xe.activate()}),ue=A7({...e,...pe,scrollToBottom:Ce,quoteMessage:H,replyType:Ee});return C.jsx(BT.Provider,{value:{channelUrl:n,isReactionEnabled:fe,isMessageGroupingEnabled:a,isMultipleFilesMessageEnabled:o,showSearchIcon:l??U.groupChannelSettings.enableMessageSearch,replyType:Ee,threadReplySelectType:se,disableMarkAsRead:u,scrollBehavior:c,messageListQueryParams:f,onBeforeSendUserMessage:p,onBeforeSendFileMessage:m,onBeforeSendVoiceMessage:b,onBeforeSendMultipleFilesMessage:v,onBeforeUpdateUserMessage:_,onBeforeDownloadFileMessage:E,onMessageAnimated:S,onBackClick:T,onChatHeaderActionClick:N,onReplyInThreadClick:I,onSearchClick:x,onQuoteMessageClick:A,renderUserMentionItem:O,currentChannel:ie,fetchChannelError:X,nicknamesMap:ve,scrollRef:te,scrollDistanceFromBottomRef:$,scrollPubSub:ce,messageInputRef:ae,quoteMessage:H,setQuoteMessage:we,animatedMessageId:q,setAnimatedMessageId:ee,isScrollBottomReached:ke,setIsScrollBottomReached:B,scrollToBottom:Ce,scrollToMessage:ze,toggleReaction:de,...pe,...ue},children:C.jsx(sU,{disableUserProfile:(e==null?void 0:e.disableUserProfile)??(U==null?void 0:U.disableUserProfile),renderUserProfile:(e==null?void 0:e.renderUserProfile)??(U==null?void 0:U.renderUserProfile),onUserProfileMessage:(e==null?void 0:e.onUserProfileMessage)??(U==null?void 0:U.onUserProfileMessage),children:t})})},Ai=()=>{const e=D.useContext(BT);if(!e)throw new Error("GroupChannelContext not found. Use within the GroupChannel module.");return e};function R7(e,n){return t=>{const r={...t,prevResultLimit:30,nextResultLimit:30,...n};return e.createMessageCollection({...r,filter:new Us(r)})}}function p3(e){Tr(1,arguments);var n=hs(e);return n.setHours(0,0,0,0),n}function $T(e,n){Tr(2,arguments);var t=p3(e),r=p3(n);return t.getTime()===r.getTime()}const oi={H_1:"H_1",H_2:"H_2",SUBTITLE_1:"SUBTITLE_1",SUBTITLE_2:"SUBTITLE_2",BODY_1:"BODY_1",BODY_2:"BODY_2",BUTTON_1:"BUTTON_1",BUTTON_2:"BUTTON_2",BUTTON_3:"BUTTON_3",CAPTION_1:"CAPTION_1",CAPTION_2:"CAPTION_2",CAPTION_3:"CAPTION_3"},Mi={ONBACKGROUND_1:"ONBACKGROUND_1",ONBACKGROUND_2:"ONBACKGROUND_2",ONBACKGROUND_3:"ONBACKGROUND_3",ONBACKGROUND_4:"ONBACKGROUND_4",ONCONTENT_1:"ONCONTENT_1",ONCONTENT_2:"ONCONTENT_2",ONCONTENT_INVERSE_1:"ONCONTENT_INVERSE_1",ONCONTENT_INVERSE_5:"ONCONTENT_INVERSE_5",PRIMARY:"PRIMARY",ERROR:"ERROR",SECONDARY_3:"SECONDARY_3"};function k7(e){switch(e){case oi.H_1:return"sendbird-label--h-1";case oi.H_2:return"sendbird-label--h-2";case oi.SUBTITLE_1:return"sendbird-label--subtitle-1";case oi.SUBTITLE_2:return"sendbird-label--subtitle-2";case oi.BODY_1:return"sendbird-label--body-1";case oi.BODY_2:return"sendbird-label--body-2";case oi.BUTTON_1:return"sendbird-label--button-1";case oi.BUTTON_2:return"sendbird-label--button-2";case oi.BUTTON_3:return"sendbird-label--button-3";case oi.CAPTION_1:return"sendbird-label--caption-1";case oi.CAPTION_2:return"sendbird-label--caption-2";case oi.CAPTION_3:return"sendbird-label--caption-3";default:return""}}function L7(e){switch(e){case Mi.ONBACKGROUND_1:return"sendbird-label--color-onbackground-1";case Mi.ONBACKGROUND_2:return"sendbird-label--color-onbackground-2";case Mi.ONBACKGROUND_3:return"sendbird-label--color-onbackground-3";case Mi.ONBACKGROUND_4:return"sendbird-label--color-onbackground-4";case Mi.ONCONTENT_1:return"sendbird-label--color-oncontent-1";case Mi.ONCONTENT_2:return"sendbird-label--color-oncontent-2";case Mi.ONCONTENT_INVERSE_1:return"sendbird-label--color-oncontent-inverse-1";case Mi.ONCONTENT_INVERSE_5:return"sendbird-label--color-oncontent-inverse-5";case Mi.PRIMARY:return"sendbird-label--color-primary";case Mi.ERROR:return"sendbird-label--color-error";case Mi.SECONDARY_3:return"sendbird-label--color-secondary-3";default:return""}}const D7={en:{MESSAGE_STATUS__YESTERDAY:"Yesterday",CHANNEL__MESSAGE_LIST__NOTIFICATION__NEW_MESSAGE:"new message(s) since",CHANNEL__MESSAGE_LIST__NOTIFICATION__ON:"on",CHANNEL_PREVIEW_MOBILE_LEAVE:"Leave channel",CHANNEL_SETTING__HEADER__TITLE:"Channel information",CHANNEL_SETTING__PROFILE__EDIT:"Edit",CHANNEL_SETTING__MEMBERS__TITLE:"Members",CHANNEL_SETTING__MEMBERS__SEE_ALL_MEMBERS:"All members",CHANNEL_SETTING__MEMBERS__INVITE_MEMBER:"Invite users",CHANNEL_SETTING__MEMBERS__YOU:" (You)",CHANNEL_SETTING__MEMBERS__SELECT_TITLE:"Select members",CHANNEL_SETTING__MEMBERS__OPERATOR:"Operator",CHANNEL_SETTING__LEAVE_CHANNEL__TITLE:"Leave channel",CHANNEL_SETTING__OPERATORS__TITLE:"Operators",CHANNEL_SETTING__OPERATORS__TITLE_ALL:"All operators",CHANNEL_SETTING__OPERATORS__TITLE_ADD:"Add operator",CHANNEL_SETTING__OPERATORS__ADD_BUTTON:"Add",CHANNEL_SETTING__MUTED_MEMBERS__TITLE:"Muted members",CHANNEL_SETTING__MUTED_MEMBERS__TITLE_ALL:"All muted members",CHANNEL_SETTING__NO_UNMUTED:"No muted members yet",CHANNEL_SETTING__BANNED_MEMBERS__TITLE:"Banned users",CHANNEL_SETTING__FREEZE_CHANNEL:"Freeze Channel",CHANNEL_SETTING__MODERATION__REGISTER_AS_OPERATOR:"Register as operator",CHANNEL_SETTING__MODERATION__UNREGISTER_OPERATOR:"Unregister operator",CHANNEL_SETTING__MODERATION__MUTE:"Mute",CHANNEL_SETTING__MODERATION__UNMUTE:"Unmute",CHANNEL_SETTING__MODERATION__BAN:"Ban",CHANNEL_SETTING__MODERATION__UNBAN:"Unban",CHANNEL_SETTING__MODERATION__EMPTY_BAN:"No banned members yet",CHANNEL_SETTING__MODERATION__ALL_BAN:"All banned members",OPEN_CHANNEL_CONVERSATION__TITLE_PARTICIPANTS:"participants",OPEN_CHANNEL_CONVERSATION__SELECT_PARTICIPANTS:"Select participants",OPEN_CHANNEL_LIST__TITLE:"Channels",CREATE_OPEN_CHANNEL_LIST__TITLE:"New channel profile",CREATE_OPEN_CHANNEL_LIST__SUBTITLE__IMG_SECTION:"Channel image",CREATE_OPEN_CHANNEL_LIST__SUBTITLE__IMG_UPLOAD:"Upload",CREATE_OPEN_CHANNEL_LIST__SUBTITLE__TEXT_SECTION:"Channel name",CREATE_OPEN_CHANNEL_LIST__SUBTITLE__TEXT_PLACE_HOLDER:"Enter channel name",CREATE_OPEN_CHANNEL_LIST__SUBMIT:"Create",OPEN_CHANNEL_SETTINGS__OPERATOR_TITLE:"Channel Information",OPEN_CHANNEL_SETTINGS__OPERATOR_URL:"URL",OPEN_CHANNEL_SETTINGS__PARTICIPANTS_ACCORDION_TITLE:"Participants",OPEN_CHANNEL_SETTINGS__DELETE_CHANNEL_PANEL:"Delete channel",OPEN_CHANNEL_SETTINGS__DELETE_CHANNEL_TITLE:"Delete channel?",OPEN_CHANNEL_SETTINGS__DELETE_CHANNEL_CONTEXT:"Once deleted, this channel can't be restored.",OPEN_CHANNEL_SETTINGS__DELETE_CHANNEL_SUBMIT:"Delete",OPEN_CHANNEL_SETTINGS__OPERATORS_TITLE:"Operators",OPEN_CHANNEL_SETTINGS__OPERATORS__TITLE_ADD:"Add operator",OPEN_CHANNEL_SETTINGS__OPERATORS__TITLE_ALL:"All operators",OPEN_CHANNEL_SETTINGS__MUTED_MEMBERS__TITLE:"Muted participants",OPEN_CHANNEL_SETTINGS__MUTED_MEMBERS__TITLE_ALL:"All muted participants",OPEN_CHANNEL_SETTINGS__MUTED_MEMBERS__NO_ONE:"No muted participants yet",OPEN_CHANNEL_SETTINGS__BANNED_MEMBERS__TITLE:"Banned users",OPEN_CHANNEL_SETTINGS__BANNED_MEMBERS__TITLE_ALL:"All banned users",OPEN_CHANNEL_SETTINGS__BANNED_MEMBERS__NO_ONE:"No banned users yet",OPEN_CHANNEL_SETTINGS__MEMBERS__YOU:" (You)",OPEN_CHANNEL_SETTINGS__MEMBERS__OPERATOR:"Operator",OPEN_CHANNEL_SETTINGS__PARTICIPANTS_TITLE:"Participants",OPEN_CHANNEL_SETTINGS__EMPTY_LIST:"No participants yet",OPEN_CHANNEL_SETTINGS__SEE_ALL:"See all participants",OPEN_CHANNEL_SETTINGS__ALL_PARTICIPANTS_TITLE:"All participants",OPEN_CHANNEL_SETTINGS__NO_TITLE:"(No title)",OPEN_CHANNEL_SETTING__MODERATION__REGISTER_AS_OPERATOR:"Register as operator",OPEN_CHANNEL_SETTING__MODERATION__UNREGISTER_OPERATOR:"Unregister operator",OPEN_CHANNEL_SETTING__MODERATION__MUTE:"Mute",OPEN_CHANNEL_SETTING__MODERATION__UNMUTE:"Unmute",OPEN_CHANNEL_SETTING__MODERATION__BAN:"Ban",OPEN_CHANNEL_SETTING__MODERATION__UNBAN:"Unban",TRYING_TO_CONNECT:"Trying to connect…",TYPING_INDICATOR__IS_TYPING:"is typing...",TYPING_INDICATOR__AND:"and",TYPING_INDICATOR__ARE_TYPING:"are typing...",TYPING_INDICATOR__MULTIPLE_TYPING:"Several people are typing...",CHANNEL_FROZEN:"Channel frozen",PLACE_HOLDER__NO_CHANNEL:"No channels",PLACE_HOLDER__WRONG:"Something went wrong",PLACE_HOLDER__RETRY_TO_CONNECT:"Retry",PLACE_HOLDER__NO_MESSAGES:"No messages",TOOLTIP__AND_YOU:", and you",TOOLTIP__YOU:"you",TOOLTIP__UNKNOWN_USER:"(no name)",UNKNOWN__UNKNOWN_MESSAGE_TYPE:"(Unknown message type)",UNKNOWN__CANNOT_READ_MESSAGE:"Cannot read this message.",UNKNOWN__TEMPLATE_ERROR:"(Template error)",UNKNOWN__CANNOT_READ_TEMPLATE:"Cannot read this template.",MESSAGE_EDITED:"(edited)",MODAL__DELETE_MESSAGE__TITLE:"Delete this message?",MODAL__CHANNEL_INFORMATION__TITLE:"Edit channel information",MODAL__CHANNEL_INFORMATION__CHANNEL_IMAGE:"Channel image",MODAL__CHANNEL_INFORMATION__UPLOAD:"Upload",MODAL__CHANNEL_INFORMATION__CHANNEL_NAME:"Channel name",MODAL__CHANNEL_INFORMATION__INPUT__PLACE_HOLDER:"Enter name",MODAL__INVITE_MEMBER__TITLE:"Invite member",MODAL__INVITE_MEMBER__SELECTED:"selected",MODAL__CHOOSE_CHANNEL_TYPE__TITLE:"New channel",MODAL__CHOOSE_CHANNEL_TYPE__GROUP:"Group",MODAL__CHOOSE_CHANNEL_TYPE__SUPER_GROUP:"Super group",MODAL__CHOOSE_CHANNEL_TYPE__BROADCAST:"Broadcast",MODAL__CREATE_CHANNEL__TITLE:"New channel",MODAL__CREATE_CHANNEL__GROUP:"Group",MODAL__CREATE_CHANNEL__SUPER:"Super group",MODAL__CREATE_CHANNEL__BROADCAST:"Broadcast",MODAL__CREATE_CHANNEL__SELECTED:"selected",MODAL__LEAVE_CHANNEL__TITLE:"Leave this channel?",MODAL__LEAVE_CHANNEL__FOOTER:"Leave",MODAL__VOICE_MESSAGE_INPUT_DISABLED__TITLE_MUTED:"You're muted by the operator.",MODAL__VOICE_MESSAGE_INPUT_DISABLED__TITLE_FROZEN:"Channel is frozen.",USER_PROFILE__MESSAGE:"Message",USER_PROFILE__USER_ID:"User ID",EDIT_PROFILE__TITLE:"My profile",EDIT_PROFILE__IMAGE_LABEL:"Profile image",EDIT_PROFILE__IMAGE_UPLOAD:"Upload",EDIT_PROFILE__NICKNAME_LABEL:"Nickname",EDIT_PROFILE__NICKNAME_PLACEHOLDER:"Enter your nickname",EDIT_PROFILE__USERID_LABEL:"User ID",EDIT_PROFILE__THEME_LABEL:"Dark theme",MESSAGE_INPUT__PLACE_HOLDER:"Enter message",MESSAGE_INPUT__PLACE_HOLDER__DISABLED:"Chat is unavailable in this channel",MESSAGE_INPUT__PLACE_HOLDER__MUTED:"Chat is unavailable because you're muted",MESSAGE_INPUT__PLACE_HOLDER__MUTED_SHORT:"You're muted",MESSAGE_INPUT__QUOTE_REPLY__PLACE_HOLDER:"Reply to message",BUTTON__SUBMIT:"Submit",BUTTON__CANCEL:"Cancel",BUTTON__DELETE:"Delete",BUTTON__SAVE:"Save",BUTTON__CREATE:"Create",BUTTON__INVITE:"Invite",BUTTON__OK:"OK",BADGE__OVER:"+",NO_TITLE:"No title",NO_NAME:"(No name)",NO_MEMBERS:"(No members)",LABEL__OPERATOR:"Operator",MESSAGE_MENU__COPY:"Copy",MESSAGE_MENU__REPLY:"Reply",MESSAGE_MENU__THREAD:"Reply in thread",MESSAGE_MENU__OPEN_IN_CHANNEL:"Open in channel",MESSAGE_MENU__EDIT:"Edit",MESSAGE_MENU__RESEND:"Resend",MESSAGE_MENU__DELETE:"Delete",MESSAGE_MENU__SAVE:"Save",CONTEXT_MENU_DROPDOWN__COPY:"Copy",CONTEXT_MENU_DROPDOWN__EDIT:"Edit",CONTEXT_MENU_DROPDOWN__RESEND:"Resend",CONTEXT_MENU_DROPDOWN__DELETE:"Delete",CONTEXT_MENU_DROPDOWN__SAVE:"Save",SEARCH:"Search",SEARCH_IN_CHANNEL:"Search in channel",SEARCH_IN:"Search in",SEARCHING:"Searching for messages...",NO_SEARCHED_MESSAGE:"No results found.",QUOTE_MESSAGE_INPUT__REPLY_TO:"Reply to",QUOTE_MESSAGE_INPUT__FILE_TYPE_IMAGE:"Photo",QUOTE_MESSAGE_INPUT__FILE_TYPE_GIF:"GIF",QUOTE_MESSAGE_INPUT__FILE_TYPE__VIDEO:"Video",QUOTED_MESSAGE__REPLIED_TO:"replied to",QUOTED_MESSAGE__CURRENT_USER:"You",QUOTED_MESSAGE__UNAVAILABLE:"Message unavailable",THREAD__HEADER_TITLE:"Thread",CHANNEL__THREAD_REPLY:"reply",CHANNEL__THREAD_REPLIES:"replies",CHANNEL__THREAD_OVER_MAX:"99+",THREAD__THREAD_REPLY:"reply",THREAD__THREAD_REPLIES:"replies",THREAD__INPUT__REPLY_TO_THREAD:"Reply to thread",THREAD__INPUT__REPLY_IN_THREAD:"Reply in thread",MENTION_NAME__NO_NAME:"(No name)",MENTION_COUNT__OVER_LIMIT:"You can mention up to %d times at a time.",UI__FILE_VIEWER__UNSUPPORT:"Unsupported message",VOICE_RECORDING_PERMISSION_DENIED:`You cannot record the voice since + voice recording is not permitted in your device system setting`,VOICE_MESSAGE:"Voice Message",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_GIF:"GIF",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_PHOTO:"Photo",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_VIDEO:"Video",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_AUDIO:"Audio",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_VOICE_MESSAGE:"Voice message",CHANNEL_PREVIEW_LAST_MESSAGE_FILE_TYPE_GENERAL:"File",CHANNEL_PREVIEW_LAST_MESSAGE_TEMPLATE_MESSAGE:"Message",DATE_FORMAT__MESSAGE_LIST__NOTIFICATION__UNREAD_SINCE:"p 'on' MMM dd",DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR:"MMMM dd, yyyy",DATE_FORMAT__THREAD_LIST__DATE_SEPARATOR:"MMM dd, yyyy",FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT:"Up to %d files can be attached.",FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT:"The maximum size per file is %d MB.",FEEDBACK_LIKE:"Like",FEEDBACK_DISLIKE:"Dislike",EDIT_COMMENT:"Edit comment",REMOVE_FEEDBACK:"Remove Feedback",FEEDBACK_MODAL_TITLE:"Provide additional feedback (optional)",FEEDBACK_CONTENT_PLACEHOLDER:"Leave a comment",BUTTON__REMOVE_FEEDBACK:"Remove feedback",FEEDBACK_FAILED_SUBMIT:"Couldn’t submit. Try again.",FEEDBACK_FAILED_SAVE:"Couldn’t save. Try again.",FEEDBACK_FAILED_DELETE:"Couldn’t delete. Try again."}},U2=(e="en")=>D7[e],ut=D.forwardRef(({className:e=[],type:n,color:t,children:r=null},i)=>C.jsx("span",{className:[...Array.isArray(e)?e:[e],"sendbird-label",k7(n),L7(t)].join(" "),ref:i,children:r})),it=oi,at=Mi,GT=U2("en"),zT={stringSet:U2("en"),dateLocale:FT},Ki=Dt.createContext(zT),U7=e=>{const{children:n}=e;return C.jsx(Ki.Provider,{value:{...zT,...e},children:n})},vl=()=>Dt.useContext(Ki),L0=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)}),D0=L0,P7=({members:e})=>{function n(){const{stringSet:t}=D.useContext(Ki);return!e||e.length===0?"":e&&e.length===1?`${e[0].nickname} ${t.TYPING_INDICATOR__IS_TYPING}`:e&&e.length===2?`${e[0].nickname} ${t.TYPING_INDICATOR__AND} ${e[1].nickname} ${t.TYPING_INDICATOR__ARE_TYPING}`:t.TYPING_INDICATOR__MULTIPLE_TYPING}return C.jsx(C.Fragment,{children:n()})},F7=({channelUrl:e})=>{var l,u,c;const n=pn(),t=(u=(l=n==null?void 0:n.stores)==null?void 0:l.sdkStore)==null?void 0:u.sdk,r=(c=n==null?void 0:n.config)==null?void 0:c.logger,[i,s]=D.useState(L0()),[a,o]=D.useState([]);return D.useEffect(()=>{var d;if((d=t==null?void 0:t.groupChannel)!=null&&d.addGroupChannelHandler){t.groupChannel.removeGroupChannelHandler(i);const h=L0(),f=new O2({onTypingStatusUpdated:p=>{if(r.info("Channel > Typing Indicator: onTypingStatusUpdated",p),p.url===e){const m=p.getTypingUsers();o(m)}}});t.groupChannel.addGroupChannelHandler(h,f),s(h)}return()=>{var h;o([]),(h=t==null?void 0:t.groupChannel)!=null&&h.removeGroupChannelHandler&&t.groupChannel.removeGroupChannelHandler(i)}},[e]),C.jsx(ut,{className:"sendbird-conversation__footer__typing-indicator__text",type:it.CAPTION_2,color:at.ONBACKGROUND_2,children:C.jsx(P7,{members:a})})};var P2=(e=>(e.Text="text",e.Bubble="bubble",e))(P2||{});const ye={ADD:"ADD",ARROW_LEFT:"ARROW_LEFT",ATTACH:"ATTACH",AUDIO_ON_LINED:"AUDIO_ON_LINED",BAN:"BAN",BROADCAST:"BROADCAST",CAMERA:"CAMERA",CHANNELS:"CHANNELS",CHAT:"CHAT",CHAT_FILLED:"CHAT_FILLED",CHEVRON_DOWN:"CHEVRON_DOWN",CHEVRON_RIGHT:"CHEVRON_RIGHT",CLOSE:"CLOSE",COLLAPSE:"COLLAPSE",COPY:"COPY",CREATE:"CREATE",DELETE:"DELETE",DISCONNECTED:"DISCONNECTED",DOCUMENT:"DOCUMENT",DONE:"DONE",DONE_ALL:"DONE_ALL",DOWNLOAD:"DOWNLOAD",EDIT:"EDIT",EMOJI_MORE:"EMOJI_MORE",ERROR:"ERROR",EXPAND:"EXPAND",FILE_AUDIO:"FILE_AUDIO",FILE_DOCUMENT:"FILE_DOCUMENT",FREEZE:"FREEZE",GIF:"GIF",INFO:"INFO",LEAVE:"LEAVE",MEMBERS:"MEMBERS",MESSAGE:"MESSAGE",MODERATIONS:"MODERATIONS",MORE:"MORE",MUTE:"MUTE",NOTIFICATIONS:"NOTIFICATIONS",NOTIFICATIONS_OFF_FILLED:"NOTIFICATIONS_OFF_FILLED",OPERATOR:"OPERATOR",PHOTO:"PHOTO",PLAY:"PLAY",PLUS:"PLUS",QUESTION:"QUESTION",REFRESH:"REFRESH",REPLY:"REPLY",REMOVE:"REMOVE",SEARCH:"SEARCH",SEND:"SEND",SETTINGS_FILLED:"SETTINGS_FILLED",SLIDE_LEFT:"SLIDE_LEFT",SPINNER:"SPINNER",SUPERGROUP:"SUPERGROUP",THREAD:"THREAD",THUMBNAIL_NONE:"THUMBNAIL_NONE",TOGGLE_OFF:"TOGGLE_OFF",TOGGLE_ON:"TOGGLE_ON",USER:"USER",FEEDBACK_LIKE:"FEEDBACK_LIKE",FEEDBACK_DISLIKE:"FEEDBACK_DISLIKE"},Kn={DEFAULT:"DEFAULT",PRIMARY:"PRIMARY",PRIMARY_2:"PRIMARY_2",SECONDARY:"SECONDARY",CONTENT:"CONTENT",CONTENT_INVERSE:"CONTENT_INVERSE",CONTENT_INVERSE_5:"CONTENT_INVERSE_5",WHITE:"WHITE",GRAY:"GRAY",THUMBNAIL_ICON:"THUMBNAIL_ICON",SENT:"SENT",READ:"READ",ON_BACKGROUND_1:"ON_BACKGROUND_1",ON_BACKGROUND_2:"ON_BACKGROUND_2",ON_BACKGROUND_3:"ON_BACKGROUND_3",ON_BACKGROUND_4:"ON_BACKGROUND_4",BACKGROUND_3:"BACKGROUND_3",ERROR:"ERROR"};function H7(e){switch(e){case Kn.PRIMARY:return"sendbird-icon-color--primary";case Kn.PRIMARY_2:return"sendbird-icon-color--primary-2";case Kn.SECONDARY:return"sendbird-icon-color--secondary";case Kn.CONTENT:return"sendbird-icon-color--content";case Kn.CONTENT_INVERSE:return"sendbird-icon-color--content-inverse";case Kn.CONTENT_INVERSE_5:return"sendbird-icon-color--content-inverse-5";case Kn.WHITE:return"sendbird-icon-color--white";case Kn.GRAY:return"sendbird-icon-color--gray";case Kn.THUMBNAIL_ICON:return"sendbird-icon-color--thumbnail-icon";case Kn.SENT:return"sendbird-icon-color--sent";case Kn.READ:return"sendbird-icon-color--read";case Kn.ON_BACKGROUND_1:return"sendbird-icon-color--on-background-1";case Kn.ON_BACKGROUND_2:return"sendbird-icon-color--on-background-2";case Kn.ON_BACKGROUND_3:return"sendbird-icon-color--on-background-3";case Kn.ON_BACKGROUND_4:return"sendbird-icon-color--on-background-4";case Kn.BACKGROUND_3:return"sendbird-icon-color--background-3";case Kn.ERROR:return"sendbird-icon-color--error";default:return""}}function j7(e){switch(e){case ye.ADD:return"sendbird-icon-add";case ye.ARROW_LEFT:return"sendbird-icon-arrow-left";case ye.ATTACH:return"sendbird-icon-attach";case ye.AUDIO_ON_LINED:return"sendbird-icon-audio-on-lined";case ye.BAN:return"sendbird-icon-ban";case ye.BROADCAST:return"sendbird-icon-broadcast";case ye.CAMERA:return"sendbird-icon-camera";case ye.CHANNELS:return"sendbird-icon-channels";case ye.CHAT:return"sendbird-icon-chat";case ye.CHAT_FILLED:return"sendbird-icon-chat-filled";case ye.CHEVRON_DOWN:return"sendbird-icon-chevron-down";case ye.CHEVRON_RIGHT:return"sendbird-icon-chevron-right";case ye.CLOSE:return"sendbird-icon-close";case ye.COLLAPSE:return"sendbird-icon-collapse";case ye.COPY:return"sendbird-icon-copy";case ye.CREATE:return"sendbird-icon-create";case ye.DELETE:return"sendbird-icon-delete";case ye.DISCONNECTED:return"sendbird-icon-disconnected";case ye.DOCUMENT:return"sendbird-icon-document";case ye.DONE:return"sendbird-icon-done";case ye.DONE_ALL:return"sendbird-icon-done-all";case ye.DOWNLOAD:return"sendbird-icon-down-load";case ye.EDIT:return"sendbird-icon-edit";case ye.EMOJI_MORE:return"sendbird-icon-emoji-more";case ye.ERROR:return"sendbird-icon-error";case ye.EXPAND:return"sendbird-icon-expand";case ye.FILE_AUDIO:return"sendbird-icon-file-audio";case ye.FILE_DOCUMENT:return"sendbird-icon-file-document";case ye.FREEZE:return"sendbird-icon-freeze";case ye.GIF:return"sendbird-icon-gif";case ye.INFO:return"sendbird-icon-info";case ye.LEAVE:return"sendbird-icon-leave";case ye.MEMBERS:return"sendbird-icon-members";case ye.MESSAGE:return"sendbird-icon-message";case ye.MODERATIONS:return"sendbird-icon-moderations";case ye.MORE:return"sendbird-icon-more";case ye.MUTE:return"sendbird-icon-mute";case ye.NOTIFICATIONS:return"sendbird-icon-notifications";case ye.NOTIFICATIONS_OFF_FILLED:return"sendbird-icon-notifications-off-filled";case ye.OPERATOR:return"sendbird-icon-operator";case ye.PHOTO:return"sendbird-icon-photo";case ye.PLAY:return"sendbird-icon-play";case ye.PLUS:return"sendbird-iconn-plus";case ye.QUESTION:return"sendbird-icon-question";case ye.REFRESH:return"sendbird-icon-refresh";case ye.REMOVE:return"sendbird-icon-remove";case ye.REPLY:return"sendbird-icon-reply";case ye.SEARCH:return"sendbird-icon-search";case ye.SEND:return"sendbird-icon-send";case ye.SETTINGS_FILLED:return"sendbird-icon-settings-filled";case ye.SPINNER:return"sendbird-icon-spinner";case ye.SUPERGROUP:return"sendbird-icon-supergroup";case ye.THREAD:return"sendbird-icon-thread";case ye.THUMBNAIL_NONE:return"sendbird-icon-thumbnail-none";case ye.TOGGLE_OFF:return"sendbird-icon-toggle-off";case ye.TOGGLE_ON:return"sendbird-icon-toggle-on";case ye.USER:return"sendbird-icon-user";case ye.FEEDBACK_LIKE:return"sendbird-icon-feedback-like";case ye.FEEDBACK_DISLIKE:return"sendbird-icon-feedback-dislike";default:return"sendbird-icon-unknown"}}const B7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M50.667%205.333c4.418%200%208%203.582%208%208v37.334c0%204.418-3.582%208-8%208H13.333c-4.418%200-8-3.582-8-8V13.333c0-4.418%203.582-8%208-8zm0%205.334H13.333c-1.472%200-2.666%201.194-2.666%202.666v37.334c0%201.472%201.194%202.666%202.666%202.666h37.334c1.472%200%202.666-1.194%202.666-2.666V13.333c0-1.472-1.194-2.666-2.666-2.666zm-18.667%208c1.368%200%202.495%201.03%202.649%202.355l.018.311v8h8c1.472%200%202.666%201.194%202.666%202.667%200%201.368-1.03%202.495-2.355%202.649l-.311.018h-8v8c0%201.472-1.194%202.666-2.667%202.666-1.368%200-2.495-1.03-2.649-2.355l-.018-.311v-8h-8c-1.472%200-2.666-1.194-2.666-2.667%200-1.368%201.03-2.495%202.355-2.649l.311-.018h8v-8c0-1.472%201.194-2.666%202.667-2.666z'%20transform='translate(-66%20-271)%20translate(66%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",$7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M33.886%208.781c.96.961%201.035%202.474.221%203.52l-.221.251-16.78%2016.781H56c1.473%200%202.667%201.194%202.667%202.667%200%201.368-1.03%202.495-2.356%202.649l-.311.018-38.895-.001%2016.78%2016.782c.962.961%201.036%202.474.222%203.52l-.221.251c-.962.961-2.474%201.035-3.52.222l-.252-.222L8.781%2033.886c-.961-.962-1.035-2.474-.222-3.52l.222-.252L30.114%208.781c1.042-1.041%202.73-1.041%203.772%200z'%20transform='translate(-66%20-751)%20translate(66%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",G7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M55.334%2028.926l-24.506%2023.34c-5.222%204.973-13.74%204.973-18.962%200-5.149-4.903-5.149-12.797%200-17.7l24.506-23.34c3.138-2.988%208.278-2.988%2011.416%200%203.064%202.919%203.064%207.594%200%2010.513L23.255%2045.077c-1.055%201.005-2.815%201.005-3.87.001-.98-.933-.98-2.39%200-3.325l22.64-21.535c1.067-1.015%201.109-2.703.094-3.77-1.015-1.067-2.703-1.11-3.77-.094L15.709%2037.89c-3.189%203.037-3.189%208.015-.001%2011.05%203.113%202.966%208.11%202.966%2011.224%200l24.533-23.338c5.272-5.021%205.272-13.217%200-18.238-5.197-4.95-13.573-4.95-18.77%200L8.187%2030.704c-7.356%207.005-7.356%2018.419%200%2025.424%207.281%206.935%2019.036%206.935%2026.318%200l24.506-23.34c1.067-1.016%201.108-2.703.092-3.77-1.015-1.066-2.703-1.108-3.77-.092z'%20transform='translate(-642%20-591)%20translate(642%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",z7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333%202.667%2048.2%202.667%2032%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032s10.745%2024%2024%2024%2024-10.745%2024-24S45.255%208%2032%208zm12.333%2021.333c.553%200%201%20.448%201%201v3.334c0%20.552-.447%201-1%201H19.667c-.553%200-1-.448-1-1v-3.334c0-.552.447-1%201-1h24.666z'%20transform='translate(-498%20-1071)%20translate(498%201071)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",V7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M58.545%205.498c.08.258.122.526.122.796v46.079c0%201.473-1.194%202.666-2.667%202.666-.27%200-.538-.04-.795-.12l-17.951-5.61c-.645%205.273-5.14%209.358-10.587%209.358C20.776%2058.667%2016%2053.89%2016%2048v-5.334h-5.333c-4.335%200-7.865-3.447-7.997-7.75l-.003-.25V24c0-4.418%203.581-8%208-8H16L55.205%203.749c1.405-.44%202.901.344%203.34%201.75zM21.333%2044.587V48c0%202.946%202.388%205.333%205.334%205.333%202.811%200%205.115-2.175%205.318-4.935L32%2047.92l-10.667-3.333zm32-34.667l-32%209.997v18.83l32%209.997V9.92zM16%2021.333h-5.333c-1.368%200-2.495%201.03-2.65%202.356L8%2024v10.667c0%201.472%201.194%202.666%202.667%202.666H16v-16z'%20transform='translate(-1074%20-431)%20translate(1074%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",q7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M40%205.333c.892%200%201.724.446%202.219%201.188l4.541%206.812H56c4.26%200%207.743%203.33%207.986%207.53l.014.47v29.334c0%204.418-3.582%208-8%208H8c-4.418%200-8-3.582-8-8V21.333c0-4.418%203.582-8%208-8h9.237l4.544-6.812c.433-.65%201.125-1.072%201.888-1.167l.331-.02zm-1.43%205.334H25.428l-4.542%206.812c-.432.65-1.124%201.072-1.887%201.167l-.331.02H8c-1.473%200-2.667%201.195-2.667%202.667v29.334c0%201.472%201.194%202.666%202.667%202.666h48c1.473%200%202.667-1.194%202.667-2.666V21.333c0-1.472-1.194-2.666-2.667-2.666H45.333c-.891%200-1.724-.446-2.218-1.188l-4.544-6.812zM32%2021.333c7.364%200%2013.333%205.97%2013.333%2013.334C45.333%2042.03%2039.363%2048%2032%2048c-7.364%200-13.333-5.97-13.333-13.333%200-7.364%205.97-13.334%2013.333-13.334zm0%205.334c-4.418%200-8%203.581-8%208%200%204.418%203.582%208%208%208s8-3.582%208-8c0-4.419-3.582-8-8-8z'%20transform='translate(-66%20-591)%20translate(66%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",W7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M42.65%205.333l.311.017c1.36.15%202.366%201.298%202.373%202.633l-.017.311-1.45%2013.04h9.466C54.806%2021.333%2056%2022.526%2056%2024c0%201.368-1.03%202.495-2.356%202.649l-.31.018H43.271l-1.184%2010.666h11.245C54.806%2037.333%2056%2038.527%2056%2040c0%201.368-1.03%202.495-2.356%202.649l-.31.018H41.495l-1.512%2013.627c-.163%201.464-1.481%202.519-2.945%202.356-1.36-.15-2.366-1.298-2.373-2.633l.017-.311%201.448-13.04H25.496l-1.512%2013.628c-.163%201.464-1.481%202.519-2.945%202.356-1.36-.15-2.366-1.298-2.373-2.633l.017-.311%201.448-13.04h-9.464C9.194%2042.667%208%2041.474%208%2040c0-1.368%201.03-2.495%202.356-2.649l.31-.018h10.057l1.186-10.667H10.667C9.194%2026.667%208%2025.474%208%2024c0-1.368%201.03-2.495%202.356-2.649l.31-.018h11.835l1.515-13.627c.151-1.36%201.299-2.366%202.634-2.373l.311.017c1.36.15%202.366%201.298%202.373%202.633l-.017.311-1.45%2013.04H38.5l1.515-13.628c.151-1.36%201.299-2.366%202.634-2.373zm-5.927%2032l1.186-10.667H27.272l-1.184%2010.667h10.635z'%20transform='translate(-66%20-431)%20translate(66%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",K7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333c-4.455%200-8.679-.993-12.461-2.77l-1.753.58c-5.965%201.912-10.133%202.572-12.504%201.981-2.799-.698-3.351-1.919-1.657-3.663%201.171-1.396%202.147-3.14%202.928-5.234.622-1.668.377-4.001-.737-7C3.8%2041.253%202.666%2036.759%202.666%2032%202.667%2015.8%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032c0%203.5.747%206.88%202.168%209.978l.405.837.137.271.106.285c1.517%204.085%201.89%207.622.734%2010.72l-.382.972-.192.433.235-.05c1.38-.317%203.017-.767%204.886-1.363l1.721-.568%202.04-.696%201.95.917C24.965%2055.22%2028.422%2056%2032%2056c13.255%200%2024-10.745%2024-24S45.255%208%2032%208z'%20transform='translate(-210%20-431)%20translate(210%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Q7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333c-4.455%200-8.679-.993-12.461-2.77l-1.753.58c-5.965%201.912-10.133%202.572-12.504%201.981-2.799-.698-3.351-1.919-1.657-3.663%201.171-1.396%202.147-3.14%202.928-5.234.622-1.668.377-4.001-.737-7C3.8%2041.253%202.666%2036.759%202.666%2032%202.667%2015.8%2015.8%202.667%2032%202.667z'%20transform='translate(-358%20-431)%20translate(358%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Y7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M20.879%2048.879c-1.172%201.171-1.172%203.07%200%204.242%201.171%201.172%203.07%201.172%204.242%200l18-18c1.172-1.171%201.172-3.07%200-4.242l-18-18c-1.171-1.172-3.07-1.172-4.242%200-1.172%201.171-1.172%203.07%200%204.242L36.757%2033%2020.88%2048.879z'%20transform='translate(-786%20-751)%20translate(786%20751)%20rotate(90%2032%2033)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Z7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M22.114%2046.114c-1.041%201.042-1.041%202.73%200%203.772%201.042%201.041%202.73%201.041%203.772%200l16-16c1.041-1.042%201.041-2.73%200-3.772l-16-16c-1.042-1.041-2.73-1.041-3.772%200-1.041%201.042-1.041%202.73%200%203.772L36.23%2032%2022.114%2046.114z'%20transform='translate(-642%20-751)%20translate(642%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",X7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M52.552%2011.448c.962.961%201.036%202.474.222%203.52l-.222.251-16.781%2016.78%2016.781%2016.782c1.042%201.041%201.042%202.73%200%203.771-.961.962-2.474%201.036-3.52.222l-.251-.222L32%2035.771%2015.219%2052.552c-1.041%201.042-2.73%201.042-3.771%200-.962-.961-1.036-2.474-.222-3.52l.222-.251L28.228%2032l-16.78-16.781c-1.042-1.041-1.042-2.73%200-3.771.961-.962%202.474-1.036%203.52-.222l.251.222%2016.78%2016.78%2016.782-16.78c1.041-1.042%202.73-1.042%203.771%200z'%20transform='translate(-210%20-751)%20translate(210%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",J7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M16%208c-1.368%200-2.495%201.03-2.649%202.356l-.018.31v42.667C13.333%2054.806%2014.527%2056%2016%2056c1.368%200%202.495-1.03%202.649-2.356l.018-.31V34.666h25.56l-6.113%206.114c-.96.961-1.035%202.474-.221%203.52l.221.251c.962.962%202.474%201.036%203.52.222l.252-.222%2010.666-10.666c.962-.962%201.036-2.474.222-3.52l-.222-.252-10.666-10.666c-1.042-1.042-2.73-1.042-3.772%200-.96.961-1.035%202.474-.221%203.52l.221.251%206.113%206.114h-25.56V10.667C18.667%209.194%2017.473%208%2016%208z'%20transform='translate(-66%20-1215)%20translate(66%201215)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",e8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M53.333%2021.333c4.419%200%208%203.582%208%208v24c0%204.419-3.581%208-8%208h-24c-4.418%200-8-3.581-8-8v-24c0-4.418%203.582-8%208-8zm0%205.334h-24c-1.472%200-2.666%201.194-2.666%202.666v24c0%201.473%201.194%202.667%202.666%202.667h24C54.806%2056%2056%2054.806%2056%2053.333v-24c0-1.472-1.194-2.666-2.667-2.666zm-18.666-24c4.26%200%207.743%203.33%207.986%207.53l.014.47v2.666C42.667%2014.806%2041.473%2016%2040%2016c-1.368%200-2.495-1.03-2.649-2.356l-.018-.31v-2.667c0-1.368-1.03-2.495-2.355-2.65L34.667%208h-24c-1.368%200-2.495%201.03-2.65%202.356l-.017.31v24c0%201.368%201.03%202.495%202.356%202.65l.31.017h2.667C14.806%2037.333%2016%2038.527%2016%2040c0%201.368-1.03%202.495-2.356%202.649l-.31.018h-2.667c-4.26%200-7.743-3.33-7.987-7.53l-.013-.47v-24c0-4.26%203.33-7.743%207.53-7.987l.47-.013h24z'%20transform='translate(-354%20-271)%20translate(354%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",t8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333c-4.455%200-8.679-.993-12.461-2.77l-1.753.58c-5.965%201.912-10.133%202.572-12.504%201.981-2.799-.698-3.351-1.919-1.657-3.663%201.171-1.396%202.147-3.14%202.928-5.234.622-1.668.377-4.001-.737-7C3.8%2041.253%202.666%2036.759%202.666%2032%202.667%2015.8%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032c0%203.5.747%206.88%202.168%209.978l.405.837.137.271.106.285c1.517%204.085%201.89%207.622.734%2010.72l-.382.972-.192.433.235-.05c1.38-.317%203.017-.767%204.886-1.363l1.721-.568%202.04-.696%201.95.917C24.965%2055.22%2028.422%2056%2032%2056c13.255%200%2024-10.745%2024-24S45.255%208%2032%208zm2.667%2016v5.333H40c3.556%200%203.556%205.334%200%205.334h-5.333V40c0%203.556-5.334%203.556-5.334%200v-5.333H24c-3.556%200-3.556-5.334%200-5.334h5.333V24c0-3.556%205.334-3.556%205.334%200z'%20transform='translate(-210%20-271)%20translate(210%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",n8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M9.466%206.069l.248.217%209.736%209.735.04.04%209.573%209.573c.15.118.286.254.405.404l28.246%2028.248c.947.947.947%202.481%200%203.428-.868.868-2.23.94-3.18.217l-.248-.217-13.374-13.373c-.632.126-1.313.002-1.88-.401-4.203-2.987-9.836-2.987-14.04%200-1.092.775-2.605.52-3.38-.572-.776-1.092-.52-2.605.572-3.38%203.363-2.39%207.38-3.414%2011.303-3.072l-6.743-6.744c-3.731.841-7.215%202.56-10.159%205.021-1.027.859-2.556.722-3.415-.305-.858-1.027-.722-2.556.305-3.414%202.772-2.318%205.942-4.087%209.34-5.23l-5.633-5.634c-3.356%201.496-6.467%203.496-9.225%205.934-1.003.886-2.535.792-3.422-.211-.887-1.003-.792-2.535.211-3.422%202.666-2.357%205.624-4.353%208.796-5.941L6.286%209.714c-.947-.947-.947-2.481%200-3.428.868-.868%202.23-.94%203.18-.217zm35.04%2021.474c2.167%201.057%204.193%202.382%206.032%203.942%201.021.866%201.146%202.396.28%203.417-.866%201.02-2.396%201.146-3.417.28-1.53-1.3-3.218-2.402-5.022-3.282-1.203-.587-1.702-2.039-1.115-3.242.587-1.203%202.038-1.703%203.242-1.115zm14.746-4.634c1.004.886%201.1%202.418.214%203.422-.885%201.004-2.417%201.1-3.421.214-7.402-6.53-17.14-9.77-26.978-8.977-1.334.107-2.503-.887-2.61-2.222-.108-1.334.886-2.503%202.221-2.61%2011.15-.9%2022.186%202.773%2030.574%2010.173z'%20transform='translate(-930%20-911)%20translate(930%20911)%20matrix(-1%200%200%201%2064%200)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",r8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M37.333%202.667c.059%200%20.117.002.174.005.033.002.067.005.1.009l.085.01.058.008c.047.007.094.016.141.026l.029.007c.05.01.098.023.146.037l.034.01c.237.07.46.173.663.303l.034.022c.036.023.07.047.104.072l.057.043c.03.022.058.045.085.068.06.05.12.104.176.16l-.126-.117c.05.043.097.088.143.135L55.21%2019.438c.047.046.091.094.134.143l.035.04c.026.032.052.063.076.096l.04.054.07.1.024.038c.16.253.279.535.347.836l.01.048c.009.043.017.086.024.13l.006.048.007.051.004.041c.01.09.014.18.014.27v32c0%204.419-3.582%208-8%208H16c-4.418%200-8-3.581-8-8V10.667c0-4.419%203.582-8%208-8h21.333zM34.666%208H16c-1.473%200-2.667%201.194-2.667%202.667v42.666C13.333%2054.806%2014.527%2056%2016%2056h32c1.473%200%202.667-1.194%202.667-2.667L50.666%2024H37.333c-1.367%200-2.494-1.03-2.648-2.356l-.018-.31L34.666%208zm12.227%2010.667l-6.894-6.894.001%206.894h6.893z'%20transform='translate(-498%20-591)%20translate(498%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",i8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M12.552%2031.448c-1.041-1.042-2.73-1.042-3.771%200-1.041%201.041-1.041%202.73%200%203.771l13.333%2013.333c1.042%201.042%202.73%201.042%203.772%200L55.219%2019.22c1.041-1.041%201.041-2.73%200-3.771-1.041-1.042-2.73-1.042-3.771%200L24%2042.895%2012.552%2031.448z'%20transform='translate(-66%20-911)%20translate(66%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",s8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M5.886%2031.448L19.219%2044.78c1.041%201.041%201.041%202.73%200%203.771-1.041%201.042-2.73%201.042-3.771%200L2.114%2035.22c-1.041-1.041-1.041-2.73%200-3.771%201.042-1.042%202.73-1.042%203.772%200zm52.228-16c1.042-1.042%202.73-1.042%203.772%200%201.041%201.041%201.041%202.73%200%203.771L32.552%2048.552c-1.041%201.042-2.73%201.042-3.771%200L15.448%2035.22c-1.042-1.041-1.042-2.73%200-3.771%201.041-1.042%202.73-1.042%203.771%200l11.448%2011.447zm-9.562%200c1.042%201.041%201.042%202.73%200%203.771L32.556%2035.215c-1.042%201.042-2.73%201.042-3.771%200-1.042-1.041-1.042-2.73%200-3.77L44.78%2015.447c1.041-1.042%202.73-1.042%203.771%200z'%20transform='translate(-210%20-911)%20translate(210%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",a8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M56%2042.667c1.368%200%202.495%201.03%202.649%202.355l.018.311v8c0%204.26-3.33%207.743-7.53%207.987l-.47.013H13.333c-4.26%200-7.743-3.33-7.986-7.53l-.014-.47v-8c0-1.472%201.194-2.666%202.667-2.666%201.368%200%202.495%201.03%202.649%202.355l.018.311v8c0%201.368%201.03%202.495%202.355%202.65l.311.017h37.334c1.367%200%202.494-1.03%202.648-2.356l.018-.31v-8c0-1.473%201.194-2.667%202.667-2.667zm-36.552-8.781c-1.042-1.042-1.042-2.73%200-3.772.961-.96%202.474-1.035%203.52-.221l.251.221%206.114%206.114V5.333c0-1.472%201.194-2.666%202.667-2.666%201.368%200%202.495%201.03%202.649%202.355l.018.311v30.894l6.114-6.113c.961-.96%202.474-1.035%203.52-.221l.251.221c.962.962%201.036%202.474.222%203.52l-.222.252-10.658%2010.657c-.043.044-.088.087-.135.128l.127-.119c-.063.063-.128.121-.195.176l-.056.045c-.028.022-.057.044-.086.064l-.056.04-.086.056-.06.036-.081.046-.079.04c-.046.023-.093.045-.14.065l-.09.036c-.023.01-.045.017-.067.025l-.09.03-.063.019c-.043.012-.086.024-.13.034l-.013.003c-.047.01-.095.02-.144.028l-.064.01c-.03.005-.061.009-.092.012l-.084.008c-.034.003-.068.005-.103.006l-.069.002h-.095c-.028%200-.055-.002-.082-.003l.139.003c-.084%200-.167-.004-.249-.011l-.061-.007c-.031-.003-.062-.007-.092-.012l-.09-.015c-.04-.007-.079-.016-.118-.025l-.04-.01c-.116-.029-.23-.066-.34-.11l-.015-.006c-.05-.02-.097-.04-.145-.063l-.042-.02L30.71%2045c-.022-.012-.045-.025-.067-.039-.03-.018-.059-.035-.087-.054l-.062-.041c-.03-.02-.06-.042-.088-.063l-.04-.03-.008-.007c-.088-.069-.172-.144-.251-.223L19.448%2033.886z'%20transform='translate(-786%20-271)%20translate(786%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",o8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2065%2065'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M56%2056c1.473%200%202.667%201.194%202.667%202.667%200%201.367-1.03%202.494-2.356%202.648l-.311.018H8c-1.473%200-2.667-1.194-2.667-2.666%200-1.368%201.03-2.495%202.356-2.65L8%2056h48zM35.448%203.448c1.041-1.042%202.73-1.042%203.771%200l10.667%2010.666c1.041%201.042%201.041%202.73%200%203.772L20.552%2047.219c-.5.5-1.178.781-1.885.781H8c-1.473%200-2.667-1.194-2.667-2.667V34.667c0-.708.281-1.386.781-1.886zm1.885%205.659L10.667%2035.77v6.896h6.89L44.227%2016l-6.894-6.893z'%20transform='translate(-642%20-271)%20translate(642%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",l8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32.097%203.22c2.65%200%205.255.357%207.763%201.054%201.135.316%201.799%201.493%201.483%202.628-.316%201.135-1.492%201.799-2.627%201.483-2.136-.594-4.356-.899-6.619-.899-13.603%200-24.63%2011.027-24.63%2024.63s11.027%2024.63%2024.63%2024.63%2024.63-11.027%2024.63-24.63c0-2.227-.295-4.413-.87-6.518-.312-1.136.357-2.31%201.494-2.62%201.136-.312%202.31.357%202.62%201.494.677%202.471%201.023%205.036%201.023%207.644%200%2015.96-12.938%2028.897-28.897%2028.897-15.96%200-28.897-12.937-28.897-28.897C3.2%2016.157%2016.138%203.22%2032.097%203.22zm10.705%2034.792c1.456%200%202.485%201.426%202.024%202.808-1.873%205.623-6.937%209.488-12.729%209.488-5.792%200-10.856-3.865-12.73-9.488-.444-1.334.5-2.71%201.875-2.803l.15-.005h21.41zm-3.477%204.266H24.867l.294.382c1.539%201.887%203.718%203.113%206.115%203.342l.314.024.507.015c2.617%200%205.037-1.188%206.743-3.151l.193-.23.292-.382zM21.392%2021.954c1.087%200%201.985.814%202.116%201.866l.017.267v5.353c0%201.178-.955%202.133-2.133%202.133-1.088%200-1.986-.814-2.117-1.865l-.017-.268v-5.353c0-1.178.955-2.133%202.134-2.133zm21.41%200c1.088%200%201.985.814%202.117%201.866l.017.267v5.353c0%201.178-.955%202.133-2.134%202.133-1.087%200-1.985-.814-2.116-1.865l-.017-.268v-5.353c0-1.178.955-2.133%202.133-2.133zM54.853%200c.442%200%20.8.358.8.8v7.786h7.76c.442%200%20.8.359.8.8v2.667c0%20.442-.358.8-.8.8h-7.76v7.758c0%20.442-.358.8-.8.8h-2.666c-.442%200-.8-.358-.8-.8v-7.758h-7.785c-.441%200-.8-.358-.8-.8V9.387c0-.442.359-.8.8-.8l7.784-.001V.8c0-.442.359-.8.8-.8h2.667z'%20transform='translate(-1074%20-271)%20translate(1074%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",u8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%205.06c2.622%200%205.065%201.283%206.561%203.424l.287.439%2022.608%2037.744c1.421%202.461%201.43%205.492.022%207.962-1.32%202.315-3.698%203.81-6.356%204.014l-.535.024H9.384c-2.842-.032-5.455-1.569-6.862-4.038-1.314-2.305-1.394-5.1-.226-7.493l.27-.506L25.16%208.91c1.45-2.39%204.044-3.85%206.84-3.85zm0%205.333c-.816%200-1.58.372-2.076.99l-.196.28-22.565%2037.67c-.474.821-.477%201.831-.008%202.655.41.72%201.129%201.202%201.917%201.318l.341.027h45.144c.948-.01%201.819-.522%202.288-1.345.41-.72.46-1.584.162-2.314l-.148-.304L34.28%2011.676c-.483-.797-1.348-1.283-2.28-1.283zm0%2032.274c1.473%200%202.667%201.194%202.667%202.666C34.667%2046.806%2033.473%2048%2032%2048c-1.473%200-2.667-1.194-2.667-2.667%200-1.472%201.194-2.666%202.667-2.666zm0-21.334c1.368%200%202.495%201.03%202.649%202.356l.018.311v10.667c0%201.472-1.194%202.666-2.667%202.666-1.368%200-2.495-1.03-2.649-2.355l-.018-.311V24c0-1.473%201.194-2.667%202.667-2.667z'%20transform='translate(-354%20-911)%20translate(354%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",c8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M48%208c1.368%200%202.495%201.03%202.649%202.356l.018.31V32l-.001.027v21.306C50.667%2054.806%2049.474%2056%2048%2056c-1.368%200-2.495-1.03-2.649-2.356l-.018-.31V34.665H19.772l6.114%206.115c.96.961%201.035%202.474.221%203.52l-.221.251c-.962.962-2.474%201.036-3.52.222l-.252-.222-10.666-10.666c-.962-.962-1.036-2.474-.222-3.52l.222-.252%2010.666-10.666c1.042-1.042%202.73-1.042%203.772%200%20.96.961%201.035%202.474.221%203.52l-.221.251-6.113%206.114h25.56V10.667C45.333%209.194%2046.527%208%2048%208z'%20transform='translate(-210%20-1215)%20translate(210%201215)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",d8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333%202.667%2048.2%202.667%2032%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032s10.745%2024%2024%2024%2024-10.745%2024-24S45.255%208%2032%208zm1.667%2021.333c.552%200%201%20.448%201%201v14c0%20.553-.448%201-1%201h-3.334c-.552%200-1-.447-1-1v-14c0-.552.448-1%201-1h3.334zm-1.667-8c1.473%200%202.667%201.194%202.667%202.667%200%201.473-1.194%202.667-2.667%202.667-1.473%200-2.667-1.194-2.667-2.667%200-1.473%201.194-2.667%202.667-2.667z'%20transform='translate(-498%20-911)%20translate(498%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",h8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M34.667%2037.333c7.17%200%2013.018%205.66%2013.32%2012.755l.013.579V56c0%201.473-1.194%202.667-2.667%202.667-1.367%200-2.494-1.03-2.648-2.356L42.667%2056v-5.333c0-4.26-3.33-7.743-7.53-7.987l-.47-.013H13.333c-4.26%200-7.743%203.33-7.986%207.53l-.014.47V56c0%201.473-1.194%202.667-2.666%202.667-1.368%200-2.495-1.03-2.65-2.356L0%2056v-5.333c0-7.17%205.66-13.019%2012.755-13.321l.578-.013h21.334zM54%2037.765c5.687%201.468%209.72%206.474%209.986%2012.297l.014.605V56c0%201.473-1.194%202.667-2.667%202.667-1.367%200-2.494-1.03-2.648-2.356L58.667%2056v-5.331c-.003-3.646-2.47-6.829-6-7.74-1.426-.369-2.284-1.823-1.916-3.249.369-1.426%201.823-2.284%203.249-1.915zM24%205.333c7.364%200%2013.333%205.97%2013.333%2013.334C37.333%2026.03%2031.363%2032%2024%2032c-7.364%200-13.333-5.97-13.333-13.333%200-7.364%205.97-13.334%2013.333-13.334zm19.328.43c5.9%201.51%2010.026%206.827%2010.026%2012.917s-4.126%2011.406-10.026%2012.917c-1.427.365-2.88-.495-3.245-1.922-.365-1.427.495-2.88%201.922-3.245%203.54-.906%206.016-4.096%206.016-7.75s-2.476-6.844-6.016-7.75c-1.427-.365-2.287-1.818-1.922-3.245.366-1.427%201.818-2.287%203.245-1.922zM24%2010.667c-4.418%200-8%203.581-8%208%200%204.418%203.582%208%208%208s8-3.582%208-8c0-4.419-3.582-8-8-8z'%20transform='translate(-786%20-431)%20translate(786%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",f8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333c-4.455%200-8.679-.993-12.461-2.77l-1.753.58c-5.965%201.912-10.133%202.572-12.504%201.981-2.799-.698-3.351-1.919-1.657-3.663%201.171-1.396%202.147-3.14%202.928-5.234.622-1.668.377-4.001-.737-7C3.8%2041.253%202.666%2036.759%202.666%2032%202.667%2015.8%2015.8%202.667%2032%202.667zM32%208C18.745%208%208%2018.745%208%2032c0%203.5.747%206.88%202.168%209.978l.405.837.137.271.106.285c1.517%204.085%201.89%207.622.734%2010.72l-.382.972-.192.433.235-.05c1.38-.317%203.017-.767%204.886-1.363l1.721-.568%202.04-.696%201.95.917C24.965%2055.22%2028.422%2056%2032%2056c13.255%200%2024-10.745%2024-24S45.255%208%2032%208zM18.667%2029.333c1.472%200%202.666%201.194%202.666%202.667%200%201.473-1.194%202.667-2.666%202.667C17.194%2034.667%2016%2033.473%2016%2032c0-1.473%201.194-2.667%202.667-2.667zm13.333%200c1.473%200%202.667%201.194%202.667%202.667%200%201.473-1.194%202.667-2.667%202.667-1.473%200-2.667-1.194-2.667-2.667%200-1.473%201.194-2.667%202.667-2.667zm13.333%200C46.806%2029.333%2048%2030.527%2048%2032c0%201.473-1.194%202.667-2.667%202.667-1.472%200-2.666-1.194-2.666-2.667%200-1.473%201.194-2.667%202.666-2.667z'%20transform='translate(-498%20-431)%20translate(498%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",p8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%2045.333c2.946%200%205.333%202.388%205.333%205.334C37.333%2053.612%2034.946%2056%2032%2056s-5.333-2.388-5.333-5.333c0-2.946%202.387-5.334%205.333-5.334zM32%2028c2.946%200%205.333%202.388%205.333%205.333%200%202.946-2.387%205.334-5.333%205.334s-5.333-2.388-5.333-5.334C26.667%2030.388%2029.054%2028%2032%2028zm0-17.333c2.946%200%205.333%202.387%205.333%205.333S34.946%2021.333%2032%2021.333%2026.667%2018.946%2026.667%2016s2.387-5.333%205.333-5.333z'%20transform='translate(-1074%20-751)%20translate(1074%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",_8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M29.83%206.45c1.064-1.489%203.276-1.489%204.34%200l11.697%2016.374L57%2013.918c1.88-1.504%204.573.054%204.32%202.35l-.047.29-8%2037.334c-.263%201.23-1.35%202.108-2.607%202.108H13.333c-1.257%200-2.344-.878-2.607-2.108l-8-37.333c-.525-2.452%202.315-4.207%204.273-2.641l11.132%208.906zM32%2012.587l-11.163%2015.63c-.89%201.245-2.642%201.488-3.836.532l-7.497-5.997%205.984%2027.915h33.021l5.984-27.915L47%2028.749c-1.11.887-2.699.741-3.632-.281l-.204-.251L32%2012.587zM32%2032c2.946%200%205.333%202.388%205.333%205.333%200%202.946-2.387%205.334-5.333%205.334s-5.333-2.388-5.333-5.334C26.667%2034.388%2029.054%2032%2032%2032z'%20transform='translate(-66%20-1071)%20translate(66%201071)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",m8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M51.908%2034.75c1.9-1.233%201.896-3.26.013-4.514L19.376%208.577c-1.893-1.26-3.404-.391-3.376%201.968l.522%2042.888c.028%202.347%201.596%203.247%203.493%202.016L51.908%2034.75z'%20transform='translate(-1076%20-591)%20translate(1076%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",v8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M34.667%2029.333h18.666c3.556%200%203.556%205.334%200%205.334H34.667v18.666c0%203.556-5.334%203.556-5.334%200V34.667H10.667c-3.556%200-3.556-5.334%200-5.334h18.666V10.667c0-3.556%205.334-3.556%205.334%200v18.666z'%20transform='translate(-354%20-751)%20translate(354%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",g8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%2061.333C15.8%2061.333%202.667%2048.2%202.667%2032S15.8%202.667%2032%202.667%2061.333%2015.8%2061.333%2032%2048.2%2061.333%2032%2061.333zM32%2056c13.255%200%2024-10.745%2024-24S45.255%208%2032%208%208%2018.745%208%2032s10.745%2024%2024%2024zm2.213-18.63c0%201.473-1.194%202.667-2.666%202.667-1.473%200-2.667-1.194-2.667-2.667v-2.69c0-1.148.734-2.168%201.823-2.53.173-.058.532-.195%201.01-.407.809-.36%201.616-.79%202.354-1.282%201.835-1.223%202.813-2.528%202.813-3.786.004-2.6-1.868-4.824-4.432-5.264-2.563-.44-5.07%201.033-5.932%203.487-.49%201.389-2.012%202.119-3.4%201.63-1.39-.488-2.12-2.01-1.632-3.4%201.726-4.907%206.74-7.853%2011.866-6.974%205.126.88%208.871%205.328%208.863%2010.525%200%203.413-2.022%206.109-5.187%208.22-.975.649-1.94%201.173-2.813%201.578v.893zm-5.333%207.523c0-1.473%201.194-2.667%202.667-2.667%201.472%200%202.666%201.194%202.666%202.667v.44c0%201.473-1.194%202.667-2.666%202.667-1.473%200-2.667-1.194-2.667-2.667v-.31-.13z'%20transform='translate(-642%20-911)%20translate(642%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",y8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M46.14%2014.43l.562.537%206.631%206.167v-7.8c0-1.368%201.03-2.495%202.356-2.65l.311-.017c1.368%200%202.495%201.03%202.649%202.355l.018.311v16c0%201.368-1.03%202.495-2.356%202.65L56%2032H40c-1.473%200-2.667-1.194-2.667-2.667%200-1.367%201.03-2.494%202.356-2.648l.311-.018h11.452l-8.44-7.85c-5.964-5.893-15.168-7.182-22.563-3.156-7.38%204.018-11.172%2012.357-9.314%2020.455%201.859%208.107%208.935%2014.032%2017.362%2014.518%208.43.487%2016.162-4.585%2018.967-12.426.496-1.387%202.023-2.108%203.41-1.612%201.386.496%202.108%202.022%201.612%203.409C48.88%2050.082%2038.973%2056.582%2028.19%2055.959c-10.785-.623-19.862-8.222-22.254-18.65C3.542%2026.872%208.426%2016.135%2017.9%2010.977c9.227-5.024%2020.65-3.579%2028.241%203.453z'%20transform='translate(-930%20-751)%20translate(930%20751)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",E8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%202.667C48.2%202.667%2061.333%2015.8%2061.333%2032S48.2%2061.333%2032%2061.333%202.667%2048.2%202.667%2032%2015.8%202.667%2032%202.667zm9.886%2019.447c-1.042-1.041-2.73-1.041-3.772%200L32%2028.23l-6.114-6.115-.134-.124c-1.047-.915-2.64-.874-3.638.124l-.124.134c-.915%201.047-.874%202.64.124%203.638L28.23%2032l-6.115%206.114-.124.134c-.915%201.047-.874%202.64.124%203.638l.134.124c1.047.915%202.64.874%203.638-.124L32%2035.77l6.114%206.115.134.124c1.047.915%202.64.874%203.638-.124l.124-.134c.915-1.047.874-2.64-.124-3.638L35.77%2032l6.115-6.114.124-.134c.915-1.047.874-2.64-.124-3.638z'%20transform='translate(-1220%20-271)%20translate(1220%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",b8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%2012'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cg%3e%3cg%3e%3cg%3e%3cpath%20class='fill'%20d='M.226%208.5c-.062%200-.12-.025-.164-.07C.02%208.387-.003%208.327%200%208.266c.069-1.447.495-2.678%201.268-3.66.618-.785%201.455-1.409%202.49-1.855.503-.217%201.329-.507%202.406-.655.372-.05.671-.07.862-.078V.225c0-.087.05-.166.128-.203.079-.037.172-.026.24.028l4.522%203.642c.053.042.084.106.084.173%200%20.068-.03.132-.082.175L7.395%207.777c-.067.056-.16.068-.24.03-.079-.036-.13-.115-.13-.202v-1.95c-1.134-.08-2.178.003-3.107.25-.782.207-1.484.53-2.087.96C.813%207.589.433%208.365.43%208.372.39%208.45.313%208.5.226%208.5z'%20transform='translate(-397.000000,%20-324.000000)%20translate(321.000000,%20-0.000000)%20translate(64.000000,%20324.000000)%20translate(11.999950,%200.000000)%20translate(0.000000,%202.000000)%20translate(6.000000,%204.250000)%20scale(-1,%201)%20translate(-6.000000,%20-4.250000)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",C8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M26.667%2048C14.885%2048%205.333%2038.449%205.333%2026.667c0-11.782%209.552-21.334%2021.334-21.334S48%2014.885%2048%2026.667c0%204.93-1.672%209.469-4.48%2013.081l13.67%2013.67c1.041%201.042%201.041%202.73%200%203.772-1.042%201.041-2.73%201.041-3.772%200l-13.67-13.67C36.136%2046.328%2031.597%2048%2026.667%2048zm0-5.333c8.836%200%2016-7.164%2016-16%200-8.837-7.164-16-16-16-8.837%200-16%207.163-16%2016%200%208.836%207.163%2016%2016%2016z'%20transform='translate(-1220%20-750)%20translate(1220%20750)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",S8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M59.795%2029.43L7.329%202.979C4.691%201.802%201.76%204.153%202.932%206.798l6.925%2018.609c.25.67.838%201.157%201.544%201.275l32.273%205.394L11.4%2037.47c-.706.118-1.295.604-1.544%201.275L2.932%2057.353c-.879%202.645%201.76%204.997%204.397%203.527l52.466-26.453c2.051-.882%202.051-3.82%200-4.996z'%20transform='translate(-930%20-271)%20translate(930%20271)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",w8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%20fill='none'%3e%3cpath%20class='fill'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M21.9427%2024.3904C22.4634%2024.9111%2022.4634%2025.7554%2021.9427%2026.2761C21.422%2026.7968%2020.5778%2026.7968%2020.0571%2026.2761L10.7238%2016.9427C10.2031%2016.422%2010.2031%2015.5778%2010.7238%2015.0571L20.0571%205.72378C20.5778%205.20308%2021.422%205.20308%2021.9427%205.72378C22.4634%206.24448%2022.4634%207.0887%2021.9427%207.60939L13.5522%2015.9999L21.9427%2024.3904Z'/%3e%3c/svg%3e",T8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M32%2061.333C48.2%2061.333%2061.333%2048.2%2061.333%2032S48.2%202.667%2032%202.667%202.667%2015.8%202.667%2032c0%201.568%201.27%202.839%202.838%202.839s2.84-1.271%202.84-2.839C8.344%2018.935%2018.934%208.344%2032%208.344c13.065%200%2023.656%2010.591%2023.656%2023.656S45.065%2055.656%2032%2055.656c-1.568%200-2.839%201.27-2.839%202.839%200%201.567%201.271%202.838%202.839%202.838z'%20transform='translate(-786%20-911)%20translate(786%20911)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",N8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M36.889%2043.013c6.608%200%2012.121%204.685%2012.43%2010.734l.014.537V58c0%201.472-1.194%202.666-2.666%202.666-1.368%200-2.495-1.03-2.65-2.355L44%2058v-3.716c0-3.07-2.87-5.718-6.636-5.925l-.475-.013H27.11c-3.838%200-6.86%202.525-7.096%205.557l-.015.381V58c0%201.472-1.194%202.666-2.667%202.666-1.367%200-2.494-1.03-2.648-2.355L14.667%2058v-3.716c0-6.126%205.324-10.986%2011.864-11.26l.58-.011h9.778zm18.578-17.291c.266%200%20.53.04.784.118%204.632%201.426%207.518%204.801%207.736%209.688l.013.594v12.8c0%201.472-1.194%202.666-2.667%202.666-1.367%200-2.494-1.03-2.648-2.355l-.018-.311V36.124c-.002-2.595-1.163-4.171-3.528-5.034l-.104-.037-2.502.002c-1.367%200-2.494-1.03-2.648-2.356l-.018-.31c0-1.368%201.03-2.495%202.355-2.65l.311-.017h2.934zm-44%200l.31.018c1.327.154%202.356%201.28%202.356%202.648l-.018.311c-.154%201.327-1.28%202.356-2.648%202.356l-2.51-.002-.119.042c-2.246.85-3.503%202.574-3.505%205.147v12.68l-.018.31c-.154%201.327-1.28%202.356-2.648%202.356C1.194%2051.588%200%2050.394%200%2048.922V36.24l.014-.591c.225-4.874%203.203-8.415%207.712-9.809.255-.078.52-.118.788-.118h2.953zM32%2019.958c5.512%200%2010%204.409%2010%209.871%200%205.463-4.488%209.872-10%209.872s-10-4.41-10-9.872%204.488-9.871%2010-9.871zm0%205.333c-2.588%200-4.667%202.043-4.667%204.538%200%202.496%202.08%204.538%204.667%204.538%202.588%200%204.667-2.042%204.667-4.538%200-2.495-2.08-4.538-4.667-4.538zM17.333%202.667c5.513%200%2010%204.409%2010%209.871%200%205.462-4.487%209.871-10%209.871-5.512%200-10-4.409-10-9.871%200-5.462%204.488-9.871%2010-9.871zm29.334%200c5.512%200%2010%204.409%2010%209.871%200%205.462-4.488%209.871-10%209.871-5.513%200-10-4.409-10-9.871%200-5.462%204.487-9.871%2010-9.871zM17.333%208c-2.587%200-4.666%202.042-4.666%204.538%200%202.496%202.079%204.538%204.666%204.538%202.588%200%204.667-2.042%204.667-4.538C22%2010.042%2019.921%208%2017.333%208zm29.334%200C44.079%208%2042%2010.042%2042%2012.538c0%202.496%202.079%204.538%204.667%204.538%202.587%200%204.666-2.042%204.666-4.538%200-2.496-2.079-4.538-4.666-4.538z'%20transform='translate(-930%20-431)%20translate(930%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",I8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M34.667%205.333c1.472%200%202.666%201.194%202.666%202.667%200%201.473-1.194%202.667-2.666%202.667H13.333c-1.472%200-2.666%201.194-2.666%202.666v37.334c0%201.143.72%202.118%201.73%202.497l28.384-28.383c1.041-1.041%202.73-1.041%203.771%200l8.781%208.78v-4.228c0-1.416%201.104-2.574%202.498-2.661l.169-.005c1.473%200%202.667%201.194%202.667%202.666v21.334c0%204.418-3.582%208-8%208H13.33c-4.417-.001-7.998-3.583-7.998-8V13.333c0-4.418%203.582-8%208-8zm8%2025.105L19.77%2053.333h30.897c1.416%200%202.574-1.104%202.661-2.498l.005-.168v-9.563L42.667%2030.438zM22.667%2016c3.682%200%206.666%202.985%206.666%206.667s-2.984%206.666-6.666%206.666c-3.682%200-6.667-2.984-6.667-6.666C16%2018.985%2018.985%2016%2022.667%2016zm0%205.333c-.737%200-1.334.597-1.334%201.334%200%20.736.597%201.333%201.334%201.333.736%200%201.333-.597%201.333-1.333%200-.737-.597-1.334-1.333-1.334zM56.78%203.448c1.041-1.042%202.73-1.042%203.771%200%201.042%201.041%201.042%202.73%200%203.771l-4.782%204.78%204.782%204.782c.998.998%201.04%202.59.125%203.638l-.125.133c-1.041%201.042-2.73%201.042-3.771%200l-4.782-4.781-4.78%204.781c-.998.998-2.59%201.04-3.638.125l-.133-.125c-1.042-1.041-1.042-2.73%200-3.771L48.228%2012l-4.78-4.781c-.998-.998-1.04-2.59-.125-3.638l.125-.133c1.041-1.042%202.73-1.042%203.771%200l4.78%204.78z'%20transform='translate(-354%20-591)%20translate(354%20591)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",A8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2088%2048'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%3e%3cg%20transform='translate(-797%20-1231)%20translate(797%201231)'%3e%3crect%20class='fill'%20width='80'%20height='40'%20x='4'%20y='4'%20fill='%23000'%20rx='20'/%3e%3ccircle%20cx='24'%20cy='24'%20r='12'%20fill='%23FFF'/%3e%3cpath%20fill='%23FFF'%20d='M64%204c11.046%200%2020%208.954%2020%2020s-8.954%2020-20%2020H24C12.954%2044%204%2035.046%204%2024S12.954%204%2024%204h40zm0%202H24C14.059%206%206%2014.059%206%2024c0%209.764%207.774%2017.712%2017.47%2017.992L24%2042h40c9.941%200%2018-8.059%2018-18%200-9.764-7.774-17.712-17.47-17.992L64%206z'/%3e%3cpath%20class='fill'%20fill='%23000'%20d='M64%200H24C10.745%200%200%2010.745%200%2024s10.745%2024%2024%2024h40c13.255%200%2024-10.745%2024-24S77.255%200%2064%200zm0%204c11.046%200%2020%208.954%2020%2020s-8.954%2020-20%2020H24C12.954%2044%204%2035.046%204%2024S12.954%204%2024%204h40z'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",M8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2088%2048'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%3e%3cg%20transform='translate(-655%20-1231)%20translate(655%201231)'%3e%3crect%20class='fill'%20width='80'%20height='40'%20x='4'%20y='4'%20fill='%23000'%20rx='20'/%3e%3ccircle%20cx='64'%20cy='24'%20r='12'%20fill='%23FFF'/%3e%3cpath%20fill='%23FFF'%20d='M64%204c11.046%200%2020%208.954%2020%2020s-8.954%2020-20%2020H24C12.954%2044%204%2035.046%204%2024S12.954%204%2024%204h40zm0%202H24C14.059%206%206%2014.059%206%2024c0%209.764%207.774%2017.712%2017.47%2017.992L24%2042h40c9.941%200%2018-8.059%2018-18%200-9.764-7.774-17.712-17.47-17.992L64%206z'/%3e%3cpath%20class='fill'%20fill='%23000'%20d='M64%200H24C10.745%200%200%2010.745%200%2024s10.745%2024%2024%2024h40c13.255%200%2024-10.745%2024-24S77.255%200%2064%200zm0%204c11.046%200%2020%208.954%2020%2020s-8.954%2020-20%2020H24C12.954%2044%204%2035.046%204%2024S12.954%204%2024%204h40z'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",x8="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20fill='%23000'%3e%3cg%3e%3cpath%20class='fill'%20d='M42.667%2037.333c7.17%200%2013.018%205.66%2013.32%2012.755l.013.579V56c0%201.473-1.194%202.667-2.667%202.667-1.367%200-2.494-1.03-2.648-2.356L50.667%2056v-5.333c0-4.26-3.33-7.743-7.53-7.987l-.47-.013H21.333c-4.26%200-7.743%203.33-7.986%207.53l-.014.47V56c0%201.473-1.194%202.667-2.666%202.667-1.368%200-2.495-1.03-2.65-2.356L8%2056v-5.333c0-7.17%205.66-13.019%2012.755-13.321l.578-.013h21.334zM32%205.333c7.364%200%2013.333%205.97%2013.333%2013.334C45.333%2026.03%2039.363%2032%2032%2032c-7.364%200-13.333-5.97-13.333-13.333%200-7.364%205.97-13.334%2013.333-13.334zm0%205.334c-4.418%200-8%203.581-8%208%200%204.418%203.582%208%208%208s8-3.582%208-8c0-4.419-3.582-8-8-8z'%20transform='translate(-642%20-431)%20translate(642%20431)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",O8="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='icon-good'%3e%3cg%20id='Group'%3e%3cpath%20id='Union'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.3462%205.33563L12.3468%205.33479C12.7513%204.81247%2013.5284%204.81054%2013.9252%205.2978C14.088%205.49844%2014.1761%205.74147%2014.1761%205.98836V9.66626C14.1761%2010.184%2014.5958%2010.6038%2015.1136%2010.6038H18.6002C18.959%2010.6038%2019.3003%2010.7827%2019.5112%2011.0919L19.5121%2011.0932L19.8809%2011.6409L19.8839%2011.6453C20.0583%2011.9011%2020.1096%2012.2276%2020.0178%2012.5397L18.4861%2017.8555C18.3549%2018.3149%2017.9273%2018.6377%2017.4418%2018.6377H10.3672C10.0667%2018.6377%209.7739%2018.5109%209.56695%2018.2934L8.43645%2017.071V10.4237L12.3462%205.33563ZM7.61615%208.41391L10.861%204.19117L10.8625%204.18917C11.9879%202.73286%2014.2018%202.6675%2015.3795%204.11435C15.8013%204.63345%2016.0511%205.29067%2016.0511%205.98836V8.72876H18.6002C19.5906%208.72876%2020.5085%209.22411%2021.0626%2010.0389L21.065%2010.0424L21.4331%2010.589L21.4348%2010.5915C21.9333%2011.3243%2022.0617%2012.2328%2021.8174%2013.0662L21.8166%2013.0688L20.289%2018.3706C19.9252%2019.6429%2018.7556%2020.5127%2017.4418%2020.5127H10.3672C9.54424%2020.5127%208.75863%2020.1683%208.20092%2019.5778L8.19422%2019.5706L8.1279%2019.4989C7.75433%2020.1135%207.07847%2020.5239%206.30673%2020.5239H4.19222C3.01601%2020.5239%202.0625%2019.5704%202.0625%2018.3942V10.0937C2.0625%208.91744%203.01601%207.96393%204.19222%207.96393H6.30673C6.80046%207.96393%207.25496%208.13194%207.61615%208.41391ZM3.9375%2010.0937C3.9375%209.95297%204.05154%209.83893%204.19222%209.83893H6.30673C6.44741%209.83893%206.56145%209.95297%206.56145%2010.0937V18.3942C6.56145%2018.5349%206.44741%2018.6489%206.30673%2018.6489H4.19222C4.05154%2018.6489%203.9375%2018.5349%203.9375%2018.3942V10.0937Z'%20fill='black'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",R8="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='icon-good'%3e%3cg%20id='Group'%3e%3cpath%20id='Union'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.6538%2018.6644L11.6532%2018.6652C11.2487%2019.1875%2010.4716%2019.1895%2010.0748%2018.7022C9.91197%2018.5016%209.82395%2018.2585%209.82395%2018.0116V14.3337C9.82395%2013.816%209.40422%2013.3962%208.88645%2013.3962H5.39976C5.04099%2013.3962%204.69967%2013.2173%204.48881%2012.9081L4.48789%2012.9068L4.11909%2012.3591L4.11608%2012.3547C3.94167%2012.0989%203.8904%2011.7724%203.98222%2011.4603L5.51387%206.1445C5.64514%205.68505%206.07272%205.36229%206.55824%205.36229H13.6328C13.9333%205.36229%2014.2261%205.48913%2014.4331%205.70657L15.5635%206.92898V13.5763L11.6538%2018.6644ZM16.3838%2015.5861L13.139%2019.8088L13.1375%2019.8108C12.0121%2021.2671%209.79817%2021.3325%208.6205%2019.8857C8.19873%2019.3665%207.94895%2018.7093%207.94895%2018.0116V15.2712H5.39976C4.40936%2015.2712%203.49145%2014.7759%202.93741%2013.9611L2.93505%2013.9576L2.5669%2013.411L2.5652%2013.4085C2.0667%2012.6757%201.93834%2011.7672%202.18261%2010.9338L2.18339%2010.9312L3.71101%205.6294C4.07483%204.35709%205.24439%203.48729%206.55824%203.48729H13.6328C14.4558%203.48729%2015.2414%203.83167%2015.7991%204.42218L15.8058%204.42936L15.8721%204.50107C16.2457%203.88653%2016.9215%203.47606%2017.6933%203.47606H19.8078C20.984%203.47606%2021.9375%204.42956%2021.9375%205.60578V13.9063C21.9375%2015.0826%2020.984%2016.0361%2019.8078%2016.0361H17.6933C17.1995%2016.0361%2016.745%2015.8681%2016.3838%2015.5861ZM20.0625%2013.9063C20.0625%2014.047%2019.9485%2014.1611%2019.8078%2014.1611H17.6933C17.5526%2014.1611%2017.4385%2014.047%2017.4385%2013.9063V5.60578C17.4385%205.4651%2017.5526%205.35106%2017.6933%205.35106H19.8078C19.9485%205.35106%2020.0625%205.4651%2020.0625%205.60578V13.9063Z'%20fill='black'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",bi=()=>{},k8=e=>{const n=/iPhone|iPad|iPod/i.test(e),t=/WebKit/i.test(e),r=/Safari/i.test(e);return n&&(t||r)},Tp=e=>{const n={};return Object.entries(e).forEach(([t,r])=>{r!=null&&(n[t]=r)}),n};function ls(...e){return e.filter(Boolean).join(" ")}function L8(e){switch(e){case ye.ADD:return C.jsx(B7,{});case ye.ARROW_LEFT:return C.jsx($7,{});case ye.ATTACH:return C.jsx(G7,{});case ye.BAN:return C.jsx(z7,{});case ye.BROADCAST:return C.jsx(V7,{});case ye.CAMERA:return C.jsx(q7,{});case ye.CHANNELS:return C.jsx(W7,{});case ye.CHAT:return C.jsx(K7,{});case ye.CHAT_FILLED:return C.jsx(Q7,{});case ye.CHEVRON_DOWN:return C.jsx(Y7,{});case ye.CHEVRON_RIGHT:return C.jsx(Z7,{});case ye.CLOSE:return C.jsx(X7,{});case ye.COLLAPSE:return C.jsx(J7,{});case ye.COPY:return C.jsx(e8,{});case ye.CREATE:return C.jsx(t8,{});case ye.DISCONNECTED:return C.jsx(n8,{});case ye.DOCUMENT:return C.jsx(r8,{});case ye.DONE:return C.jsx(i8,{});case ye.DONE_ALL:return C.jsx(s8,{});case ye.DOWNLOAD:return C.jsx(a8,{});case ye.EDIT:return C.jsx(o8,{});case ye.EMOJI_MORE:return C.jsx(l8,{});case ye.ERROR:return C.jsx(u8,{});case ye.EXPAND:return C.jsx(c8,{});case ye.INFO:return C.jsx(d8,{});case ye.MEMBERS:return C.jsx(h8,{});case ye.MESSAGE:return C.jsx(f8,{});case ye.MORE:return C.jsx(p8,{});case ye.OPERATOR:return C.jsx(_8,{});case ye.PLAY:return C.jsx(m8,{});case ye.PLUS:return C.jsx(v8,{});case ye.QUESTION:return C.jsx(g8,{});case ye.REFRESH:return C.jsx(y8,{});case ye.REMOVE:return C.jsx(E8,{});case ye.REPLY:return C.jsx(b8,{});case ye.SEARCH:return C.jsx(C8,{});case ye.SEND:return C.jsx(S8,{});case ye.SLIDE_LEFT:return C.jsx(w8,{});case ye.SPINNER:return C.jsx(T8,{});case ye.SUPERGROUP:return C.jsx(N8,{});case ye.THUMBNAIL_NONE:return C.jsx(I8,{});case ye.TOGGLE_OFF:return C.jsx(A8,{});case ye.TOGGLE_ON:return C.jsx(M8,{});case ye.USER:return C.jsx(x8,{});case ye.FEEDBACK_LIKE:return C.jsx(O8,{});case ye.FEEDBACK_DISLIKE:return C.jsx(R8,{});default:return"icon"}}function Sn({className:e="",type:n,fillColor:t=Kn.DEFAULT,width:r=26,height:i=26,onClick:s=bi,children:a=null}){const o={width:typeof r=="string"?r:`${r}px`,minWidth:typeof r=="string"?r:`${r}px`,height:typeof i=="string"?i:`${i}px`,minHeight:typeof i=="string"?i:`${i}px`};return C.jsx("div",{className:[...Array.isArray(e)?e:[e],"sendbird-icon",j7(n),H7(t)].join(" "),role:"button",onClick:s,onKeyDown:s,tabIndex:0,style:o,children:a||L8(n)})}const Qt=ye,Yt=Kn;function D8(){const{stringSet:e}=D.useContext(Ki);return C.jsxs("div",{className:"sendbird-connection-status",children:[C.jsx(ut,{type:it.BODY_2,color:at.ONBACKGROUND_2,children:e.TRYING_TO_CONNECT}),C.jsx(Sn,{type:Qt.DISCONNECTED,fillColor:Yt.SENT,width:"14px",height:"14px"})]})}function U8({className:e="",width:n="26px",height:t="26px",children:r}){return C.jsx("div",{className:[...Array.isArray(e)?e:[e],"sendbird-loader"].join(" "),style:{width:typeof n=="string"?n:`${n}px`,height:typeof t=="string"?t:`${t}px`},children:r||C.jsx(Sn,{type:Qt.SPINNER,width:"26px",height:"26px"})})}const bn={LOADING:"LOADING",NO_CHANNELS:"NO_CHANNELS",NO_MESSAGES:"NO_MESSAGES",WRONG:"WRONG",SEARCH_IN:"SEARCH_IN",SEARCHING:"SEARCHING",NO_RESULTS:"NO_RESULTS"};function Wl({className:e="",type:n,iconSize:t,searchInString:r="",retryToConnect:i}){const{stringSet:s}=D.useContext(Ki);return C.jsxs("div",{className:[...Array.isArray(e)?e:[e],"sendbird-place-holder"].join(" "),children:[n===bn.LOADING&&C.jsx(U8,{width:t||"48px",height:t||"48px",children:C.jsx(Sn,{type:Qt.SPINNER,fillColor:Yt.PRIMARY,width:t||"48px",height:t||"48px"})}),(n===bn.NO_CHANNELS||n===bn.NO_MESSAGES||n===bn.WRONG)&&C.jsxs("div",{className:"sendbird-place-holder__body",children:[n===bn.NO_CHANNELS&&C.jsx(Sn,{className:"sendbird-place-holder__body__icon",type:Qt.CHAT,fillColor:Yt.ON_BACKGROUND_3,width:t||"64px",height:t||"64px"}),n===bn.WRONG&&C.jsx(Sn,{className:"sendbird-place-holder__body__icon",type:Qt.ERROR,fillColor:Yt.ON_BACKGROUND_3,width:t||"64px",height:t||"64px"}),n===bn.NO_MESSAGES&&C.jsx(Sn,{className:"sendbird-place-holder__body__icon",type:Qt.MESSAGE,fillColor:Yt.ON_BACKGROUND_3,width:t||"64px",height:t||"64px"}),C.jsxs(ut,{className:"sendbird-place-holder__body__text",type:it.BODY_1,color:at.ONBACKGROUND_2,children:[n===bn.NO_CHANNELS&&s.PLACE_HOLDER__NO_CHANNEL,n===bn.WRONG&&s.PLACE_HOLDER__WRONG,n===bn.NO_MESSAGES&&s.PLACE_HOLDER__NO_MESSAGES]}),i&&C.jsxs("div",{className:"sendbird-place-holder__body__reconnect",role:"button",onClick:i,onKeyPress:i,tabIndex:0,children:[C.jsx(Sn,{className:"sendbird-place-holder__body__reconnect__icon",type:Qt.REFRESH,fillColor:Yt.PRIMARY,width:"20px",height:"20px"}),C.jsx(ut,{className:"sendbird-place-holder__body__reconnect__text",type:it.BUTTON_1,color:at.PRIMARY,children:s.PLACE_HOLDER__RETRY_TO_CONNECT})]})]}),(n===bn.NO_RESULTS||n===bn.SEARCH_IN||n===bn.SEARCHING)&&C.jsxs("div",{className:"sendbird-place-holder__body--align-top",children:[n===bn.SEARCH_IN&&C.jsxs("div",{className:"sendbird-place-holder__body--align-top__text",children:[C.jsx(ut,{className:"sendbird-place-holder__body--align-top__text__search-in",type:it.BUTTON_2,color:at.ONBACKGROUND_2,children:s.SEARCH_IN}),C.jsx(ut,{className:"sendbird-place-holder__body--align-top__text__channel-name",type:it.BUTTON_2,color:at.PRIMARY,children:`'${r}`}),C.jsx(ut,{className:"sendbird-place-holder__body--align-top__text__quote",type:it.BUTTON_2,color:at.PRIMARY,children:"'"})]}),n===bn.SEARCHING&&C.jsx(ut,{className:"sendbird-place-hlder__body--align-top__searching",type:it.BODY_1,color:at.ONBACKGROUND_2,children:s.SEARCHING}),n===bn.NO_RESULTS&&C.jsx(ut,{className:"sendbird-place-hlder__body--align-top__no-result",type:it.BODY_1,color:at.ONBACKGROUND_2,children:s.NO_SEARCHED_MESSAGE})]})]})}const P8=e=>{var m,b,v,_;const{isLoading:n,isInvalid:t,channelUrl:r}=e,{renderChannelHeader:i,renderMessageList:s,renderMessageInput:a,renderTypingIndicator:o,renderPlaceholderLoader:l,renderPlaceholderInvalid:u}=Tp(e),{stores:c,config:d}=pn(),h=(m=c==null?void 0:c.sdkStore)==null?void 0:m.error,{logger:f,isOnline:p}=d;return n?C.jsx("div",{className:"sendbird-conversation",children:(l==null?void 0:l())||C.jsx(Wl,{type:bn.LOADING})}):r?t?C.jsx("div",{className:"sendbird-conversation",children:(u==null?void 0:u())||C.jsx(Wl,{type:bn.WRONG})}):h?C.jsx("div",{className:"sendbird-conversation",children:(u==null?void 0:u())||C.jsx(Wl,{type:bn.WRONG,retryToConnect:()=>{f.info("Channel: reconnecting")}})}):C.jsxs("div",{className:"sendbird-conversation",children:[i==null?void 0:i({className:"sendbird-conversation__channel-header"}),s==null?void 0:s(e),C.jsxs("div",{className:"sendbird-conversation__footer",children:[a==null?void 0:a(),C.jsxs("div",{className:"sendbird-conversation__footer__typing-indicator",children:[(o==null?void 0:o())||((b=d==null?void 0:d.groupChannel)==null?void 0:b.enableTypingIndicator)&&((_=(v=d==null?void 0:d.groupChannel)==null?void 0:v.typingIndicatorTypes)==null?void 0:_.has(P2.Text))&&C.jsx(F7,{channelUrl:r}),!p&&C.jsx(D8,{})]})]})]}):C.jsx("div",{className:"sendbird-conversation",children:(u==null?void 0:u())||C.jsx(Wl,{type:bn.NO_CHANNELS})})},VT=e=>{if(e!==null)return typeof e=="number"?`${e}px`:e};function _3(e,n,t){return`min(${n??t}, ${VT(e)??t})`}function F8({width:e,height:n,maxSideLength:t,defaultMinLength:r}){const i=D.useMemo(()=>_3(e,t,r),[e]),s=D.useMemo(()=>_3(n,t,r),[n]);return[i,s]}const H8=e=>{const[n,t]=D.useState(!1);return D.useLayoutEffect(()=>{const r=new IntersectionObserver(i=>{const[s]=i;s&&t(s.isIntersecting)});return e.current&&r.observe(e.current),()=>r.disconnect()},[e.current]),n},j8=e=>{const n=D.useRef(!1);return H8(e)&&(n.current=!0),n.current};function m3(e=!1,n=null){return e?"50%":VT(n)}const js=({className:e="",url:n,alt:t="",width:r=null,maxSideLength:i=null,height:s=null,circle:a=!1,fixedSize:o=!1,placeHolder:l=null,defaultComponent:u=null,borderRadius:c=null,onLoad:d=bi,onError:h=bi,shadeOnHover:f,isUploaded:p=!0})=>{const m=D.useRef(null),v=j8(m)?n:null,[_,E]=D.useState(!1),[S,T]=D.useState(!0),[N,I]=F8({width:r,height:s,maxSideLength:i,defaultMinLength:"400px"}),x=()=>typeof l=="function"?l({style:{width:"100%",minWidth:N,maxWidth:o?N:"400px",height:I,position:"absolute",display:"flex",justifyContent:"center",alignItems:"center"}}):l,A=()=>typeof u=="function"?u():u,O=()=>{const U=v?{backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover",backgroundImage:`url(${v})`}:{};return C.jsx("div",{className:"sendbird-image-renderer__image",style:{width:"100%",minWidth:N,maxWidth:o?N:"400px",height:I,position:"absolute",borderRadius:m3(a,c),...U}})};return N&&I&&C.jsxs("div",{ref:m,className:[...Array.isArray(e)?e:[e],"sendbird-image-renderer"].join(" "),style:{width:"100%",minWidth:N,maxWidth:o?N:"400px",height:I},children:[S&&x(),!v||_?A():O(),f&&C.jsx("div",{className:"sendbird-multiple-files-image-renderer__image-cover",style:{borderRadius:m3(a,c),...p?{}:{display:"inline-flex"}}}),v&&C.jsx(B8,{src:v,alt:t,onLoadStart:()=>{T(!0),E(!1)},onLoad:()=>{T(!1),E(!1),d()},onError:()=>{T(!1),E(!0),h()}})]})},B8=e=>{const{src:n,alt:t,onLoadStart:r=bi,onLoad:i=bi,onError:s=bi}=e,a=D.useRef({currSrc:n,prevSrc:n,loadFailure:!1});return a.current.currSrc!==n&&(a.current.prevSrc=a.current.currSrc,a.current.currSrc=n),D.useLayoutEffect(()=>{if(n){const o=a.current.prevSrc!==a.current.currSrc,l=a.current.loadFailure;(o||l)&&r()}},[n,navigator.onLine]),C.jsx("img",{className:"sendbird-image-renderer__hidden-image-loader",src:n,alt:t,onLoad:()=>{a.current.loadFailure=!1,i()},onError:()=>{a.current.loadFailure=!0,s()}})},U0=e=>{if(typeof e=="number")return e;if(typeof e=="string"){const n=Number.parseFloat(e);if(!Number.isNaN(n))return n}return NaN},qT=e=>{const{width:n,height:t,text:r}=e;let i=U0(n),s=U0(t);return typeof i=="number"&&!Number.isNaN(i)&&(i*=.575),typeof s=="number"&&!Number.isNaN(s)&&(s*=.575),C.jsx("div",{className:ls("sendbird-avatar-img--default",r&&"text"),style:{width:n,height:t},children:r?C.jsx("div",{className:"sendbird-avatar-text",children:r}):C.jsx(Sn,{type:Qt.USER,fillColor:Yt.CONTENT,width:i,height:s})})},Bs="sendbird-avatar-img",$8=({src:e="",alt:n="",height:t,width:r,customDefaultComponent:i})=>{const s=()=>i?i({width:r,height:t}):C.jsx(qT,{width:r,height:t});return typeof e=="string"?C.jsx(js,{className:Bs,url:e,height:t,width:r,alt:n,defaultComponent:s}):e&&e.length?e.length===1?C.jsx(js,{className:Bs,url:e[0],height:t,width:r,alt:n,defaultComponent:s}):e.length===2?C.jsxs("div",{className:"sendbird-avatar--inner__two-child",children:[C.jsx(js,{className:Bs,url:e[0],height:t,width:r,alt:n,defaultComponent:s}),C.jsx(js,{className:Bs,url:e[1],height:t,width:r,alt:n,defaultComponent:s})]}):e.length===3?C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"sendbird-avatar--inner__three-child--upper",children:C.jsx(js,{className:Bs,url:e[0],height:t,width:r,alt:n,defaultComponent:s})}),C.jsxs("div",{className:"sendbird-avatar--inner__three-child--lower",children:[C.jsx(js,{className:Bs,url:e[1],height:t,width:r,alt:n,defaultComponent:s}),C.jsx(js,{className:Bs,url:e[2],height:t,width:r,alt:n,defaultComponent:s})]})]}):C.jsx("div",{className:"sendbird-avatar--inner__four-child",children:e.slice(0,4).map((a,o)=>C.jsx(js,{className:Bs,url:a,height:t,width:r,alt:n,defaultComponent:s},`${a}-${o}`))}):C.jsx(js,{className:Bs,url:"",height:t,width:r,alt:n,defaultComponent:s})};function G8({className:e="",src:n="",alt:t="",width:r="56px",height:i="56px",zIndex:s=0,left:a="",bottom:o="",onClick:l,customDefaultComponent:u},c){return C.jsx("div",{className:[...Array.isArray(e)?e:[e],"sendbird-avatar"].join(" "),role:"button",ref:c,style:{height:i,width:r,zIndex:s,left:a,bottom:o},onClick:l,onKeyDown:l,tabIndex:0,children:C.jsx($8,{src:n,width:r,height:i,alt:t,customDefaultComponent:u})})}const Ps=Dt.forwardRef(G8),WT="https://static.sendbird.com/sample/cover/cover_",Q_=(e,n)=>e!=null&&e.coverUrl&&!new RegExp(`^${WT}`).test(e.coverUrl)?e.coverUrl:((e==null?void 0:e.members)||[]).filter(t=>t.userId!==n).map(({profileUrl:t})=>t),z8=e=>e!=null&&e.coverUrl?!!new RegExp(`^${WT}`).test(e.coverUrl):!0;function V8({channel:e,userId:n,theme:t,width:r=56,height:i=56}){const s=e==null?void 0:e.isBroadcast,a=D.useMemo(()=>s?z8(e)?C.jsx("div",{className:"sendbird-chat-header--default-avatar",style:{width:r,height:i,display:"flex",justifyContent:"center",alignItems:"center"},children:C.jsx(Sn,{type:Qt.BROADCAST,fillColor:Yt.CONTENT,width:r*.575,height:i*.575})}):C.jsx(Ps,{className:"sendbird-chat-header--avatar--broadcast-channel",src:Q_(e,n),width:r,height:i,alt:e==null?void 0:e.name}):C.jsx(Ps,{className:"sendbird-chat-header--avatar--group-channel",src:Q_(e,n),width:`${r}px`,height:`${i}px`,alt:e==null?void 0:e.name}),[Q_(e,n),t]);return C.jsx(C.Fragment,{children:a})}const q8=(e,n,t)=>{var i;const r=t||GT;return!(e!=null&&e.name)&&!(e!=null&&e.members)?r.NO_TITLE:e!=null&&e.name&&e.name!=="Group Channel"?e.name:((i=e==null?void 0:e.members)==null?void 0:i.length)===1?r.NO_MEMBERS:e==null?void 0:e.members.filter(({userId:s})=>s!==n).map(({nickname:s})=>s||r.NO_NAME).join(", ")},W8=!1,KT="sendbird--mobile-mode",QT=Dt.createContext({breakpoint:W8,isMobile:!1}),v3=()=>{try{const e=document.querySelector("body");e==null||e.classList.add(KT)}catch{}},g3=()=>{try{const e=document.querySelector("body");e==null||e.classList.remove(KT)}catch{}},K8=e=>{const{children:n,logger:t}=e,r=(e==null?void 0:e.breakpoint)||!1,[i,s]=D.useState(!1);return D.useEffect(()=>{var o;const a=()=>{var l,u,c,d,h;if(typeof r=="boolean")s(r),r?((l=t==null?void 0:t.info)==null||l.call(t,"MediaQueryProvider: isMobile: true"),v3()):((u=t==null?void 0:t.info)==null||u.call(t,"MediaQueryProvider: isMobile: false"),g3());else{const f=window.matchMedia(`(max-width: ${r})`);(c=t==null?void 0:t.info)==null||c.call(t,`MediaQueryProvider: Screensize updated to ${r}`),f.matches?(s(!0),v3(),(d=t==null?void 0:t.info)==null||d.call(t,"MediaQueryProvider: isMobile: true")):(s(!1),g3(),(h=t==null?void 0:t.info)==null||h.call(t,"MediaQueryProvider: isMobile: false"))}};return a(),window.addEventListener("resize",a),(o=t==null?void 0:t.info)==null||o.call(t,"MediaQueryProvider: addEventListener",{updateSize:a}),()=>{var l;window.removeEventListener("resize",a),(l=t==null?void 0:t.info)==null||l.call(t,"MediaQueryProvider: removeEventListener",{updateSize:a})}},[r]),C.jsx(QT.Provider,{value:{breakpoint:r,isMobile:i},children:n})},Ja=()=>Dt.useContext(QT);var F2=(e=>(e.ONBACKGROUND_1="ONBACKGROUND_1",e.ONBACKGROUND_2="ONBACKGROUND_2",e.ONBACKGROUND_3="ONBACKGROUND_3",e.ONBACKGROUND_4="ONBACKGROUND_4",e.ONCONTENT_1="ONCONTENT_1",e.ONCONTENT_2="ONCONTENT_2",e.PRIMARY="PRIMARY",e.ERROR="ERROR",e))(F2||{});const jv=e=>{switch(e){case"ONBACKGROUND_1":return"sendbird-color--onbackground-1";case"ONBACKGROUND_2":return"sendbird-color--onbackground-2";case"ONBACKGROUND_3":return"sendbird-color--onbackground-3";case"ONBACKGROUND_4":return"sendbird-color--onbackground-4";case"ONCONTENT_1":return"sendbird-color--oncontent-1";case"PRIMARY":return"sendbird-color--primary";case"ERROR":return"sendbird-color--error";default:return""}},Q8=({className:e="",color:n=F2.ONBACKGROUND_1,disabled:t=!1,disableUnderline:r=!1,onClick:i=()=>{},children:s})=>C.jsx("div",{className:[...Array.isArray(e)?e:[e],jv(n),r?"sendbird-textbutton--not-underline":"sendbird-textbutton",t?"sendbird-textbutton--disabled":""].join(" "),role:"button",tabIndex:0,onClick:a=>i(a),onKeyPress:a=>i(a),children:s}),P0=Dt.forwardRef((e,n)=>{const{className:t="",children:r,disabled:i=!1,width:s="56px",height:a="56px",type:o="button",style:l={},onBlur:u=()=>{},onClick:c=()=>{}}=e,[d,h]=D.useState(!1);return C.jsx("button",{className:[...Array.isArray(t)?t:[t],"sendbird-iconbutton",d?"sendbird-iconbutton--pressed":""].join(" "),disabled:i,ref:n,type:o,style:{...l,height:a,width:s},onClick:f=>{i||(h(!0),c==null||c(f))},onBlur:f=>{h(!1),u==null||u(f)},children:C.jsx("span",{className:"sendbird-iconbutton__inner",children:r})})}),Y8=({className:e,renderLeft:n,renderRight:t,renderMiddle:r})=>{var s;let i=!1;try{i=(s=Ja==null?void 0:Ja())==null?void 0:s.isMobile}catch{}return C.jsxs("div",{className:`sendbird-ui-header ${e}`,children:[n?C.jsx("div",{className:ls("sendbird-ui-header__left",i?"sendbird-ui-header--is-mobile":"sendbird-ui-header--is-desktop"),children:n==null?void 0:n()}):null,C.jsx("div",{className:"sendbird-ui-header__middle",children:r==null?void 0:r()}),t?C.jsx("div",{className:ls("sendbird-ui-header__right",i?"sendbird-ui-header--is-mobile":"sendbird-ui-header--is-desktop"),children:t==null?void 0:t()}):null]})},Z8=({title:e,subtitle:n,onClickSubtitle:t})=>C.jsxs("div",{className:"sendbird-ui-header__middle",children:[e&&C.jsx(ut,{className:"sendbird-ui-header__middle__title",type:it.H_2,color:at.ONBACKGROUND_1,children:e}),n&&(t?C.jsx(Q8,{className:"sendbird-ui-header__middle__subtitle__container",onClick:t,disableUnderline:!0,children:C.jsx(ut,{className:"sendbird-ui-header__middle__subtitle",type:it.CAPTION_3,color:at.ONBACKGROUND_2,children:n})}):C.jsx(ut,{className:"sendbird-ui-header__middle__subtitle",type:it.BODY_1,color:at.ONBACKGROUND_2,children:n}))]}),X8=({className:e,onClick:n,type:t,color:r,width:i="32px",height:s="32px",renderIcon:a=o=>C.jsx(YT,{...o})})=>C.jsx(P0,{className:e,width:i,height:s,onClick:n,children:a({type:t,color:r})}),YT=({className:e,type:n,color:t,width:r="22px",height:i="22px",onClick:s=bi})=>C.jsx(Sn,{className:e,type:n,fillColor:t,width:r,height:i,onClick:a=>s==null?void 0:s(a)}),ga=Object.assign(Y8,{Title:Z8,IconButton:X8,Icon:YT}),J8=({className:e,currentChannel:n,showSearchIcon:t,onBackClick:r,onSearchClick:i,onChatHeaderActionClick:s,renderLeft:a,renderMiddle:o,renderRight:l})=>{const{config:u}=pn(),{userId:c,theme:d}=u,{isMobile:h}=Ja(),{stringSet:f}=vl(),p=(n==null?void 0:n.myMutedState)==="muted",m=q8(n,c,f);return C.jsx(ga,{className:`sendbird-chat-header ${e}`,renderLeft:a??(()=>C.jsxs(C.Fragment,{children:[h&&C.jsx(ga.Icon,{className:"sendbird-chat-header__icon_back",onClick:r,type:Qt.ARROW_LEFT,color:Yt.PRIMARY,width:"24px",height:"24px"}),C.jsx(V8,{theme:d,channel:n,userId:c,height:32,width:32})]})),renderMiddle:o??(()=>C.jsx(ga.Title,{title:m})),renderRight:l??(()=>C.jsxs(C.Fragment,{children:[p&&C.jsx(ga.Icon,{className:"sendbird-chat-header__right__mute",type:Qt.NOTIFICATIONS_OFF_FILLED,color:Yt.ON_BACKGROUND_2,width:"24px",height:"24px"}),t&&!(n!=null&&n.isEphemeral)&&C.jsx(ga.IconButton,{className:"sendbird-chat-header__right__search",onClick:i,type:Qt.SEARCH,color:Yt.PRIMARY,renderIcon:b=>C.jsx(ga.Icon,{...b,width:"24px",height:"24px"})}),C.jsx(ga.IconButton,{className:"sendbird-chat-header__right__info",onClick:s,type:Qt.INFO,color:Yt.PRIMARY,renderIcon:b=>C.jsx(ga.Icon,{...b,width:"24px",height:"24px"})})]}))})},eP=e=>{const n=Ai();return C.jsx(J8,{...e,...n,currentChannel:n.currentChannel})};var ZT=(e=>(e.NONE="NONE",e.PENDING="PENDING",e.SENT="SENT",e.FAILED="FAILED",e.DELIVERED="DELIVERED",e.READ="READ",e))(ZT||{});const tP=(e,n)=>{var t,r,i;if(!n||!("sendingStatus"in n))return"NONE";if(n.sendingStatus==="pending")return"PENDING";if(n.sendingStatus==="failed")return"FAILED";if((t=e==null?void 0:e.isGroupChannel)!=null&&t.call(e)){if(((r=e.getUnreadMemberCount)==null?void 0:r.call(e,n))===0)return"READ";if(((i=e.getUndeliveredMemberCount)==null?void 0:i.call(e,n))===0)return"DELIVERED"}return n.sendingStatus==="succeeded"?"SENT":"NONE"};var F0=Symbol("@ts-pattern/matcher"),y3="@ts-pattern/anonymous-select-key",E3=function(e){return!!(e&&typeof e=="object")},Y_=function(e){return e&&!!e[F0]},nP=function e(n,t,r){if(E3(n)){if(Y_(n)){var i=n[F0]().match(t),s=i.matched,a=i.selections;return s&&a&&Object.keys(a).forEach(function(l){return r(l,a[l])}),s}if(!E3(t))return!1;if(Array.isArray(n))return!!Array.isArray(t)&&n.length===t.length&&n.every(function(l,u){return e(l,t[u],r)});if(n instanceof Map)return t instanceof Map&&Array.from(n.keys()).every(function(l){return e(n.get(l),t.get(l),r)});if(n instanceof Set){if(!(t instanceof Set))return!1;if(n.size===0)return t.size===0;if(n.size===1){var o=Array.from(n.values())[0];return Y_(o)?Array.from(t.values()).every(function(l){return e(o,l,r)}):t.has(o)}return Array.from(n.values()).every(function(l){return t.has(l)})}return Object.keys(n).every(function(l){var u,c=n[l];return(l in t||Y_(u=c)&&u[F0]().matcherType==="optional")&&e(c,t[l],r)})}return Object.is(t,n)};function gl(e){var n;return(n={})[F0]=function(){return{match:function(t){return{matched:!!e(t)}}}},n}gl(function(e){return!0});gl(function(e){return typeof e=="string"});gl(function(e){return typeof e=="number"});gl(function(e){return typeof e=="boolean"});gl(function(e){return typeof e=="bigint"});gl(function(e){return typeof e=="symbol"});gl(function(e){return e==null});function Gu(e){return new rP(e,[])}var rP=function(){function e(t,r){this.value=void 0,this.cases=void 0,this.value=t,this.cases=r}var n=e.prototype;return n.with=function(){var t=[].slice.call(arguments),r=t[t.length-1],i=[t[0]],s=[];return t.length===3&&typeof t[1]=="function"?(i.push(t[0]),s.push(t[1])):t.length>2&&i.push.apply(i,t.slice(1,t.length-1)),new e(this.value,this.cases.concat([{match:function(a){var o={},l=!!(i.some(function(u){return nP(u,a,function(c,d){o[c]=d})})&&s.every(function(u){return u(a)}));return{matched:l,value:l&&Object.keys(o).length?y3 in o?o[y3]:o:a}},handler:r}]))},n.when=function(t,r){return new e(this.value,this.cases.concat([{match:function(i){return{matched:!!t(i),value:i}},handler:r}]))},n.otherwise=function(t){return new e(this.value,this.cases.concat([{match:function(r){return{matched:!0,value:r}},handler:t}])).run()},n.exhaustive=function(){return this.run()},n.run=function(){for(var t=this.value,r=void 0,i=0;iArray.isArray(e)&&e.length>0?e.reduce((n,t)=>{switch(t){case"image":{n.push(...Kl.IMAGE);break}case"video":{n.push(...Kl.VIDEO);break}case"audio":{n.push(...Kl.AUDIO);break}default:{n.push(t);break}}return n},[]).join():Object.values(Kl).reduce((n,t)=>n.concat(t),[]).join(),b3=e=>e===""||e===null,H2=e=>Kl.IMAGE.indexOf(e)>=0,XT=e=>Kl.VIDEO.indexOf(e)>=0,C3=e=>H2(e)||XT(e),S3=(e,n)=>tP(e,n)===ZT.READ,sP=e=>e&&(e.isMultipleFilesMessage&&typeof e.isMultipleFilesMessage=="function"?e.isMultipleFilesMessage():e.messageType==="file"&&Object.prototype.hasOwnProperty.call(e,"fileInfoList")),aP=(e,n)=>Array.isArray(n)?[...e,...n]:(e.push(n),e),Bv=e=>Array.isArray(e)?e.reduce(aP,[]).join(" "):e;function JT(e){var n;return e!=null&&e.extendedMessagePayload&&Array.isArray((n=e==null?void 0:e.extendedMessagePayload)==null?void 0:n.suggested_replies)?e.extendedMessagePayload.suggested_replies:[]}const oP=(e,n)=>{if(Array.isArray(e)&&Array.isArray(n)&&e.length===n.length){for(let t=0;t!!e&&"sender"in e,eN=10,tN=15,ad="@";var nN=(e=>(e.PARENT="PARENT",e.THREAD="THREAD",e))(nN||{});function w3(e){if(e){const n=e.querySelectorAll("[data-sb-mention='true']");return Array.from(n)}return[]}function rN({ref:e},{logger:n}){const t=e.current,[r,i]=D.useState([]);return D.useLayoutEffect(()=>{if(t){const s=w3(t);i(s)}},[t]),D.useEffect(()=>{const s={childList:!0,subtree:!0},a=l=>{l.length>0&&i(w3(t))},o=new MutationObserver(a);return t&&o.observe(t,s),()=>{try{o.disconnect()}catch{n.error("useDirtyGetMentions: observer disconnect failed",{observer:o})}}},[t]),r}const T3=(e,n)=>{const[t,r]=D.useState(!1);D.useEffect(()=>{t?e():r(!0)},n)},lP=({children:e=void 0,className:n="",separatorColor:t=F2.ONBACKGROUND_4})=>C.jsxs("div",{className:[...Array.isArray(n)?n:[n],"sendbird-separator"].join(" "),children:[C.jsx("div",{className:["sendbird-separator__left",`${jv(t)}--background-color`].join(" ")}),C.jsx("div",{className:"sendbird-separator__text",children:e||C.jsx(ut,{type:it.CAPTION_2,color:at.ONBACKGROUND_2,children:"Date Separator"})}),C.jsx("div",{className:["sendbird-separator__right",`${jv(t)}--background-color`].join(" ")})]}),uP=e=>{var Le;const{message:n,children:t,hasSeparator:r,chainTop:i,chainBottom:s,handleScroll:a,channel:o,editInputDisabled:l,shouldRenderSuggestedReplies:u,isReactionEnabled:c,replyType:d,threadReplySelectType:h,nicknamesMap:f,scrollToMessage:p,toggleReaction:m,setQuoteMessage:b,onQuoteMessageClick:v,onReplyInThreadClick:_,onBeforeDownloadFileMessage:E,sendUserMessage:S,updateUserMessage:T,resendMessage:N,deleteMessage:I,setAnimatedMessageId:x,animatedMessageId:A,onMessageAnimated:O,usedInLegacy:U=!0}=e,{renderUserMentionItem:W,renderMessage:P,renderCustomSeparator:J,renderEditInput:V,renderFileViewer:H,renderRemoveMessageModal:we}=Tp(e),{dateLocale:q,stringSet:ee}=vl(),ie=pn(),{userId:Ne,isOnline:X,userMention:oe,logger:te,groupChannel:ce}=ie.config,$=(oe==null?void 0:oe.maxMentionCount)||eN;oe!=null&&oe.maxSuggestionCount;const[ke,B]=D.useState(!1);D.useState(!1),D.useState(!1);const[ae,de]=D.useState(!1),[Ee,se]=D.useState(""),[he,fe]=D.useState([]),[ve,me]=D.useState([]);D.useState(null),D.useState(null),D.useState([]);const pe=D.useRef(null),Ce=D.useRef(null);X&&ce.enableMention&&Ee.length>0&&!A0(o)&&M0(o);const ze=rN({ref:pe},{logger:te});(ze==null?void 0:ze.length)<$,D.useEffect(()=>{fe(he.filter(({userId:re})=>{const Re=ve.indexOf(re);return Re<0?!1:(ve.splice(Re,1),!0)}))},[ve]),T3(()=>{a==null||a()},[ke,(Le=n==null?void 0:n.reactions)==null?void 0:Le.length]),T3(()=>{a==null||a(!0)},[n==null?void 0:n.updatedAt,n==null?void 0:n.message]);const ue=D.useRef(u);D.useEffect(()=>{ue.current!==u?a==null||a():ue.current=u},[u]),D.useLayoutEffect(()=>{U&&(a==null||a(!0))},[]),D.useLayoutEffect(()=>{const re=[];return A===n.messageId&&(Ce!=null&&Ce.current)?(re.push(setTimeout(()=>{de(!0)},500)),re.push(setTimeout(()=>{x(null),O==null||O()},1600))):de(!1),()=>{re.forEach(Re=>clearTimeout(Re))}},[A,Ce.current,n.messageId]);const ne=D.useMemo(()=>(J==null?void 0:J({message:n}))??null,[n,J]),xe=()=>{if(t)return t;if(P){const re={...e,renderMessage:void 0};return P(re)}return C.jsx(C.Fragment,{})};return C.jsxs("div",{className:Bv(["sendbird-msg-hoc sendbird-msg--scroll-ref",ae?"sendbird-msg-hoc__animated":""]),style:t||P?void 0:{marginBottom:"2px"},"data-sb-message-id":n.messageId,"data-sb-created-at":n.createdAt,ref:Ce,children:[r&&(ne||C.jsx(lP,{children:C.jsx(ut,{type:it.CAPTION_2,color:at.ONBACKGROUND_2,children:D2(n.createdAt,ee.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR,{locale:q})})})),xe()]})},Du="sendbird-modal-root",cP=()=>C.jsx("div",{id:Du,className:Du});var Zn=(e=>(e.PRIMARY="PRIMARY",e.SECONDARY="SECONDARY",e.DANGER="DANGER",e.DISABLED="DISABLED",e.WARNING="WARNING",e))(Zn||{}),Uu=(e=>(e.BIG="BIG",e.SMALL="SMALL",e))(Uu||{});function dP(e){switch(e){case Zn.PRIMARY:return"sendbird-button--primary";case Zn.SECONDARY:return"sendbird-button--secondary";case Zn.DANGER:return"sendbird-button--danger";case Zn.DISABLED:return"sendbird-button--disabled";case Zn.WARNING:return"sendbird-button--warning";default:return""}}function hP(e){switch(e){case Uu.BIG:return"sendbird-button--big";case Uu.SMALL:return"sendbird-button--small";default:return""}}function ra({className:e,type:n=Zn.PRIMARY,size:t=Uu.BIG,children:r="Button",disabled:i=!1,onClick:s=()=>{},labelType:a=it.BUTTON_1,labelColor:o=at.ONCONTENT_1}){const l=[...Array.isArray(e)?e:[e],"sendbird-button",i?"sendbird-button__disabled":"",dP(n),hP(t)].join(" ");return C.jsx("button",{className:l,type:"button",onClick:s,disabled:i,children:C.jsx(ut,{className:"sendbird-button__text",type:a,color:o,children:r})})}/*! * css-vars-ponyfill * v2.4.9 * https://jhildenbiddle.github.io/css-vars-ponyfill/ @@ -63,7 +63,7 @@ Error generating stack: `+s.message+` * https://github.com/jhildenbiddle/get-css-data * (c) 2018-2022 John Hildenbiddle * MIT license - */function w3(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={mimeType:n.mimeType||null,onBeforeSend:n.onBeforeSend||Function.prototype,onSuccess:n.onSuccess||Function.prototype,onError:n.onError||Function.prototype,onComplete:n.onComplete||Function.prototype},r=Array.isArray(e)?e:[e],i=Array.apply(null,Array(r.length)).map(function(u){return null});function s(u){var c=typeof u=="string",d=c&&u.trim().charAt(0)==="<";return c&&!d}function a(u,c){t.onError(u,r[c],c)}function o(u,c){var d=t.onSuccess(u,r[c],c);u=d===!1?"":d||u,i[c]=u,i.indexOf(null)===-1&&t.onComplete(i)}var l=document.createElement("a");r.forEach(function(u,c){l.setAttribute("href",u),l.href=String(l.href);var d=!!(document.all&&!window.atob),h=d&&l.host.split(":")[0]!==location.host.split(":")[0];if(h){var f=l.protocol===location.protocol;if(f){var p=new XDomainRequest;p.open("GET",u),p.timeout=0,p.onprogress=Function.prototype,p.ontimeout=Function.prototype,p.onload=function(){var b=p.responseText;s(b)?o(b,c):a(p,c)},p.onerror=function(b){a(p,c)},setTimeout(function(){p.send()},0)}else console.warn("Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol (".concat(u,")")),a(null,c)}else{var m=new XMLHttpRequest;m.open("GET",u),t.mimeType&&m.overrideMimeType&&m.overrideMimeType(t.mimeType),t.onBeforeSend(m,u,c),m.onreadystatechange=function(){if(m.readyState===4){var b=m.responseText;m.status<400&&s(b)||m.status===0&&s(b)?o(b,c):a(m,c)}},m.send()}})}/** + */function N3(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={mimeType:n.mimeType||null,onBeforeSend:n.onBeforeSend||Function.prototype,onSuccess:n.onSuccess||Function.prototype,onError:n.onError||Function.prototype,onComplete:n.onComplete||Function.prototype},r=Array.isArray(e)?e:[e],i=Array.apply(null,Array(r.length)).map(function(u){return null});function s(u){var c=typeof u=="string",d=c&&u.trim().charAt(0)==="<";return c&&!d}function a(u,c){t.onError(u,r[c],c)}function o(u,c){var d=t.onSuccess(u,r[c],c);u=d===!1?"":d||u,i[c]=u,i.indexOf(null)===-1&&t.onComplete(i)}var l=document.createElement("a");r.forEach(function(u,c){l.setAttribute("href",u),l.href=String(l.href);var d=!!(document.all&&!window.atob),h=d&&l.host.split(":")[0]!==location.host.split(":")[0];if(h){var f=l.protocol===location.protocol;if(f){var p=new XDomainRequest;p.open("GET",u),p.timeout=0,p.onprogress=Function.prototype,p.ontimeout=Function.prototype,p.onload=function(){var b=p.responseText;s(b)?o(b,c):a(p,c)},p.onerror=function(b){a(p,c)},setTimeout(function(){p.send()},0)}else console.warn("Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol (".concat(u,")")),a(null,c)}else{var m=new XMLHttpRequest;m.open("GET",u),t.mimeType&&m.overrideMimeType&&m.overrideMimeType(t.mimeType),t.onBeforeSend(m,u,c),m.onreadystatechange=function(){if(m.readyState===4){var b=m.responseText;m.status<400&&s(b)||m.status===0&&s(b)?o(b,c):a(m,c)}},m.send()}})}/** * Gets CSS data from - +