getstream
Version:
The official low-level GetStream.io client for Node.js and the browser.
2 lines • 120 kB
JavaScript
/*! For license information please see getstream.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.stream=t():e.stream=t()}(self,(()=>(()=>{var e={9272:(e,t,n)=>{"use strict";var r=n(723),i=[],o=[],s=r.makeRequestCallFromTimer((function(){if(o.length)throw o.shift()}));function a(e){var t;(t=i.length?i.pop():new c).task=e,r(t)}function c(){this.task=null}e.exports=a,c.prototype.call=function(){try{this.task.call()}catch(e){a.onerror?a.onerror(e):(o.push(e),s())}finally{this.task=null,i[i.length]=this}}},723:(e,t,n)=>{"use strict";function r(e){o.length||i(),o[o.length]=e}e.exports=r;var i,o=[],s=0;function a(){for(;s<o.length;){var e=s;if(s+=1,o[e].call(),s>1024){for(var t=0,n=o.length-s;t<n;t++)o[t]=o[t+s];o.length-=s,s=0}}o.length=0,s=0}var c,u,l,h=void 0!==n.g?n.g:self,f=h.MutationObserver||h.WebKitMutationObserver;function d(e){return function(){var t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}"function"==typeof f?(c=1,u=new f(a),l=document.createTextNode(""),u.observe(l,{characterData:!0}),i=function(){c=-c,l.data=c}):i=d(a),r.requestFlush=i,r.makeRequestCallFromTimer=d},3513:(e,t,n)=>{"use strict";n.d(t,{n:()=>kt});var r={};n.r(r),n.d(r,{hasBrowserEnv:()=>de,hasStandardBrowserEnv:()=>pe,hasStandardBrowserWebWorkerEnv:()=>ye});var i=n(8152),o=n(4925),s=n(5861),a=n(5671),c=n(3144),u=n(4942),l=n(4687),h=n.n(l),f=n(8854),d=n(5697);function p(e,t){return function(){return e.apply(t,arguments)}}const{toString:v}=Object.prototype,{getPrototypeOf:y}=Object,g=(m=Object.create(null),e=>{const t=v.call(e);return m[t]||(m[t]=t.slice(8,-1).toLowerCase())});var m;const _=e=>(e=e.toLowerCase(),t=>g(t)===e),b=e=>t=>typeof t===e,{isArray:w}=Array,E=b("undefined"),k=_("ArrayBuffer"),O=b("string"),T=b("function"),S=b("number"),x=e=>null!==e&&"object"==typeof e,A=e=>{if("object"!==g(e))return!1;const t=y(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},C=_("Date"),R=_("File"),N=_("Blob"),j=_("FileList"),I=_("URLSearchParams");function P(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,i;if("object"!=typeof e&&(e=[e]),w(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(r=0;r<o;r++)s=i[r],t.call(null,e[s],s,e)}}function U(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,i=n.length;for(;i-- >0;)if(r=n[i],t===r.toLowerCase())return r;return null}const D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,L=e=>!E(e)&&e!==D,Z=(F="undefined"!=typeof Uint8Array&&y(Uint8Array),e=>F&&e instanceof F);var F;const M=_("HTMLFormElement"),q=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),B=_("RegExp"),z=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};P(n,((n,i)=>{let o;!1!==(o=t(n,i,e))&&(r[i]=o||n)})),Object.defineProperties(e,r)},H="abcdefghijklmnopqrstuvwxyz",V="0123456789",K={DIGIT:V,ALPHA:H,ALPHA_DIGIT:H+H.toUpperCase()+V},$=_("AsyncFunction"),G={isArray:w,isArrayBuffer:k,isBuffer:function(e){return null!==e&&!E(e)&&null!==e.constructor&&!E(e.constructor)&&T(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||T(e.append)&&("formdata"===(t=g(e))||"object"===t&&T(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&k(e.buffer),t},isString:O,isNumber:S,isBoolean:e=>!0===e||!1===e,isObject:x,isPlainObject:A,isUndefined:E,isDate:C,isFile:R,isBlob:N,isRegExp:B,isFunction:T,isStream:e=>x(e)&&T(e.pipe),isURLSearchParams:I,isTypedArray:Z,isFileList:j,forEach:P,merge:function e(){const{caseless:t}=L(this)&&this||{},n={},r=(r,i)=>{const o=t&&U(n,i)||i;A(n[o])&&A(r)?n[o]=e(n[o],r):A(r)?n[o]=e({},r):w(r)?n[o]=r.slice():n[o]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&P(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(P(t,((t,r)=>{n&&T(t)?e[r]=p(t,n):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let i,o,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&y(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:g,kindOfTest:_,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(w(e))return e;let t=e.length;if(!S(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:M,hasOwnProperty:q,hasOwnProp:q,reduceDescriptors:z,freezeMethods:e=>{z(e,((t,n)=>{if(T(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];T(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return w(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:U,global:D,isContextDefined:L,ALPHABET:K,generateString:(e=16,t=K.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&T(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(x(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const i=w(e)?[]:{};return P(e,((e,t)=>{const o=n(e,r+1);!E(o)&&(i[t]=o)})),t[r]=void 0,i}}return e};return n(e,0)},isAsyncFn:$,isThenable:e=>e&&(x(e)||T(e))&&T(e.then)&&T(e.catch)};function J(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}G.inherits(J,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:G.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Y=J.prototype,W={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{W[e]={value:e}})),Object.defineProperties(J,W),Object.defineProperty(Y,"isAxiosError",{value:!0}),J.from=(e,t,n,r,i,o)=>{const s=Object.create(Y);return G.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),J.call(s,e.message,t,n,r,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};const X=J;function Q(e){return G.isPlainObject(e)||G.isArray(e)}function ee(e){return G.endsWith(e,"[]")?e.slice(0,-2):e}function te(e,t,n){return e?e.concat(t).map((function(e,t){return e=ee(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const ne=G.toFlatObject(G,{},null,(function(e){return/^is[A-Z]/.test(e)})),re=function(e,t,n){if(!G.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=G.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!G.isUndefined(t[e])}))).metaTokens,i=n.visitor||u,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&G.isSpecCompliantForm(t);if(!G.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(G.isDate(e))return e.toISOString();if(!a&&G.isBlob(e))throw new X("Blob is not supported. Use a Buffer instead.");return G.isArrayBuffer(e)||G.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,i){let a=e;if(e&&!i&&"object"==typeof e)if(G.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(G.isArray(e)&&function(e){return G.isArray(e)&&!e.some(Q)}(e)||(G.isFileList(e)||G.endsWith(n,"[]"))&&(a=G.toArray(e)))return n=ee(n),a.forEach((function(e,r){!G.isUndefined(e)&&null!==e&&t.append(!0===s?te([n],r,o):null===s?n:n+"[]",c(e))})),!1;return!!Q(e)||(t.append(te(i,n,o),c(e)),!1)}const l=[],h=Object.assign(ne,{defaultVisitor:u,convertValue:c,isVisitable:Q});if(!G.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!G.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),G.forEach(n,(function(n,o){!0===(!(G.isUndefined(n)||null===n)&&i.call(t,n,G.isString(o)?o.trim():o,r,h))&&e(n,r?r.concat(o):[o])})),l.pop()}}(e),t};function ie(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function oe(e,t){this._pairs=[],e&&re(e,this,t)}const se=oe.prototype;se.append=function(e,t){this._pairs.push([e,t])},se.toString=function(e){const t=e?function(t){return e.call(this,t,ie)}:ie;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const ae=oe;function ce(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ue(e,t,n){if(!t)return e;const r=n&&n.encode||ce,i=n&&n.serialize;let o;if(o=i?i(t,n):G.isURLSearchParams(t)?t.toString():new ae(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}const le=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){G.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},he={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ae,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},de="undefined"!=typeof window&&"undefined"!=typeof document,pe=(ve="undefined"!=typeof navigator&&navigator.product,de&&["ReactNative","NativeScript","NS"].indexOf(ve)<0);var ve;const ye="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ge={...r,...fe},me=function(e){function t(e,n,r,i){let o=e[i++];const s=Number.isFinite(+o),a=i>=e.length;return o=!o&&G.isArray(r)?r.length:o,a?(G.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s):(r[o]&&G.isObject(r[o])||(r[o]=[]),t(e,n,r[o],i)&&G.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],t[o]=e[o];return t}(r[o])),!s)}if(G.isFormData(e)&&G.isFunction(e.entries)){const n={};return G.forEachEntry(e,((e,r)=>{t(function(e){return G.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null},_e={transitional:he,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,i=G.isObject(e);if(i&&G.isHTMLForm(e)&&(e=new FormData(e)),G.isFormData(e))return r&&r?JSON.stringify(me(e)):e;if(G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e))return e;if(G.isArrayBufferView(e))return e.buffer;if(G.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return re(e,new ge.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return ge.isNode&&G.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=G.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return re(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),function(e,t,n){if(G.isString(e))try{return(0,JSON.parse)(e),G.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||_e.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&G.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw X.from(e,X.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ge.classes.FormData,Blob:ge.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};G.forEach(["delete","get","head","post","put","patch"],(e=>{_e.headers[e]={}}));const be=_e,we=G.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ee=Symbol("internals");function ke(e){return e&&String(e).trim().toLowerCase()}function Oe(e){return!1===e||null==e?e:G.isArray(e)?e.map(Oe):String(e)}function Te(e,t,n,r,i){return G.isFunction(r)?r.call(this,t,n):(i&&(t=n),G.isString(t)?G.isString(r)?-1!==t.indexOf(r):G.isRegExp(r)?r.test(t):void 0:void 0)}class Se{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function i(e,t,n){const i=ke(t);if(!i)throw new Error("header name must be a non-empty string");const o=G.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=Oe(e))}const o=(e,t)=>G.forEach(e,((e,n)=>i(e,n,t)));return G.isPlainObject(e)||e instanceof this.constructor?o(e,t):G.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?o((e=>{const t={};let n,r,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!n||t[n]&&we[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&i(t,e,n),this}get(e,t){if(e=ke(e)){const n=G.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(G.isFunction(t))return t.call(this,e,n);if(G.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ke(e)){const n=G.findKey(this,e);return!(!n||void 0===this[n]||t&&!Te(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function i(e){if(e=ke(e)){const i=G.findKey(n,e);!i||t&&!Te(0,n[i],i,t)||(delete n[i],r=!0)}}return G.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const i=t[n];e&&!Te(0,this[i],i,e,!0)||(delete this[i],r=!0)}return r}normalize(e){const t=this,n={};return G.forEach(this,((r,i)=>{const o=G.findKey(n,i);if(o)return t[o]=Oe(r),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(i):String(i).trim();s!==i&&delete t[i],t[s]=Oe(r),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return G.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&G.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[Ee]=this[Ee]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ke(e);t[r]||(function(e,t){const n=G.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})}))}(n,e),t[r]=!0)}return G.isArray(e)?e.forEach(r):r(e),this}}Se.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),G.reduceDescriptors(Se.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),G.freezeMethods(Se);const xe=Se;function Ae(e,t){const n=this||be,r=t||n,i=xe.from(r.headers);let o=r.data;return G.forEach(e,(function(e){o=e.call(n,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function Ce(e){return!(!e||!e.__CANCEL__)}function Re(e,t,n){X.call(this,null==e?"canceled":e,X.ERR_CANCELED,t,n),this.name="CanceledError"}G.inherits(Re,X,{__CANCEL__:!0});const Ne=Re,je=ge.hasStandardBrowserEnv?{write:function(e,t,n,r,i,o){const s=[];s.push(e+"="+encodeURIComponent(t)),G.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),G.isString(r)&&s.push("path="+r),G.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Ie(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Pe=ge.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=G.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function Ue(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];i||(i=c),n[o]=a,r[o]=c;let l=s,h=0;for(;l!==o;)h+=n[l++],l%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-i<t)return;const f=u&&c-u;return f?Math.round(1e3*h/f):void 0}}(50,250);return i=>{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-n,c=r(a);n=o;const u={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}const De={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const i=xe.from(e.headers).normalize(),o=e.responseType;let s,a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}if(G.isFormData(r))if(ge.hasStandardBrowserEnv||ge.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(a=i.getContentType())){const[e,...t]=a?a.split(";").map((e=>e.trim())).filter(Boolean):[];i.setContentType([e||"multipart/form-data",...t].join("; "))}let u=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+n))}const l=Ie(e.baseURL,e.url);function h(){if(!u)return;const r=xe.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new X("Request failed with status code "+n.status,[X.ERR_BAD_REQUEST,X.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),c()}),(function(e){n(e),c()}),{data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),ue(l,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(h)},u.onabort=function(){u&&(n(new X("Request aborted",X.ECONNABORTED,e,u)),u=null)},u.onerror=function(){n(new X("Network Error",X.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||he;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new X(t,r.clarifyTimeoutError?X.ETIMEDOUT:X.ECONNABORTED,e,u)),u=null},ge.hasStandardBrowserEnv){const t=Pe(l)&&e.xsrfCookieName&&je.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===r&&i.setContentType(null),"setRequestHeader"in u&&G.forEach(i.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),G.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),o&&"json"!==o&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",Ue(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",Ue(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{u&&(n(!t||t.type?new Ne(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const f=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(l);f&&-1===ge.protocols.indexOf(f)?n(new X("Unsupported protocol "+f+":",X.ERR_BAD_REQUEST,e)):u.send(r||null)}))}};G.forEach(De,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Le=e=>`- ${e}`,Ze=e=>G.isFunction(e)||null===e||!1===e,Fe=e=>{e=G.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let o=0;o<t;o++){let t;if(n=e[o],r=n,!Ze(n)&&(r=De[(t=String(n)).toLowerCase()],void 0===r))throw new X(`Unknown adapter '${t}'`);if(r)break;i[t||"#"+o]=r}if(!r){const e=Object.entries(i).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let n=t?e.length>1?"since :\n"+e.map(Le).join("\n"):" "+Le(e[0]):"as no adapter specified";throw new X("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return r};function Me(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ne(null,e)}function qe(e){return Me(e),e.headers=xe.from(e.headers),e.data=Ae.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Fe(e.adapter||be.adapter)(e).then((function(t){return Me(e),t.data=Ae.call(e,e.transformResponse,t),t.headers=xe.from(t.headers),t}),(function(t){return Ce(t)||(Me(e),t&&t.response&&(t.response.data=Ae.call(e,e.transformResponse,t.response),t.response.headers=xe.from(t.response.headers))),Promise.reject(t)}))}const Be=e=>e instanceof xe?e.toJSON():e;function ze(e,t){t=t||{};const n={};function r(e,t,n){return G.isPlainObject(e)&&G.isPlainObject(t)?G.merge.call({caseless:n},e,t):G.isPlainObject(t)?G.merge({},t):G.isArray(t)?t.slice():t}function i(e,t,n){return G.isUndefined(t)?G.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function o(e,t){if(!G.isUndefined(t))return r(void 0,t)}function s(e,t){return G.isUndefined(t)?G.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,i,o){return o in t?r(n,i):o in e?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>i(Be(e),Be(t),!0)};return G.forEach(Object.keys(Object.assign({},e,t)),(function(r){const o=c[r]||i,s=o(e[r],t[r],r);G.isUndefined(s)&&o!==a||(n[r]=s)})),n}const He={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{He[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const Ve={};He.transitional=function(e,t,n){function r(e,t){return"[Axios v1.6.1] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,i,o)=>{if(!1===e)throw new X(r(i," has been removed"+(t?" in "+t:"")),X.ERR_DEPRECATED);return t&&!Ve[i]&&(Ve[i]=!0,console.warn(r(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,o)}};const Ke={assertOptions:function(e,t,n){if("object"!=typeof e)throw new X("options must be an object",X.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],s=t[o];if(s){const t=e[o],n=void 0===t||s(t,o,e);if(!0!==n)throw new X("option "+o+" must be "+n,X.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new X("Unknown option "+o,X.ERR_BAD_OPTION)}},validators:He},$e=Ke.validators;class Ge{constructor(e){this.defaults=e,this.interceptors={request:new le,response:new le}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ze(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:i}=t;void 0!==n&&Ke.assertOptions(n,{silentJSONParsing:$e.transitional($e.boolean),forcedJSONParsing:$e.transitional($e.boolean),clarifyTimeoutError:$e.transitional($e.boolean)},!1),null!=r&&(G.isFunction(r)?t.paramsSerializer={serialize:r}:Ke.assertOptions(r,{encode:$e.function,serialize:$e.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&G.merge(i.common,i[t.method]);i&&G.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=xe.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,h=0;if(!a){const e=[qe.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);h<l;)u=u.then(e[h++],e[h++]);return u}l=s.length;let f=t;for(h=0;h<l;){const e=s[h++],t=s[h++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=qe.call(this,f)}catch(e){return Promise.reject(e)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(e){return ue(Ie((e=ze(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}G.forEach(["delete","get","head","options"],(function(e){Ge.prototype[e]=function(t,n){return this.request(ze(n||{},{method:e,url:t,data:(n||{}).data}))}})),G.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,i){return this.request(ze(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Ge.prototype[e]=t(),Ge.prototype[e+"Form"]=t(!0)}));const Je=Ge;class Ye{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,i){n.reason||(n.reason=new Ne(e,r,i),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new Ye((function(t){e=t})),cancel:e}}}const We=Ye,Xe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Xe).forEach((([e,t])=>{Xe[t]=e}));const Qe=Xe,et=function e(t){const n=new Je(t),r=p(Je.prototype.request,n);return G.extend(r,Je.prototype,n,{allOwnKeys:!0}),G.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(ze(t,n))},r}(be);et.Axios=Je,et.CanceledError=Ne,et.CancelToken=We,et.isCancel=Ce,et.VERSION="1.6.1",et.toFormData=re,et.AxiosError=X,et.Cancel=et.CanceledError,et.all=function(e){return Promise.all(e)},et.spread=function(e){return function(t){return e.apply(null,t)}},et.isAxiosError=function(e){return G.isObject(e)&&!0===e.isAxiosError},et.mergeConfig=ze,et.AxiosHeaders=xe,et.formToJSON=e=>me(G.isHTMLForm(e)?new FormData(e):e),et.getAdapter=Fe,et.HttpStatusCode=Qe,et.default=et;const tt=et;var nt=n(2965);class rt extends Error{}rt.prototype.name="InvalidTokenError";var it=n(8039),ot=n(3709),st=n(448),at=n(9082),ct=n(8824),ut=n(7878),lt=n(6685),ht=n(2589),ft=n(2637),dt=n(6793),pt=n.n(dt),vt=n(7496),yt=n.n(vt),gt=n(7248),mt=["method","token"],_t=["ids","foreignIDTimes"],bt=["activities"];function wt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wt(Object(n),!0).forEach((function(t){(0,u.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var kt=function(){function e(t,n,r){var i,o,c=this,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if((0,a.Z)(this,e),(0,u.Z)(this,"baseUrl",void 0),(0,u.Z)(this,"baseAnalyticsUrl",void 0),(0,u.Z)(this,"apiKey",void 0),(0,u.Z)(this,"appId",void 0),(0,u.Z)(this,"usingApiSecret",void 0),(0,u.Z)(this,"apiSecret",void 0),(0,u.Z)(this,"userToken",void 0),(0,u.Z)(this,"enrichByDefault",void 0),(0,u.Z)(this,"options",void 0),(0,u.Z)(this,"userId",void 0),(0,u.Z)(this,"authPayload",void 0),(0,u.Z)(this,"version",void 0),(0,u.Z)(this,"fayeUrl",void 0),(0,u.Z)(this,"group",void 0),(0,u.Z)(this,"expireTokens",void 0),(0,u.Z)(this,"location",void 0),(0,u.Z)(this,"fayeClient",void 0),(0,u.Z)(this,"browser",void 0),(0,u.Z)(this,"node",void 0),(0,u.Z)(this,"nodeOptions",void 0),(0,u.Z)(this,"request",void 0),(0,u.Z)(this,"subscriptions",void 0),(0,u.Z)(this,"handlers",void 0),(0,u.Z)(this,"currentUser",void 0),(0,u.Z)(this,"personalization",void 0),(0,u.Z)(this,"collections",void 0),(0,u.Z)(this,"files",void 0),(0,u.Z)(this,"images",void 0),(0,u.Z)(this,"reactions",void 0),(0,u.Z)(this,"_personalizationToken",void 0),(0,u.Z)(this,"_collectionsToken",void 0),(0,u.Z)(this,"_getOrCreateToken",void 0),(0,u.Z)(this,"addToMany",void 0),(0,u.Z)(this,"followMany",void 0),(0,u.Z)(this,"unfollowMany",void 0),(0,u.Z)(this,"createRedirectUrl",void 0),(0,u.Z)(this,"replaceReactionOptions",(function(e){null!=e&&e.reactions&&(null!=e.reactions.own&&(e.withOwnReactions=e.reactions.own),null!=e.reactions.recent&&(e.withRecentReactions=e.reactions.recent),null!=e.reactions.ranking_vars&&(e.rankingVars=e.reactions.ranking_vars),null!=e.reactions.score_vars&&(e.withScoreVars=e.reactions.score_vars),null!=e.reactions.counts&&(e.withReactionCounts=e.reactions.counts),null!=e.reactions.own_children&&(e.withOwnChildren=e.reactions.own_children),null!=e.reactions.kinds&&(e.reactionKindsFilter=e.reactions.kinds),null!=e.reactions.user_id&&(e.withUserId=e.reactions.user_id),delete e.reactions)})),(0,u.Z)(this,"handleResponse",(function(e){if(/^2/.test("".concat(e.status)))return c.send("response",null,e,e.data),e.data;throw new ht.eY("".concat(JSON.stringify(e.data)," with HTTP status code ").concat(e.status),e.data,e)})),(0,u.Z)(this,"doAxiosRequest",function(){var e=(0,s.Z)(h().mark((function e(t,n){var r,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c.send("request",t,n),e.prev=1,e.next=4,c.request(c.enrichKwargs(Et({method:t},n)));case 4:return r=e.sent,e.abrupt("return",c.handleResponse(r));case 8:if(e.prev=8,e.t0=e.catch(1),!(i=e.t0).response){e.next=13;break}return e.abrupt("return",c.handleResponse(i.response));case 13:throw new ht.z4(i.message);case 14:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}()),this.baseUrl="https://api.stream-io-api.com/api/",this.baseAnalyticsUrl="https://analytics.stream-io-api.com/analytics/",this.apiKey=t,this.usingApiSecret=null!=n&&!n.includes("."),this.apiSecret=this.usingApiSecret?n:null,this.userToken=this.usingApiSecret?null:n,this.enrichByDefault=!this.usingApiSecret,null!=this.userToken){var p=function(e,t){if("string"!=typeof e)throw new rt("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new rt(`Invalid token specified: missing part #${n+1}`);let i;try{i=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return atob(t)}}(r)}catch(e){throw new rt(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new rt(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(this.userToken);if(!p.user_id)throw new TypeError("user_id is missing in user token");this.userId=p.user_id,this.currentUser=this.user(this.userId)}if(this.appId=r,this.options=l,this.version=this.options.version||"v1.0",this.fayeUrl=this.options.fayeUrl||"https://faye-us-east.stream-io-api.com/faye",this.fayeClient=null,this.group=this.options.group||"unspecified",this.subscriptions={},this.expireTokens=!!this.options.expireTokens&&this.options.expireTokens,this.location=this.options.location,this.baseUrl=this.getBaseUrl(),"undefined"!=typeof process&&(null!==(i={PACKAGE_VERSION:"8.4.0"})&&void 0!==i&&i.LOCAL_FAYE&&(this.fayeUrl="http://localhost:9999/faye/"),null!==(o={PACKAGE_VERSION:"8.4.0"})&&void 0!==o&&o.STREAM_ANALYTICS_BASE_URL&&(this.baseAnalyticsUrl={PACKAGE_VERSION:"8.4.0"}.STREAM_ANALYTICS_BASE_URL)),this.handlers={},this.node="undefined"==typeof window,this.browser=void 0!==this.options.browser?this.options.browser:!this.node,this.node){var v=void 0===this.options.keepAlive||this.options.keepAlive;this.nodeOptions={httpAgent:new f.Agent({keepAlive:v,keepAliveMsecs:3e3}),httpsAgent:new d.Agent({keepAlive:v,keepAliveMsecs:3e3})}}if(this.request=tt.create(Et({timeout:this.options.timeout||1e4,withCredentials:!1},this.nodeOptions||{})),this.personalization=new it.S(this),this.browser&&this.usingApiSecret)throw new ht.IY('You are publicly sharing your App Secret. Do not expose the App Secret in browsers, "native" mobile apps, or other non-trusted environments.');this.collections=new ot.n(this,this.getOrCreateToken()),this.files=new st.h(this,this.getOrCreateToken()),this.images=new at.$(this,this.getOrCreateToken()),this.reactions=new ct.R(this,this.getOrCreateToken()),pt()&&yt()&&(this.addToMany=pt().addToMany,this.followMany=pt().followMany,this.unfollowMany=pt().unfollowMany,this.createRedirectUrl=yt())}var t,r;return(0,c.Z)(e,[{key:"_throwMissingApiSecret",value:function(){if(!this.usingApiSecret)throw new ht.z4("This method can only be used server-side using your API Secret, use client = stream.connect(key, secret);")}},{key:"getPersonalizationToken",value:function(){return this._personalizationToken||(this._throwMissingApiSecret(),this._personalizationToken=(0,lt.v)(this.apiSecret,"personalization","*",{userId:"*",feedId:"*",expireTokens:this.expireTokens})),this._personalizationToken}},{key:"getCollectionsToken",value:function(){return this._collectionsToken||(this._throwMissingApiSecret(),this._collectionsToken=(0,lt.v)(this.apiSecret,"collections","*",{feedId:"*",expireTokens:this.expireTokens})),this._collectionsToken}},{key:"getAnalyticsToken",value:function(){return this._throwMissingApiSecret(),(0,lt.v)(this.apiSecret,"analytics","*",{userId:"*",expireTokens:this.expireTokens})}},{key:"getBaseUrl",value:function(e){var t,n;if(e||(e="api"),this.options.urlOverride&&this.options.urlOverride[e])return this.options.urlOverride[e];var r="api"===e?"STREAM_BASE_URL":"STREAM_".concat(e.toUpperCase(),"_URL");if("undefined"!=typeof process&&null!==(t={PACKAGE_VERSION:"8.4.0"})&&void 0!==t&&t[r])return{PACKAGE_VERSION:"8.4.0"}[r];if("undefined"!=typeof process&&null!==(n={PACKAGE_VERSION:"8.4.0"})&&void 0!==n&&n.LOCAL||this.options.local)return"http://localhost:8000/".concat(e,"/");if(this.location){var i=this.options.protocol||"https";return"".concat(i,"://").concat(this.location,"-").concat(e,".stream-io-api.com/").concat(e,"/")}return"api"!==e?"https://".concat(e,".stream-io-api.com/").concat(e,"/"):this.baseUrl}},{key:"on",value:function(e,t){this.handlers[e]=t}},{key:"off",value:function(e){void 0===e?this.handlers={}:delete this.handlers[e]}},{key:"send",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.handlers[e]&&this.handlers[e].apply(this,n)}},{key:"userAgent",value:function(){return void 0===process?"stream-javascript-client-".concat(this.node?"node":"browser","-").concat(n(4147).i8):"stream-javascript-client-".concat(this.node?"node":"browser","-").concat("8.4.0")}},{key:"getReadOnlyToken",value:function(e,t){return ft.Z.validateFeedSlug(e),ft.Z.validateUserId(t),(0,lt.v)(this.apiSecret,"*","read",{feedId:"".concat(e).concat(t),expireTokens:this.expireTokens})}},{key:"getReadWriteToken",value:function(e,t){return ft.Z.validateFeedSlug(e),ft.Z.validateUserId(t),(0,lt.v)(this.apiSecret,"*","*",{feedId:"".concat(e).concat(t),expireTokens:this.expireTokens})}},{key:"feed",value:function(e,t,n){return t instanceof ut.h&&(t=t.id),void 0===n&&(n=this.usingApiSecret?(0,lt.v)(this.apiSecret,"*","*",{feedId:"".concat(e).concat(t)}):this.userToken),new gt.r(this,e,t||this.userId,n)}},{key:"enrichUrl",value:function(e,t){return"".concat(this.getBaseUrl(t)).concat(this.version,"/").concat(e)}},{key:"shouldUseEnrichEndpoint",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(void 0!==e.enrich){var t=e.enrich;return delete e.enrich,t}return this.enrichByDefault||null!=e.ownReactions||null!=e.reactionKindsFilter||null!=e.withRecentReactions||null!=e.withScoreVars||null!=e.withReactionCounts||null!=e.withOwnChildren||null!=e.withUserId}},{key:"enrichKwargs",value:function(e){var t=e.method,n=e.token,r=(0,o.Z)(e,mt);return Et({method:t,url:this.enrichUrl(r.url,r.serviceName),data:r.body,params:Et({api_key:this.apiKey,location:this.group},r.qs||{}),headers:Et({"X-Stream-Client":this.userAgent(),"stream-auth-type":"jwt",Authorization:n},r.headers||{})},r.axiosOptions||{})}},{key:"getFayeAuthorization",value:function(){var e=this;return{incoming:function(e,t){return t(e)},outgoing:function(t,n){if(t.subscription&&e.subscriptions[t.subscription]){var r=e.subscriptions[t.subscription];t.ext={user_id:r.userId,api_key:e.apiKey,signature:r.token}}n(t)}}}},{key:"getFayeClient",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;if(null===this.fayeClient){this.fayeClient=new nt.Client(this.fayeUrl,{timeout:e});var t=this.getFayeAuthorization();this.fayeClient.addExtension(t)}return this.fayeClient}},{key:"upload",value:function(e,t,n,r,i){var o=ft.Z.addFileToFormData(t,n,r);return this.doAxiosRequest("POST",{url:e,body:o,headers:o.getHeaders?o.getHeaders():{},token:this.getOrCreateToken(),axiosOptions:{timeout:0,maxContentLength:1/0,maxBodyLength:1/0,onUploadProgress:i}})}},{key:"get",value:function(e){return this.doAxiosRequest("GET",e)}},{key:"post",value:function(e){return this.doAxiosRequest("POST",e)}},{key:"delete",value:function(e){return this.doAxiosRequest("DELETE",e)}},{key:"put",value:function(e){return this.doAxiosRequest("PUT",e)}},{key:"createUserToken",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._throwMissingApiSecret(),(0,lt.c)(this.apiSecret,e,t,{noTimestamp:!this.expireTokens})}},{key:"updateActivities",value:function(e){if(this._throwMissingApiSecret(),!(e instanceof Array))throw new TypeError("The activities argument should be an Array");var t=(0,lt.v)(this.apiSecret,"activities","*",{feedId:"*",expireTokens:this.expireTokens});return this.post({url:"activities/",body:{activities:e},token:t})}},{key:"updateActivity",value:function(e){return this._throwMissingApiSecret(),this.updateActivities([e])}},{key:"getActivities",value:function(e){var t=e.ids,n=e.foreignIDTimes,r=(0,o.Z)(e,_t),i={};if(t){if(!(t instanceof Array))throw new TypeError("The ids argument should be an Array");i.ids=t.join(",")}else{if(!n)throw new TypeError("Missing ids or foreignIDTimes params");if(!(n instanceof Array))throw new TypeError("The foreignIDTimes argument should be an Array");var s=[],a=[];n.forEach((function(e){if(!(e instanceof Object))throw new TypeError("foreignIDTimes elements should be Objects");s.push(e.foreign_id||e.foreignID),a.push(e.time)})),i.foreign_ids=s.join(","),i.timestamps=a.join(",")}var c=this.userToken;this.usingApiSecret&&(c=(0,lt.v)(this.apiSecret,"activities","*",{feedId:"*",expireTokens:this.expireTokens})),this.replaceReactionOptions(r);var u=this.shouldUseEnrichEndpoint(r)?"enrich/activities/":"activities/";return this.get({url:u,qs:Et(Et({},r),i),token:c})}},{key:"getOrCreateToken",value:function(){return this._getOrCreateToken||(this._getOrCreateToken=this.usingApiSecret?(0,lt.v)(this.apiSecret,"*","*",{feedId:"*"}):this.userToken),this._getOrCreateToken}},{key:"user",value:function(e){return new ut.h(this,e,this.getOrCreateToken())}},{key:"setUser",value:(r=(0,s.Z)(h().mark((function e(t){var n,r;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.usingApiSecret){e.next=2;break}throw new ht.z4("This method can only be used client-side using a user token");case 2:return delete(n=Et({},t)).id,e.next=6,this.currentUser.getOrCreate(n);case 6:return r=e.sent,this.currentUser=r,e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"og",value:function(e){return this.get({url:"og/",qs:{url:e},token:this.getOrCreateToken()})}},{key:"personalizedFeed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.get({url:"enrich/personalization/feed/",qs:e,token:this.getOrCreateToken()})}},{key:"activityPartialUpdate",value:(t=(0,s.Z)(h().mark((function e(t){var n,r,s,a,c;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.activitiesPartialUpdate([t]);case 2:return n=e.sent,r=n.activities,s=(0,o.Z)(n,bt),a=(0,i.Z)(r,1),c=a[0],e.abrupt("return",Et(Et({},c),s));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"activitiesPartialUpdate",value:function(e){if(!(e instanceof Array))throw new TypeError("changes should be an Array");e.forEach((function(e){if(!(e instanceof Object))throw new TypeError("changeset should be and Object");if(e.foreignID&&(e.foreign_id=e.foreignID),void 0===e.id&&(void 0===e.foreign_id||void 0===e.time))throw new TypeError("missing id or foreign_id and time");if(e.set&&!(e.set instanceof Object))throw new TypeError("set field should be an Object");if(e.unset&&!(e.unset instanceof Array))throw new TypeError("unset field should be an Array")}));var t=this.userToken;return this.usingApiSecret&&(t=(0,lt.v)(this.apiSecret,"activities","*",{feedId:"*",expireTokens:this.expireTokens})),this.post({url:"activity/",body:{changes:e},token:t})}}]),e}()},3709:(e,t,n)=>{"use strict";n.d(t,{R:()=>l,n:()=>h});var r=n(5861),i=n(5671),o=n(3144),s=n(4942),a=n(4687),c=n.n(a),u=n(2589),l=function(){function e(t,n,r,o){(0,i.Z)(this,e),(0,s.Z)(this,"id",void 0),(0,s.Z)(this,"collection",void 0),(0,s.Z)(this,"store",void 0),(0,s.Z)(this,"data",void 0),(0,s.Z)(this,"full",void 0),this.collection=n,this.store=t,this.id=r,this.data=o}var t,n,a,u;return(0,o.Z)(e,[{key:"ref",value:function(){return"SO:".concat(this.collection,":").concat(this.id)}},{key:"get",value:(u=(0,r.Z)(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.store.get(this.collection,this.id);case 2:return t=e.sent,this.data=t.data,this.full=t,e.abrupt("return",t);case 6:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"add",value:(a=(0,r.Z)(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.store.add(this.collection,this.id,this.data);case 2:return t=e.sent,this.data=t.data,this.full=t,e.abrupt("return",t);case 6:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"update",value:(n=(0,r.Z)(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.store.update(this.collection,this.id,this.data);case 2:return t=e.sent,this.data=t.data,this.full=t,e.abrupt("return",t);case 6:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"delete",value:(t=(0,r.Z)(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.store.delete(this.collection,this.id);case 2:return t=e.sent,this.data=null,this.full=null,e.abrupt("return",t);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),h=function(){function e(t,n){(0,i.Z)(this,e),(0,s.Z)(this,"client",void 0),(0,s.Z)(this,"token",void 0),(0,s.Z)(this,"buildURL",(function(e,t){var n="collections/".concat(e,"/");return void 0===t?n:"".concat(n).concat(t,"/")})),this.client=t,this.token=n}var t,n,a;return(0,o.Z)(e,[{key:"entry",value:function(e,t,n){return new l(this,e,t,n)}},{key:"get",value:(a=(0,r.Z)(c().mark((function e(t,n){var r,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.get({url:this.buildURL(t,n),token:this.token});case 2:return r=e.sent,(i=this.entry(r.collection,r.id,r.data)).full=r,e.abrupt("return",i);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"add",value:(n=(0,r.Z)(c().mark((function e(t,n,r){var i,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.post({url:this.buildURL(t),body:{id:null===n?void 0:n,data:r},token:this.token});case 2:return i=e.sent,(o=this.entry(i.collection,i.id,i.data)).full=i,e.abrupt("return",o);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"update",value:(t=(0,r.Z)(c().mark((function e(t,n,r){var i,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.put({url:this.buildURL(t,n),body:{data:r},token:this.token});case 2:return i=e.sent,(o=this.entry(i.collection,i.id,i.data)).full=i,e.abrupt("return",o);case 6:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"delete",value:function(e,t){return this.client.delete({url:this.buildURL(e,t),token:this.token})}},{key:"upsert",value:function(e,t){if(!this.client.usingApiSecret)throw new u.z4("This method can only be used server-side using your API Secret");return Array.isArray(t)||(t=[t]),this.client.post({url:"collections/",serviceName:"api",body:{data:(0,s.Z)({},e,t)},token:this.client.getCollectionsToken()})}},{key:"upsertMany",value:function(e){if(!this.client.usingApiSecret)throw new u.z4("This method can only be used server-side using your API Secret");return this.client.post({url:"collections/",serviceName:"api",body:{data:e},token:this.client.getCollectionsToken()})}},{key:"select",value:function(e,t){if(!this.client.usingApiSecret)throw n