@mkody/twitch-emoticons 2.9.6 → 2.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,25 @@
1
- var ts=Object.defineProperty;var mw=Object.getOwnPropertyDescriptor;var yw=Object.getOwnPropertyNames;var fw=Object.prototype.hasOwnProperty;var n=(i,e)=>ts(i,"name",{value:e,configurable:!0});var gw=(i,e)=>()=>(i&&(e=i(i=0)),e);var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),bw=(i,e)=>{for(var t in e)ts(i,t,{get:e[t],enumerable:!0})},xw=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of yw(e))!fw.call(i,a)&&a!==t&&ts(i,a,{get:()=>e[a],enumerable:!(r=mw(e,a))||r.enumerable});return i};var x=i=>xw(ts({},"__esModule",{value:!0}),i);var vr=u((tU,X_)=>{var Mu=class i{static{n(this,"Emote")}constructor(e,t,r){if(new.target.name===i.name)throw new Error("Base Emote class cannot be used");this.fetcher=e.fetcher,this.channel=e,this.id=t,this.type=null,this._setup(r)}_setup(e){this.code=e.code}toLink(){return null}toString(){return this.code}toObject(){return{code:this.code,id:this.id,channel_id:this.channel.channel_id}}};X_.exports=Mu});var Tt=u((iU,Y_)=>{Y_.exports={Twitch:{CDN:n((i,e)=>`https://static-cdn.jtvnw.net/emoticons/v2/${i}/default/dark/${e+1}.0`,"CDN")},BTTV:{Global:"https://api.betterttv.net/3/cached/emotes/global",Channel:n(i=>`https://api.betterttv.net/3/cached/users/twitch/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.betterttv.net/emote/${i}/${e+1}x.webp`,"CDN")},SevenTV:{Global:"https://7tv.io/v3/emote-sets/global",Channel:n(i=>`https://7tv.io/v3/users/twitch/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.7tv.app/emote/${i}/${e}`,"CDN")},FFZ:{sets:{Global:3,Modifiers:1532818},Set:n(i=>`https://api.frankerfacez.com/v1/set/${i}`,"Set"),Channel:n(i=>`https://api.frankerfacez.com/v1/room/id/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.frankerfacez.com/emote/${i}/${e}`,"CDN"),CDNAnimated:n((i,e)=>`https://cdn.frankerfacez.com/emote/${i}/animated/${e}.webp`,"CDNAnimated")},Templates:{html:'<img alt="{name}" title="{name}" class="twitch-emote twitch-emote-{size}" src="{link}">',markdown:'![{name}]({link} "{name}")',bbcode:"[img]{link}[/img]",plain:"{link}"}}});var Fu=u((aU,em)=>{var ww=vr(),vw=Tt(),Lu=class i extends ww{static{n(this,"BTTVEmote")}constructor(e,t,r){super(e,t,r),this.type="bttv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.ownerName="user"in e?e.user.name:null,this.animated=e.animated,this.imageType="webp"}toLink(e=0){return vw.BTTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,ownerName:this.ownerName,type:this.type})}static fromObject(e,t=null){return new i(t,e.id,{code:e.code,animated:e.animated,user:{name:e.ownerName}})}};em.exports=Lu});var rs=u((oU,tm)=>{var Nu=class extends Map{static{n(this,"Collection")}find(e,t){if(typeof e=="string"){if(typeof t>"u")return null;for(let r of this.values())if(r[e]===t)return r;return null}if(typeof e=="function"){let r=0;for(let a of this.values()){if(e(a,r,this))return a;r++}return null}return null}filter(e,t){t&&(e=e.bind(t));let r=new this.constructor,a=0;for(let[s,o]of this)e(o,a,this)&&r.set(s,o),a++;return r}map(e,t){t&&(e=e.bind(t));let r=new Array(this.size),a=0;for(let s of this.values())r[a]=e(s,a,this),a++;return r}};tm.exports=Nu});var Gu=u((uU,rm)=>{var Sw=rs(),Qu=class{static{n(this,"Channel")}constructor(e,t){this.fetcher=e,this.channel_id=t,this.emotes=new Sw}fetchBTTVEmotes(){return this.fetcher.fetchBTTVEmotes(this.id)}fetchFFZEmotes(){return this.fetcher.fetchFFZEmotes(this.id)}fetchSevenTVEmotes(){return this.fetcher.fetchSevenTVEmotes(this.id)}};rm.exports=Qu});var Vu=u((dU,nm)=>{var Hw=vr(),im=Tt(),Wu=class i extends Hw{static{n(this,"FFZEmote")}constructor(e,t,r){super(e,t,r),this.type="ffz"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e?e.owner.name:null,this.sizes="animated"in e?Object.keys(e.animated):Object.keys(e.urls),this.animated="animated"in e,this.imageType="animated"in e?"webp":"png",this.modifier=e.modifier&&(e.modifier_flags&1)!==0}toLink(e=0){return e=this.sizes[e],this.animated?im.FFZ.CDNAnimated(this.id,e):im.FFZ.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,modifier:this.modifier})}static fromObject(e,t=null){let r=e.sizes.reduce((a,s)=>(a[s]=s,a),{});return new i(t,e.id,{code:e.code,name:e.code,urls:r,...e.animated?{animated:r}:{},owner:{name:e.ownerName},modifier:e.modifier,modifier_flags:e.modifier})}};nm.exports=Wu});var zu=u((pU,am)=>{var Cw=vr(),qw=Tt(),$u=class i extends Cw{static{n(this,"SevenTVEmote")}constructor(e,t,r){super(e,t,r),this.type="7tv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e.data?e.data.owner.display_name:null,this.sizes=e.data.host.files.filter(t=>t.format===this.channel.format.toUpperCase()).map(t=>t.name),this.animated=e.data.animated,this.imageType=this.channel.format}toLink(e=0){return e=this.sizes[e],qw.SevenTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,imageType:this.imageType})}static fromObject(e,t){let r=e.sizes.map(a=>({format:t.format.toUpperCase(),name:a}));return new i(t,e.id,{code:e.code,name:e.code,data:{animated:e.animated,owner:{display_name:e.ownerName},host:{files:r}}})}};am.exports=$u});var Ju=u((mU,sm)=>{var Ew=vr(),Pw=Tt(),Ku=class i extends Ew{static{n(this,"TwitchEmote")}constructor(e,t,r){super(e,t,r),this.type="twitch"}get owner(){return this.channel}_setup(e){super._setup(e),this.set=e.emoticon_set,this.animated="animated"in e.formats,this.imageType="animated"in e.formats?"gif":"png"}toLink(e=0){return Pw.Twitch.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,set:this.set,type:this.type})}static fromObject(e,t=null){return new i(t,e.id,{code:e.code,animated:e.animated,emoticon_set:e.set,formats:e.animated?{animated:e.animated}:{}})}};sm.exports=Ku});var Gm=u((fU,Qm)=>{"use strict";function Sm(i,e){return n(function(){return i.apply(e,arguments)},"wrap")}n(Sm,"bind");var{toString:Aw}=Object.prototype,{getPrototypeOf:oc}=Object,{iterator:us,toStringTag:Hm}=Symbol,cs=(i=>e=>{let t=Aw.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ye=n(i=>(i=i.toLowerCase(),e=>cs(e)===i),"kindOfTest"),ds=n(i=>e=>typeof e===i,"typeOfTest"),{isArray:qr}=Array,Sr=ds("undefined");function pi(i){return i!==null&&!Sr(i)&&i.constructor!==null&&!Sr(i.constructor)&&qe(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}n(pi,"isBuffer");var Cm=Ye("ArrayBuffer");function Dw(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Cm(i.buffer),e}n(Dw,"isArrayBufferView");var Iw=ds("string"),qe=ds("function"),qm=ds("number"),_i=n(i=>i!==null&&typeof i=="object","isObject"),Tw=n(i=>i===!0||i===!1,"isBoolean"),ns=n(i=>{if(cs(i)!=="object")return!1;let e=oc(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Hm in i)&&!(us in i)},"isPlainObject"),Rw=n(i=>{if(!_i(i)||pi(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},"isEmptyObject"),Uw=Ye("Date"),Ow=Ye("File"),Bw=Ye("Blob"),jw=Ye("FileList"),kw=n(i=>_i(i)&&qe(i.pipe),"isStream"),Mw=n(i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||qe(i.append)&&((e=cs(i))==="formdata"||e==="object"&&qe(i.toString)&&i.toString()==="[object FormData]"))},"isFormData"),Lw=Ye("URLSearchParams"),[Fw,Nw,Qw,Gw]=["ReadableStream","Request","Response","Headers"].map(Ye),Ww=n(i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function mi(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let r,a;if(typeof i!="object"&&(i=[i]),qr(i))for(r=0,a=i.length;r<a;r++)e.call(null,i[r],r,i);else{if(pi(i))return;let s=t?Object.getOwnPropertyNames(i):Object.keys(i),o=s.length,l;for(r=0;r<o;r++)l=s[r],e.call(null,i[l],l,i)}}n(mi,"forEach");function Em(i,e){if(pi(i))return null;e=e.toLowerCase();let t=Object.keys(i),r=t.length,a;for(;r-- >0;)if(a=t[r],e===a.toLowerCase())return a;return null}n(Em,"findKey");var tr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Pm=n(i=>!Sr(i)&&i!==tr,"isContextDefined");function ec(){let{caseless:i,skipUndefined:e}=Pm(this)&&this||{},t={},r=n((a,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;let o=i&&Em(t,s)||s;ns(t[o])&&ns(a)?t[o]=ec(t[o],a):ns(a)?t[o]=ec({},a):qr(a)?t[o]=a.slice():(!e||!Sr(a))&&(t[o]=a)},"assignValue");for(let a=0,s=arguments.length;a<s;a++)arguments[a]&&mi(arguments[a],r);return t}n(ec,"merge");var Vw=n((i,e,t,{allOwnKeys:r}={})=>(mi(e,(a,s)=>{t&&qe(a)?Object.defineProperty(i,s,{value:Sm(a,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,s,{value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),i),"extend"),$w=n(i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),"stripBOM"),zw=n((i,e,t,r)=>{i.prototype=Object.create(e.prototype,r),Object.defineProperty(i.prototype,"constructor",{value:i,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},"inherits"),Kw=n((i,e,t,r)=>{let a,s,o,l={};if(e=e||{},i==null)return e;do{for(a=Object.getOwnPropertyNames(i),s=a.length;s-- >0;)o=a[s],(!r||r(o,i,e))&&!l[o]&&(e[o]=i[o],l[o]=!0);i=t!==!1&&oc(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},"toFlatObject"),Jw=n((i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;let r=i.indexOf(e,t);return r!==-1&&r===t},"endsWith"),Zw=n(i=>{if(!i)return null;if(qr(i))return i;let e=i.length;if(!qm(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},"toArray"),Xw=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&oc(Uint8Array)),Yw=n((i,e)=>{let r=(i&&i[us]).call(i),a;for(;(a=r.next())&&!a.done;){let s=a.value;e.call(i,s[0],s[1])}},"forEachEntry"),ev=n((i,e)=>{let t,r=[];for(;(t=i.exec(e))!==null;)r.push(t);return r},"matchAll"),tv=Ye("HTMLFormElement"),rv=n(i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,n(function(t,r,a){return r.toUpperCase()+a},"replacer")),"toCamelCase"),om=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),iv=Ye("RegExp"),Am=n((i,e)=>{let t=Object.getOwnPropertyDescriptors(i),r={};mi(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(r[s]=o||a)}),Object.defineProperties(i,r)},"reduceDescriptors"),nv=n(i=>{Am(i,(e,t)=>{if(qe(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=i[t];if(qe(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),av=n((i,e)=>{let t={},r=n(a=>{a.forEach(s=>{t[s]=!0})},"define");return qr(i)?r(i):r(String(i).split(e)),t},"toObjectSet"),sv=n(()=>{},"noop"),ov=n((i,e)=>i!=null&&Number.isFinite(i=+i)?i:e,"toFiniteNumber");function lv(i){return!!(i&&qe(i.append)&&i[Hm]==="FormData"&&i[us])}n(lv,"isSpecCompliantForm");var uv=n(i=>{let e=new Array(10),t=n((r,a)=>{if(_i(r)){if(e.indexOf(r)>=0)return;if(pi(r))return r;if(!("toJSON"in r)){e[a]=r;let s=qr(r)?[]:{};return mi(r,(o,l)=>{let d=t(o,a+1);!Sr(d)&&(s[l]=d)}),e[a]=void 0,s}}return r},"visit");return t(i,0)},"toJSONObject"),cv=Ye("AsyncFunction"),dv=n(i=>i&&(_i(i)||qe(i))&&qe(i.then)&&qe(i.catch),"isThenable"),Dm=((i,e)=>i?setImmediate:e?((t,r)=>(tr.addEventListener("message",({source:a,data:s})=>{a===tr&&s===t&&r.length&&r.shift()()},!1),a=>{r.push(a),tr.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",qe(tr.postMessage)),hv=typeof queueMicrotask<"u"?queueMicrotask.bind(tr):typeof process<"u"&&process.nextTick||Dm,pv=n(i=>i!=null&&qe(i[us]),"isIterable"),m={isArray:qr,isArrayBuffer:Cm,isBuffer:pi,isFormData:Mw,isArrayBufferView:Dw,isString:Iw,isNumber:qm,isBoolean:Tw,isObject:_i,isPlainObject:ns,isEmptyObject:Rw,isReadableStream:Fw,isRequest:Nw,isResponse:Qw,isHeaders:Gw,isUndefined:Sr,isDate:Uw,isFile:Ow,isBlob:Bw,isRegExp:iv,isFunction:qe,isStream:kw,isURLSearchParams:Lw,isTypedArray:Xw,isFileList:jw,forEach:mi,merge:ec,extend:Vw,trim:Ww,stripBOM:$w,inherits:zw,toFlatObject:Kw,kindOf:cs,kindOfTest:Ye,endsWith:Jw,toArray:Zw,forEachEntry:Yw,matchAll:ev,isHTMLForm:tv,hasOwnProperty:om,hasOwnProp:om,reduceDescriptors:Am,freezeMethods:nv,toObjectSet:av,toCamelCase:rv,noop:sv,toFiniteNumber:ov,findKey:Em,global:tr,isContextDefined:Pm,isSpecCompliantForm:lv,toJSONObject:uv,isAsyncFn:cv,isThenable:dv,setImmediate:Dm,asap:hv,isIterable:pv},Ce=class i extends Error{static{n(this,"AxiosError")}static from(e,t,r,a,s,o){let l=new i(e.message,t||e.code,r,a,s);return l.cause=e,l.name=e.name,o&&Object.assign(l,o),l}constructor(e,t,r,a,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),a&&(this.request=a),s&&(this.response=s,this.status=s.status)}toJSON(){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:m.toJSONObject(this.config),code:this.code,status:this.status}}};Ce.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Ce.ERR_BAD_OPTION="ERR_BAD_OPTION";Ce.ECONNABORTED="ECONNABORTED";Ce.ETIMEDOUT="ETIMEDOUT";Ce.ERR_NETWORK="ERR_NETWORK";Ce.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Ce.ERR_DEPRECATED="ERR_DEPRECATED";Ce.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Ce.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Ce.ERR_CANCELED="ERR_CANCELED";Ce.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Ce.ERR_INVALID_URL="ERR_INVALID_URL";var O=Ce,_v=null;function tc(i){return m.isPlainObject(i)||m.isArray(i)}n(tc,"isVisitable");function Im(i){return m.endsWith(i,"[]")?i.slice(0,-2):i}n(Im,"removeBrackets");function lm(i,e,t){return i?i.concat(e).map(n(function(a,s){return a=Im(a),!t&&s?"["+a+"]":a},"each")).join(t?".":""):e}n(lm,"renderKey");function mv(i){return m.isArray(i)&&!i.some(tc)}n(mv,"isFlatArray");var yv=m.toFlatObject(m,{},null,n(function(e){return/^is[A-Z]/.test(e)},"filter"));function hs(i,e,t){if(!m.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=m.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,n(function(q,v){return!m.isUndefined(v[q])},"defined"));let r=t.metaTokens,a=t.visitor||h,s=t.dots,o=t.indexes,d=(t.Blob||typeof Blob<"u"&&Blob)&&m.isSpecCompliantForm(e);if(!m.isFunction(a))throw new TypeError("visitor must be a function");function p(y){if(y===null)return"";if(m.isDate(y))return y.toISOString();if(m.isBoolean(y))return y.toString();if(!d&&m.isBlob(y))throw new O("Blob is not supported. Use a Buffer instead.");return m.isArrayBuffer(y)||m.isTypedArray(y)?d&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}n(p,"convertValue");function h(y,q,v){let U=y;if(y&&!v&&typeof y=="object"){if(m.endsWith(q,"{}"))q=r?q:q.slice(0,-2),y=JSON.stringify(y);else if(m.isArray(y)&&mv(y)||(m.isFileList(y)||m.endsWith(q,"[]"))&&(U=m.toArray(y)))return q=Im(q),U.forEach(n(function(z,k){!(m.isUndefined(z)||z===null)&&e.append(o===!0?lm([q],k,s):o===null?q:q+"[]",p(z))},"each")),!1}return tc(y)?!0:(e.append(lm(v,q,s),p(y)),!1)}n(h,"defaultVisitor");let w=[],E=Object.assign(yv,{defaultVisitor:h,convertValue:p,isVisitable:tc});function P(y,q){if(!m.isUndefined(y)){if(w.indexOf(y)!==-1)throw Error("Circular reference detected in "+q.join("."));w.push(y),m.forEach(y,n(function(U,be){(!(m.isUndefined(U)||U===null)&&a.call(e,U,m.isString(be)?be.trim():be,q,E))===!0&&P(U,q?q.concat(be):[be])},"each")),w.pop()}}if(n(P,"build"),!m.isObject(i))throw new TypeError("data must be an object");return P(i),e}n(hs,"toFormData");function um(i){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,n(function(r){return e[r]},"replacer"))}n(um,"encode$1");function lc(i,e){this._pairs=[],i&&hs(i,this,e)}n(lc,"AxiosURLSearchParams");var Tm=lc.prototype;Tm.append=n(function(e,t){this._pairs.push([e,t])},"append");Tm.toString=n(function(e){let t=e?function(r){return e.call(this,r,um)}:um;return this._pairs.map(n(function(a){return t(a[0])+"="+t(a[1])},"each"),"").join("&")},"toString");function fv(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}n(fv,"encode");function Rm(i,e,t){if(!e)return i;let r=t&&t.encode||fv,a=m.isFunction(t)?{serialize:t}:t,s=a&&a.serialize,o;if(s?o=s(e,a):o=m.isURLSearchParams(e)?e.toString():new lc(e,a).toString(r),o){let l=i.indexOf("#");l!==-1&&(i=i.slice(0,l)),i+=(i.indexOf("?")===-1?"?":"&")+o}return i}n(Rm,"buildURL");var rc=class{static{n(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){m.forEach(this.handlers,n(function(r){r!==null&&e(r)},"forEachHandler"))}},cm=rc,uc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},gv=typeof URLSearchParams<"u"?URLSearchParams:lc,bv=typeof FormData<"u"?FormData:null,xv=typeof Blob<"u"?Blob:null,wv={isBrowser:!0,classes:{URLSearchParams:gv,FormData:bv,Blob:xv},protocols:["http","https","file","blob","url","data"]},cc=typeof window<"u"&&typeof document<"u",ic=typeof navigator=="object"&&navigator||void 0,vv=cc&&(!ic||["ReactNative","NativeScript","NS"].indexOf(ic.product)<0),Sv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hv=cc&&window.location.href||"http://localhost",Cv=Object.freeze({__proto__:null,hasBrowserEnv:cc,hasStandardBrowserWebWorkerEnv:Sv,hasStandardBrowserEnv:vv,navigator:ic,origin:Hv}),ve={...Cv,...wv};function qv(i,e){return hs(i,new ve.classes.URLSearchParams,{visitor:n(function(t,r,a,s){return ve.isNode&&m.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},"visitor"),...e})}n(qv,"toURLEncodedForm");function Ev(i){return m.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}n(Ev,"parsePropPath");function Pv(i){let e={},t=Object.keys(i),r,a=t.length,s;for(r=0;r<a;r++)s=t[r],e[s]=i[s];return e}n(Pv,"arrayToObject");function Um(i){function e(t,r,a,s){let o=t[s++];if(o==="__proto__")return!0;let l=Number.isFinite(+o),d=s>=t.length;return o=!o&&m.isArray(a)?a.length:o,d?(m.hasOwnProp(a,o)?a[o]=[a[o],r]:a[o]=r,!l):((!a[o]||!m.isObject(a[o]))&&(a[o]=[]),e(t,r,a[o],s)&&m.isArray(a[o])&&(a[o]=Pv(a[o])),!l)}if(n(e,"buildPath"),m.isFormData(i)&&m.isFunction(i.entries)){let t={};return m.forEachEntry(i,(r,a)=>{e(Ev(r),a,t,0)}),t}return null}n(Um,"formDataToJSON");function Av(i,e,t){if(m.isString(i))try{return(e||JSON.parse)(i),m.trim(i)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(i)}n(Av,"stringifySafely");var dc={transitional:uc,adapter:["xhr","http","fetch"],transformRequest:[n(function(e,t){let r=t.getContentType()||"",a=r.indexOf("application/json")>-1,s=m.isObject(e);if(s&&m.isHTMLForm(e)&&(e=new FormData(e)),m.isFormData(e))return a?JSON.stringify(Um(e)):e;if(m.isArrayBuffer(e)||m.isBuffer(e)||m.isStream(e)||m.isFile(e)||m.isBlob(e)||m.isReadableStream(e))return e;if(m.isArrayBufferView(e))return e.buffer;if(m.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return qv(e,this.formSerializer).toString();if((l=m.isFileList(e))||r.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return hs(l?{"files[]":e}:e,d&&new d,this.formSerializer)}}return s||a?(t.setContentType("application/json",!1),Av(e)):e},"transformRequest")],transformResponse:[n(function(e){let t=this.transitional||dc.transitional,r=t&&t.forcedJSONParsing,a=this.responseType==="json";if(m.isResponse(e)||m.isReadableStream(e))return e;if(e&&m.isString(e)&&(r&&!this.responseType||a)){let o=!(t&&t.silentJSONParsing)&&a;try{return JSON.parse(e,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?O.from(l,O.ERR_BAD_RESPONSE,this,null,this.response):l}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ve.classes.FormData,Blob:ve.classes.Blob},validateStatus:n(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};m.forEach(["delete","get","head","post","put","patch"],i=>{dc.headers[i]={}});var hc=dc,Dv=m.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"]),Iv=n(i=>{let e={},t,r,a;return i&&i.split(`
2
- `).forEach(n(function(o){a=o.indexOf(":"),t=o.substring(0,a).trim().toLowerCase(),r=o.substring(a+1).trim(),!(!t||e[t]&&Dv[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)},"parser")),e},"parseHeaders"),dm=Symbol("internals");function hi(i){return i&&String(i).trim().toLowerCase()}n(hi,"normalizeHeader");function as(i){return i===!1||i==null?i:m.isArray(i)?i.map(as):String(i)}n(as,"normalizeValue");function Tv(i){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=t.exec(i);)e[r[1]]=r[2];return e}n(Tv,"parseTokens");var Rv=n(i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim()),"isValidHeaderName");function Zu(i,e,t,r,a){if(m.isFunction(r))return r.call(this,e,t);if(a&&(e=t),!!m.isString(e)){if(m.isString(r))return e.indexOf(r)!==-1;if(m.isRegExp(r))return r.test(e)}}n(Zu,"matchHeaderValue");function Uv(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}n(Uv,"formatHeader");function Ov(i,e){let t=m.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(i,r+t,{value:n(function(a,s,o){return this[r].call(this,e,a,s,o)},"value"),configurable:!0})})}n(Ov,"buildAccessors");var Hr=class{static{n(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,r){let a=this;function s(l,d,p){let h=hi(d);if(!h)throw new Error("header name must be a non-empty string");let w=m.findKey(a,h);(!w||a[w]===void 0||p===!0||p===void 0&&a[w]!==!1)&&(a[w||d]=as(l))}n(s,"setHeader");let o=n((l,d)=>m.forEach(l,(p,h)=>s(p,h,d)),"setHeaders");if(m.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(m.isString(e)&&(e=e.trim())&&!Rv(e))o(Iv(e),t);else if(m.isObject(e)&&m.isIterable(e)){let l={},d,p;for(let h of e){if(!m.isArray(h))throw TypeError("Object iterator must return a key-value pair");l[p=h[0]]=(d=l[p])?m.isArray(d)?[...d,h[1]]:[d,h[1]]:h[1]}o(l,t)}else e!=null&&s(t,e,r);return this}get(e,t){if(e=hi(e),e){let r=m.findKey(this,e);if(r){let a=this[r];if(!t)return a;if(t===!0)return Tv(a);if(m.isFunction(t))return t.call(this,a,r);if(m.isRegExp(t))return t.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=hi(e),e){let r=m.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Zu(this,this[r],r,t)))}return!1}delete(e,t){let r=this,a=!1;function s(o){if(o=hi(o),o){let l=m.findKey(r,o);l&&(!t||Zu(r,r[l],l,t))&&(delete r[l],a=!0)}}return n(s,"deleteHeader"),m.isArray(e)?e.forEach(s):s(e),a}clear(e){let t=Object.keys(this),r=t.length,a=!1;for(;r--;){let s=t[r];(!e||Zu(this,this[s],s,e,!0))&&(delete this[s],a=!0)}return a}normalize(e){let t=this,r={};return m.forEach(this,(a,s)=>{let o=m.findKey(r,s);if(o){t[o]=as(a),delete t[s];return}let l=e?Uv(s):String(s).trim();l!==s&&delete t[s],t[l]=as(a),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return m.forEach(this,(r,a)=>{r!=null&&r!==!1&&(t[a]=e&&m.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let r=new this(e);return t.forEach(a=>r.set(a)),r}static accessor(e){let r=(this[dm]=this[dm]={accessors:{}}).accessors,a=this.prototype;function s(o){let l=hi(o);r[l]||(Ov(a,o),r[l]=!0)}return n(s,"defineAccessor"),m.isArray(e)?e.forEach(s):s(e),this}};Hr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);m.reduceDescriptors(Hr.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:n(()=>i,"get"),set(r){this[t]=r}}});m.freezeMethods(Hr);var Xe=Hr;function Xu(i,e){let t=this||hc,r=e||t,a=Xe.from(r.headers),s=r.data;return m.forEach(i,n(function(l){s=l.call(t,s,a.normalize(),e?e.status:void 0)},"transform")),a.normalize(),s}n(Xu,"transformData");function Om(i){return!!(i&&i.__CANCEL__)}n(Om,"isCancel");var nc=class extends O{static{n(this,"CanceledError")}constructor(e,t,r){super(e??"canceled",O.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}},yi=nc;function Bm(i,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?i(t):e(new O("Request failed with status code "+t.status,[O.ERR_BAD_REQUEST,O.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}n(Bm,"settle");function Bv(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}n(Bv,"parseProtocol");function jv(i,e){i=i||10;let t=new Array(i),r=new Array(i),a=0,s=0,o;return e=e!==void 0?e:1e3,n(function(d){let p=Date.now(),h=r[s];o||(o=p),t[a]=d,r[a]=p;let w=s,E=0;for(;w!==a;)E+=t[w++],w=w%i;if(a=(a+1)%i,a===s&&(s=(s+1)%i),p-o<e)return;let P=h&&p-h;return P?Math.round(E*1e3/P):void 0},"push")}n(jv,"speedometer");function kv(i,e){let t=0,r=1e3/e,a,s,o=n((p,h=Date.now())=>{t=h,a=null,s&&(clearTimeout(s),s=null),i(...p)},"invoke");return[n((...p)=>{let h=Date.now(),w=h-t;w>=r?o(p,h):(a=p,s||(s=setTimeout(()=>{s=null,o(a)},r-w)))},"throttled"),n(()=>a&&o(a),"flush")]}n(kv,"throttle");var ls=n((i,e,t=3)=>{let r=0,a=jv(50,250);return kv(s=>{let o=s.loaded,l=s.lengthComputable?s.total:void 0,d=o-r,p=a(d),h=o<=l;r=o;let w={loaded:o,total:l,progress:l?o/l:void 0,bytes:d,rate:p||void 0,estimated:p&&l&&h?(l-o)/p:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};i(w)},t)},"progressEventReducer"),hm=n((i,e)=>{let t=i!=null;return[r=>e[0]({lengthComputable:t,total:i,loaded:r}),e[1]]},"progressEventDecorator"),pm=n(i=>(...e)=>m.asap(()=>i(...e)),"asyncDecorator"),Mv=ve.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,ve.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(ve.origin),ve.navigator&&/(msie|trident)/i.test(ve.navigator.userAgent)):()=>!0,Lv=ve.hasStandardBrowserEnv?{write(i,e,t,r,a,s,o){if(typeof document>"u")return;let l=[`${i}=${encodeURIComponent(e)}`];m.isNumber(t)&&l.push(`expires=${new Date(t).toUTCString()}`),m.isString(r)&&l.push(`path=${r}`),m.isString(a)&&l.push(`domain=${a}`),s===!0&&l.push("secure"),m.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(i){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Fv(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}n(Fv,"isAbsoluteURL");function Nv(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}n(Nv,"combineURLs");function jm(i,e,t){let r=!Fv(e);return i&&(r||t==!1)?Nv(i,e):e}n(jm,"buildFullPath");var _m=n(i=>i instanceof Xe?{...i}:i,"headersToObject");function rr(i,e){e=e||{};let t={};function r(p,h,w,E){return m.isPlainObject(p)&&m.isPlainObject(h)?m.merge.call({caseless:E},p,h):m.isPlainObject(h)?m.merge({},h):m.isArray(h)?h.slice():h}n(r,"getMergedValue");function a(p,h,w,E){if(m.isUndefined(h)){if(!m.isUndefined(p))return r(void 0,p,w,E)}else return r(p,h,w,E)}n(a,"mergeDeepProperties");function s(p,h){if(!m.isUndefined(h))return r(void 0,h)}n(s,"valueFromConfig2");function o(p,h){if(m.isUndefined(h)){if(!m.isUndefined(p))return r(void 0,p)}else return r(void 0,h)}n(o,"defaultToConfig2");function l(p,h,w){if(w in e)return r(p,h);if(w in i)return r(void 0,p)}n(l,"mergeDirectKeys");let d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:n((p,h,w)=>a(_m(p),_m(h),w,!0),"headers")};return m.forEach(Object.keys({...i,...e}),n(function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;let w=m.hasOwnProp(d,h)?d[h]:a,E=w(i[h],e[h],h);m.isUndefined(E)&&w!==l||(t[h]=E)},"computeConfigValue")),t}n(rr,"mergeConfig");var km=n(i=>{let e=rr({},i),{data:t,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:l}=e;if(e.headers=o=Xe.from(o),e.url=Rm(jm(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),m.isFormData(t)){if(ve.hasStandardBrowserEnv||ve.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(m.isFunction(t.getHeaders)){let d=t.getHeaders(),p=["content-type","content-length"];Object.entries(d).forEach(([h,w])=>{p.includes(h.toLowerCase())&&o.set(h,w)})}}if(ve.hasStandardBrowserEnv&&(r&&m.isFunction(r)&&(r=r(e)),r||r!==!1&&Mv(e.url))){let d=a&&s&&Lv.read(s);d&&o.set(a,d)}return e},"resolveConfig"),Qv=typeof XMLHttpRequest<"u",Gv=Qv&&function(i){return new Promise(n(function(t,r){let a=km(i),s=a.data,o=Xe.from(a.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:p}=a,h,w,E,P,y;function q(){P&&P(),y&&y(),a.cancelToken&&a.cancelToken.unsubscribe(h),a.signal&&a.signal.removeEventListener("abort",h)}n(q,"done");let v=new XMLHttpRequest;v.open(a.method.toUpperCase(),a.url,!0),v.timeout=a.timeout;function U(){if(!v)return;let z=Xe.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),Oe={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:z,config:i,request:v};Bm(n(function(J){t(J),q()},"_resolve"),n(function(J){r(J),q()},"_reject"),Oe),v=null}n(U,"onloadend"),"onloadend"in v?v.onloadend=U:v.onreadystatechange=n(function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(U)},"handleLoad"),v.onabort=n(function(){v&&(r(new O("Request aborted",O.ECONNABORTED,i,v)),v=null)},"handleAbort"),v.onerror=n(function(k){let Oe=k&&k.message?k.message:"Network Error",ft=new O(Oe,O.ERR_NETWORK,i,v);ft.event=k||null,r(ft),v=null},"handleError"),v.ontimeout=n(function(){let k=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded",Oe=a.transitional||uc;a.timeoutErrorMessage&&(k=a.timeoutErrorMessage),r(new O(k,Oe.clarifyTimeoutError?O.ETIMEDOUT:O.ECONNABORTED,i,v)),v=null},"handleTimeout"),s===void 0&&o.setContentType(null),"setRequestHeader"in v&&m.forEach(o.toJSON(),n(function(k,Oe){v.setRequestHeader(Oe,k)},"setRequestHeader")),m.isUndefined(a.withCredentials)||(v.withCredentials=!!a.withCredentials),l&&l!=="json"&&(v.responseType=a.responseType),p&&([E,y]=ls(p,!0),v.addEventListener("progress",E)),d&&v.upload&&([w,P]=ls(d),v.upload.addEventListener("progress",w),v.upload.addEventListener("loadend",P)),(a.cancelToken||a.signal)&&(h=n(z=>{v&&(r(!z||z.type?new yi(null,i,v):z),v.abort(),v=null)},"onCanceled"),a.cancelToken&&a.cancelToken.subscribe(h),a.signal&&(a.signal.aborted?h():a.signal.addEventListener("abort",h)));let be=Bv(a.url);if(be&&ve.protocols.indexOf(be)===-1){r(new O("Unsupported protocol "+be+":",O.ERR_BAD_REQUEST,i));return}v.send(s||null)},"dispatchXhrRequest"))},Wv=n((i,e)=>{let{length:t}=i=i?i.filter(Boolean):[];if(e||t){let r=new AbortController,a,s=n(function(p){if(!a){a=!0,l();let h=p instanceof Error?p:this.reason;r.abort(h instanceof O?h:new yi(h instanceof Error?h.message:h))}},"onabort"),o=e&&setTimeout(()=>{o=null,s(new O(`timeout of ${e}ms exceeded`,O.ETIMEDOUT))},e),l=n(()=>{i&&(o&&clearTimeout(o),o=null,i.forEach(p=>{p.unsubscribe?p.unsubscribe(s):p.removeEventListener("abort",s)}),i=null)},"unsubscribe");i.forEach(p=>p.addEventListener("abort",s));let{signal:d}=r;return d.unsubscribe=()=>m.asap(l),d}},"composeSignals"),Vv=Wv,$v=n(function*(i,e){let t=i.byteLength;if(!e||t<e){yield i;return}let r=0,a;for(;r<t;)a=r+e,yield i.slice(r,a),r=a},"streamChunk"),zv=n(async function*(i,e){for await(let t of Kv(i))yield*$v(t,e)},"readBytes"),Kv=n(async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}let e=i.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},"readStream"),mm=n((i,e,t,r)=>{let a=zv(i,e),s=0,o,l=n(d=>{o||(o=!0,r&&r(d))},"_onFinish");return new ReadableStream({async pull(d){try{let{done:p,value:h}=await a.next();if(p){l(),d.close();return}let w=h.byteLength;if(t){let E=s+=w;t(E)}d.enqueue(new Uint8Array(h))}catch(p){throw l(p),p}},cancel(d){return l(d),a.return()}},{highWaterMark:2})},"trackStream"),ym=64*1024,{isFunction:is}=m,Jv=(({Request:i,Response:e})=>({Request:i,Response:e}))(m.global),{ReadableStream:fm,TextEncoder:gm}=m.global,bm=n((i,...e)=>{try{return!!i(...e)}catch{return!1}},"test"),Zv=n(i=>{i=m.merge.call({skipUndefined:!0},Jv,i);let{fetch:e,Request:t,Response:r}=i,a=e?is(e):typeof fetch=="function",s=is(t),o=is(r);if(!a)return!1;let l=a&&is(fm),d=a&&(typeof gm=="function"?(y=>q=>y.encode(q))(new gm):async y=>new Uint8Array(await new t(y).arrayBuffer())),p=s&&l&&bm(()=>{let y=!1,q=new t(ve.origin,{body:new fm,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!q}),h=o&&l&&bm(()=>m.isReadableStream(new r("").body)),w={stream:h&&(y=>y.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!w[y]&&(w[y]=(q,v)=>{let U=q&&q[y];if(U)return U.call(q);throw new O(`Response type '${y}' is not supported`,O.ERR_NOT_SUPPORT,v)})});let E=n(async y=>{if(y==null)return 0;if(m.isBlob(y))return y.size;if(m.isSpecCompliantForm(y))return(await new t(ve.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(m.isArrayBufferView(y)||m.isArrayBuffer(y))return y.byteLength;if(m.isURLSearchParams(y)&&(y=y+""),m.isString(y))return(await d(y)).byteLength},"getBodyLength"),P=n(async(y,q)=>{let v=m.toFiniteNumber(y.getContentLength());return v??E(q)},"resolveBodyLength");return async y=>{let{url:q,method:v,data:U,signal:be,cancelToken:z,timeout:k,onDownloadProgress:Oe,onUploadProgress:ft,responseType:J,headers:di,withCredentials:At="same-origin",fetchOptions:f}=km(y),H=e||fetch;J=J?(J+"").toLowerCase():"text";let I=Vv([be,z&&z.toAbortSignal()],k),X=null,$=I&&I.unsubscribe&&(()=>{I.unsubscribe()}),B;try{if(ft&&p&&v!=="get"&&v!=="head"&&(B=await P(di,U))!==0){let It=new t(q,{method:"POST",body:U,duplex:"half"}),wr;if(m.isFormData(U)&&(wr=It.headers.get("content-type"))&&di.setContentType(wr),It.body){let[ku,es]=hm(B,ls(pm(ft)));U=mm(It.body,ym,ku,es)}}m.isString(At)||(At=At?"include":"omit");let he=s&&"credentials"in t.prototype,Dt={...f,signal:I,method:v.toUpperCase(),headers:di.normalize().toJSON(),body:U,duplex:"half",credentials:he?At:void 0};X=s&&new t(q,Dt);let Fe=await(s?H(X,f):H(q,Dt)),J_=h&&(J==="stream"||J==="response");if(h&&(Oe||J_&&$)){let It={};["status","statusText","headers"].forEach(Z_=>{It[Z_]=Fe[Z_]});let wr=m.toFiniteNumber(Fe.headers.get("content-length")),[ku,es]=Oe&&hm(wr,ls(pm(Oe),!0))||[];Fe=new r(mm(Fe.body,ym,ku,()=>{es&&es(),$&&$()}),It)}J=J||"text";let _w=await w[m.findKey(w,J)||"text"](Fe,y);return!J_&&$&&$(),await new Promise((It,wr)=>{Bm(It,wr,{data:_w,headers:Xe.from(Fe.headers),status:Fe.status,statusText:Fe.statusText,config:y,request:X})})}catch(he){throw $&&$(),he&&he.name==="TypeError"&&/Load failed|fetch/i.test(he.message)?Object.assign(new O("Network Error",O.ERR_NETWORK,y,X,he&&he.response),{cause:he.cause||he}):O.from(he,he&&he.code,y,X,he&&he.response)}}},"factory"),Xv=new Map,Mm=n(i=>{let e=i&&i.env||{},{fetch:t,Request:r,Response:a}=e,s=[r,a,t],o=s.length,l=o,d,p,h=Xv;for(;l--;)d=s[l],p=h.get(d),p===void 0&&h.set(d,p=l?new Map:Zv(e)),h=p;return p},"getFetch");Mm();var pc={http:_v,xhr:Gv,fetch:{get:Mm}};m.forEach(pc,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});var xm=n(i=>`- ${i}`,"renderReason"),Yv=n(i=>m.isFunction(i)||i===null||i===!1,"isResolvedHandle");function eS(i,e){i=m.isArray(i)?i:[i];let{length:t}=i,r,a,s={};for(let o=0;o<t;o++){r=i[o];let l;if(a=r,!Yv(r)&&(a=pc[(l=String(r)).toLowerCase()],a===void 0))throw new O(`Unknown adapter '${l}'`);if(a&&(m.isFunction(a)||(a=a.get(e))))break;s[l||"#"+o]=a}if(!a){let o=Object.entries(s).map(([d,p])=>`adapter ${d} `+(p===!1?"is not supported by the environment":"is not available in the build")),l=t?o.length>1?`since :
4
- `+o.map(xm).join(`
5
- `):" "+xm(o[0]):"as no adapter specified";throw new O("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return a}n(eS,"getAdapter");var Lm={getAdapter:eS,adapters:pc};function Yu(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new yi(null,i)}n(Yu,"throwIfCancellationRequested");function wm(i){return Yu(i),i.headers=Xe.from(i.headers),i.data=Xu.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),Lm.getAdapter(i.adapter||hc.adapter,i)(i).then(n(function(r){return Yu(i),r.data=Xu.call(i,i.transformResponse,r),r.headers=Xe.from(r.headers),r},"onAdapterResolution"),n(function(r){return Om(r)||(Yu(i),r&&r.response&&(r.response.data=Xu.call(i,i.transformResponse,r.response),r.response.headers=Xe.from(r.response.headers))),Promise.reject(r)},"onAdapterRejection"))}n(wm,"dispatchRequest");var Fm="1.13.5",ps={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{ps[i]=n(function(r){return typeof r===i||"a"+(e<1?"n ":" ")+i},"validator")});var vm={};ps.transitional=n(function(e,t,r){function a(s,o){return"[Axios v"+Fm+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return n(a,"formatMessage"),(s,o,l)=>{if(e===!1)throw new O(a(o," has been removed"+(t?" in "+t:"")),O.ERR_DEPRECATED);return t&&!vm[o]&&(vm[o]=!0,console.warn(a(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,l):!0}},"transitional");ps.spelling=n(function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)},"spelling");function tS(i,e,t){if(typeof i!="object")throw new O("options must be an object",O.ERR_BAD_OPTION_VALUE);let r=Object.keys(i),a=r.length;for(;a-- >0;){let s=r[a],o=e[s];if(o){let l=i[s],d=l===void 0||o(l,s,i);if(d!==!0)throw new O("option "+s+" must be "+d,O.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new O("Unknown option "+s,O.ERR_BAD_OPTION)}}n(tS,"assertOptions");var ss={assertOptions:tS,validators:ps},Ne=ss.validators,Cr=class{static{n(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new cm,response:new cm}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;let s=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
6
- `+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=rr(this.defaults,t);let{transitional:r,paramsSerializer:a,headers:s}=t;r!==void 0&&ss.assertOptions(r,{silentJSONParsing:Ne.transitional(Ne.boolean),forcedJSONParsing:Ne.transitional(Ne.boolean),clarifyTimeoutError:Ne.transitional(Ne.boolean),legacyInterceptorReqResOrdering:Ne.transitional(Ne.boolean)},!1),a!=null&&(m.isFunction(a)?t.paramsSerializer={serialize:a}:ss.assertOptions(a,{encode:Ne.function,serialize:Ne.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ss.assertOptions(t,{baseUrl:Ne.spelling("baseURL"),withXsrfToken:Ne.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&m.merge(s.common,s[t.method]);s&&m.forEach(["delete","get","head","post","put","patch","common"],y=>{delete s[y]}),t.headers=Xe.concat(o,s);let l=[],d=!0;this.interceptors.request.forEach(n(function(q){if(typeof q.runWhen=="function"&&q.runWhen(t)===!1)return;d=d&&q.synchronous;let v=t.transitional||uc;v&&v.legacyInterceptorReqResOrdering?l.unshift(q.fulfilled,q.rejected):l.push(q.fulfilled,q.rejected)},"unshiftRequestInterceptors"));let p=[];this.interceptors.response.forEach(n(function(q){p.push(q.fulfilled,q.rejected)},"pushResponseInterceptors"));let h,w=0,E;if(!d){let y=[wm.bind(this),void 0];for(y.unshift(...l),y.push(...p),E=y.length,h=Promise.resolve(t);w<E;)h=h.then(y[w++],y[w++]);return h}E=l.length;let P=t;for(;w<E;){let y=l[w++],q=l[w++];try{P=y(P)}catch(v){q.call(this,v);break}}try{h=wm.call(this,P)}catch(y){return Promise.reject(y)}for(w=0,E=p.length;w<E;)h=h.then(p[w++],p[w++]);return h}getUri(e){e=rr(this.defaults,e);let t=jm(e.baseURL,e.url,e.allowAbsoluteUrls);return Rm(t,e.params,e.paramsSerializer)}};m.forEach(["delete","get","head","options"],n(function(e){Cr.prototype[e]=function(t,r){return this.request(rr(r||{},{method:e,url:t,data:(r||{}).data}))}},"forEachMethodNoData"));m.forEach(["post","put","patch"],n(function(e){function t(r){return n(function(s,o,l){return this.request(rr(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))},"httpMethod")}n(t,"generateHTTPMethod"),Cr.prototype[e]=t(),Cr.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var os=Cr,ac=class i{static{n(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(n(function(s){t=s},"promiseExecutor"));let r=this;this.promise.then(a=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](a);r._listeners=null}),this.promise.then=a=>{let s,o=new Promise(l=>{r.subscribe(l),s=l}).then(a);return o.cancel=n(function(){r.unsubscribe(s)},"reject"),o},e(n(function(s,o,l){r.reason||(r.reason=new yi(s,o,l),t(r.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=n(r=>{e.abort(r)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new i(n(function(a){e=a},"executor")),cancel:e}}},rS=ac;function iS(i){return n(function(t){return i.apply(null,t)},"wrap")}n(iS,"spread");function nS(i){return m.isObject(i)&&i.isAxiosError===!0}n(nS,"isAxiosError");var sc={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(sc).forEach(([i,e])=>{sc[e]=i});var aS=sc;function Nm(i){let e=new os(i),t=Sm(os.prototype.request,e);return m.extend(t,os.prototype,e,{allOwnKeys:!0}),m.extend(t,e,null,{allOwnKeys:!0}),t.create=n(function(a){return Nm(rr(i,a))},"create"),t}n(Nm,"createInstance");var ae=Nm(hc);ae.Axios=os;ae.CanceledError=yi;ae.CancelToken=rS;ae.isCancel=Om;ae.VERSION=Fm;ae.toFormData=hs;ae.AxiosError=O;ae.Cancel=ae.CanceledError;ae.all=n(function(e){return Promise.all(e)},"all");ae.spread=iS;ae.isAxiosError=nS;ae.mergeConfig=rr;ae.AxiosHeaders=Xe;ae.formToJSON=i=>Um(m.isHTMLForm(i)?new FormData(i):i);ae.getAdapter=Lm.getAdapter;ae.HttpStatusCode=aS;ae.default=ae;Qm.exports=ae});var g={};bw(g,{__addDisposableResource:()=>my,__assign:()=>_s,__asyncDelegator:()=>oy,__asyncGenerator:()=>sy,__asyncValues:()=>ly,__await:()=>Er,__awaiter:()=>ey,__classPrivateFieldGet:()=>hy,__classPrivateFieldIn:()=>_y,__classPrivateFieldSet:()=>py,__createBinding:()=>ys,__decorate:()=>$m,__disposeResources:()=>yy,__esDecorate:()=>Km,__exportStar:()=>ry,__extends:()=>Wm,__generator:()=>ty,__importDefault:()=>dy,__importStar:()=>cy,__makeTemplateObject:()=>uy,__metadata:()=>Ym,__param:()=>zm,__propKey:()=>Zm,__read:()=>yc,__rest:()=>Vm,__rewriteRelativeImportExtension:()=>fy,__runInitializers:()=>Jm,__setFunctionName:()=>Xm,__spread:()=>iy,__spreadArray:()=>ay,__spreadArrays:()=>ny,__values:()=>ms,default:()=>lS});function Wm(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");_c(i,e);function t(){this.constructor=i}n(t,"__"),i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Vm(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(i);a<r.length;a++)e.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(i,r[a])&&(t[r[a]]=i[r[a]]);return t}function $m(i,e,t,r){var a=arguments.length,s=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(i,e,t,r);else for(var l=i.length-1;l>=0;l--)(o=i[l])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}function zm(i,e){return function(t,r){e(t,r,i)}}function Km(i,e,t,r,a,s){function o(U){if(U!==void 0&&typeof U!="function")throw new TypeError("Function expected");return U}n(o,"accept");for(var l=r.kind,d=l==="getter"?"get":l==="setter"?"set":"value",p=!e&&i?r.static?i:i.prototype:null,h=e||(p?Object.getOwnPropertyDescriptor(p,r.name):{}),w,E=!1,P=t.length-1;P>=0;P--){var y={};for(var q in r)y[q]=q==="access"?{}:r[q];for(var q in r.access)y.access[q]=r.access[q];y.addInitializer=function(U){if(E)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(U||null))};var v=(0,t[P])(l==="accessor"?{get:h.get,set:h.set}:h[d],y);if(l==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(w=o(v.get))&&(h.get=w),(w=o(v.set))&&(h.set=w),(w=o(v.init))&&a.unshift(w)}else(w=o(v))&&(l==="field"?a.unshift(w):h[d]=w)}p&&Object.defineProperty(p,r.name,h),E=!0}function Jm(i,e,t){for(var r=arguments.length>2,a=0;a<e.length;a++)t=r?e[a].call(i,t):e[a].call(i);return r?t:void 0}function Zm(i){return typeof i=="symbol"?i:"".concat(i)}function Xm(i,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(i,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function Ym(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function ey(i,e,t,r){function a(s){return s instanceof t?s:new t(function(o){o(s)})}return n(a,"adopt"),new(t||(t=Promise))(function(s,o){function l(h){try{p(r.next(h))}catch(w){o(w)}}n(l,"fulfilled");function d(h){try{p(r.throw(h))}catch(w){o(w)}}n(d,"rejected");function p(h){h.done?s(h.value):a(h.value).then(l,d)}n(p,"step"),p((r=r.apply(i,e||[])).next())})}function ty(i,e){var t={label:0,sent:n(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,a,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(p){return function(h){return d([p,h])}}function d(p){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,p[0]&&(t=0)),t;)try{if(r=1,a&&(s=p[0]&2?a.return:p[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,p[1])).done)return s;switch(a=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,a=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){t.label=p[1];break}if(p[0]===6&&t.label<s[1]){t.label=s[1],s=p;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(p);break}s[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(i,t)}catch(h){p=[6,h],a=0}finally{r=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function ry(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ys(e,i,t)}function ms(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:n(function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function yc(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),a,s=[],o;try{for(;(e===void 0||e-- >0)&&!(a=r.next()).done;)s.push(a.value)}catch(l){o={error:l}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function iy(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(yc(arguments[e]));return i}function ny(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),a=0,e=0;e<t;e++)for(var s=arguments[e],o=0,l=s.length;o<l;o++,a++)r[a]=s[o];return r}function ay(i,e,t){if(t||arguments.length===2)for(var r=0,a=e.length,s;r<a;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return i.concat(s||Array.prototype.slice.call(e))}function Er(i){return this instanceof Er?(this.v=i,this):new Er(i)}function sy(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),a,s=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(P){return function(y){return Promise.resolve(y).then(P,w)}}function l(P,y){r[P]&&(a[P]=function(q){return new Promise(function(v,U){s.push([P,q,v,U])>1||d(P,q)})},y&&(a[P]=y(a[P])))}function d(P,y){try{p(r[P](y))}catch(q){E(s[0][3],q)}}function p(P){P.value instanceof Er?Promise.resolve(P.value.v).then(h,w):E(s[0][2],P)}function h(P){d("next",P)}function w(P){d("throw",P)}function E(P,y){P(y),s.shift(),s.length&&d(s[0][0],s[0][1])}}function oy(i){var e,t;return e={},r("next"),r("throw",function(a){throw a}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(a,s){e[a]=i[a]?function(o){return(t=!t)?{value:Er(i[a](o)),done:!1}:s?s(o):o}:s}}function ly(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof ms=="function"?ms(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=i[s]&&function(o){return new Promise(function(l,d){o=i[s](o),a(l,d,o.done,o.value)})}}function a(s,o,l,d){Promise.resolve(d).then(function(p){s({value:p,done:l})},o)}}function uy(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function cy(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t=mc(i),r=0;r<t.length;r++)t[r]!=="default"&&ys(e,i,t[r]);return sS(e,i),e}function dy(i){return i&&i.__esModule?i:{default:i}}function hy(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)}function py(i,e,t,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!a:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(i,t):a?a.value=t:e.set(i,t),t}function _y(i,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?e===i:i.has(e)}function my(i,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,a;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],t&&(a=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");a&&(r=n(function(){try{a.call(this)}catch(s){return Promise.reject(s)}},"dispose")),i.stack.push({value:e,dispose:r,async:t})}else t&&i.stack.push({async:!0});return e}function yy(i){function e(s){i.error=i.hasError?new oS(s,i.error,"An error was suppressed during disposal."):s,i.hasError=!0}n(e,"fail");var t,r=0;function a(){for(;t=i.stack.pop();)try{if(!t.async&&r===1)return r=0,i.stack.push(t),Promise.resolve().then(a);if(t.dispose){var s=t.dispose.call(t.value);if(t.async)return r|=2,Promise.resolve(s).then(a,function(o){return e(o),a()})}else r|=1}catch(o){e(o)}if(r===1)return i.hasError?Promise.reject(i.error):Promise.resolve();if(i.hasError)throw i.error}return n(a,"next"),a()}function fy(i,e){return typeof i=="string"&&/^\.\.?\//.test(i)?i.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,a,s,o){return r?e?".jsx":".js":a&&(!s||!o)?t:a+s+"."+o.toLowerCase()+"js"}):i}var _c,_s,ys,sS,mc,oS,lS,b=gw(()=>{_c=n(function(i,e){return _c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])},_c(i,e)},"extendStatics");n(Wm,"__extends");_s=n(function(){return _s=Object.assign||n(function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),_s.apply(this,arguments)},"__assign");n(Vm,"__rest");n($m,"__decorate");n(zm,"__param");n(Km,"__esDecorate");n(Jm,"__runInitializers");n(Zm,"__propKey");n(Xm,"__setFunctionName");n(Ym,"__metadata");n(ey,"__awaiter");n(ty,"__generator");ys=Object.create?(function(i,e,t,r){r===void 0&&(r=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:n(function(){return e[t]},"get")}),Object.defineProperty(i,r,a)}):(function(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]});n(ry,"__exportStar");n(ms,"__values");n(yc,"__read");n(iy,"__spread");n(ny,"__spreadArrays");n(ay,"__spreadArray");n(Er,"__await");n(sy,"__asyncGenerator");n(oy,"__asyncDelegator");n(ly,"__asyncValues");n(uy,"__makeTemplateObject");sS=Object.create?(function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}):function(i,e){i.default=e},mc=n(function(i){return mc=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},mc(i)},"ownKeys");n(cy,"__importStar");n(dy,"__importDefault");n(hy,"__classPrivateFieldGet");n(py,"__classPrivateFieldSet");n(_y,"__classPrivateFieldIn");n(my,"__addDisposableResource");oS=typeof SuppressedError=="function"?SuppressedError:function(i,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=i,r.suppressed=e,r};n(yy,"__disposeResources");n(fy,"__rewriteRelativeImportExtension");lS={__extends:Wm,__assign:_s,__rest:Vm,__decorate:$m,__param:zm,__esDecorate:Km,__runInitializers:Jm,__propKey:Zm,__setFunctionName:Xm,__metadata:Ym,__awaiter:ey,__generator:ty,__createBinding:ys,__exportStar:ry,__values:ms,__read:yc,__spread:iy,__spreadArrays:ny,__spreadArray:ay,__await:Er,__asyncGenerator:sy,__asyncDelegator:oy,__asyncValues:ly,__makeTemplateObject:uy,__importStar:cy,__importDefault:dy,__classPrivateFieldGet:hy,__classPrivateFieldSet:py,__classPrivateFieldIn:_y,__addDisposableResource:my,__disposeResources:yy,__rewriteRelativeImportExtension:fy}});var fi=u((xU,gy)=>{gy.exports.isNode=!1});var ir=u(Ut=>{"use strict";var Rt;Object.defineProperty(Ut,"__esModule",{value:!0});Ut.LogLevelToConsoleFunction=Ut.resolveLogLevel=Ut.LogLevel=void 0;var uS=fi(),Ee;(function(i){i[i.CRITICAL=0]="CRITICAL",i[i.ERROR=1]="ERROR",i[i.WARNING=2]="WARNING",i[i.INFO=3]="INFO",i[i.DEBUG=4]="DEBUG",i[i.TRACE=7]="TRACE"})(Ee||(Ee={}));Ut.LogLevel=Ee;function cS(i){if(typeof i=="number"){if(Object.prototype.hasOwnProperty.call(Ee,i))return i;var e=Object.keys(Ee).map(function(r){return parseInt(r,10)}).filter(function(r){return!isNaN(r)&&r<i});return e.length?Math.max.apply(Math,e):Ee.WARNING}var t=i.replace(/\d+$/,"").toUpperCase();if(!Object.prototype.hasOwnProperty.call(Ee,t))throw new Error("Unknown log level string: ".concat(i));return Ee[t]}n(cS,"resolveLogLevel");Ut.resolveLogLevel=cS;var dS=uS.isNode?console.log.bind(console):console.debug.bind(console);Ut.LogLevelToConsoleFunction=(Rt={},Rt[Ee.CRITICAL]=console.error.bind(console),Rt[Ee.ERROR]=console.error.bind(console),Rt[Ee.WARNING]=console.warn.bind(console),Rt[Ee.INFO]=console.info.bind(console),Rt[Ee.DEBUG]=dS.bind(console),Rt[Ee.TRACE]=console.trace.bind(console),Rt)});var by=u(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.Enumerable=void 0;function hS(i){return i===void 0&&(i=!0),function(e,t){Object.defineProperty(e,t,{get:n(function(){},"get"),set:n(function(r){Object.defineProperty(this,t,{value:r,writable:!0,enumerable:i})},"set"),enumerable:i})}}n(hS,"Enumerable");fs.Enumerable=hS});var wy=u(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.flatten=void 0;var xy=(b(),x(g));function pS(i){var e;return(e=[]).concat.apply(e,xy.__spreadArray([],xy.__read(i),!1))}n(pS,"flatten");gs.flatten=pS});var vy=u(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.immutableSplice=void 0;var Pr=(b(),x(g));function _S(i,e,t){for(var r=[],a=3;a<arguments.length;a++)r[a-3]=arguments[a];return Pr.__spreadArray(Pr.__spreadArray(Pr.__spreadArray([],Pr.__read(i.slice(0,e)),!1),Pr.__read(r),!1),Pr.__read(i.slice(e+t)),!1)}n(_S,"immutableSplice");bs.immutableSplice=_S});var Sy=u(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.partitionedFlatMap=void 0;var fc=(b(),x(g));function mS(i,e,t){var r,a,s,o={};try{for(var l=fc.__values(i),d=l.next();!d.done;d=l.next()){var p=d.value,h=e(p),w=t(p);Array.isArray(w)||(w=[w]),Object.prototype.hasOwnProperty.call(o,h)?(s=o[h]).push.apply(s,fc.__spreadArray([],fc.__read(w),!1)):o[h]=w}}catch(E){r={error:E}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}return o}n(mS,"partitionedFlatMap");xs.partitionedFlatMap=mS});var Cy=u(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.resolveConfigValueSync=Ar.resolveConfigValue=void 0;var Hy=(b(),x(g));function yS(i){return Hy.__awaiter(this,void 0,void 0,function(){return Hy.__generator(this,function(e){switch(e.label){case 0:return typeof i!="function"?[3,2]:[4,i()];case 1:return[2,e.sent()];case 2:return[2,i]}})})}n(yS,"resolveConfigValue");Ar.resolveConfigValue=yS;function fS(i){return typeof i=="function"?i():i}n(fS,"resolveConfigValueSync");Ar.resolveConfigValueSync=fS});var qy=u(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.deprecateClass=void 0;var gc=(b(),x(g));function gS(i,e){var t=!1;return(function(r){gc.__extends(a,r);function a(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];return t||(console.warn(e),t=!0),r.apply(this,gc.__spreadArray([],gc.__read(s),!1))||this}return n(a,"class_1"),a})(i)}n(gS,"deprecateClass");ws.deprecateClass=gS});var Py=u(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.match=nr.eq=void 0;var Ey=n(function(i){return{otherwise:n(function(){return i},"otherwise"),on:n(function(){return Ey(i)},"on")}},"matched"),bc=n(function(i){return{on:n(function(e,t){return e(i)?Ey(t(i)):bc(i)},"on"),otherwise:n(function(e){return e(i)},"otherwise")}},"match");nr.match=bc;var bS=n(function(i){return function(e){return i===e}},"eq");nr.eq=bS;bc.eq=nr.eq});var Dy=u(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.fibWithLimit=void 0;var Ay=(b(),x(g));function xS(i){var e,t,r;return Ay.__generator(this,function(a){switch(a.label){case 0:e=0,t=1,a.label=1;case 1:return e<i?[4,e]:[3,3];case 2:return a.sent(),r=Ay.__read([t,e+t],2),e=r[0],t=r[1],[3,1];case 3:return[4,i];case 4:return a.sent(),[3,3];case 5:return[2]}})}n(xS,"fibWithLimit");vs.fibWithLimit=xS});var Hs=u(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.arrayToObject=void 0;var Iy=(b(),x(g));function wS(i,e){return Object.assign.apply(Object,Iy.__spreadArray([{}],Iy.__read(i.map(e)),!1))}n(wS,"arrayToObject");Ss.arrayToObject=wS});var Ty=u(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.entriesToObject=void 0;var vS=(b(),x(g)),SS=Hs();function HS(i){return(0,SS.arrayToObject)(i,function(e){var t,r=vS.__read(e,2),a=r[0],s=r[1];return t={},t[a]=s,t})}n(HS,"entriesToObject");Cs.entriesToObject=HS});var Ry=u(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.forEachObjectEntry=void 0;var CS=(b(),x(g));function qS(i,e){Object.entries(i).forEach(function(t){var r=CS.__read(t,2),a=r[0],s=r[1];return e(s,a)})}n(qS,"forEachObjectEntry");qs.forEachObjectEntry=qS});var Uy=u(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.groupBy=void 0;var ES=(b(),x(g));function PS(i,e){var t,r,a;if(typeof e!="function"){var s=e;e=n((function(w){return w[s].toString()}),"keyFn")}var o={};try{for(var l=ES.__values(i),d=l.next();!d.done;d=l.next()){var p=d.value,h=e(p);((a=o[h])!==null&&a!==void 0?a:o[h]=[]).push(p)}}catch(w){t={error:w}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return o}n(PS,"groupBy");Es.groupBy=PS});var Oy=u(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.indexBy=void 0;var AS=Hs();function DS(i,e){if(typeof e!="function"){var t=e;e=n((function(r){return r[t].toString()}),"keyFn")}return(0,AS.arrayToObject)(i,function(r){var a;return a={},a[e(r)]=r,a})}n(DS,"indexBy");Ps.indexBy=DS});var By=u(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.mapObject=void 0;var xc=(b(),x(g));function IS(i,e){var t=Object.entries(i).map(function(r){var a,s=xc.__read(r,2),o=s[0],l=s[1];return a={},a[o]=e(l,o),a});return Object.assign.apply(Object,xc.__spreadArray([{}],xc.__read(t),!1))}n(IS,"mapObject");As.mapObject=IS});var wc=u(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.pick=void 0;var Ds=(b(),x(g));function TS(i,e){return Object.assign.apply(Object,Ds.__spreadArray([{}],Ds.__read(Object.entries(i).filter(function(t){var r=Ds.__read(t,1),a=r[0];return e.includes(a)}).map(function(t){var r,a=Ds.__read(t,2),s=a[0],o=a[1];return r={},r[s]=o,r})),!1))}n(TS,"pick");Is.pick=TS});var jy=u(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.omit=void 0;var RS=wc();function US(i,e){return(0,RS.pick)(i,Object.keys(i).filter(function(t){return!e.includes(t)}))}n(US,"omit");Ts.omit=US});var ky=u(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.mapOptional=Ot.mapNullable=Ot.isNullish=void 0;function vc(i){return i==null}n(vc,"isNullish");Ot.isNullish=vc;function OS(i,e){return vc(i)?null:e(i)}n(OS,"mapNullable");Ot.mapNullable=OS;function BS(i,e){return vc(i)?void 0:e(i)}n(BS,"mapOptional");Ot.mapOptional=BS});var Ly=u(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.delay=void 0;var My=(b(),x(g));function jS(i){return My.__awaiter(this,void 0,void 0,function(){return My.__generator(this,function(e){switch(e.label){case 0:return[4,new Promise(function(t){return setTimeout(t,i)})];case 1:return e.sent(),[2]}})})}n(jS,"delay");Rs.delay=jS});var Fy=u(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.promiseWithResolvers=void 0;function kS(){var i,e,t=new Promise(function(r,a){i=r,e=a});return{promise:t,resolve:i,reject:e}}n(kS,"promiseWithResolvers");Us.promiseWithResolvers=kS});var Ny=u(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.padLeft=void 0;function MS(i,e,t){if(typeof i=="number"&&(i=i.toString()),e=e-i.length,e<=0)return i;t===void 0&&(t=" ");var r="";do(e&1)===1&&(r+=t),e>>=1,e&&(t+=t);while(e);return r+i}n(MS,"padLeft");Os.padLeft=MS});var Qy=u(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.splitWithLimit=void 0;var Sc=(b(),x(g));function LS(i,e,t){var r=i.split(e);return r.length<=t?r:Sc.__spreadArray(Sc.__spreadArray([],Sc.__read(r.slice(0,t-1)),!1),[r.slice(t-1).join(e)],!1)}n(LS,"splitWithLimit");Bs.splitWithLimit=LS});var Gy=u(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.utf8Substring=Dr.utf8Length=void 0;var js=(b(),x(g));function FS(i){return js.__spreadArray([],js.__read(i),!1).length}n(FS,"utf8Length");Dr.utf8Length=FS;function NS(i,e,t){return js.__spreadArray([],js.__read(i),!1).slice(e,t).join("")}n(NS,"utf8Substring");Dr.utf8Substring=NS});var C=u(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.utf8Substring=A.utf8Length=A.splitWithLimit=A.padLeft=A.promiseWithResolvers=A.delay=A.mapOptional=A.mapNullable=A.isNullish=A.pick=A.omit=A.mapObject=A.indexBy=A.groupBy=A.forEachObjectEntry=A.entriesToObject=A.arrayToObject=A.fibWithLimit=A.eq=A.match=A.deprecateClass=A.resolveConfigValueSync=A.resolveConfigValue=A.partitionedFlatMap=A.immutableSplice=A.flatten=A.Enumerable=void 0;var QS=by();Object.defineProperty(A,"Enumerable",{enumerable:!0,get:n(function(){return QS.Enumerable},"get")});var GS=wy();Object.defineProperty(A,"flatten",{enumerable:!0,get:n(function(){return GS.flatten},"get")});var WS=vy();Object.defineProperty(A,"immutableSplice",{enumerable:!0,get:n(function(){return WS.immutableSplice},"get")});var VS=Sy();Object.defineProperty(A,"partitionedFlatMap",{enumerable:!0,get:n(function(){return VS.partitionedFlatMap},"get")});var Wy=Cy();Object.defineProperty(A,"resolveConfigValue",{enumerable:!0,get:n(function(){return Wy.resolveConfigValue},"get")});Object.defineProperty(A,"resolveConfigValueSync",{enumerable:!0,get:n(function(){return Wy.resolveConfigValueSync},"get")});var $S=qy();Object.defineProperty(A,"deprecateClass",{enumerable:!0,get:n(function(){return $S.deprecateClass},"get")});var Vy=Py();Object.defineProperty(A,"match",{enumerable:!0,get:n(function(){return Vy.match},"get")});Object.defineProperty(A,"eq",{enumerable:!0,get:n(function(){return Vy.eq},"get")});var zS=Dy();Object.defineProperty(A,"fibWithLimit",{enumerable:!0,get:n(function(){return zS.fibWithLimit},"get")});var KS=Hs();Object.defineProperty(A,"arrayToObject",{enumerable:!0,get:n(function(){return KS.arrayToObject},"get")});var JS=Ty();Object.defineProperty(A,"entriesToObject",{enumerable:!0,get:n(function(){return JS.entriesToObject},"get")});var ZS=Ry();Object.defineProperty(A,"forEachObjectEntry",{enumerable:!0,get:n(function(){return ZS.forEachObjectEntry},"get")});var XS=Uy();Object.defineProperty(A,"groupBy",{enumerable:!0,get:n(function(){return XS.groupBy},"get")});var YS=Oy();Object.defineProperty(A,"indexBy",{enumerable:!0,get:n(function(){return YS.indexBy},"get")});var e0=By();Object.defineProperty(A,"mapObject",{enumerable:!0,get:n(function(){return e0.mapObject},"get")});var t0=jy();Object.defineProperty(A,"omit",{enumerable:!0,get:n(function(){return t0.omit},"get")});var r0=wc();Object.defineProperty(A,"pick",{enumerable:!0,get:n(function(){return r0.pick},"get")});var Hc=ky();Object.defineProperty(A,"isNullish",{enumerable:!0,get:n(function(){return Hc.isNullish},"get")});Object.defineProperty(A,"mapNullable",{enumerable:!0,get:n(function(){return Hc.mapNullable},"get")});Object.defineProperty(A,"mapOptional",{enumerable:!0,get:n(function(){return Hc.mapOptional},"get")});var i0=Ly();Object.defineProperty(A,"delay",{enumerable:!0,get:n(function(){return i0.delay},"get")});var n0=Fy();Object.defineProperty(A,"promiseWithResolvers",{enumerable:!0,get:n(function(){return n0.promiseWithResolvers},"get")});var a0=Ny();Object.defineProperty(A,"padLeft",{enumerable:!0,get:n(function(){return a0.padLeft},"get")});var s0=Qy();Object.defineProperty(A,"splitWithLimit",{enumerable:!0,get:n(function(){return s0.splitWithLimit},"get")});var $y=Gy();Object.defineProperty(A,"utf8Length",{enumerable:!0,get:n(function(){return $y.utf8Length},"get")});Object.defineProperty(A,"utf8Substring",{enumerable:!0,get:n(function(){return $y.utf8Substring},"get")})});var Pc=u(Ms=>{"use strict";var Cc,qc;Object.defineProperty(Ms,"__esModule",{value:!0});Ms.getMinLogLevelFromEnv=void 0;var o0=ir(),ks=typeof process>"u"?[]:(qc=(Cc=process.env.LOGGING)===null||Cc===void 0?void 0:Cc.split(";").map(function(i){var e=i.split("=",2),t=e[0],r=e[1];return r?[t==="default"?void 0:t.split(":"),(0,o0.resolveLogLevel)(r)]:null}).filter(function(i){return!!i}).sort(function(i,e){var t,r,a=i[0],s=e[0];return((t=s?.length)!==null&&t!==void 0?t:0)-((r=a?.length)!==null&&r!==void 0?r:0)}))!==null&&qc!==void 0?qc:[],Ec=ks.findIndex(function(i){var e=i[0];return!e}),zy=void 0;Ec!==-1&&(zy=ks[Ec][1],ks.splice(Ec));function l0(i,e){return e.length<=i.length&&e.every(function(t,r){return t===i[r]})}n(l0,"isPrefix");function u0(i){for(var e=i.split(":"),t=0,r=ks;t<r.length;t++){var a=r[t],s=a[0],o=a[1];if(l0(e,s))return o}return zy}n(u0,"getMinLogLevelFromEnv");Ms.getMinLogLevelFromEnv=u0});var Ac=u(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.BaseLogger=void 0;var c0=C(),d0=fi(),h0=Pc(),Bt=ir(),p0=(function(){function i(e){var t=e.name,r=e.minLevel,a=e.emoji,s=a===void 0?!1:a,o=e.colors,l=e.timestamps,d=l===void 0?d0.isNode:l,p,h;this._name=t,this._minLevel=(h=(p=(0,c0.mapOptional)(r,function(w){return(0,Bt.resolveLogLevel)(w)}))!==null&&p!==void 0?p:(0,h0.getMinLogLevelFromEnv)(t))!==null&&h!==void 0?h:Bt.LogLevel.WARNING,this._emoji=s,this._colors=o,this._timestamps=d}return n(i,"BaseLogger"),i.prototype.crit=function(e){this.log(Bt.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this.log(Bt.LogLevel.ERROR,e)},i.prototype.warn=function(e){this.log(Bt.LogLevel.WARNING,e)},i.prototype.info=function(e){this.log(Bt.LogLevel.INFO,e)},i.prototype.debug=function(e){this.log(Bt.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this.log(Bt.LogLevel.TRACE,e)},i})();Ls.BaseLogger=p0});var Ky=u(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.BrowserLogger=void 0;var _0=(b(),x(g)),m0=ir(),y0=Ac(),f0=(function(i){_0.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return n(e,"BrowserLogger"),e.prototype.log=function(t,r){if(!(t>this._minLevel)){var a=m0.LogLevelToConsoleFunction[t],s="[".concat(this._name,"] ").concat(r);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(r)),a(s)}},e})(y0.BaseLogger);Fs.BrowserLogger=f0});var Jy=u(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.CustomLoggerWrapper=void 0;var g0=C(),b0=Pc(),Be=ir(),x0=(function(){function i(e){var t=e.name,r=e.minLevel,a=e.custom,s;this._minLevel=(s=(0,g0.mapOptional)(r,function(o){return(0,Be.resolveLogLevel)(o)}))!==null&&s!==void 0?s:(0,b0.getMinLogLevelFromEnv)(t),this._override=typeof a=="function"?{log:a}:a}return n(i,"CustomLoggerWrapper"),i.prototype.log=function(e,t){this._shouldLog(e)&&this._override.log(e,t)},i.prototype.crit=function(e){this._override.crit?this._shouldLog(Be.LogLevel.CRITICAL)&&this._override.crit(e):this.log(Be.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this._override.error?this._shouldLog(Be.LogLevel.ERROR)&&this._override.error(e):this.log(Be.LogLevel.ERROR,e)},i.prototype.warn=function(e){this._override.warn?this._shouldLog(Be.LogLevel.WARNING)&&this._override.warn(e):this.log(Be.LogLevel.WARNING,e)},i.prototype.info=function(e){this._override.info?this._shouldLog(Be.LogLevel.INFO)&&this._override.info(e):this.log(Be.LogLevel.INFO,e)},i.prototype.debug=function(e){this._override.debug?this._shouldLog(Be.LogLevel.DEBUG)&&this._override.debug(e):this.log(Be.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this._override.trace?this._shouldLog(Be.LogLevel.TRACE)&&this._override.trace(e):this.log(Be.LogLevel.TRACE,e)},i.prototype._shouldLog=function(e){return this._minLevel===void 0||this._minLevel>=e},i})();Ns.CustomLoggerWrapper=x0});var Zy=u(Pe=>{"use strict";var jt,kt,Mt;Object.defineProperty(Pe,"__esModule",{value:!0});Pe.NodeLogger=Pe.LogLevelToBackgroundColor=Pe.LogLevelToColor=Pe.LogLevelToEmoji=void 0;var w0=(b(),x(g)),ne=ir(),v0=Ac();Pe.LogLevelToEmoji=(jt={},jt[ne.LogLevel.CRITICAL]="\u{1F6D1}",jt[ne.LogLevel.ERROR]="\u274C",jt[ne.LogLevel.WARNING]="\u26A0\uFE0F ",jt[ne.LogLevel.INFO]="\u2139\uFE0F ",jt[ne.LogLevel.DEBUG]="\u{1F41E}",jt[ne.LogLevel.TRACE]="\u{1F43E}",jt);var S0={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,blackBright:90,redBright:91,greenBright:92,yellowBright:93,blueBright:94,magentaBright:95,cyanBright:96,whiteBright:97},H0={bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bgBlackBright:100,bgRedBright:101,bgGreenBright:102,bgYellowBright:103,bgBlueBright:104,bgMagentaBright:105,bgCyanBright:106,bgWhiteBright:107};function Qs(i,e,t){return function(r){return"\x1B[".concat(i,"m").concat(t?t(r):r,"\x1B[").concat(e,"m")}}n(Qs,"createGenericWrapper");function ot(i){return Qs(S0[i],39)}n(ot,"createColorWrapper");function gi(i,e){return Qs(H0[i],49,e)}n(gi,"createBgWrapper");Pe.LogLevelToColor=(kt={},kt[ne.LogLevel.CRITICAL]=ot("red"),kt[ne.LogLevel.ERROR]=ot("redBright"),kt[ne.LogLevel.WARNING]=ot("yellow"),kt[ne.LogLevel.INFO]=ot("blue"),kt[ne.LogLevel.DEBUG]=ot("magenta"),kt[ne.LogLevel.TRACE]=Qs(0,0),kt);Pe.LogLevelToBackgroundColor=(Mt={},Mt[ne.LogLevel.CRITICAL]=gi("bgRed",ot("white")),Mt[ne.LogLevel.ERROR]=gi("bgRedBright",ot("white")),Mt[ne.LogLevel.WARNING]=gi("bgYellow",ot("black")),Mt[ne.LogLevel.INFO]=gi("bgBlue",ot("white")),Mt[ne.LogLevel.DEBUG]=gi("bgMagenta",ot("black")),Mt[ne.LogLevel.TRACE]=Qs(7,27),Mt);var C0=(function(i){w0.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return n(e,"NodeLogger"),e.prototype.log=function(t,r){var a,s,o;if(!(t>this._minLevel)){var l=ne.LogLevelToConsoleFunction[t],d="";if(this._timestamps&&(d+="[".concat(new Date().toISOString(),"] ")),this._emoji){var p=Pe.LogLevelToEmoji[t];d+="".concat(p," ")}var h=(o=(a=this._colors)!==null&&a!==void 0?a:(s=process.stdout)===null||s===void 0?void 0:s.isTTY)!==null&&o!==void 0?o:!0;h?d+="".concat(Pe.LogLevelToBackgroundColor[t](this._name)," ").concat(Pe.LogLevelToBackgroundColor[t](ne.LogLevel[t])," ").concat(Pe.LogLevelToColor[t](r)):d+="[".concat(this._name,":").concat(ne.LogLevel[t].toLowerCase(),"] ").concat(r),l(d)}},e})(v0.BaseLogger);Pe.NodeLogger=C0});var Xy=u(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.createLogger=void 0;var q0=fi(),E0=Ky(),P0=Jy(),A0=Zy();function D0(i){return i.custom?new P0.CustomLoggerWrapper(i):q0.isNode?new A0.NodeLogger(i):new E0.BrowserLogger(i)}n(D0,"createLogger");Gs.createLogger=D0});var bi=u(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.LogLevel=Ir.createLogger=void 0;var I0=Xy();Object.defineProperty(Ir,"createLogger",{enumerable:!0,get:n(function(){return I0.createLogger},"get")});var T0=ir();Object.defineProperty(Ir,"LogLevel",{enumerable:!0,get:n(function(){return T0.LogLevel},"get")})});var Vs=u(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.CustomError=void 0;var Dc=class extends Error{static{n(this,"CustomError")}constructor(...e){var t;super(...e),Object.setPrototypeOf(this,new.target.prototype),(t=Error.captureStackTrace)===null||t===void 0||t.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}};Ws.CustomError=Dc});var zs=u($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.RateLimiterDestroyedError=void 0;var R0=Vs(),Ic=class extends R0.CustomError{static{n(this,"RateLimiterDestroyedError")}};$s.RateLimiterDestroyedError=Ic});var xi=u(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.RateLimitReachedError=void 0;var U0=Vs(),Tc=class extends U0.CustomError{static{n(this,"RateLimitReachedError")}};Ks.RateLimitReachedError=Tc});var Uc=u(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.RetryAfterError=void 0;var O0=Vs(),Rc=class extends O0.CustomError{static{n(this,"RetryAfterError")}constructor(e){super(`Need to retry after ${e} ms`),this._retryAt=Date.now()+e}get retryAt(){return this._retryAt}};Js.RetryAfterError=Rc});var Yy=u(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.NullRateLimiter=void 0;var Oc=class{static{n(this,"NullRateLimiter")}constructor(e){this._callback=e}async request(e){return await this._callback(e)}clear(){}pause(){}resume(){}};Zs.NullRateLimiter=Oc});var jc=u(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.ResponseBasedRateLimiter=void 0;var B0=bi(),j0=C(),k0=xi(),ef=Uc(),Bc=class{static{n(this,"ResponseBasedRateLimiter")}constructor({logger:e}){this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,B0.createLogger)({name:"rate-limiter",emoji:!0,...e})}async request(e,t){return this._logger.trace("request start"),await new Promise((r,a)=>{var s;let o={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"};this._batchRunning||this._nextBatchTimer||this._paused?(this._logger.trace(`request queued batchRunning:${this._batchRunning.toString()} hasNextBatchTimer:${(!!this._nextBatchTimer).toString()} paused:${this._paused.toString()}`),this._queue.push(o)):this._runRequestBatch([o])})}clear(){this._queue=[]}pause(){this._paused=!0}resume(){this._paused=!1,this._runNextBatch()}get stats(){var e,t,r,a,s;return{lastKnownLimit:(t=(e=this._parameters)===null||e===void 0?void 0:e.limit)!==null&&t!==void 0?t:null,lastKnownRemainingRequests:(a=(r=this._parameters)===null||r===void 0?void 0:r.remaining)!==null&&a!==void 0?a:null,lastKnownResetDate:(0,j0.mapNullable)((s=this._parameters)===null||s===void 0?void 0:s.resetsAt,o=>new Date(o))}}async _runRequestBatch(e){this._logger.trace(`runRequestBatch start specs:${e.length}`),this._batchRunning=!0,this._parameters&&this._logger.debug(`Remaining requests: ${this._parameters.remaining}`),this._logger.debug(`Doing ${e.length} requests, new queue length is ${this._queue.length}`);let t=e.map(async o=>{let{req:l,resolve:d,reject:p}=o;try{let h=await this.doRequest(l),w=this.needsToRetryAfter(h);if(w!==null)throw this._queue.unshift(o),this._logger.info(`Retrying after ${w} ms`),new ef.RetryAfterError(w);let E=this.getParametersFromResponse(h);return d(h),E}catch(h){if(h instanceof ef.RetryAfterError)throw h;p(h);return}}),r=await Promise.allSettled(t),a=r.filter(o=>o.status==="rejected"),s=Date.now();if(a.length){this._logger.trace("runRequestBatch some rejected");let l=Math.max(s,...a.map(d=>d.reason.retryAt))-s;this._logger.warn(`Waiting for ${l} ms because the rate limit was exceeded`),this._nextBatchTimer=setTimeout(()=>{this._parameters=void 0,this._runNextBatch()},l)}else{this._logger.trace("runRequestBatch none rejected");let o=r.filter(l=>l.status==="fulfilled"&&l.value!==void 0).map(l=>l.value).reduce((l,d)=>l?d.remaining<l.remaining?d:l:d,void 0);if(this._batchRunning=!1,o)if(this._parameters=o,o.resetsAt<s||o.remaining>0)this._logger.trace("runRequestBatch canRunMore"),this._runNextBatch();else{let l=o.resetsAt-s;this._logger.trace(`runRequestBatch delay:${l}`),this._logger.warn(`Waiting for ${l} ms because the rate limit was reached`),this._queue=this._queue.filter(d=>{switch(d.limitReachedBehavior){case"enqueue":return!0;case"null":return d.resolve(null),!1;case"throw":return d.reject(new k0.RateLimitReachedError("Request removed from queue because the rate limit was reached")),!1;default:throw new Error("this should never happen")}}),this._nextBatchTimer=setTimeout(()=>{this._parameters=void 0,this._runNextBatch()},l)}}this._logger.trace("runRequestBatch end")}_runNextBatch(){if(this._paused)return;this._logger.trace("runNextBatch start"),this._nextBatchTimer&&(clearTimeout(this._nextBatchTimer),this._nextBatchTimer=void 0);let e=this._parameters?Math.min(this._parameters.remaining,this._parameters.limit/10):1,t=this._queue.splice(0,e);t.length&&this._runRequestBatch(t),this._logger.trace("runNextBatch end")}};Xs.ResponseBasedRateLimiter=Bc});var tf=u(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.PartitionedRateLimiter=void 0;var M0=jc(),kc=class{static{n(this,"PartitionedRateLimiter")}constructor(e){this._children=new Map,this._paused=!1,this._partitionKeyCallback=e.getPartitionKey,this._createChildCallback=e.createChild}async request(e,t){let r=this._partitionKeyCallback(e);return await this._getChild(r).request(e,t)}clear(){for(let e of this._children.values())e.clear()}pause(){this._paused=!0;for(let e of this._children.values())e.pause()}resume(){this._paused=!1;for(let e of this._children.values())e.resume()}getChildStats(e){if(!this._children.has(e))return null;let t=this._children.get(e);return t instanceof M0.ResponseBasedRateLimiter?t.stats:null}_getChild(e){if(this._children.has(e))return this._children.get(e);let t=this._createChildCallback(e);return this._paused&&t.pause(),this._children.set(e,t),t}};Ys.PartitionedRateLimiter=kc});var nf=u(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.PartitionedTimeBasedRateLimiter=void 0;var L0=bi(),F0=xi(),rf=zs(),Mc=class{static{n(this,"PartitionedTimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a,getPartitionKey:s}){this._partitionedQueue=new Map,this._usedFromBucket=new Map,this._counterTimers=new Set,this._paused=!1,this._destroyed=!1,this._logger=(0,L0.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=a,this._partitionKeyCallback=s}async request(e,t){return await new Promise((r,a)=>{var s,o;if(this._destroyed){a(new rf.RateLimiterDestroyedError("Rate limiter was destroyed"));return}let l={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"},d=this._partitionKeyCallback(e),p=(o=this._usedFromBucket.get(d))!==null&&o!==void 0?o:0;if(p>=this._bucketSize||this._paused)switch(l.limitReachedBehavior){case"enqueue":{let h=this._getPartitionedQueue(d);h.push(l),p+h.length>=this._bucketSize?this._logger.warn(`Rate limit of ${this._bucketSize} for ${d?`partition ${d}`:"default partition"} was reached, waiting for ${this._paused?"the limiter to be unpaused":"a free bucket entry"}; queue size is ${h.length}`):this._logger.info(`Enqueueing request for ${d?`partition ${d}`:"default partition"} because the rate limiter is paused; queue size is ${h.length}`);break}case"null":{l.resolve(null),this._paused?this._logger.info(`Returning null for request for ${d?`partition ${d}`:"default partition"} because the rate limiter is paused`):this._logger.warn(`Rate limit of ${this._bucketSize} for ${d?`partition ${d}`:"default partition"} was reached, dropping request and returning null`);break}case"throw":{l.reject(new F0.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":`the rate limit for ${d?`partition ${d}`:"default partition"} was reached`}`));break}default:throw new Error("this should never happen")}else this._runRequest(l,d)})}clear(){this._partitionedQueue.clear()}pause(){this._paused=!0}resume(){this._paused=!1;for(let e of this._partitionedQueue.keys())this._runNextRequest(e)}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._partitionedQueue.values())for(let t of e)t.reject(new rf.RateLimiterDestroyedError("Rate limiter was destroyed"));this._partitionedQueue.clear()}_getPartitionedQueue(e){if(this._partitionedQueue.has(e))return this._partitionedQueue.get(e);let t=[];return this._partitionedQueue.set(e,t),t}async _runRequest(e,t){var r;let a=this._getPartitionedQueue(t);this._logger.debug(`doing a request for ${t?`partition ${t}`:"default partition"}, new queue length is ${a.length}`),this._usedFromBucket.set(t,((r=this._usedFromBucket.get(t))!==null&&r!==void 0?r:0)+1);let{req:s,resolve:o,reject:l}=e;try{o(await this._callback(s))}catch(d){l(d)}finally{let d=setTimeout(()=>{this._counterTimers.delete(d);let p=this._usedFromBucket.get(t)-1;this._usedFromBucket.set(t,p),a.length&&p<this._bucketSize&&this._runNextRequest(t)},this._timeFrame);this._counterTimers.add(d)}}_runNextRequest(e){if(this._paused)return;let r=this._getPartitionedQueue(e).shift();r&&this._runRequest(r,e)}};eo.PartitionedTimeBasedRateLimiter=Mc});var Fc=u(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.TimeBasedRateLimiter=void 0;var N0=bi(),Q0=xi(),af=zs(),Lc=class{static{n(this,"TimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a}){this._queue=[],this._usedFromBucket=0,this._counterTimers=new Set,this._paused=!1,this._destroyed=!1,this._logger=(0,N0.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=a}async request(e,t){return await new Promise((r,a)=>{var s;if(this._destroyed){a(new af.RateLimiterDestroyedError("Rate limiter was destroyed"));return}let o={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"};if(this._usedFromBucket>=this._bucketSize||this._paused)switch(o.limitReachedBehavior){case"enqueue":{this._queue.push(o),this._usedFromBucket+this._queue.length>=this._bucketSize?this._logger.warn(`Rate limit of ${this._bucketSize} was reached, waiting for ${this._paused?"the limiter to be unpaused":"a free bucket entry"}; queue size is ${this._queue.length}`):this._logger.info(`Enqueueing request because the rate limiter is paused; queue size is ${this._queue.length}`);break}case"null":{o.resolve(null),this._logger.warn(`Rate limit of ${this._bucketSize} was reached, dropping request and returning null`),this._paused?this._logger.info("Returning null for request because the rate limiter is paused"):this._logger.warn(`Rate limit of ${this._bucketSize} was reached, dropping request and returning null`);break}case"throw":{o.reject(new Q0.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":"the rate limit was reached"}`));break}default:throw new Error("this should never happen")}else this._runRequest(o)})}clear(){this._queue=[]}pause(){this._paused=!0}resume(){this._paused=!1,this._runNextRequest()}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._queue)e.reject(new af.RateLimiterDestroyedError("Rate limiter was destroyed"));this._queue=[]}async _runRequest(e){this._logger.debug(`doing a request, new queue length is ${this._queue.length}`),this._usedFromBucket+=1;let{req:t,resolve:r,reject:a}=e;try{r(await this._callback(t))}catch(s){a(s)}finally{let s=setTimeout(()=>{this._counterTimers.delete(s),this._usedFromBucket-=1,this._queue.length&&this._usedFromBucket<this._bucketSize&&this._runNextRequest()},this._timeFrame);this._counterTimers.add(s)}}_runNextRequest(){if(this._paused)return;let e=this._queue.shift();e&&this._runRequest(e)}};to.TimeBasedRateLimiter=Lc});var sf=u(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.TimedPassthruRateLimiter=void 0;var G0=Fc(),Nc=class extends G0.TimeBasedRateLimiter{static{n(this,"TimedPassthruRateLimiter")}constructor(e,t){super({...t,async doRequest(r,a){return await e.request(r,a)}})}};ro.TimedPassthruRateLimiter=Nc});var io=u(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.TimedPassthruRateLimiter=se.TimeBasedRateLimiter=se.ResponseBasedRateLimiter=se.PartitionedTimeBasedRateLimiter=se.PartitionedRateLimiter=se.NullRateLimiter=se.RetryAfterError=se.RateLimitReachedError=se.RateLimiterDestroyedError=void 0;var W0=zs();Object.defineProperty(se,"RateLimiterDestroyedError",{enumerable:!0,get:n(function(){return W0.RateLimiterDestroyedError},"get")});var V0=xi();Object.defineProperty(se,"RateLimitReachedError",{enumerable:!0,get:n(function(){return V0.RateLimitReachedError},"get")});var $0=Uc();Object.defineProperty(se,"RetryAfterError",{enumerable:!0,get:n(function(){return $0.RetryAfterError},"get")});var z0=Yy();Object.defineProperty(se,"NullRateLimiter",{enumerable:!0,get:n(function(){return z0.NullRateLimiter},"get")});var K0=tf();Object.defineProperty(se,"PartitionedRateLimiter",{enumerable:!0,get:n(function(){return K0.PartitionedRateLimiter},"get")});var J0=nf();Object.defineProperty(se,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:n(function(){return J0.PartitionedTimeBasedRateLimiter},"get")});var Z0=jc();Object.defineProperty(se,"ResponseBasedRateLimiter",{enumerable:!0,get:n(function(){return Z0.ResponseBasedRateLimiter},"get")});var X0=Fc();Object.defineProperty(se,"TimeBasedRateLimiter",{enumerable:!0,get:n(function(){return X0.TimeBasedRateLimiter},"get")});var Y0=sf();Object.defineProperty(se,"TimedPassthruRateLimiter",{enumerable:!0,get:n(function(){return Y0.TimedPassthruRateLimiter},"get")})});var uf=u((gt,lf)=>{var of=typeof self<"u"?self:gt,no=(function(){function i(){this.fetch=!1,this.DOMException=of.DOMException}return n(i,"F"),i.prototype=of,new i})();(function(i){var e=(function(t){var r={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function a(f){return f&&DataView.prototype.isPrototypeOf(f)}if(n(a,"isDataView"),r.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(f){return f&&s.indexOf(Object.prototype.toString.call(f))>-1};function l(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}n(l,"normalizeName");function d(f){return typeof f!="string"&&(f=String(f)),f}n(d,"normalizeValue");function p(f){var H={next:n(function(){var I=f.shift();return{done:I===void 0,value:I}},"next")};return r.iterable&&(H[Symbol.iterator]=function(){return H}),H}n(p,"iteratorFor");function h(f){this.map={},f instanceof h?f.forEach(function(H,I){this.append(I,H)},this):Array.isArray(f)?f.forEach(function(H){this.append(H[0],H[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(H){this.append(H,f[H])},this)}n(h,"Headers"),h.prototype.append=function(f,H){f=l(f),H=d(H);var I=this.map[f];this.map[f]=I?I+", "+H:H},h.prototype.delete=function(f){delete this.map[l(f)]},h.prototype.get=function(f){return f=l(f),this.has(f)?this.map[f]:null},h.prototype.has=function(f){return this.map.hasOwnProperty(l(f))},h.prototype.set=function(f,H){this.map[l(f)]=d(H)},h.prototype.forEach=function(f,H){for(var I in this.map)this.map.hasOwnProperty(I)&&f.call(H,this.map[I],I,this)},h.prototype.keys=function(){var f=[];return this.forEach(function(H,I){f.push(I)}),p(f)},h.prototype.values=function(){var f=[];return this.forEach(function(H){f.push(H)}),p(f)},h.prototype.entries=function(){var f=[];return this.forEach(function(H,I){f.push([I,H])}),p(f)},r.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function w(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}n(w,"consumed");function E(f){return new Promise(function(H,I){f.onload=function(){H(f.result)},f.onerror=function(){I(f.error)}})}n(E,"fileReaderReady");function P(f){var H=new FileReader,I=E(H);return H.readAsArrayBuffer(f),I}n(P,"readBlobAsArrayBuffer");function y(f){var H=new FileReader,I=E(H);return H.readAsText(f),I}n(y,"readBlobAsText");function q(f){for(var H=new Uint8Array(f),I=new Array(H.length),X=0;X<H.length;X++)I[X]=String.fromCharCode(H[X]);return I.join("")}n(q,"readArrayBufferAsText");function v(f){if(f.slice)return f.slice(0);var H=new Uint8Array(f.byteLength);return H.set(new Uint8Array(f)),H.buffer}n(v,"bufferClone");function U(){return this.bodyUsed=!1,this._initBody=function(f){this._bodyInit=f,f?typeof f=="string"?this._bodyText=f:r.blob&&Blob.prototype.isPrototypeOf(f)?this._bodyBlob=f:r.formData&&FormData.prototype.isPrototypeOf(f)?this._bodyFormData=f:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)?this._bodyText=f.toString():r.arrayBuffer&&r.blob&&a(f)?(this._bodyArrayBuffer=v(f.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(f)||o(f))?this._bodyArrayBuffer=v(f):this._bodyText=f=Object.prototype.toString.call(f):this._bodyText="",this.headers.get("content-type")||(typeof f=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var f=w(this);if(f)return f;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(){return this._bodyArrayBuffer?w(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(P)}),this.text=function(){var f=w(this);if(f)return f;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(q(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(Oe)}),this.json=function(){return this.text().then(JSON.parse)},this}n(U,"Body");var be=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function z(f){var H=f.toUpperCase();return be.indexOf(H)>-1?H:f}n(z,"normalizeMethod");function k(f,H){H=H||{};var I=H.body;if(f instanceof k){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,H.headers||(this.headers=new h(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!I&&f._bodyInit!=null&&(I=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=H.credentials||this.credentials||"same-origin",(H.headers||!this.headers)&&(this.headers=new h(H.headers)),this.method=z(H.method||this.method||"GET"),this.mode=H.mode||this.mode||null,this.signal=H.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(I)}n(k,"Request"),k.prototype.clone=function(){return new k(this,{body:this._bodyInit})};function Oe(f){var H=new FormData;return f.trim().split("&").forEach(function(I){if(I){var X=I.split("="),$=X.shift().replace(/\+/g," "),B=X.join("=").replace(/\+/g," ");H.append(decodeURIComponent($),decodeURIComponent(B))}}),H}n(Oe,"decode");function ft(f){var H=new h,I=f.replace(/\r?\n[\t ]+/g," ");return I.split(/\r?\n/).forEach(function(X){var $=X.split(":"),B=$.shift().trim();if(B){var he=$.join(":").trim();H.append(B,he)}}),H}n(ft,"parseHeaders"),U.call(k.prototype);function J(f,H){H||(H={}),this.type="default",this.status=H.status===void 0?200:H.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in H?H.statusText:"OK",this.headers=new h(H.headers),this.url=H.url||"",this._initBody(f)}n(J,"Response"),U.call(J.prototype),J.prototype.clone=function(){return new J(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},J.error=function(){var f=new J(null,{status:0,statusText:""});return f.type="error",f};var di=[301,302,303,307,308];J.redirect=function(f,H){if(di.indexOf(H)===-1)throw new RangeError("Invalid status code");return new J(null,{status:H,headers:{location:f}})},t.DOMException=i.DOMException;try{new t.DOMException}catch{t.DOMException=function(H,I){this.message=H,this.name=I;var X=Error(H);this.stack=X.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function At(f,H){return new Promise(function(I,X){var $=new k(f,H);if($.signal&&$.signal.aborted)return X(new t.DOMException("Aborted","AbortError"));var B=new XMLHttpRequest;function he(){B.abort()}n(he,"abortXhr"),B.onload=function(){var Dt={status:B.status,statusText:B.statusText,headers:ft(B.getAllResponseHeaders()||"")};Dt.url="responseURL"in B?B.responseURL:Dt.headers.get("X-Request-URL");var Fe="response"in B?B.response:B.responseText;I(new J(Fe,Dt))},B.onerror=function(){X(new TypeError("Network request failed"))},B.ontimeout=function(){X(new TypeError("Network request failed"))},B.onabort=function(){X(new t.DOMException("Aborted","AbortError"))},B.open($.method,$.url,!0),$.credentials==="include"?B.withCredentials=!0:$.credentials==="omit"&&(B.withCredentials=!1),"responseType"in B&&r.blob&&(B.responseType="blob"),$.headers.forEach(function(Dt,Fe){B.setRequestHeader(Fe,Dt)}),$.signal&&($.signal.addEventListener("abort",he),B.onreadystatechange=function(){B.readyState===4&&$.signal.removeEventListener("abort",he)}),B.send(typeof $._bodyInit>"u"?null:$._bodyInit)})}return n(At,"fetch"),At.polyfill=!0,i.fetch||(i.fetch=At,i.Headers=h,i.Request=k,i.Response=J),t.Headers=h,t.Request=k,t.Response=J,t.fetch=At,Object.defineProperty(t,"__esModule",{value:!0}),t})({})})(no);no.fetch.ponyfill=!0;delete no.fetch.polyfill;var Tr=no;gt=Tr.fetch;gt.default=Tr.fetch;gt.fetch=Tr.fetch;gt.Headers=Tr.Headers;gt.Request=Tr.Request;gt.Response=Tr.Response;lf.exports=gt});var ao=u((XO,df)=>{"use strict";var Qc=Object.prototype.hasOwnProperty,Rr=Array.isArray,lt=(function(){for(var i=[],e=0;e<256;++e)i.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return i})(),eH=n(function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(Rr(r)){for(var a=[],s=0;s<r.length;++s)typeof r[s]<"u"&&a.push(r[s]);t.obj[t.prop]=a}}},"compactQueue"),cf=n(function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(r[a]=e[a]);return r},"arrayToObject"),tH=n(function i(e,t,r){if(!t)return e;if(typeof t!="object"){if(Rr(e))e.push(t);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!Qc.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var a=e;return Rr(e)&&!Rr(t)&&(a=cf(e,r)),Rr(e)&&Rr(t)?(t.forEach(function(s,o){if(Qc.call(e,o)){var l=e[o];l&&typeof l=="object"&&s&&typeof s=="object"?e[o]=i(l,s,r):e.push(s)}else e[o]=s}),e):Object.keys(t).reduce(function(s,o){var l=t[o];return Qc.call(s,o)?s[o]=i(s[o],l,r):s[o]=l,s},a)},"merge"),rH=n(function(e,t){return Object.keys(t).reduce(function(r,a){return r[a]=t[a],r},e)},"assignSingleSource"),iH=n(function(i,e,t){var r=i.replace(/\+/g," ");if(t==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},"decode"),nH=n(function(e,t,r){if(e.length===0)return e;var a=e;if(typeof e=="symbol"?a=Symbol.prototype.toString.call(e):typeof e!="string"&&(a=String(e)),r==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var s="",o=0;o<a.length;++o){var l=a.charCodeAt(o);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122){s+=a.charAt(o);continue}if(l<128){s=s+lt[l];continue}if(l<2048){s=s+(lt[192|l>>6]+lt[128|l&63]);continue}if(l<55296||l>=57344){s=s+(lt[224|l>>12]+lt[128|l>>6&63]+lt[128|l&63]);continue}o+=1,l=65536+((l&1023)<<10|a.charCodeAt(o)&1023),s+=lt[240|l>>18]+lt[128|l>>12&63]+lt[128|l>>6&63]+lt[128|l&63]}return s},"encode"),aH=n(function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],a=0;a<t.length;++a)for(var s=t[a],o=s.obj[s.prop],l=Object.keys(o),d=0;d<l.length;++d){var p=l[d],h=o[p];typeof h=="object"&&h!==null&&r.indexOf(h)===-1&&(t.push({obj:o,prop:p}),r.push(h))}return eH(t),e},"compact"),sH=n(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),oH=n(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),lH=n(function(e,t){return[].concat(e,t)},"combine");df.exports={arrayToObject:cf,assign:rH,combine:lH,compact:aH,decode:iH,encode:nH,isBuffer:oH,isRegExp:sH,merge:tH}});var Gc=u((eB,pf)=>{"use strict";var uH=String.prototype.replace,cH=/%20/g,dH=ao(),hf={RFC1738:"RFC1738",RFC3986:"RFC3986"};pf.exports=dH.assign({default:hf.RFC3986,formatters:{RFC1738:n(function(i){return uH.call(i,cH,"+")},"RFC1738"),RFC3986:n(function(i){return String(i)},"RFC3986")}},hf)});var gf=u((rB,ff)=>{"use strict";var yf=ao(),wi=Gc(),hH=Object.prototype.hasOwnProperty,_f={brackets:n(function(e){return e+"[]"},"brackets"),comma:"comma",indices:n(function(e,t){return e+"["+t+"]"},"indices"),repeat:n(function(e){return e},"repeat")},Ur=Array.isArray,pH=Array.prototype.push,Wc=n(function(i,e){pH.apply(i,Ur(e)?e:[e])},"pushToArray"),_H=Date.prototype.toISOString,mf=wi.default,Se={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:yf.encode,encodeValuesOnly:!1,format:mf,formatter:wi.formatters[mf],indices:!1,serializeDate:n(function(e){return _H.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},mH=n(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),yH=n(function i(e,t,r,a,s,o,l,d,p,h,w,E,P){var y=e;if(typeof l=="function"?y=l(t,y):y instanceof Date?y=h(y):r==="comma"&&Ur(y)&&(y=y.join(",")),y===null){if(a)return o&&!E?o(t,Se.encoder,P,"key"):t;y=""}if(mH(y)||yf.isBuffer(y)){if(o){var q=E?t:o(t,Se.encoder,P,"key");return[w(q)+"="+w(o(y,Se.encoder,P,"value"))]}return[w(t)+"="+w(String(y))]}var v=[];if(typeof y>"u")return v;var U;if(Ur(l))U=l;else{var be=Object.keys(y);U=d?be.sort(d):be}for(var z=0;z<U.length;++z){var k=U[z];s&&y[k]===null||(Ur(y)?Wc(v,i(y[k],typeof r=="function"?r(t,k):t,r,a,s,o,l,d,p,h,w,E,P)):Wc(v,i(y[k],t+(p?"."+k:"["+k+"]"),r,a,s,o,l,d,p,h,w,E,P)))}return v},"stringify"),fH=n(function(e){if(!e)return Se;if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||Se.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=wi.default;if(typeof e.format<"u"){if(!hH.call(wi.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var a=wi.formatters[r],s=Se.filter;return(typeof e.filter=="function"||Ur(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Se.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Se.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Se.charsetSentinel,delimiter:typeof e.delimiter>"u"?Se.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Se.encode,encoder:typeof e.encoder=="function"?e.encoder:Se.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Se.encodeValuesOnly,filter:s,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Se.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Se.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Se.strictNullHandling}},"normalizeStringifyOptions");ff.exports=function(i,e){var t=i,r=fH(e),a,s;typeof r.filter=="function"?(s=r.filter,t=s("",t)):Ur(r.filter)&&(s=r.filter,a=s);var o=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in _f?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var d=_f[l];a||(a=Object.keys(t)),r.sort&&a.sort(r.sort);for(var p=0;p<a.length;++p){var h=a[p];r.skipNulls&&t[h]===null||Wc(o,yH(t[h],h,d,r.strictNullHandling,r.skipNulls,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.formatter,r.encodeValuesOnly,r.charset))}var w=o.join(r.delimiter),E=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?E+="utf8=%26%2310003%3B&":E+="utf8=%E2%9C%93&"),w.length>0?E+w:""}});var vf=u((nB,wf)=>{"use strict";var vi=ao(),Vc=Object.prototype.hasOwnProperty,bf=Array.isArray,xe={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:vi.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},gH=n(function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},"interpretNumericEntities"),xf=n(function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},"parseArrayValue"),bH=n(function(e,t){if(bf(e)){for(var r=[],a=0;a<e.length;a+=1)r.push(t(e[a]));return r}return t(e)},"maybeMap"),xH="utf8=%26%2310003%3B",wH="utf8=%E2%9C%93",vH=n(function(e,t){var r={},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=a.split(t.delimiter,s),l=-1,d,p=t.charset;if(t.charsetSentinel)for(d=0;d<o.length;++d)o[d].indexOf("utf8=")===0&&(o[d]===wH?p="utf-8":o[d]===xH&&(p="iso-8859-1"),l=d,d=o.length);for(d=0;d<o.length;++d)if(d!==l){var h=o[d],w=h.indexOf("]="),E=w===-1?h.indexOf("="):w+1,P,y;E===-1?(P=t.decoder(h,xe.decoder,p,"key"),y=t.strictNullHandling?null:""):(P=t.decoder(h.slice(0,E),xe.decoder,p,"key"),y=bH(xf(h.slice(E+1),t),function(q){return t.decoder(q,xe.decoder,p,"value")})),y&&t.interpretNumericEntities&&p==="iso-8859-1"&&(y=gH(y)),h.indexOf("[]=")>-1&&(y=bf(y)?[y]:y),Vc.call(r,P)?r[P]=vi.combine(r[P],y):r[P]=y}return r},"parseQueryStringValues"),SH=n(function(i,e,t,r){for(var a=r?e:xf(e,t),s=i.length-1;s>=0;--s){var o,l=i[s];if(l==="[]"&&t.parseArrays)o=[].concat(a);else{o=t.plainObjects?Object.create(null):{};var d=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,p=parseInt(d,10);!t.parseArrays&&d===""?o={0:a}:!isNaN(p)&&l!==d&&String(p)===d&&p>=0&&t.parseArrays&&p<=t.arrayLimit?(o=[],o[p]=a):o[d]=a}a=o}return a},"parseObject"),HH=n(function(e,t,r,a){if(e){var s=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,d=r.depth>0&&o.exec(s),p=d?s.slice(0,d.index):s,h=[];if(p){if(!r.plainObjects&&Vc.call(Object.prototype,p)&&!r.allowPrototypes)return;h.push(p)}for(var w=0;r.depth>0&&(d=l.exec(s))!==null&&w<r.depth;){if(w+=1,!r.plainObjects&&Vc.call(Object.prototype,d[1].slice(1,-1))&&!r.allowPrototypes)return;h.push(d[1])}return d&&h.push("["+s.slice(d.index)+"]"),SH(h,t,r,a)}},"parseQueryStringKeys"),CH=n(function(e){if(!e)return xe;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?xe.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?xe.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:xe.allowPrototypes,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:xe.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:xe.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:xe.comma,decoder:typeof e.decoder=="function"?e.decoder:xe.decoder,delimiter:typeof e.delimiter=="string"||vi.isRegExp(e.delimiter)?e.delimiter:xe.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:xe.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:xe.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:xe.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:xe.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:xe.strictNullHandling}},"normalizeParseOptions");wf.exports=function(i,e){var t=CH(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?vH(i,t):i,a=t.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var l=s[o],d=HH(l,r[l],t,typeof i=="string");a=vi.merge(a,d,t)}return vi.compact(a)}});var $c=u((sB,Sf)=>{"use strict";var qH=gf(),EH=vf(),PH=Gc();Sf.exports={formats:PH,parse:EH,stringify:qH}});var Cf=u(Hf=>{function bt(i){if(typeof i!="object")return i;var e,t,r=Object.prototype.toString.call(i);if(r==="[object Object]"){if(i.constructor!==Object&&typeof i.constructor=="function"){t=new i.constructor;for(e in i)i.hasOwnProperty(e)&&t[e]!==i[e]&&(t[e]=bt(i[e]))}else{t={};for(e in i)e==="__proto__"?Object.defineProperty(t,e,{value:bt(i[e]),configurable:!0,enumerable:!0,writable:!0}):t[e]=bt(i[e])}return t}if(r==="[object Array]"){for(e=i.length,t=Array(e);e--;)t[e]=bt(i[e]);return t}return r==="[object Set]"?(t=new Set,i.forEach(function(a){t.add(bt(a))}),t):r==="[object Map]"?(t=new Map,i.forEach(function(a,s){t.set(bt(s),bt(a))}),t):r==="[object Date]"?new Date(+i):r==="[object RegExp]"?(t=new RegExp(i.source,i.flags),t.lastIndex=i.lastIndex,t):r==="[object DataView]"?new i.constructor(bt(i.buffer)):r==="[object ArrayBuffer]"?i.slice(0):r.slice(-6)==="Array]"?new i.constructor(i):i}n(bt,"klona");Hf.klona=bt});var Kc=u(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.DataObject=ut.getRawData=ut.rawDataSymbol=void 0;var AH=Cf();ut.rawDataSymbol=Symbol("twurpleRawData");function DH(i){return(0,AH.klona)(i[ut.rawDataSymbol])}n(DH,"getRawData");ut.getRawData=DH;var zc=class{static{n(this,"DataObject")}constructor(e){this[ut.rawDataSymbol]=e}};ut.DataObject=zc});var oo=u(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.CustomError=void 0;var Jc=class extends Error{static{n(this,"CustomError")}constructor(e,t){var r;super(e,t),Object.setPrototypeOf(this,new.target.prototype),(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}};so.CustomError=Jc});var Xc=u(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.RelationAssertionError=void 0;var IH=oo(),Zc=class extends IH.CustomError{static{n(this,"RelationAssertionError")}constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}};lo.RelationAssertionError=Zc});var qf=u(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.checkRelationAssertion=void 0;var TH=Xc();function RH(i){if(i==null)throw new TH.RelationAssertionError;return i}n(RH,"checkRelationAssertion");uo.checkRelationAssertion=RH});var Yc=u(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.rtfm=void 0;function UH(i,e,t){return r=>{let a=t?function(){return`[${e}#${this[t]} - please check https://twurple.js.org/reference/${i}/classes/${e}.html for available properties]`}:function(){return`[${e} - please check https://twurple.js.org/reference/${i}/classes/${e}.html for available properties]`};Object.defineProperty(r.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:a,enumerable:!1})}}n(UH,"rtfm");co.rtfm=UH});var Ef=u(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.HelixExtension=void 0;var OH=(b(),x(g)),D=Kc(),BH=Yc(),ed=class extends D.DataObject{static{n(this,"HelixExtension")}get authorName(){return this[D.rawDataSymbol].author_name}get bitsEnabled(){return this[D.rawDataSymbol].bits_enabled}get installable(){return this[D.rawDataSymbol].can_install}get configurationLocation(){return this[D.rawDataSymbol].configuration_location}get description(){return this[D.rawDataSymbol].description}get tosUrl(){return this[D.rawDataSymbol].eula_tos_url}get hasChatSupport(){return this[D.rawDataSymbol].has_chat_support}get iconUrl(){return this[D.rawDataSymbol].icon_url}getIconUrl(e){return this[D.rawDataSymbol].icon_urls[e]}get id(){return this[D.rawDataSymbol].id}get name(){return this[D.rawDataSymbol].name}get privacyPolicyUrl(){return this[D.rawDataSymbol].privacy_policy_url}get requestsIdentityLink(){return this[D.rawDataSymbol].request_identity_link}get screenshotUrls(){return this[D.rawDataSymbol].screenshot_urls}get state(){return this[D.rawDataSymbol].state}get subscriptionsSupportLevel(){return this[D.rawDataSymbol].subscriptions_support_level}get summary(){return this[D.rawDataSymbol].summary}get supportEmail(){return this[D.rawDataSymbol].support_email}get version(){return this[D.rawDataSymbol].version}get viewerSummary(){return this[D.rawDataSymbol].viewer_summary}get viewerSummery(){return this[D.rawDataSymbol].viewer_summary}get allowedConfigUrls(){return this[D.rawDataSymbol].allowlisted_config_urls}get allowedPanelUrls(){return this[D.rawDataSymbol].allowlisted_panel_urls}get mobileViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.mobile)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelHeight(){var e,t;return(t=(e=this[D.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.height)!==null&&t!==void 0?t:null}get panelCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get overlayViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get overlayCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get componentViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get componentAspectWidth(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_width)!==null&&t!==void 0?t:null}get componentAspectHeight(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_height)!==null&&t!==void 0?t:null}get componentAspectRatioX(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_x)!==null&&t!==void 0?t:null}get componentAspectRatioY(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_y)!==null&&t!==void 0?t:null}get componentAutoScales(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.autoscale)!==null&&t!==void 0?t:null}get componentScalePixels(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.scale_pixels)!==null&&t!==void 0?t:null}get componentTargetHeight(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.target_height)!==null&&t!==void 0?t:null}get componentSize(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.size)!==null&&t!==void 0?t:null}get componentZoom(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom)!==null&&t!==void 0?t:null}get componentZoomPixels(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom_pixels)!==null&&t!==void 0?t:null}get componentCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get configViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.config)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get configCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.config)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}};Si.HelixExtension=ed;Si.HelixExtension=ed=OH.__decorate([(0,BH.rtfm)("api","HelixExtension","id")],ed)});var Pf=u(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.HellFreezesOverError=void 0;var jH=oo(),td=class extends jH.CustomError{static{n(this,"HellFreezesOverError")}constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}};ho.HellFreezesOverError=td});var Af=u(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.extractUserName=Or.extractUserId=void 0;function kH(i){return typeof i=="string"?i:typeof i=="number"?i.toString(10):i.id}n(kH,"extractUserId");Or.extractUserId=kH;function MH(i){return typeof i=="string"?i:i.name}n(MH,"extractUserName");Or.extractUserName=MH});var _=u(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.extractUserName=K.extractUserId=K.RelationAssertionError=K.HellFreezesOverError=K.CustomError=K.HelixExtension=K.rtfm=K.checkRelationAssertion=K.rawDataSymbol=K.getRawData=K.DataObject=void 0;var rd=Kc();Object.defineProperty(K,"DataObject",{enumerable:!0,get:n(function(){return rd.DataObject},"get")});Object.defineProperty(K,"getRawData",{enumerable:!0,get:n(function(){return rd.getRawData},"get")});Object.defineProperty(K,"rawDataSymbol",{enumerable:!0,get:n(function(){return rd.rawDataSymbol},"get")});var LH=qf();Object.defineProperty(K,"checkRelationAssertion",{enumerable:!0,get:n(function(){return LH.checkRelationAssertion},"get")});var FH=Yc();Object.defineProperty(K,"rtfm",{enumerable:!0,get:n(function(){return FH.rtfm},"get")});var NH=Ef();Object.defineProperty(K,"HelixExtension",{enumerable:!0,get:n(function(){return NH.HelixExtension},"get")});var QH=oo();Object.defineProperty(K,"CustomError",{enumerable:!0,get:n(function(){return QH.CustomError},"get")});var GH=Pf();Object.defineProperty(K,"HellFreezesOverError",{enumerable:!0,get:n(function(){return GH.HellFreezesOverError},"get")});var WH=Xc();Object.defineProperty(K,"RelationAssertionError",{enumerable:!0,get:n(function(){return WH.RelationAssertionError},"get")});var Df=Af();Object.defineProperty(K,"extractUserId",{enumerable:!0,get:n(function(){return Df.extractUserId},"get")});Object.defineProperty(K,"extractUserName",{enumerable:!0,get:n(function(){return Df.extractUserName},"get")})});var nd=u(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.HttpStatusCodeError=void 0;var VH=_(),id=class extends VH.CustomError{static{n(this,"HttpStatusCodeError")}constructor(e,t,r,a,s,o){super(`Encountered HTTP status code ${e}: ${t}
1
+ var ts=Object.defineProperty;var fw=Object.getOwnPropertyDescriptor;var gw=Object.getOwnPropertyNames;var bw=Object.prototype.hasOwnProperty;var n=(i,e)=>ts(i,"name",{value:e,configurable:!0});var xw=(i,e)=>()=>(i&&(e=i(i=0)),e);var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),ww=(i,e)=>{for(var t in e)ts(i,t,{get:e[t],enumerable:!0})},vw=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of gw(e))!bw.call(i,a)&&a!==t&&ts(i,a,{get:()=>e[a],enumerable:!(r=fw(e,a))||r.enumerable});return i};var x=i=>vw(ts({},"__esModule",{value:!0}),i);var vr=u((sU,Y_)=>{var Mu=class i{static{n(this,"Emote")}constructor(e,t,r){if(new.target.name===i.name)throw new Error("Base Emote class cannot be used");this.fetcher=e.fetcher,this.channel=e,this.id=t,this.type=null,this._setup(r)}_setup(e){this.code=e.code}toLink(){return null}toString(){return this.code}toObject(){return{code:this.code,id:this.id,channel_id:this.channel.channel_id}}};Y_.exports=Mu});var Tt=u((lU,em)=>{em.exports={Twitch:{CDN:n((i,e)=>`https://static-cdn.jtvnw.net/emoticons/v2/${i}/default/dark/${e+1}.0`,"CDN")},BTTV:{Global:"https://api.betterttv.net/3/cached/emotes/global",Channel:n(i=>`https://api.betterttv.net/3/cached/users/twitch/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.betterttv.net/emote/${i}/${e+1}x.webp`,"CDN")},SevenTV:{Global:"https://7tv.io/v3/emote-sets/global",Channel:n(i=>`https://7tv.io/v3/users/twitch/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.7tv.app/emote/${i}/${e}`,"CDN")},FFZ:{sets:{Global:3,Modifiers:1532818},Set:n(i=>`https://api.frankerfacez.com/v1/set/${i}`,"Set"),Channel:n(i=>`https://api.frankerfacez.com/v1/room/id/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.frankerfacez.com/emote/${i}/${e}`,"CDN"),CDNAnimated:n((i,e)=>`https://cdn.frankerfacez.com/emote/${i}/animated/${e}.webp`,"CDNAnimated")},Templates:{html:'<img alt="{name}" title="{name}" class="twitch-emote twitch-emote-{size}" src="{link}">',markdown:'![{name}]({link} "{name}")',bbcode:"[img]{link}[/img]",plain:"{link}"}}});var Fu=u((cU,tm)=>{var Sw=vr(),Hw=Tt(),Lu=class i extends Sw{static{n(this,"BTTVEmote")}constructor(e,t,r){super(e,t,r),this.type="bttv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.ownerName="user"in e?e.user.name:null,this.animated=e.animated,this.imageType="webp"}toLink(e=0){return Hw.BTTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,ownerName:this.ownerName,type:this.type})}static fromObject(e,t=null){return new i(t,e.id,{code:e.code,animated:e.animated,user:{name:e.ownerName}})}};tm.exports=Lu});var rs=u((hU,rm)=>{var Nu=class extends Map{static{n(this,"Collection")}find(e,t){if(typeof e=="string"){if(typeof t>"u")return null;for(let r of this.values())if(r[e]===t)return r;return null}if(typeof e=="function"){let r=0;for(let a of this.values()){if(e(a,r,this))return a;r++}return null}return null}filter(e,t){t&&(e=e.bind(t));let r=new this.constructor,a=0;for(let[s,o]of this)e(o,a,this)&&r.set(s,o),a++;return r}map(e,t){t&&(e=e.bind(t));let r=new Array(this.size),a=0;for(let s of this.values())r[a]=e(s,a,this),a++;return r}};rm.exports=Nu});var Gu=u((_U,im)=>{var Cw=rs(),Qu=class{static{n(this,"Channel")}constructor(e,t){this.fetcher=e,this.channel_id=t,this.emotes=new Cw}fetchBTTVEmotes(){return this.fetcher.fetchBTTVEmotes(this.id)}fetchFFZEmotes(){return this.fetcher.fetchFFZEmotes(this.id)}fetchSevenTVEmotes(){return this.fetcher.fetchSevenTVEmotes(this.id)}};im.exports=Qu});var Vu=u((yU,am)=>{var qw=vr(),nm=Tt(),Wu=class i extends qw{static{n(this,"FFZEmote")}constructor(e,t,r){super(e,t,r),this.type="ffz"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e?e.owner.name:null,this.sizes="animated"in e?Object.keys(e.animated):Object.keys(e.urls),this.animated="animated"in e,this.imageType="animated"in e?"webp":"png",this.modifier=e.modifier&&(e.modifier_flags&1)!==0}toLink(e=0){return e=this.sizes[e],this.animated?nm.FFZ.CDNAnimated(this.id,e):nm.FFZ.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,modifier:this.modifier})}static fromObject(e,t=null){let r=e.sizes.reduce((a,s)=>(a[s]=s,a),{});return new i(t,e.id,{code:e.code,name:e.code,urls:r,...e.animated?{animated:r}:{},owner:{name:e.ownerName},modifier:e.modifier,modifier_flags:e.modifier})}};am.exports=Wu});var zu=u((gU,sm)=>{var Ew=vr(),Pw=Tt(),$u=class i extends Ew{static{n(this,"SevenTVEmote")}constructor(e,t,r){super(e,t,r),this.type="7tv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e.data?e.data.owner.display_name:null,this.sizes=e.data.host.files.filter(t=>t.format===this.channel.format.toUpperCase()).map(t=>t.name),this.animated=e.data.animated,this.imageType=this.channel.format}toLink(e=0){return e=this.sizes[e],Pw.SevenTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,imageType:this.imageType})}static fromObject(e,t){let r=e.sizes.map(a=>({format:t.format.toUpperCase(),name:a}));return new i(t,e.id,{code:e.code,name:e.code,data:{animated:e.animated,owner:{display_name:e.ownerName},host:{files:r}}})}};sm.exports=$u});var Ju=u((xU,om)=>{var Aw=vr(),Dw=Tt(),Ku=class i extends Aw{static{n(this,"TwitchEmote")}constructor(e,t,r){super(e,t,r),this.type="twitch"}get owner(){return this.channel}_setup(e){super._setup(e),this.set=e.emoticon_set,this.animated=e.formats.includes("animated"),this.imageType=e.formats.includes("animated")?"gif":"png"}toLink(e=0){return Dw.Twitch.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,set:this.set,type:this.type})}static fromObject(e,t=null){return new i(t,e.id,{code:e.code,animated:e.animated,emoticon_set:e.set,formats:e.animated?["static","animated"]:["static"]})}};om.exports=Ku});var Vm=u((vU,Wm)=>{"use strict";function Cm(i,e){return n(function(){return i.apply(e,arguments)},"wrap")}n(Cm,"bind");var{toString:Iw}=Object.prototype,{getPrototypeOf:lc}=Object,{iterator:us,toStringTag:qm}=Symbol,cs=(i=>e=>{let t=Iw.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ye=n(i=>(i=i.toLowerCase(),e=>cs(e)===i),"kindOfTest"),ds=n(i=>e=>typeof e===i,"typeOfTest"),{isArray:qr}=Array,Sr=ds("undefined");function pi(i){return i!==null&&!Sr(i)&&i.constructor!==null&&!Sr(i.constructor)&&qe(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}n(pi,"isBuffer");var Em=Ye("ArrayBuffer");function Tw(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Em(i.buffer),e}n(Tw,"isArrayBufferView");var Rw=ds("string"),qe=ds("function"),Pm=ds("number"),_i=n(i=>i!==null&&typeof i=="object","isObject"),Uw=n(i=>i===!0||i===!1,"isBoolean"),ns=n(i=>{if(cs(i)!=="object")return!1;let e=lc(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(qm in i)&&!(us in i)},"isPlainObject"),Ow=n(i=>{if(!_i(i)||pi(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},"isEmptyObject"),Bw=Ye("Date"),jw=Ye("File"),kw=n(i=>!!(i&&typeof i.uri<"u"),"isReactNativeBlob"),Mw=n(i=>i&&typeof i.getParts<"u","isReactNative"),Lw=Ye("Blob"),Fw=Ye("FileList"),Nw=n(i=>_i(i)&&qe(i.pipe),"isStream");function Qw(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}n(Qw,"getGlobal");var lm=Qw(),um=typeof lm.FormData<"u"?lm.FormData:void 0,Gw=n(i=>{let e;return i&&(um&&i instanceof um||qe(i.append)&&((e=cs(i))==="formdata"||e==="object"&&qe(i.toString)&&i.toString()==="[object FormData]"))},"isFormData"),Ww=Ye("URLSearchParams"),[Vw,$w,zw,Kw]=["ReadableStream","Request","Response","Headers"].map(Ye),Jw=n(i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function mi(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let r,a;if(typeof i!="object"&&(i=[i]),qr(i))for(r=0,a=i.length;r<a;r++)e.call(null,i[r],r,i);else{if(pi(i))return;let s=t?Object.getOwnPropertyNames(i):Object.keys(i),o=s.length,l;for(r=0;r<o;r++)l=s[r],e.call(null,i[l],l,i)}}n(mi,"forEach");function Am(i,e){if(pi(i))return null;e=e.toLowerCase();let t=Object.keys(i),r=t.length,a;for(;r-- >0;)if(a=t[r],e===a.toLowerCase())return a;return null}n(Am,"findKey");var tr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Dm=n(i=>!Sr(i)&&i!==tr,"isContextDefined");function tc(){let{caseless:i,skipUndefined:e}=Dm(this)&&this||{},t={},r=n((a,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;let o=i&&Am(t,s)||s;ns(t[o])&&ns(a)?t[o]=tc(t[o],a):ns(a)?t[o]=tc({},a):qr(a)?t[o]=a.slice():(!e||!Sr(a))&&(t[o]=a)},"assignValue");for(let a=0,s=arguments.length;a<s;a++)arguments[a]&&mi(arguments[a],r);return t}n(tc,"merge");var Zw=n((i,e,t,{allOwnKeys:r}={})=>(mi(e,(a,s)=>{t&&qe(a)?Object.defineProperty(i,s,{value:Cm(a,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,s,{value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),i),"extend"),Xw=n(i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),"stripBOM"),Yw=n((i,e,t,r)=>{i.prototype=Object.create(e.prototype,r),Object.defineProperty(i.prototype,"constructor",{value:i,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},"inherits"),ev=n((i,e,t,r)=>{let a,s,o,l={};if(e=e||{},i==null)return e;do{for(a=Object.getOwnPropertyNames(i),s=a.length;s-- >0;)o=a[s],(!r||r(o,i,e))&&!l[o]&&(e[o]=i[o],l[o]=!0);i=t!==!1&&lc(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},"toFlatObject"),tv=n((i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;let r=i.indexOf(e,t);return r!==-1&&r===t},"endsWith"),rv=n(i=>{if(!i)return null;if(qr(i))return i;let e=i.length;if(!Pm(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},"toArray"),iv=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&lc(Uint8Array)),nv=n((i,e)=>{let r=(i&&i[us]).call(i),a;for(;(a=r.next())&&!a.done;){let s=a.value;e.call(i,s[0],s[1])}},"forEachEntry"),av=n((i,e)=>{let t,r=[];for(;(t=i.exec(e))!==null;)r.push(t);return r},"matchAll"),sv=Ye("HTMLFormElement"),ov=n(i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,n(function(t,r,a){return r.toUpperCase()+a},"replacer")),"toCamelCase"),cm=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),lv=Ye("RegExp"),Im=n((i,e)=>{let t=Object.getOwnPropertyDescriptors(i),r={};mi(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(r[s]=o||a)}),Object.defineProperties(i,r)},"reduceDescriptors"),uv=n(i=>{Im(i,(e,t)=>{if(qe(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=i[t];if(qe(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),cv=n((i,e)=>{let t={},r=n(a=>{a.forEach(s=>{t[s]=!0})},"define");return qr(i)?r(i):r(String(i).split(e)),t},"toObjectSet"),dv=n(()=>{},"noop"),hv=n((i,e)=>i!=null&&Number.isFinite(i=+i)?i:e,"toFiniteNumber");function pv(i){return!!(i&&qe(i.append)&&i[qm]==="FormData"&&i[us])}n(pv,"isSpecCompliantForm");var _v=n(i=>{let e=new Array(10),t=n((r,a)=>{if(_i(r)){if(e.indexOf(r)>=0)return;if(pi(r))return r;if(!("toJSON"in r)){e[a]=r;let s=qr(r)?[]:{};return mi(r,(o,l)=>{let d=t(o,a+1);!Sr(d)&&(s[l]=d)}),e[a]=void 0,s}}return r},"visit");return t(i,0)},"toJSONObject"),mv=Ye("AsyncFunction"),yv=n(i=>i&&(_i(i)||qe(i))&&qe(i.then)&&qe(i.catch),"isThenable"),Tm=((i,e)=>i?setImmediate:e?((t,r)=>(tr.addEventListener("message",({source:a,data:s})=>{a===tr&&s===t&&r.length&&r.shift()()},!1),a=>{r.push(a),tr.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",qe(tr.postMessage)),fv=typeof queueMicrotask<"u"?queueMicrotask.bind(tr):typeof process<"u"&&process.nextTick||Tm,gv=n(i=>i!=null&&qe(i[us]),"isIterable"),_={isArray:qr,isArrayBuffer:Em,isBuffer:pi,isFormData:Gw,isArrayBufferView:Tw,isString:Rw,isNumber:Pm,isBoolean:Uw,isObject:_i,isPlainObject:ns,isEmptyObject:Ow,isReadableStream:Vw,isRequest:$w,isResponse:zw,isHeaders:Kw,isUndefined:Sr,isDate:Bw,isFile:jw,isReactNativeBlob:kw,isReactNative:Mw,isBlob:Lw,isRegExp:lv,isFunction:qe,isStream:Nw,isURLSearchParams:Ww,isTypedArray:iv,isFileList:Fw,forEach:mi,merge:tc,extend:Zw,trim:Jw,stripBOM:Xw,inherits:Yw,toFlatObject:ev,kindOf:cs,kindOfTest:Ye,endsWith:tv,toArray:rv,forEachEntry:nv,matchAll:av,isHTMLForm:sv,hasOwnProperty:cm,hasOwnProp:cm,reduceDescriptors:Im,freezeMethods:uv,toObjectSet:cv,toCamelCase:ov,noop:dv,toFiniteNumber:hv,findKey:Am,global:tr,isContextDefined:Dm,isSpecCompliantForm:pv,toJSONObject:_v,isAsyncFn:mv,isThenable:yv,setImmediate:Tm,asap:fv,isIterable:gv},Ce=class i extends Error{static{n(this,"AxiosError")}static from(e,t,r,a,s,o){let l=new i(e.message,t||e.code,r,a,s);return l.cause=e,l.name=e.name,e.status!=null&&l.status==null&&(l.status=e.status),o&&Object.assign(l,o),l}constructor(e,t,r,a,s){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),a&&(this.request=a),s&&(this.response=s,this.status=s.status)}toJSON(){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:_.toJSONObject(this.config),code:this.code,status:this.status}}};Ce.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Ce.ERR_BAD_OPTION="ERR_BAD_OPTION";Ce.ECONNABORTED="ECONNABORTED";Ce.ETIMEDOUT="ETIMEDOUT";Ce.ERR_NETWORK="ERR_NETWORK";Ce.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Ce.ERR_DEPRECATED="ERR_DEPRECATED";Ce.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Ce.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Ce.ERR_CANCELED="ERR_CANCELED";Ce.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Ce.ERR_INVALID_URL="ERR_INVALID_URL";var O=Ce,bv=null;function rc(i){return _.isPlainObject(i)||_.isArray(i)}n(rc,"isVisitable");function Rm(i){return _.endsWith(i,"[]")?i.slice(0,-2):i}n(Rm,"removeBrackets");function Zu(i,e,t){return i?i.concat(e).map(n(function(a,s){return a=Rm(a),!t&&s?"["+a+"]":a},"each")).join(t?".":""):e}n(Zu,"renderKey");function xv(i){return _.isArray(i)&&!i.some(rc)}n(xv,"isFlatArray");var wv=_.toFlatObject(_,{},null,n(function(e){return/^is[A-Z]/.test(e)},"filter"));function hs(i,e,t){if(!_.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=_.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,n(function(q,v){return!_.isUndefined(v[q])},"defined"));let r=t.metaTokens,a=t.visitor||p,s=t.dots,o=t.indexes,d=(t.Blob||typeof Blob<"u"&&Blob)&&_.isSpecCompliantForm(e);if(!_.isFunction(a))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(_.isDate(y))return y.toISOString();if(_.isBoolean(y))return y.toString();if(!d&&_.isBlob(y))throw new O("Blob is not supported. Use a Buffer instead.");return _.isArrayBuffer(y)||_.isTypedArray(y)?d&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}n(h,"convertValue");function p(y,q,v){let U=y;if(_.isReactNative(e)&&_.isReactNativeBlob(y))return e.append(Zu(v,q,s),h(y)),!1;if(y&&!v&&typeof y=="object"){if(_.endsWith(q,"{}"))q=r?q:q.slice(0,-2),y=JSON.stringify(y);else if(_.isArray(y)&&xv(y)||(_.isFileList(y)||_.endsWith(q,"[]"))&&(U=_.toArray(y)))return q=Rm(q),U.forEach(n(function(z,k){!(_.isUndefined(z)||z===null)&&e.append(o===!0?Zu([q],k,s):o===null?q:q+"[]",h(z))},"each")),!1}return rc(y)?!0:(e.append(Zu(v,q,s),h(y)),!1)}n(p,"defaultVisitor");let w=[],E=Object.assign(wv,{defaultVisitor:p,convertValue:h,isVisitable:rc});function P(y,q){if(!_.isUndefined(y)){if(w.indexOf(y)!==-1)throw Error("Circular reference detected in "+q.join("."));w.push(y),_.forEach(y,n(function(U,be){(!(_.isUndefined(U)||U===null)&&a.call(e,U,_.isString(be)?be.trim():be,q,E))===!0&&P(U,q?q.concat(be):[be])},"each")),w.pop()}}if(n(P,"build"),!_.isObject(i))throw new TypeError("data must be an object");return P(i),e}n(hs,"toFormData");function dm(i){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,n(function(r){return e[r]},"replacer"))}n(dm,"encode$1");function uc(i,e){this._pairs=[],i&&hs(i,this,e)}n(uc,"AxiosURLSearchParams");var Um=uc.prototype;Um.append=n(function(e,t){this._pairs.push([e,t])},"append");Um.toString=n(function(e){let t=e?function(r){return e.call(this,r,dm)}:dm;return this._pairs.map(n(function(a){return t(a[0])+"="+t(a[1])},"each"),"").join("&")},"toString");function vv(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}n(vv,"encode");function Om(i,e,t){if(!e)return i;let r=t&&t.encode||vv,a=_.isFunction(t)?{serialize:t}:t,s=a&&a.serialize,o;if(s?o=s(e,a):o=_.isURLSearchParams(e)?e.toString():new uc(e,a).toString(r),o){let l=i.indexOf("#");l!==-1&&(i=i.slice(0,l)),i+=(i.indexOf("?")===-1?"?":"&")+o}return i}n(Om,"buildURL");var ic=class{static{n(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){_.forEach(this.handlers,n(function(r){r!==null&&e(r)},"forEachHandler"))}},hm=ic,cc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Sv=typeof URLSearchParams<"u"?URLSearchParams:uc,Hv=typeof FormData<"u"?FormData:null,Cv=typeof Blob<"u"?Blob:null,qv={isBrowser:!0,classes:{URLSearchParams:Sv,FormData:Hv,Blob:Cv},protocols:["http","https","file","blob","url","data"]},dc=typeof window<"u"&&typeof document<"u",nc=typeof navigator=="object"&&navigator||void 0,Ev=dc&&(!nc||["ReactNative","NativeScript","NS"].indexOf(nc.product)<0),Pv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Av=dc&&window.location.href||"http://localhost",Dv=Object.freeze({__proto__:null,hasBrowserEnv:dc,hasStandardBrowserWebWorkerEnv:Pv,hasStandardBrowserEnv:Ev,navigator:nc,origin:Av}),ve={...Dv,...qv};function Iv(i,e){return hs(i,new ve.classes.URLSearchParams,{visitor:n(function(t,r,a,s){return ve.isNode&&_.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},"visitor"),...e})}n(Iv,"toURLEncodedForm");function Tv(i){return _.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}n(Tv,"parsePropPath");function Rv(i){let e={},t=Object.keys(i),r,a=t.length,s;for(r=0;r<a;r++)s=t[r],e[s]=i[s];return e}n(Rv,"arrayToObject");function Bm(i){function e(t,r,a,s){let o=t[s++];if(o==="__proto__")return!0;let l=Number.isFinite(+o),d=s>=t.length;return o=!o&&_.isArray(a)?a.length:o,d?(_.hasOwnProp(a,o)?a[o]=[a[o],r]:a[o]=r,!l):((!a[o]||!_.isObject(a[o]))&&(a[o]=[]),e(t,r,a[o],s)&&_.isArray(a[o])&&(a[o]=Rv(a[o])),!l)}if(n(e,"buildPath"),_.isFormData(i)&&_.isFunction(i.entries)){let t={};return _.forEachEntry(i,(r,a)=>{e(Tv(r),a,t,0)}),t}return null}n(Bm,"formDataToJSON");function Uv(i,e,t){if(_.isString(i))try{return(e||JSON.parse)(i),_.trim(i)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(i)}n(Uv,"stringifySafely");var hc={transitional:cc,adapter:["xhr","http","fetch"],transformRequest:[n(function(e,t){let r=t.getContentType()||"",a=r.indexOf("application/json")>-1,s=_.isObject(e);if(s&&_.isHTMLForm(e)&&(e=new FormData(e)),_.isFormData(e))return a?JSON.stringify(Bm(e)):e;if(_.isArrayBuffer(e)||_.isBuffer(e)||_.isStream(e)||_.isFile(e)||_.isBlob(e)||_.isReadableStream(e))return e;if(_.isArrayBufferView(e))return e.buffer;if(_.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Iv(e,this.formSerializer).toString();if((l=_.isFileList(e))||r.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return hs(l?{"files[]":e}:e,d&&new d,this.formSerializer)}}return s||a?(t.setContentType("application/json",!1),Uv(e)):e},"transformRequest")],transformResponse:[n(function(e){let t=this.transitional||hc.transitional,r=t&&t.forcedJSONParsing,a=this.responseType==="json";if(_.isResponse(e)||_.isReadableStream(e))return e;if(e&&_.isString(e)&&(r&&!this.responseType||a)){let o=!(t&&t.silentJSONParsing)&&a;try{return JSON.parse(e,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?O.from(l,O.ERR_BAD_RESPONSE,this,null,this.response):l}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ve.classes.FormData,Blob:ve.classes.Blob},validateStatus:n(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_.forEach(["delete","get","head","post","put","patch"],i=>{hc.headers[i]={}});var pc=hc,Ov=_.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"]),Bv=n(i=>{let e={},t,r,a;return i&&i.split(`
2
+ `).forEach(n(function(o){a=o.indexOf(":"),t=o.substring(0,a).trim().toLowerCase(),r=o.substring(a+1).trim(),!(!t||e[t]&&Ov[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)},"parser")),e},"parseHeaders"),pm=Symbol("internals");function hi(i){return i&&String(i).trim().toLowerCase()}n(hi,"normalizeHeader");function as(i){return i===!1||i==null?i:_.isArray(i)?i.map(as):String(i)}n(as,"normalizeValue");function jv(i){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=t.exec(i);)e[r[1]]=r[2];return e}n(jv,"parseTokens");var kv=n(i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim()),"isValidHeaderName");function Xu(i,e,t,r,a){if(_.isFunction(r))return r.call(this,e,t);if(a&&(e=t),!!_.isString(e)){if(_.isString(r))return e.indexOf(r)!==-1;if(_.isRegExp(r))return r.test(e)}}n(Xu,"matchHeaderValue");function Mv(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}n(Mv,"formatHeader");function Lv(i,e){let t=_.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(i,r+t,{value:n(function(a,s,o){return this[r].call(this,e,a,s,o)},"value"),configurable:!0})})}n(Lv,"buildAccessors");var Hr=class{static{n(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,r){let a=this;function s(l,d,h){let p=hi(d);if(!p)throw new Error("header name must be a non-empty string");let w=_.findKey(a,p);(!w||a[w]===void 0||h===!0||h===void 0&&a[w]!==!1)&&(a[w||d]=as(l))}n(s,"setHeader");let o=n((l,d)=>_.forEach(l,(h,p)=>s(h,p,d)),"setHeaders");if(_.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(_.isString(e)&&(e=e.trim())&&!kv(e))o(Bv(e),t);else if(_.isObject(e)&&_.isIterable(e)){let l={},d,h;for(let p of e){if(!_.isArray(p))throw TypeError("Object iterator must return a key-value pair");l[h=p[0]]=(d=l[h])?_.isArray(d)?[...d,p[1]]:[d,p[1]]:p[1]}o(l,t)}else e!=null&&s(t,e,r);return this}get(e,t){if(e=hi(e),e){let r=_.findKey(this,e);if(r){let a=this[r];if(!t)return a;if(t===!0)return jv(a);if(_.isFunction(t))return t.call(this,a,r);if(_.isRegExp(t))return t.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=hi(e),e){let r=_.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Xu(this,this[r],r,t)))}return!1}delete(e,t){let r=this,a=!1;function s(o){if(o=hi(o),o){let l=_.findKey(r,o);l&&(!t||Xu(r,r[l],l,t))&&(delete r[l],a=!0)}}return n(s,"deleteHeader"),_.isArray(e)?e.forEach(s):s(e),a}clear(e){let t=Object.keys(this),r=t.length,a=!1;for(;r--;){let s=t[r];(!e||Xu(this,this[s],s,e,!0))&&(delete this[s],a=!0)}return a}normalize(e){let t=this,r={};return _.forEach(this,(a,s)=>{let o=_.findKey(r,s);if(o){t[o]=as(a),delete t[s];return}let l=e?Mv(s):String(s).trim();l!==s&&delete t[s],t[l]=as(a),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return _.forEach(this,(r,a)=>{r!=null&&r!==!1&&(t[a]=e&&_.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let r=new this(e);return t.forEach(a=>r.set(a)),r}static accessor(e){let r=(this[pm]=this[pm]={accessors:{}}).accessors,a=this.prototype;function s(o){let l=hi(o);r[l]||(Lv(a,o),r[l]=!0)}return n(s,"defineAccessor"),_.isArray(e)?e.forEach(s):s(e),this}};Hr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_.reduceDescriptors(Hr.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:n(()=>i,"get"),set(r){this[t]=r}}});_.freezeMethods(Hr);var Xe=Hr;function Yu(i,e){let t=this||pc,r=e||t,a=Xe.from(r.headers),s=r.data;return _.forEach(i,n(function(l){s=l.call(t,s,a.normalize(),e?e.status:void 0)},"transform")),a.normalize(),s}n(Yu,"transformData");function jm(i){return!!(i&&i.__CANCEL__)}n(jm,"isCancel");var ac=class extends O{static{n(this,"CanceledError")}constructor(e,t,r){super(e??"canceled",O.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}},yi=ac;function km(i,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?i(t):e(new O("Request failed with status code "+t.status,[O.ERR_BAD_REQUEST,O.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}n(km,"settle");function Fv(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}n(Fv,"parseProtocol");function Nv(i,e){i=i||10;let t=new Array(i),r=new Array(i),a=0,s=0,o;return e=e!==void 0?e:1e3,n(function(d){let h=Date.now(),p=r[s];o||(o=h),t[a]=d,r[a]=h;let w=s,E=0;for(;w!==a;)E+=t[w++],w=w%i;if(a=(a+1)%i,a===s&&(s=(s+1)%i),h-o<e)return;let P=p&&h-p;return P?Math.round(E*1e3/P):void 0},"push")}n(Nv,"speedometer");function Qv(i,e){let t=0,r=1e3/e,a,s,o=n((h,p=Date.now())=>{t=p,a=null,s&&(clearTimeout(s),s=null),i(...h)},"invoke");return[n((...h)=>{let p=Date.now(),w=p-t;w>=r?o(h,p):(a=h,s||(s=setTimeout(()=>{s=null,o(a)},r-w)))},"throttled"),n(()=>a&&o(a),"flush")]}n(Qv,"throttle");var ls=n((i,e,t=3)=>{let r=0,a=Nv(50,250);return Qv(s=>{let o=s.loaded,l=s.lengthComputable?s.total:void 0,d=o-r,h=a(d),p=o<=l;r=o;let w={loaded:o,total:l,progress:l?o/l:void 0,bytes:d,rate:h||void 0,estimated:h&&l&&p?(l-o)/h:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};i(w)},t)},"progressEventReducer"),_m=n((i,e)=>{let t=i!=null;return[r=>e[0]({lengthComputable:t,total:i,loaded:r}),e[1]]},"progressEventDecorator"),mm=n(i=>(...e)=>_.asap(()=>i(...e)),"asyncDecorator"),Gv=ve.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,ve.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(ve.origin),ve.navigator&&/(msie|trident)/i.test(ve.navigator.userAgent)):()=>!0,Wv=ve.hasStandardBrowserEnv?{write(i,e,t,r,a,s,o){if(typeof document>"u")return;let l=[`${i}=${encodeURIComponent(e)}`];_.isNumber(t)&&l.push(`expires=${new Date(t).toUTCString()}`),_.isString(r)&&l.push(`path=${r}`),_.isString(a)&&l.push(`domain=${a}`),s===!0&&l.push("secure"),_.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(i){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Vv(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}n(Vv,"isAbsoluteURL");function $v(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}n($v,"combineURLs");function Mm(i,e,t){let r=!Vv(e);return i&&(r||t==!1)?$v(i,e):e}n(Mm,"buildFullPath");var ym=n(i=>i instanceof Xe?{...i}:i,"headersToObject");function rr(i,e){e=e||{};let t={};function r(h,p,w,E){return _.isPlainObject(h)&&_.isPlainObject(p)?_.merge.call({caseless:E},h,p):_.isPlainObject(p)?_.merge({},p):_.isArray(p)?p.slice():p}n(r,"getMergedValue");function a(h,p,w,E){if(_.isUndefined(p)){if(!_.isUndefined(h))return r(void 0,h,w,E)}else return r(h,p,w,E)}n(a,"mergeDeepProperties");function s(h,p){if(!_.isUndefined(p))return r(void 0,p)}n(s,"valueFromConfig2");function o(h,p){if(_.isUndefined(p)){if(!_.isUndefined(h))return r(void 0,h)}else return r(void 0,p)}n(o,"defaultToConfig2");function l(h,p,w){if(w in e)return r(h,p);if(w in i)return r(void 0,h)}n(l,"mergeDirectKeys");let d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:n((h,p,w)=>a(ym(h),ym(p),w,!0),"headers")};return _.forEach(Object.keys({...i,...e}),n(function(p){if(p==="__proto__"||p==="constructor"||p==="prototype")return;let w=_.hasOwnProp(d,p)?d[p]:a,E=w(i[p],e[p],p);_.isUndefined(E)&&w!==l||(t[p]=E)},"computeConfigValue")),t}n(rr,"mergeConfig");var Lm=n(i=>{let e=rr({},i),{data:t,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:l}=e;if(e.headers=o=Xe.from(o),e.url=Om(Mm(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),_.isFormData(t)){if(ve.hasStandardBrowserEnv||ve.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(_.isFunction(t.getHeaders)){let d=t.getHeaders(),h=["content-type","content-length"];Object.entries(d).forEach(([p,w])=>{h.includes(p.toLowerCase())&&o.set(p,w)})}}if(ve.hasStandardBrowserEnv&&(r&&_.isFunction(r)&&(r=r(e)),r||r!==!1&&Gv(e.url))){let d=a&&s&&Wv.read(s);d&&o.set(a,d)}return e},"resolveConfig"),zv=typeof XMLHttpRequest<"u",Kv=zv&&function(i){return new Promise(n(function(t,r){let a=Lm(i),s=a.data,o=Xe.from(a.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:h}=a,p,w,E,P,y;function q(){P&&P(),y&&y(),a.cancelToken&&a.cancelToken.unsubscribe(p),a.signal&&a.signal.removeEventListener("abort",p)}n(q,"done");let v=new XMLHttpRequest;v.open(a.method.toUpperCase(),a.url,!0),v.timeout=a.timeout;function U(){if(!v)return;let z=Xe.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),Oe={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:z,config:i,request:v};km(n(function(J){t(J),q()},"_resolve"),n(function(J){r(J),q()},"_reject"),Oe),v=null}n(U,"onloadend"),"onloadend"in v?v.onloadend=U:v.onreadystatechange=n(function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(U)},"handleLoad"),v.onabort=n(function(){v&&(r(new O("Request aborted",O.ECONNABORTED,i,v)),v=null)},"handleAbort"),v.onerror=n(function(k){let Oe=k&&k.message?k.message:"Network Error",ft=new O(Oe,O.ERR_NETWORK,i,v);ft.event=k||null,r(ft),v=null},"handleError"),v.ontimeout=n(function(){let k=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded",Oe=a.transitional||cc;a.timeoutErrorMessage&&(k=a.timeoutErrorMessage),r(new O(k,Oe.clarifyTimeoutError?O.ETIMEDOUT:O.ECONNABORTED,i,v)),v=null},"handleTimeout"),s===void 0&&o.setContentType(null),"setRequestHeader"in v&&_.forEach(o.toJSON(),n(function(k,Oe){v.setRequestHeader(Oe,k)},"setRequestHeader")),_.isUndefined(a.withCredentials)||(v.withCredentials=!!a.withCredentials),l&&l!=="json"&&(v.responseType=a.responseType),h&&([E,y]=ls(h,!0),v.addEventListener("progress",E)),d&&v.upload&&([w,P]=ls(d),v.upload.addEventListener("progress",w),v.upload.addEventListener("loadend",P)),(a.cancelToken||a.signal)&&(p=n(z=>{v&&(r(!z||z.type?new yi(null,i,v):z),v.abort(),v=null)},"onCanceled"),a.cancelToken&&a.cancelToken.subscribe(p),a.signal&&(a.signal.aborted?p():a.signal.addEventListener("abort",p)));let be=Fv(a.url);if(be&&ve.protocols.indexOf(be)===-1){r(new O("Unsupported protocol "+be+":",O.ERR_BAD_REQUEST,i));return}v.send(s||null)},"dispatchXhrRequest"))},Jv=n((i,e)=>{let{length:t}=i=i?i.filter(Boolean):[];if(e||t){let r=new AbortController,a,s=n(function(h){if(!a){a=!0,l();let p=h instanceof Error?h:this.reason;r.abort(p instanceof O?p:new yi(p instanceof Error?p.message:p))}},"onabort"),o=e&&setTimeout(()=>{o=null,s(new O(`timeout of ${e}ms exceeded`,O.ETIMEDOUT))},e),l=n(()=>{i&&(o&&clearTimeout(o),o=null,i.forEach(h=>{h.unsubscribe?h.unsubscribe(s):h.removeEventListener("abort",s)}),i=null)},"unsubscribe");i.forEach(h=>h.addEventListener("abort",s));let{signal:d}=r;return d.unsubscribe=()=>_.asap(l),d}},"composeSignals"),Zv=Jv,Xv=n(function*(i,e){let t=i.byteLength;if(!e||t<e){yield i;return}let r=0,a;for(;r<t;)a=r+e,yield i.slice(r,a),r=a},"streamChunk"),Yv=n(async function*(i,e){for await(let t of eS(i))yield*Xv(t,e)},"readBytes"),eS=n(async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}let e=i.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},"readStream"),fm=n((i,e,t,r)=>{let a=Yv(i,e),s=0,o,l=n(d=>{o||(o=!0,r&&r(d))},"_onFinish");return new ReadableStream({async pull(d){try{let{done:h,value:p}=await a.next();if(h){l(),d.close();return}let w=p.byteLength;if(t){let E=s+=w;t(E)}d.enqueue(new Uint8Array(p))}catch(h){throw l(h),h}},cancel(d){return l(d),a.return()}},{highWaterMark:2})},"trackStream"),gm=64*1024,{isFunction:is}=_,tS=(({Request:i,Response:e})=>({Request:i,Response:e}))(_.global),{ReadableStream:bm,TextEncoder:xm}=_.global,wm=n((i,...e)=>{try{return!!i(...e)}catch{return!1}},"test"),rS=n(i=>{i=_.merge.call({skipUndefined:!0},tS,i);let{fetch:e,Request:t,Response:r}=i,a=e?is(e):typeof fetch=="function",s=is(t),o=is(r);if(!a)return!1;let l=a&&is(bm),d=a&&(typeof xm=="function"?(y=>q=>y.encode(q))(new xm):async y=>new Uint8Array(await new t(y).arrayBuffer())),h=s&&l&&wm(()=>{let y=!1,q=new t(ve.origin,{body:new bm,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!q}),p=o&&l&&wm(()=>_.isReadableStream(new r("").body)),w={stream:p&&(y=>y.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!w[y]&&(w[y]=(q,v)=>{let U=q&&q[y];if(U)return U.call(q);throw new O(`Response type '${y}' is not supported`,O.ERR_NOT_SUPPORT,v)})});let E=n(async y=>{if(y==null)return 0;if(_.isBlob(y))return y.size;if(_.isSpecCompliantForm(y))return(await new t(ve.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(_.isArrayBufferView(y)||_.isArrayBuffer(y))return y.byteLength;if(_.isURLSearchParams(y)&&(y=y+""),_.isString(y))return(await d(y)).byteLength},"getBodyLength"),P=n(async(y,q)=>{let v=_.toFiniteNumber(y.getContentLength());return v??E(q)},"resolveBodyLength");return async y=>{let{url:q,method:v,data:U,signal:be,cancelToken:z,timeout:k,onDownloadProgress:Oe,onUploadProgress:ft,responseType:J,headers:di,withCredentials:At="same-origin",fetchOptions:f}=Lm(y),H=e||fetch;J=J?(J+"").toLowerCase():"text";let I=Zv([be,z&&z.toAbortSignal()],k),X=null,$=I&&I.unsubscribe&&(()=>{I.unsubscribe()}),B;try{if(ft&&h&&v!=="get"&&v!=="head"&&(B=await P(di,U))!==0){let It=new t(q,{method:"POST",body:U,duplex:"half"}),wr;if(_.isFormData(U)&&(wr=It.headers.get("content-type"))&&di.setContentType(wr),It.body){let[ku,es]=_m(B,ls(mm(ft)));U=fm(It.body,gm,ku,es)}}_.isString(At)||(At=At?"include":"omit");let he=s&&"credentials"in t.prototype,Dt={...f,signal:I,method:v.toUpperCase(),headers:di.normalize().toJSON(),body:U,duplex:"half",credentials:he?At:void 0};X=s&&new t(q,Dt);let Fe=await(s?H(X,f):H(q,Dt)),Z_=p&&(J==="stream"||J==="response");if(p&&(Oe||Z_&&$)){let It={};["status","statusText","headers"].forEach(X_=>{It[X_]=Fe[X_]});let wr=_.toFiniteNumber(Fe.headers.get("content-length")),[ku,es]=Oe&&_m(wr,ls(mm(Oe),!0))||[];Fe=new r(fm(Fe.body,gm,ku,()=>{es&&es(),$&&$()}),It)}J=J||"text";let yw=await w[_.findKey(w,J)||"text"](Fe,y);return!Z_&&$&&$(),await new Promise((It,wr)=>{km(It,wr,{data:yw,headers:Xe.from(Fe.headers),status:Fe.status,statusText:Fe.statusText,config:y,request:X})})}catch(he){throw $&&$(),he&&he.name==="TypeError"&&/Load failed|fetch/i.test(he.message)?Object.assign(new O("Network Error",O.ERR_NETWORK,y,X,he&&he.response),{cause:he.cause||he}):O.from(he,he&&he.code,y,X,he&&he.response)}}},"factory"),iS=new Map,Fm=n(i=>{let e=i&&i.env||{},{fetch:t,Request:r,Response:a}=e,s=[r,a,t],o=s.length,l=o,d,h,p=iS;for(;l--;)d=s[l],h=p.get(d),h===void 0&&p.set(d,h=l?new Map:rS(e)),p=h;return h},"getFetch");Fm();var _c={http:bv,xhr:Kv,fetch:{get:Fm}};_.forEach(_c,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});var vm=n(i=>`- ${i}`,"renderReason"),nS=n(i=>_.isFunction(i)||i===null||i===!1,"isResolvedHandle");function aS(i,e){i=_.isArray(i)?i:[i];let{length:t}=i,r,a,s={};for(let o=0;o<t;o++){r=i[o];let l;if(a=r,!nS(r)&&(a=_c[(l=String(r)).toLowerCase()],a===void 0))throw new O(`Unknown adapter '${l}'`);if(a&&(_.isFunction(a)||(a=a.get(e))))break;s[l||"#"+o]=a}if(!a){let o=Object.entries(s).map(([d,h])=>`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build")),l=t?o.length>1?`since :
4
+ `+o.map(vm).join(`
5
+ `):" "+vm(o[0]):"as no adapter specified";throw new O("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return a}n(aS,"getAdapter");var Nm={getAdapter:aS,adapters:_c};function ec(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new yi(null,i)}n(ec,"throwIfCancellationRequested");function Sm(i){return ec(i),i.headers=Xe.from(i.headers),i.data=Yu.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),Nm.getAdapter(i.adapter||pc.adapter,i)(i).then(n(function(r){return ec(i),r.data=Yu.call(i,i.transformResponse,r),r.headers=Xe.from(r.headers),r},"onAdapterResolution"),n(function(r){return jm(r)||(ec(i),r&&r.response&&(r.response.data=Yu.call(i,i.transformResponse,r.response),r.response.headers=Xe.from(r.response.headers))),Promise.reject(r)},"onAdapterRejection"))}n(Sm,"dispatchRequest");var Qm="1.13.6",ps={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{ps[i]=n(function(r){return typeof r===i||"a"+(e<1?"n ":" ")+i},"validator")});var Hm={};ps.transitional=n(function(e,t,r){function a(s,o){return"[Axios v"+Qm+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return n(a,"formatMessage"),(s,o,l)=>{if(e===!1)throw new O(a(o," has been removed"+(t?" in "+t:"")),O.ERR_DEPRECATED);return t&&!Hm[o]&&(Hm[o]=!0,console.warn(a(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,l):!0}},"transitional");ps.spelling=n(function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)},"spelling");function sS(i,e,t){if(typeof i!="object")throw new O("options must be an object",O.ERR_BAD_OPTION_VALUE);let r=Object.keys(i),a=r.length;for(;a-- >0;){let s=r[a],o=e[s];if(o){let l=i[s],d=l===void 0||o(l,s,i);if(d!==!0)throw new O("option "+s+" must be "+d,O.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new O("Unknown option "+s,O.ERR_BAD_OPTION)}}n(sS,"assertOptions");var ss={assertOptions:sS,validators:ps},Ne=ss.validators,Cr=class{static{n(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new hm,response:new hm}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;let s=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
6
+ `+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=rr(this.defaults,t);let{transitional:r,paramsSerializer:a,headers:s}=t;r!==void 0&&ss.assertOptions(r,{silentJSONParsing:Ne.transitional(Ne.boolean),forcedJSONParsing:Ne.transitional(Ne.boolean),clarifyTimeoutError:Ne.transitional(Ne.boolean),legacyInterceptorReqResOrdering:Ne.transitional(Ne.boolean)},!1),a!=null&&(_.isFunction(a)?t.paramsSerializer={serialize:a}:ss.assertOptions(a,{encode:Ne.function,serialize:Ne.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ss.assertOptions(t,{baseUrl:Ne.spelling("baseURL"),withXsrfToken:Ne.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&_.merge(s.common,s[t.method]);s&&_.forEach(["delete","get","head","post","put","patch","common"],y=>{delete s[y]}),t.headers=Xe.concat(o,s);let l=[],d=!0;this.interceptors.request.forEach(n(function(q){if(typeof q.runWhen=="function"&&q.runWhen(t)===!1)return;d=d&&q.synchronous;let v=t.transitional||cc;v&&v.legacyInterceptorReqResOrdering?l.unshift(q.fulfilled,q.rejected):l.push(q.fulfilled,q.rejected)},"unshiftRequestInterceptors"));let h=[];this.interceptors.response.forEach(n(function(q){h.push(q.fulfilled,q.rejected)},"pushResponseInterceptors"));let p,w=0,E;if(!d){let y=[Sm.bind(this),void 0];for(y.unshift(...l),y.push(...h),E=y.length,p=Promise.resolve(t);w<E;)p=p.then(y[w++],y[w++]);return p}E=l.length;let P=t;for(;w<E;){let y=l[w++],q=l[w++];try{P=y(P)}catch(v){q.call(this,v);break}}try{p=Sm.call(this,P)}catch(y){return Promise.reject(y)}for(w=0,E=h.length;w<E;)p=p.then(h[w++],h[w++]);return p}getUri(e){e=rr(this.defaults,e);let t=Mm(e.baseURL,e.url,e.allowAbsoluteUrls);return Om(t,e.params,e.paramsSerializer)}};_.forEach(["delete","get","head","options"],n(function(e){Cr.prototype[e]=function(t,r){return this.request(rr(r||{},{method:e,url:t,data:(r||{}).data}))}},"forEachMethodNoData"));_.forEach(["post","put","patch"],n(function(e){function t(r){return n(function(s,o,l){return this.request(rr(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))},"httpMethod")}n(t,"generateHTTPMethod"),Cr.prototype[e]=t(),Cr.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var os=Cr,sc=class i{static{n(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(n(function(s){t=s},"promiseExecutor"));let r=this;this.promise.then(a=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](a);r._listeners=null}),this.promise.then=a=>{let s,o=new Promise(l=>{r.subscribe(l),s=l}).then(a);return o.cancel=n(function(){r.unsubscribe(s)},"reject"),o},e(n(function(s,o,l){r.reason||(r.reason=new yi(s,o,l),t(r.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=n(r=>{e.abort(r)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new i(n(function(a){e=a},"executor")),cancel:e}}},oS=sc;function lS(i){return n(function(t){return i.apply(null,t)},"wrap")}n(lS,"spread");function uS(i){return _.isObject(i)&&i.isAxiosError===!0}n(uS,"isAxiosError");var oc={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(oc).forEach(([i,e])=>{oc[e]=i});var cS=oc;function Gm(i){let e=new os(i),t=Cm(os.prototype.request,e);return _.extend(t,os.prototype,e,{allOwnKeys:!0}),_.extend(t,e,null,{allOwnKeys:!0}),t.create=n(function(a){return Gm(rr(i,a))},"create"),t}n(Gm,"createInstance");var ae=Gm(pc);ae.Axios=os;ae.CanceledError=yi;ae.CancelToken=oS;ae.isCancel=jm;ae.VERSION=Qm;ae.toFormData=hs;ae.AxiosError=O;ae.Cancel=ae.CanceledError;ae.all=n(function(e){return Promise.all(e)},"all");ae.spread=lS;ae.isAxiosError=uS;ae.mergeConfig=rr;ae.AxiosHeaders=Xe;ae.formToJSON=i=>Bm(_.isHTMLForm(i)?new FormData(i):i);ae.getAdapter=Nm.getAdapter;ae.HttpStatusCode=cS;ae.default=ae;Wm.exports=ae});var g={};ww(g,{__addDisposableResource:()=>fy,__assign:()=>_s,__asyncDelegator:()=>uy,__asyncGenerator:()=>ly,__asyncValues:()=>cy,__await:()=>Er,__awaiter:()=>ry,__classPrivateFieldGet:()=>_y,__classPrivateFieldIn:()=>yy,__classPrivateFieldSet:()=>my,__createBinding:()=>ys,__decorate:()=>Km,__disposeResources:()=>gy,__esDecorate:()=>Zm,__exportStar:()=>ny,__extends:()=>$m,__generator:()=>iy,__importDefault:()=>py,__importStar:()=>hy,__makeTemplateObject:()=>dy,__metadata:()=>ty,__param:()=>Jm,__propKey:()=>Ym,__read:()=>fc,__rest:()=>zm,__rewriteRelativeImportExtension:()=>by,__runInitializers:()=>Xm,__setFunctionName:()=>ey,__spread:()=>ay,__spreadArray:()=>oy,__spreadArrays:()=>sy,__values:()=>ms,default:()=>pS});function $m(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");mc(i,e);function t(){this.constructor=i}n(t,"__"),i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function zm(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(i);a<r.length;a++)e.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(i,r[a])&&(t[r[a]]=i[r[a]]);return t}function Km(i,e,t,r){var a=arguments.length,s=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(i,e,t,r);else for(var l=i.length-1;l>=0;l--)(o=i[l])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}function Jm(i,e){return function(t,r){e(t,r,i)}}function Zm(i,e,t,r,a,s){function o(U){if(U!==void 0&&typeof U!="function")throw new TypeError("Function expected");return U}n(o,"accept");for(var l=r.kind,d=l==="getter"?"get":l==="setter"?"set":"value",h=!e&&i?r.static?i:i.prototype:null,p=e||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),w,E=!1,P=t.length-1;P>=0;P--){var y={};for(var q in r)y[q]=q==="access"?{}:r[q];for(var q in r.access)y.access[q]=r.access[q];y.addInitializer=function(U){if(E)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(U||null))};var v=(0,t[P])(l==="accessor"?{get:p.get,set:p.set}:p[d],y);if(l==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(w=o(v.get))&&(p.get=w),(w=o(v.set))&&(p.set=w),(w=o(v.init))&&a.unshift(w)}else(w=o(v))&&(l==="field"?a.unshift(w):p[d]=w)}h&&Object.defineProperty(h,r.name,p),E=!0}function Xm(i,e,t){for(var r=arguments.length>2,a=0;a<e.length;a++)t=r?e[a].call(i,t):e[a].call(i);return r?t:void 0}function Ym(i){return typeof i=="symbol"?i:"".concat(i)}function ey(i,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(i,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function ty(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function ry(i,e,t,r){function a(s){return s instanceof t?s:new t(function(o){o(s)})}return n(a,"adopt"),new(t||(t=Promise))(function(s,o){function l(p){try{h(r.next(p))}catch(w){o(w)}}n(l,"fulfilled");function d(p){try{h(r.throw(p))}catch(w){o(w)}}n(d,"rejected");function h(p){p.done?s(p.value):a(p.value).then(l,d)}n(h,"step"),h((r=r.apply(i,e||[])).next())})}function iy(i,e){var t={label:0,sent:n(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,a,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(h){return function(p){return d([h,p])}}function d(h){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(t=0)),t;)try{if(r=1,a&&(s=h[0]&2?a.return:h[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,h[1])).done)return s;switch(a=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,a=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){t.label=h[1];break}if(h[0]===6&&t.label<s[1]){t.label=s[1],s=h;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(h);break}s[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(i,t)}catch(p){h=[6,p],a=0}finally{r=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function ny(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ys(e,i,t)}function ms(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:n(function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function fc(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),a,s=[],o;try{for(;(e===void 0||e-- >0)&&!(a=r.next()).done;)s.push(a.value)}catch(l){o={error:l}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function ay(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(fc(arguments[e]));return i}function sy(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),a=0,e=0;e<t;e++)for(var s=arguments[e],o=0,l=s.length;o<l;o++,a++)r[a]=s[o];return r}function oy(i,e,t){if(t||arguments.length===2)for(var r=0,a=e.length,s;r<a;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return i.concat(s||Array.prototype.slice.call(e))}function Er(i){return this instanceof Er?(this.v=i,this):new Er(i)}function ly(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),a,s=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(P){return function(y){return Promise.resolve(y).then(P,w)}}function l(P,y){r[P]&&(a[P]=function(q){return new Promise(function(v,U){s.push([P,q,v,U])>1||d(P,q)})},y&&(a[P]=y(a[P])))}function d(P,y){try{h(r[P](y))}catch(q){E(s[0][3],q)}}function h(P){P.value instanceof Er?Promise.resolve(P.value.v).then(p,w):E(s[0][2],P)}function p(P){d("next",P)}function w(P){d("throw",P)}function E(P,y){P(y),s.shift(),s.length&&d(s[0][0],s[0][1])}}function uy(i){var e,t;return e={},r("next"),r("throw",function(a){throw a}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(a,s){e[a]=i[a]?function(o){return(t=!t)?{value:Er(i[a](o)),done:!1}:s?s(o):o}:s}}function cy(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof ms=="function"?ms(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=i[s]&&function(o){return new Promise(function(l,d){o=i[s](o),a(l,d,o.done,o.value)})}}function a(s,o,l,d){Promise.resolve(d).then(function(h){s({value:h,done:l})},o)}}function dy(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function hy(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t=yc(i),r=0;r<t.length;r++)t[r]!=="default"&&ys(e,i,t[r]);return dS(e,i),e}function py(i){return i&&i.__esModule?i:{default:i}}function _y(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)}function my(i,e,t,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!a:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(i,t):a?a.value=t:e.set(i,t),t}function yy(i,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?e===i:i.has(e)}function fy(i,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,a;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],t&&(a=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");a&&(r=n(function(){try{a.call(this)}catch(s){return Promise.reject(s)}},"dispose")),i.stack.push({value:e,dispose:r,async:t})}else t&&i.stack.push({async:!0});return e}function gy(i){function e(s){i.error=i.hasError?new hS(s,i.error,"An error was suppressed during disposal."):s,i.hasError=!0}n(e,"fail");var t,r=0;function a(){for(;t=i.stack.pop();)try{if(!t.async&&r===1)return r=0,i.stack.push(t),Promise.resolve().then(a);if(t.dispose){var s=t.dispose.call(t.value);if(t.async)return r|=2,Promise.resolve(s).then(a,function(o){return e(o),a()})}else r|=1}catch(o){e(o)}if(r===1)return i.hasError?Promise.reject(i.error):Promise.resolve();if(i.hasError)throw i.error}return n(a,"next"),a()}function by(i,e){return typeof i=="string"&&/^\.\.?\//.test(i)?i.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,a,s,o){return r?e?".jsx":".js":a&&(!s||!o)?t:a+s+"."+o.toLowerCase()+"js"}):i}var mc,_s,ys,dS,yc,hS,pS,b=xw(()=>{mc=n(function(i,e){return mc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])},mc(i,e)},"extendStatics");n($m,"__extends");_s=n(function(){return _s=Object.assign||n(function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),_s.apply(this,arguments)},"__assign");n(zm,"__rest");n(Km,"__decorate");n(Jm,"__param");n(Zm,"__esDecorate");n(Xm,"__runInitializers");n(Ym,"__propKey");n(ey,"__setFunctionName");n(ty,"__metadata");n(ry,"__awaiter");n(iy,"__generator");ys=Object.create?(function(i,e,t,r){r===void 0&&(r=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:n(function(){return e[t]},"get")}),Object.defineProperty(i,r,a)}):(function(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]});n(ny,"__exportStar");n(ms,"__values");n(fc,"__read");n(ay,"__spread");n(sy,"__spreadArrays");n(oy,"__spreadArray");n(Er,"__await");n(ly,"__asyncGenerator");n(uy,"__asyncDelegator");n(cy,"__asyncValues");n(dy,"__makeTemplateObject");dS=Object.create?(function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}):function(i,e){i.default=e},yc=n(function(i){return yc=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},yc(i)},"ownKeys");n(hy,"__importStar");n(py,"__importDefault");n(_y,"__classPrivateFieldGet");n(my,"__classPrivateFieldSet");n(yy,"__classPrivateFieldIn");n(fy,"__addDisposableResource");hS=typeof SuppressedError=="function"?SuppressedError:function(i,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=i,r.suppressed=e,r};n(gy,"__disposeResources");n(by,"__rewriteRelativeImportExtension");pS={__extends:$m,__assign:_s,__rest:zm,__decorate:Km,__param:Jm,__esDecorate:Zm,__runInitializers:Xm,__propKey:Ym,__setFunctionName:ey,__metadata:ty,__awaiter:ry,__generator:iy,__createBinding:ys,__exportStar:ny,__values:ms,__read:fc,__spread:ay,__spreadArrays:sy,__spreadArray:oy,__await:Er,__asyncGenerator:ly,__asyncDelegator:uy,__asyncValues:cy,__makeTemplateObject:dy,__importStar:hy,__importDefault:py,__classPrivateFieldGet:_y,__classPrivateFieldSet:my,__classPrivateFieldIn:yy,__addDisposableResource:fy,__disposeResources:gy,__rewriteRelativeImportExtension:by}});var fi=u((CU,xy)=>{xy.exports.isNode=!1});var ir=u(Ut=>{"use strict";var Rt;Object.defineProperty(Ut,"__esModule",{value:!0});Ut.LogLevelToConsoleFunction=Ut.resolveLogLevel=Ut.LogLevel=void 0;var _S=fi(),Ee;(function(i){i[i.CRITICAL=0]="CRITICAL",i[i.ERROR=1]="ERROR",i[i.WARNING=2]="WARNING",i[i.INFO=3]="INFO",i[i.DEBUG=4]="DEBUG",i[i.TRACE=7]="TRACE"})(Ee||(Ee={}));Ut.LogLevel=Ee;function mS(i){if(typeof i=="number"){if(Object.prototype.hasOwnProperty.call(Ee,i))return i;var e=Object.keys(Ee).map(function(r){return parseInt(r,10)}).filter(function(r){return!isNaN(r)&&r<i});return e.length?Math.max.apply(Math,e):Ee.WARNING}var t=i.replace(/\d+$/,"").toUpperCase();if(!Object.prototype.hasOwnProperty.call(Ee,t))throw new Error("Unknown log level string: ".concat(i));return Ee[t]}n(mS,"resolveLogLevel");Ut.resolveLogLevel=mS;var yS=_S.isNode?console.log.bind(console):console.debug.bind(console);Ut.LogLevelToConsoleFunction=(Rt={},Rt[Ee.CRITICAL]=console.error.bind(console),Rt[Ee.ERROR]=console.error.bind(console),Rt[Ee.WARNING]=console.warn.bind(console),Rt[Ee.INFO]=console.info.bind(console),Rt[Ee.DEBUG]=yS.bind(console),Rt[Ee.TRACE]=console.trace.bind(console),Rt)});var wy=u(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.Enumerable=void 0;function fS(i){return i===void 0&&(i=!0),function(e,t){Object.defineProperty(e,t,{get:n(function(){},"get"),set:n(function(r){Object.defineProperty(this,t,{value:r,writable:!0,enumerable:i})},"set"),enumerable:i})}}n(fS,"Enumerable");fs.Enumerable=fS});var Sy=u(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.flatten=void 0;var vy=(b(),x(g));function gS(i){var e;return(e=[]).concat.apply(e,vy.__spreadArray([],vy.__read(i),!1))}n(gS,"flatten");gs.flatten=gS});var Hy=u(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.immutableSplice=void 0;var Pr=(b(),x(g));function bS(i,e,t){for(var r=[],a=3;a<arguments.length;a++)r[a-3]=arguments[a];return Pr.__spreadArray(Pr.__spreadArray(Pr.__spreadArray([],Pr.__read(i.slice(0,e)),!1),Pr.__read(r),!1),Pr.__read(i.slice(e+t)),!1)}n(bS,"immutableSplice");bs.immutableSplice=bS});var Cy=u(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.partitionedFlatMap=void 0;var gc=(b(),x(g));function xS(i,e,t){var r,a,s,o={};try{for(var l=gc.__values(i),d=l.next();!d.done;d=l.next()){var h=d.value,p=e(h),w=t(h);Array.isArray(w)||(w=[w]),Object.prototype.hasOwnProperty.call(o,p)?(s=o[p]).push.apply(s,gc.__spreadArray([],gc.__read(w),!1)):o[p]=w}}catch(E){r={error:E}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}return o}n(xS,"partitionedFlatMap");xs.partitionedFlatMap=xS});var Ey=u(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.resolveConfigValueSync=Ar.resolveConfigValue=void 0;var qy=(b(),x(g));function wS(i){return qy.__awaiter(this,void 0,void 0,function(){return qy.__generator(this,function(e){switch(e.label){case 0:return typeof i!="function"?[3,2]:[4,i()];case 1:return[2,e.sent()];case 2:return[2,i]}})})}n(wS,"resolveConfigValue");Ar.resolveConfigValue=wS;function vS(i){return typeof i=="function"?i():i}n(vS,"resolveConfigValueSync");Ar.resolveConfigValueSync=vS});var Py=u(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.deprecateClass=void 0;var bc=(b(),x(g));function SS(i,e){var t=!1;return(function(r){bc.__extends(a,r);function a(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];return t||(console.warn(e),t=!0),r.apply(this,bc.__spreadArray([],bc.__read(s),!1))||this}return n(a,"class_1"),a})(i)}n(SS,"deprecateClass");ws.deprecateClass=SS});var Dy=u(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.match=nr.eq=void 0;var Ay=n(function(i){return{otherwise:n(function(){return i},"otherwise"),on:n(function(){return Ay(i)},"on")}},"matched"),xc=n(function(i){return{on:n(function(e,t){return e(i)?Ay(t(i)):xc(i)},"on"),otherwise:n(function(e){return e(i)},"otherwise")}},"match");nr.match=xc;var HS=n(function(i){return function(e){return i===e}},"eq");nr.eq=HS;xc.eq=nr.eq});var Ty=u(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.fibWithLimit=void 0;var Iy=(b(),x(g));function CS(i){var e,t,r;return Iy.__generator(this,function(a){switch(a.label){case 0:e=0,t=1,a.label=1;case 1:return e<i?[4,e]:[3,3];case 2:return a.sent(),r=Iy.__read([t,e+t],2),e=r[0],t=r[1],[3,1];case 3:return[4,i];case 4:return a.sent(),[3,3];case 5:return[2]}})}n(CS,"fibWithLimit");vs.fibWithLimit=CS});var Hs=u(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.arrayToObject=void 0;var Ry=(b(),x(g));function qS(i,e){return Object.assign.apply(Object,Ry.__spreadArray([{}],Ry.__read(i.map(e)),!1))}n(qS,"arrayToObject");Ss.arrayToObject=qS});var Uy=u(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.entriesToObject=void 0;var ES=(b(),x(g)),PS=Hs();function AS(i){return(0,PS.arrayToObject)(i,function(e){var t,r=ES.__read(e,2),a=r[0],s=r[1];return t={},t[a]=s,t})}n(AS,"entriesToObject");Cs.entriesToObject=AS});var Oy=u(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.forEachObjectEntry=void 0;var DS=(b(),x(g));function IS(i,e){Object.entries(i).forEach(function(t){var r=DS.__read(t,2),a=r[0],s=r[1];return e(s,a)})}n(IS,"forEachObjectEntry");qs.forEachObjectEntry=IS});var By=u(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.groupBy=void 0;var TS=(b(),x(g));function RS(i,e){var t,r,a;if(typeof e!="function"){var s=e;e=n((function(w){return w[s].toString()}),"keyFn")}var o={};try{for(var l=TS.__values(i),d=l.next();!d.done;d=l.next()){var h=d.value,p=e(h);((a=o[p])!==null&&a!==void 0?a:o[p]=[]).push(h)}}catch(w){t={error:w}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return o}n(RS,"groupBy");Es.groupBy=RS});var jy=u(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.indexBy=void 0;var US=Hs();function OS(i,e){if(typeof e!="function"){var t=e;e=n((function(r){return r[t].toString()}),"keyFn")}return(0,US.arrayToObject)(i,function(r){var a;return a={},a[e(r)]=r,a})}n(OS,"indexBy");Ps.indexBy=OS});var ky=u(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.mapObject=void 0;var wc=(b(),x(g));function BS(i,e){var t=Object.entries(i).map(function(r){var a,s=wc.__read(r,2),o=s[0],l=s[1];return a={},a[o]=e(l,o),a});return Object.assign.apply(Object,wc.__spreadArray([{}],wc.__read(t),!1))}n(BS,"mapObject");As.mapObject=BS});var vc=u(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.pick=void 0;var Ds=(b(),x(g));function jS(i,e){return Object.assign.apply(Object,Ds.__spreadArray([{}],Ds.__read(Object.entries(i).filter(function(t){var r=Ds.__read(t,1),a=r[0];return e.includes(a)}).map(function(t){var r,a=Ds.__read(t,2),s=a[0],o=a[1];return r={},r[s]=o,r})),!1))}n(jS,"pick");Is.pick=jS});var My=u(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.omit=void 0;var kS=vc();function MS(i,e){return(0,kS.pick)(i,Object.keys(i).filter(function(t){return!e.includes(t)}))}n(MS,"omit");Ts.omit=MS});var Ly=u(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.mapOptional=Ot.mapNullable=Ot.isNullish=void 0;function Sc(i){return i==null}n(Sc,"isNullish");Ot.isNullish=Sc;function LS(i,e){return Sc(i)?null:e(i)}n(LS,"mapNullable");Ot.mapNullable=LS;function FS(i,e){return Sc(i)?void 0:e(i)}n(FS,"mapOptional");Ot.mapOptional=FS});var Ny=u(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.delay=void 0;var Fy=(b(),x(g));function NS(i){return Fy.__awaiter(this,void 0,void 0,function(){return Fy.__generator(this,function(e){switch(e.label){case 0:return[4,new Promise(function(t){return setTimeout(t,i)})];case 1:return e.sent(),[2]}})})}n(NS,"delay");Rs.delay=NS});var Qy=u(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.promiseWithResolvers=void 0;function QS(){var i,e,t=new Promise(function(r,a){i=r,e=a});return{promise:t,resolve:i,reject:e}}n(QS,"promiseWithResolvers");Us.promiseWithResolvers=QS});var Gy=u(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.padLeft=void 0;function GS(i,e,t){if(typeof i=="number"&&(i=i.toString()),e=e-i.length,e<=0)return i;t===void 0&&(t=" ");var r="";do(e&1)===1&&(r+=t),e>>=1,e&&(t+=t);while(e);return r+i}n(GS,"padLeft");Os.padLeft=GS});var Wy=u(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.splitWithLimit=void 0;var Hc=(b(),x(g));function WS(i,e,t){var r=i.split(e);return r.length<=t?r:Hc.__spreadArray(Hc.__spreadArray([],Hc.__read(r.slice(0,t-1)),!1),[r.slice(t-1).join(e)],!1)}n(WS,"splitWithLimit");Bs.splitWithLimit=WS});var Vy=u(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.utf8Substring=Dr.utf8Length=void 0;var js=(b(),x(g));function VS(i){return js.__spreadArray([],js.__read(i),!1).length}n(VS,"utf8Length");Dr.utf8Length=VS;function $S(i,e,t){return js.__spreadArray([],js.__read(i),!1).slice(e,t).join("")}n($S,"utf8Substring");Dr.utf8Substring=$S});var C=u(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.utf8Substring=A.utf8Length=A.splitWithLimit=A.padLeft=A.promiseWithResolvers=A.delay=A.mapOptional=A.mapNullable=A.isNullish=A.pick=A.omit=A.mapObject=A.indexBy=A.groupBy=A.forEachObjectEntry=A.entriesToObject=A.arrayToObject=A.fibWithLimit=A.eq=A.match=A.deprecateClass=A.resolveConfigValueSync=A.resolveConfigValue=A.partitionedFlatMap=A.immutableSplice=A.flatten=A.Enumerable=void 0;var zS=wy();Object.defineProperty(A,"Enumerable",{enumerable:!0,get:n(function(){return zS.Enumerable},"get")});var KS=Sy();Object.defineProperty(A,"flatten",{enumerable:!0,get:n(function(){return KS.flatten},"get")});var JS=Hy();Object.defineProperty(A,"immutableSplice",{enumerable:!0,get:n(function(){return JS.immutableSplice},"get")});var ZS=Cy();Object.defineProperty(A,"partitionedFlatMap",{enumerable:!0,get:n(function(){return ZS.partitionedFlatMap},"get")});var $y=Ey();Object.defineProperty(A,"resolveConfigValue",{enumerable:!0,get:n(function(){return $y.resolveConfigValue},"get")});Object.defineProperty(A,"resolveConfigValueSync",{enumerable:!0,get:n(function(){return $y.resolveConfigValueSync},"get")});var XS=Py();Object.defineProperty(A,"deprecateClass",{enumerable:!0,get:n(function(){return XS.deprecateClass},"get")});var zy=Dy();Object.defineProperty(A,"match",{enumerable:!0,get:n(function(){return zy.match},"get")});Object.defineProperty(A,"eq",{enumerable:!0,get:n(function(){return zy.eq},"get")});var YS=Ty();Object.defineProperty(A,"fibWithLimit",{enumerable:!0,get:n(function(){return YS.fibWithLimit},"get")});var e0=Hs();Object.defineProperty(A,"arrayToObject",{enumerable:!0,get:n(function(){return e0.arrayToObject},"get")});var t0=Uy();Object.defineProperty(A,"entriesToObject",{enumerable:!0,get:n(function(){return t0.entriesToObject},"get")});var r0=Oy();Object.defineProperty(A,"forEachObjectEntry",{enumerable:!0,get:n(function(){return r0.forEachObjectEntry},"get")});var i0=By();Object.defineProperty(A,"groupBy",{enumerable:!0,get:n(function(){return i0.groupBy},"get")});var n0=jy();Object.defineProperty(A,"indexBy",{enumerable:!0,get:n(function(){return n0.indexBy},"get")});var a0=ky();Object.defineProperty(A,"mapObject",{enumerable:!0,get:n(function(){return a0.mapObject},"get")});var s0=My();Object.defineProperty(A,"omit",{enumerable:!0,get:n(function(){return s0.omit},"get")});var o0=vc();Object.defineProperty(A,"pick",{enumerable:!0,get:n(function(){return o0.pick},"get")});var Cc=Ly();Object.defineProperty(A,"isNullish",{enumerable:!0,get:n(function(){return Cc.isNullish},"get")});Object.defineProperty(A,"mapNullable",{enumerable:!0,get:n(function(){return Cc.mapNullable},"get")});Object.defineProperty(A,"mapOptional",{enumerable:!0,get:n(function(){return Cc.mapOptional},"get")});var l0=Ny();Object.defineProperty(A,"delay",{enumerable:!0,get:n(function(){return l0.delay},"get")});var u0=Qy();Object.defineProperty(A,"promiseWithResolvers",{enumerable:!0,get:n(function(){return u0.promiseWithResolvers},"get")});var c0=Gy();Object.defineProperty(A,"padLeft",{enumerable:!0,get:n(function(){return c0.padLeft},"get")});var d0=Wy();Object.defineProperty(A,"splitWithLimit",{enumerable:!0,get:n(function(){return d0.splitWithLimit},"get")});var Ky=Vy();Object.defineProperty(A,"utf8Length",{enumerable:!0,get:n(function(){return Ky.utf8Length},"get")});Object.defineProperty(A,"utf8Substring",{enumerable:!0,get:n(function(){return Ky.utf8Substring},"get")})});var Ac=u(Ms=>{"use strict";var qc,Ec;Object.defineProperty(Ms,"__esModule",{value:!0});Ms.getMinLogLevelFromEnv=void 0;var h0=ir(),ks=typeof process>"u"?[]:(Ec=(qc=process.env.LOGGING)===null||qc===void 0?void 0:qc.split(";").map(function(i){var e=i.split("=",2),t=e[0],r=e[1];return r?[t==="default"?void 0:t.split(":"),(0,h0.resolveLogLevel)(r)]:null}).filter(function(i){return!!i}).sort(function(i,e){var t,r,a=i[0],s=e[0];return((t=s?.length)!==null&&t!==void 0?t:0)-((r=a?.length)!==null&&r!==void 0?r:0)}))!==null&&Ec!==void 0?Ec:[],Pc=ks.findIndex(function(i){var e=i[0];return!e}),Jy=void 0;Pc!==-1&&(Jy=ks[Pc][1],ks.splice(Pc));function p0(i,e){return e.length<=i.length&&e.every(function(t,r){return t===i[r]})}n(p0,"isPrefix");function _0(i){for(var e=i.split(":"),t=0,r=ks;t<r.length;t++){var a=r[t],s=a[0],o=a[1];if(p0(e,s))return o}return Jy}n(_0,"getMinLogLevelFromEnv");Ms.getMinLogLevelFromEnv=_0});var Dc=u(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.BaseLogger=void 0;var m0=C(),y0=fi(),f0=Ac(),Bt=ir(),g0=(function(){function i(e){var t=e.name,r=e.minLevel,a=e.emoji,s=a===void 0?!1:a,o=e.colors,l=e.timestamps,d=l===void 0?y0.isNode:l,h,p;this._name=t,this._minLevel=(p=(h=(0,m0.mapOptional)(r,function(w){return(0,Bt.resolveLogLevel)(w)}))!==null&&h!==void 0?h:(0,f0.getMinLogLevelFromEnv)(t))!==null&&p!==void 0?p:Bt.LogLevel.WARNING,this._emoji=s,this._colors=o,this._timestamps=d}return n(i,"BaseLogger"),i.prototype.crit=function(e){this.log(Bt.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this.log(Bt.LogLevel.ERROR,e)},i.prototype.warn=function(e){this.log(Bt.LogLevel.WARNING,e)},i.prototype.info=function(e){this.log(Bt.LogLevel.INFO,e)},i.prototype.debug=function(e){this.log(Bt.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this.log(Bt.LogLevel.TRACE,e)},i})();Ls.BaseLogger=g0});var Zy=u(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.BrowserLogger=void 0;var b0=(b(),x(g)),x0=ir(),w0=Dc(),v0=(function(i){b0.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return n(e,"BrowserLogger"),e.prototype.log=function(t,r){if(!(t>this._minLevel)){var a=x0.LogLevelToConsoleFunction[t],s="[".concat(this._name,"] ").concat(r);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(r)),a(s)}},e})(w0.BaseLogger);Fs.BrowserLogger=v0});var Xy=u(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.CustomLoggerWrapper=void 0;var S0=C(),H0=Ac(),Be=ir(),C0=(function(){function i(e){var t=e.name,r=e.minLevel,a=e.custom,s;this._minLevel=(s=(0,S0.mapOptional)(r,function(o){return(0,Be.resolveLogLevel)(o)}))!==null&&s!==void 0?s:(0,H0.getMinLogLevelFromEnv)(t),this._override=typeof a=="function"?{log:a}:a}return n(i,"CustomLoggerWrapper"),i.prototype.log=function(e,t){this._shouldLog(e)&&this._override.log(e,t)},i.prototype.crit=function(e){this._override.crit?this._shouldLog(Be.LogLevel.CRITICAL)&&this._override.crit(e):this.log(Be.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this._override.error?this._shouldLog(Be.LogLevel.ERROR)&&this._override.error(e):this.log(Be.LogLevel.ERROR,e)},i.prototype.warn=function(e){this._override.warn?this._shouldLog(Be.LogLevel.WARNING)&&this._override.warn(e):this.log(Be.LogLevel.WARNING,e)},i.prototype.info=function(e){this._override.info?this._shouldLog(Be.LogLevel.INFO)&&this._override.info(e):this.log(Be.LogLevel.INFO,e)},i.prototype.debug=function(e){this._override.debug?this._shouldLog(Be.LogLevel.DEBUG)&&this._override.debug(e):this.log(Be.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this._override.trace?this._shouldLog(Be.LogLevel.TRACE)&&this._override.trace(e):this.log(Be.LogLevel.TRACE,e)},i.prototype._shouldLog=function(e){return this._minLevel===void 0||this._minLevel>=e},i})();Ns.CustomLoggerWrapper=C0});var Yy=u(Pe=>{"use strict";var jt,kt,Mt;Object.defineProperty(Pe,"__esModule",{value:!0});Pe.NodeLogger=Pe.LogLevelToBackgroundColor=Pe.LogLevelToColor=Pe.LogLevelToEmoji=void 0;var q0=(b(),x(g)),ne=ir(),E0=Dc();Pe.LogLevelToEmoji=(jt={},jt[ne.LogLevel.CRITICAL]="\u{1F6D1}",jt[ne.LogLevel.ERROR]="\u274C",jt[ne.LogLevel.WARNING]="\u26A0\uFE0F ",jt[ne.LogLevel.INFO]="\u2139\uFE0F ",jt[ne.LogLevel.DEBUG]="\u{1F41E}",jt[ne.LogLevel.TRACE]="\u{1F43E}",jt);var P0={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,blackBright:90,redBright:91,greenBright:92,yellowBright:93,blueBright:94,magentaBright:95,cyanBright:96,whiteBright:97},A0={bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bgBlackBright:100,bgRedBright:101,bgGreenBright:102,bgYellowBright:103,bgBlueBright:104,bgMagentaBright:105,bgCyanBright:106,bgWhiteBright:107};function Qs(i,e,t){return function(r){return"\x1B[".concat(i,"m").concat(t?t(r):r,"\x1B[").concat(e,"m")}}n(Qs,"createGenericWrapper");function ot(i){return Qs(P0[i],39)}n(ot,"createColorWrapper");function gi(i,e){return Qs(A0[i],49,e)}n(gi,"createBgWrapper");Pe.LogLevelToColor=(kt={},kt[ne.LogLevel.CRITICAL]=ot("red"),kt[ne.LogLevel.ERROR]=ot("redBright"),kt[ne.LogLevel.WARNING]=ot("yellow"),kt[ne.LogLevel.INFO]=ot("blue"),kt[ne.LogLevel.DEBUG]=ot("magenta"),kt[ne.LogLevel.TRACE]=Qs(0,0),kt);Pe.LogLevelToBackgroundColor=(Mt={},Mt[ne.LogLevel.CRITICAL]=gi("bgRed",ot("white")),Mt[ne.LogLevel.ERROR]=gi("bgRedBright",ot("white")),Mt[ne.LogLevel.WARNING]=gi("bgYellow",ot("black")),Mt[ne.LogLevel.INFO]=gi("bgBlue",ot("white")),Mt[ne.LogLevel.DEBUG]=gi("bgMagenta",ot("black")),Mt[ne.LogLevel.TRACE]=Qs(7,27),Mt);var D0=(function(i){q0.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return n(e,"NodeLogger"),e.prototype.log=function(t,r){var a,s,o;if(!(t>this._minLevel)){var l=ne.LogLevelToConsoleFunction[t],d="";if(this._timestamps&&(d+="[".concat(new Date().toISOString(),"] ")),this._emoji){var h=Pe.LogLevelToEmoji[t];d+="".concat(h," ")}var p=(o=(a=this._colors)!==null&&a!==void 0?a:(s=process.stdout)===null||s===void 0?void 0:s.isTTY)!==null&&o!==void 0?o:!0;p?d+="".concat(Pe.LogLevelToBackgroundColor[t](this._name)," ").concat(Pe.LogLevelToBackgroundColor[t](ne.LogLevel[t])," ").concat(Pe.LogLevelToColor[t](r)):d+="[".concat(this._name,":").concat(ne.LogLevel[t].toLowerCase(),"] ").concat(r),l(d)}},e})(E0.BaseLogger);Pe.NodeLogger=D0});var ef=u(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.createLogger=void 0;var I0=fi(),T0=Zy(),R0=Xy(),U0=Yy();function O0(i){return i.custom?new R0.CustomLoggerWrapper(i):I0.isNode?new U0.NodeLogger(i):new T0.BrowserLogger(i)}n(O0,"createLogger");Gs.createLogger=O0});var bi=u(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.LogLevel=Ir.createLogger=void 0;var B0=ef();Object.defineProperty(Ir,"createLogger",{enumerable:!0,get:n(function(){return B0.createLogger},"get")});var j0=ir();Object.defineProperty(Ir,"LogLevel",{enumerable:!0,get:n(function(){return j0.LogLevel},"get")})});var Vs=u(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.CustomError=void 0;var Ic=class extends Error{static{n(this,"CustomError")}constructor(...e){var t;super(...e),Object.setPrototypeOf(this,new.target.prototype),(t=Error.captureStackTrace)===null||t===void 0||t.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}};Ws.CustomError=Ic});var zs=u($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.RateLimiterDestroyedError=void 0;var k0=Vs(),Tc=class extends k0.CustomError{static{n(this,"RateLimiterDestroyedError")}};$s.RateLimiterDestroyedError=Tc});var xi=u(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.RateLimitReachedError=void 0;var M0=Vs(),Rc=class extends M0.CustomError{static{n(this,"RateLimitReachedError")}};Ks.RateLimitReachedError=Rc});var Oc=u(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.RetryAfterError=void 0;var L0=Vs(),Uc=class extends L0.CustomError{static{n(this,"RetryAfterError")}constructor(e){super(`Need to retry after ${e} ms`),this._retryAt=Date.now()+e}get retryAt(){return this._retryAt}};Js.RetryAfterError=Uc});var tf=u(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.NullRateLimiter=void 0;var Bc=class{static{n(this,"NullRateLimiter")}constructor(e){this._callback=e}async request(e){return await this._callback(e)}clear(){}pause(){}resume(){}};Zs.NullRateLimiter=Bc});var kc=u(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.ResponseBasedRateLimiter=void 0;var F0=bi(),N0=C(),Q0=xi(),rf=Oc(),jc=class{static{n(this,"ResponseBasedRateLimiter")}constructor({logger:e}){this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,F0.createLogger)({name:"rate-limiter",emoji:!0,...e})}async request(e,t){return this._logger.trace("request start"),await new Promise((r,a)=>{var s;let o={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"};this._batchRunning||this._nextBatchTimer||this._paused?(this._logger.trace(`request queued batchRunning:${this._batchRunning.toString()} hasNextBatchTimer:${(!!this._nextBatchTimer).toString()} paused:${this._paused.toString()}`),this._queue.push(o)):this._runRequestBatch([o])})}clear(){this._queue=[]}pause(){this._paused=!0}resume(){this._paused=!1,this._runNextBatch()}get stats(){var e,t,r,a,s;return{lastKnownLimit:(t=(e=this._parameters)===null||e===void 0?void 0:e.limit)!==null&&t!==void 0?t:null,lastKnownRemainingRequests:(a=(r=this._parameters)===null||r===void 0?void 0:r.remaining)!==null&&a!==void 0?a:null,lastKnownResetDate:(0,N0.mapNullable)((s=this._parameters)===null||s===void 0?void 0:s.resetsAt,o=>new Date(o))}}async _runRequestBatch(e){this._logger.trace(`runRequestBatch start specs:${e.length}`),this._batchRunning=!0,this._parameters&&this._logger.debug(`Remaining requests: ${this._parameters.remaining}`),this._logger.debug(`Doing ${e.length} requests, new queue length is ${this._queue.length}`);let t=e.map(async o=>{let{req:l,resolve:d,reject:h}=o;try{let p=await this.doRequest(l),w=this.needsToRetryAfter(p);if(w!==null)throw this._queue.unshift(o),this._logger.info(`Retrying after ${w} ms`),new rf.RetryAfterError(w);let E=this.getParametersFromResponse(p);return d(p),E}catch(p){if(p instanceof rf.RetryAfterError)throw p;h(p);return}}),r=await Promise.allSettled(t),a=r.filter(o=>o.status==="rejected"),s=Date.now();if(a.length){this._logger.trace("runRequestBatch some rejected");let l=Math.max(s,...a.map(d=>d.reason.retryAt))-s;this._logger.warn(`Waiting for ${l} ms because the rate limit was exceeded`),this._nextBatchTimer=setTimeout(()=>{this._parameters=void 0,this._runNextBatch()},l)}else{this._logger.trace("runRequestBatch none rejected");let o=r.filter(l=>l.status==="fulfilled"&&l.value!==void 0).map(l=>l.value).reduce((l,d)=>l?d.remaining<l.remaining?d:l:d,void 0);if(this._batchRunning=!1,o)if(this._parameters=o,o.resetsAt<s||o.remaining>0)this._logger.trace("runRequestBatch canRunMore"),this._runNextBatch();else{let l=o.resetsAt-s;this._logger.trace(`runRequestBatch delay:${l}`),this._logger.warn(`Waiting for ${l} ms because the rate limit was reached`),this._queue=this._queue.filter(d=>{switch(d.limitReachedBehavior){case"enqueue":return!0;case"null":return d.resolve(null),!1;case"throw":return d.reject(new Q0.RateLimitReachedError("Request removed from queue because the rate limit was reached")),!1;default:throw new Error("this should never happen")}}),this._nextBatchTimer=setTimeout(()=>{this._parameters=void 0,this._runNextBatch()},l)}}this._logger.trace("runRequestBatch end")}_runNextBatch(){if(this._paused)return;this._logger.trace("runNextBatch start"),this._nextBatchTimer&&(clearTimeout(this._nextBatchTimer),this._nextBatchTimer=void 0);let e=this._parameters?Math.min(this._parameters.remaining,this._parameters.limit/10):1,t=this._queue.splice(0,e);t.length&&this._runRequestBatch(t),this._logger.trace("runNextBatch end")}};Xs.ResponseBasedRateLimiter=jc});var nf=u(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.PartitionedRateLimiter=void 0;var G0=kc(),Mc=class{static{n(this,"PartitionedRateLimiter")}constructor(e){this._children=new Map,this._paused=!1,this._partitionKeyCallback=e.getPartitionKey,this._createChildCallback=e.createChild}async request(e,t){let r=this._partitionKeyCallback(e);return await this._getChild(r).request(e,t)}clear(){for(let e of this._children.values())e.clear()}pause(){this._paused=!0;for(let e of this._children.values())e.pause()}resume(){this._paused=!1;for(let e of this._children.values())e.resume()}getChildStats(e){if(!this._children.has(e))return null;let t=this._children.get(e);return t instanceof G0.ResponseBasedRateLimiter?t.stats:null}_getChild(e){if(this._children.has(e))return this._children.get(e);let t=this._createChildCallback(e);return this._paused&&t.pause(),this._children.set(e,t),t}};Ys.PartitionedRateLimiter=Mc});var sf=u(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.PartitionedTimeBasedRateLimiter=void 0;var W0=bi(),V0=xi(),af=zs(),Lc=class{static{n(this,"PartitionedTimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a,getPartitionKey:s}){this._partitionedQueue=new Map,this._usedFromBucket=new Map,this._counterTimers=new Set,this._paused=!1,this._destroyed=!1,this._logger=(0,W0.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=a,this._partitionKeyCallback=s}async request(e,t){return await new Promise((r,a)=>{var s,o;if(this._destroyed){a(new af.RateLimiterDestroyedError("Rate limiter was destroyed"));return}let l={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"},d=this._partitionKeyCallback(e),h=(o=this._usedFromBucket.get(d))!==null&&o!==void 0?o:0;if(h>=this._bucketSize||this._paused)switch(l.limitReachedBehavior){case"enqueue":{let p=this._getPartitionedQueue(d);p.push(l),h+p.length>=this._bucketSize?this._logger.warn(`Rate limit of ${this._bucketSize} for ${d?`partition ${d}`:"default partition"} was reached, waiting for ${this._paused?"the limiter to be unpaused":"a free bucket entry"}; queue size is ${p.length}`):this._logger.info(`Enqueueing request for ${d?`partition ${d}`:"default partition"} because the rate limiter is paused; queue size is ${p.length}`);break}case"null":{l.resolve(null),this._paused?this._logger.info(`Returning null for request for ${d?`partition ${d}`:"default partition"} because the rate limiter is paused`):this._logger.warn(`Rate limit of ${this._bucketSize} for ${d?`partition ${d}`:"default partition"} was reached, dropping request and returning null`);break}case"throw":{l.reject(new V0.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":`the rate limit for ${d?`partition ${d}`:"default partition"} was reached`}`));break}default:throw new Error("this should never happen")}else this._runRequest(l,d)})}clear(){this._partitionedQueue.clear()}pause(){this._paused=!0}resume(){this._paused=!1;for(let e of this._partitionedQueue.keys())this._runNextRequest(e)}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._partitionedQueue.values())for(let t of e)t.reject(new af.RateLimiterDestroyedError("Rate limiter was destroyed"));this._partitionedQueue.clear()}_getPartitionedQueue(e){if(this._partitionedQueue.has(e))return this._partitionedQueue.get(e);let t=[];return this._partitionedQueue.set(e,t),t}async _runRequest(e,t){var r;let a=this._getPartitionedQueue(t);this._logger.debug(`doing a request for ${t?`partition ${t}`:"default partition"}, new queue length is ${a.length}`),this._usedFromBucket.set(t,((r=this._usedFromBucket.get(t))!==null&&r!==void 0?r:0)+1);let{req:s,resolve:o,reject:l}=e;try{o(await this._callback(s))}catch(d){l(d)}finally{let d=setTimeout(()=>{this._counterTimers.delete(d);let h=this._usedFromBucket.get(t)-1;this._usedFromBucket.set(t,h),a.length&&h<this._bucketSize&&this._runNextRequest(t)},this._timeFrame);this._counterTimers.add(d)}}_runNextRequest(e){if(this._paused)return;let r=this._getPartitionedQueue(e).shift();r&&this._runRequest(r,e)}};eo.PartitionedTimeBasedRateLimiter=Lc});var Nc=u(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.TimeBasedRateLimiter=void 0;var $0=bi(),z0=xi(),of=zs(),Fc=class{static{n(this,"TimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a}){this._queue=[],this._usedFromBucket=0,this._counterTimers=new Set,this._paused=!1,this._destroyed=!1,this._logger=(0,$0.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=a}async request(e,t){return await new Promise((r,a)=>{var s;if(this._destroyed){a(new of.RateLimiterDestroyedError("Rate limiter was destroyed"));return}let o={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"};if(this._usedFromBucket>=this._bucketSize||this._paused)switch(o.limitReachedBehavior){case"enqueue":{this._queue.push(o),this._usedFromBucket+this._queue.length>=this._bucketSize?this._logger.warn(`Rate limit of ${this._bucketSize} was reached, waiting for ${this._paused?"the limiter to be unpaused":"a free bucket entry"}; queue size is ${this._queue.length}`):this._logger.info(`Enqueueing request because the rate limiter is paused; queue size is ${this._queue.length}`);break}case"null":{o.resolve(null),this._logger.warn(`Rate limit of ${this._bucketSize} was reached, dropping request and returning null`),this._paused?this._logger.info("Returning null for request because the rate limiter is paused"):this._logger.warn(`Rate limit of ${this._bucketSize} was reached, dropping request and returning null`);break}case"throw":{o.reject(new z0.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":"the rate limit was reached"}`));break}default:throw new Error("this should never happen")}else this._runRequest(o)})}clear(){this._queue=[]}pause(){this._paused=!0}resume(){this._paused=!1,this._runNextRequest()}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._queue)e.reject(new of.RateLimiterDestroyedError("Rate limiter was destroyed"));this._queue=[]}async _runRequest(e){this._logger.debug(`doing a request, new queue length is ${this._queue.length}`),this._usedFromBucket+=1;let{req:t,resolve:r,reject:a}=e;try{r(await this._callback(t))}catch(s){a(s)}finally{let s=setTimeout(()=>{this._counterTimers.delete(s),this._usedFromBucket-=1,this._queue.length&&this._usedFromBucket<this._bucketSize&&this._runNextRequest()},this._timeFrame);this._counterTimers.add(s)}}_runNextRequest(){if(this._paused)return;let e=this._queue.shift();e&&this._runRequest(e)}};to.TimeBasedRateLimiter=Fc});var lf=u(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.TimedPassthruRateLimiter=void 0;var K0=Nc(),Qc=class extends K0.TimeBasedRateLimiter{static{n(this,"TimedPassthruRateLimiter")}constructor(e,t){super({...t,async doRequest(r,a){return await e.request(r,a)}})}};ro.TimedPassthruRateLimiter=Qc});var io=u(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.TimedPassthruRateLimiter=se.TimeBasedRateLimiter=se.ResponseBasedRateLimiter=se.PartitionedTimeBasedRateLimiter=se.PartitionedRateLimiter=se.NullRateLimiter=se.RetryAfterError=se.RateLimitReachedError=se.RateLimiterDestroyedError=void 0;var J0=zs();Object.defineProperty(se,"RateLimiterDestroyedError",{enumerable:!0,get:n(function(){return J0.RateLimiterDestroyedError},"get")});var Z0=xi();Object.defineProperty(se,"RateLimitReachedError",{enumerable:!0,get:n(function(){return Z0.RateLimitReachedError},"get")});var X0=Oc();Object.defineProperty(se,"RetryAfterError",{enumerable:!0,get:n(function(){return X0.RetryAfterError},"get")});var Y0=tf();Object.defineProperty(se,"NullRateLimiter",{enumerable:!0,get:n(function(){return Y0.NullRateLimiter},"get")});var eH=nf();Object.defineProperty(se,"PartitionedRateLimiter",{enumerable:!0,get:n(function(){return eH.PartitionedRateLimiter},"get")});var tH=sf();Object.defineProperty(se,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:n(function(){return tH.PartitionedTimeBasedRateLimiter},"get")});var rH=kc();Object.defineProperty(se,"ResponseBasedRateLimiter",{enumerable:!0,get:n(function(){return rH.ResponseBasedRateLimiter},"get")});var iH=Nc();Object.defineProperty(se,"TimeBasedRateLimiter",{enumerable:!0,get:n(function(){return iH.TimeBasedRateLimiter},"get")});var nH=lf();Object.defineProperty(se,"TimedPassthruRateLimiter",{enumerable:!0,get:n(function(){return nH.TimedPassthruRateLimiter},"get")})});var df=u((gt,cf)=>{var uf=typeof self<"u"?self:gt,no=(function(){function i(){this.fetch=!1,this.DOMException=uf.DOMException}return n(i,"F"),i.prototype=uf,new i})();(function(i){var e=(function(t){var r={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function a(f){return f&&DataView.prototype.isPrototypeOf(f)}if(n(a,"isDataView"),r.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(f){return f&&s.indexOf(Object.prototype.toString.call(f))>-1};function l(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}n(l,"normalizeName");function d(f){return typeof f!="string"&&(f=String(f)),f}n(d,"normalizeValue");function h(f){var H={next:n(function(){var I=f.shift();return{done:I===void 0,value:I}},"next")};return r.iterable&&(H[Symbol.iterator]=function(){return H}),H}n(h,"iteratorFor");function p(f){this.map={},f instanceof p?f.forEach(function(H,I){this.append(I,H)},this):Array.isArray(f)?f.forEach(function(H){this.append(H[0],H[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(H){this.append(H,f[H])},this)}n(p,"Headers"),p.prototype.append=function(f,H){f=l(f),H=d(H);var I=this.map[f];this.map[f]=I?I+", "+H:H},p.prototype.delete=function(f){delete this.map[l(f)]},p.prototype.get=function(f){return f=l(f),this.has(f)?this.map[f]:null},p.prototype.has=function(f){return this.map.hasOwnProperty(l(f))},p.prototype.set=function(f,H){this.map[l(f)]=d(H)},p.prototype.forEach=function(f,H){for(var I in this.map)this.map.hasOwnProperty(I)&&f.call(H,this.map[I],I,this)},p.prototype.keys=function(){var f=[];return this.forEach(function(H,I){f.push(I)}),h(f)},p.prototype.values=function(){var f=[];return this.forEach(function(H){f.push(H)}),h(f)},p.prototype.entries=function(){var f=[];return this.forEach(function(H,I){f.push([I,H])}),h(f)},r.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function w(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}n(w,"consumed");function E(f){return new Promise(function(H,I){f.onload=function(){H(f.result)},f.onerror=function(){I(f.error)}})}n(E,"fileReaderReady");function P(f){var H=new FileReader,I=E(H);return H.readAsArrayBuffer(f),I}n(P,"readBlobAsArrayBuffer");function y(f){var H=new FileReader,I=E(H);return H.readAsText(f),I}n(y,"readBlobAsText");function q(f){for(var H=new Uint8Array(f),I=new Array(H.length),X=0;X<H.length;X++)I[X]=String.fromCharCode(H[X]);return I.join("")}n(q,"readArrayBufferAsText");function v(f){if(f.slice)return f.slice(0);var H=new Uint8Array(f.byteLength);return H.set(new Uint8Array(f)),H.buffer}n(v,"bufferClone");function U(){return this.bodyUsed=!1,this._initBody=function(f){this._bodyInit=f,f?typeof f=="string"?this._bodyText=f:r.blob&&Blob.prototype.isPrototypeOf(f)?this._bodyBlob=f:r.formData&&FormData.prototype.isPrototypeOf(f)?this._bodyFormData=f:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)?this._bodyText=f.toString():r.arrayBuffer&&r.blob&&a(f)?(this._bodyArrayBuffer=v(f.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(f)||o(f))?this._bodyArrayBuffer=v(f):this._bodyText=f=Object.prototype.toString.call(f):this._bodyText="",this.headers.get("content-type")||(typeof f=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var f=w(this);if(f)return f;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(){return this._bodyArrayBuffer?w(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(P)}),this.text=function(){var f=w(this);if(f)return f;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(q(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(Oe)}),this.json=function(){return this.text().then(JSON.parse)},this}n(U,"Body");var be=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function z(f){var H=f.toUpperCase();return be.indexOf(H)>-1?H:f}n(z,"normalizeMethod");function k(f,H){H=H||{};var I=H.body;if(f instanceof k){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,H.headers||(this.headers=new p(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!I&&f._bodyInit!=null&&(I=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=H.credentials||this.credentials||"same-origin",(H.headers||!this.headers)&&(this.headers=new p(H.headers)),this.method=z(H.method||this.method||"GET"),this.mode=H.mode||this.mode||null,this.signal=H.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(I)}n(k,"Request"),k.prototype.clone=function(){return new k(this,{body:this._bodyInit})};function Oe(f){var H=new FormData;return f.trim().split("&").forEach(function(I){if(I){var X=I.split("="),$=X.shift().replace(/\+/g," "),B=X.join("=").replace(/\+/g," ");H.append(decodeURIComponent($),decodeURIComponent(B))}}),H}n(Oe,"decode");function ft(f){var H=new p,I=f.replace(/\r?\n[\t ]+/g," ");return I.split(/\r?\n/).forEach(function(X){var $=X.split(":"),B=$.shift().trim();if(B){var he=$.join(":").trim();H.append(B,he)}}),H}n(ft,"parseHeaders"),U.call(k.prototype);function J(f,H){H||(H={}),this.type="default",this.status=H.status===void 0?200:H.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in H?H.statusText:"OK",this.headers=new p(H.headers),this.url=H.url||"",this._initBody(f)}n(J,"Response"),U.call(J.prototype),J.prototype.clone=function(){return new J(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},J.error=function(){var f=new J(null,{status:0,statusText:""});return f.type="error",f};var di=[301,302,303,307,308];J.redirect=function(f,H){if(di.indexOf(H)===-1)throw new RangeError("Invalid status code");return new J(null,{status:H,headers:{location:f}})},t.DOMException=i.DOMException;try{new t.DOMException}catch{t.DOMException=function(H,I){this.message=H,this.name=I;var X=Error(H);this.stack=X.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function At(f,H){return new Promise(function(I,X){var $=new k(f,H);if($.signal&&$.signal.aborted)return X(new t.DOMException("Aborted","AbortError"));var B=new XMLHttpRequest;function he(){B.abort()}n(he,"abortXhr"),B.onload=function(){var Dt={status:B.status,statusText:B.statusText,headers:ft(B.getAllResponseHeaders()||"")};Dt.url="responseURL"in B?B.responseURL:Dt.headers.get("X-Request-URL");var Fe="response"in B?B.response:B.responseText;I(new J(Fe,Dt))},B.onerror=function(){X(new TypeError("Network request failed"))},B.ontimeout=function(){X(new TypeError("Network request failed"))},B.onabort=function(){X(new t.DOMException("Aborted","AbortError"))},B.open($.method,$.url,!0),$.credentials==="include"?B.withCredentials=!0:$.credentials==="omit"&&(B.withCredentials=!1),"responseType"in B&&r.blob&&(B.responseType="blob"),$.headers.forEach(function(Dt,Fe){B.setRequestHeader(Fe,Dt)}),$.signal&&($.signal.addEventListener("abort",he),B.onreadystatechange=function(){B.readyState===4&&$.signal.removeEventListener("abort",he)}),B.send(typeof $._bodyInit>"u"?null:$._bodyInit)})}return n(At,"fetch"),At.polyfill=!0,i.fetch||(i.fetch=At,i.Headers=p,i.Request=k,i.Response=J),t.Headers=p,t.Request=k,t.Response=J,t.fetch=At,Object.defineProperty(t,"__esModule",{value:!0}),t})({})})(no);no.fetch.ponyfill=!0;delete no.fetch.polyfill;var Tr=no;gt=Tr.fetch;gt.default=Tr.fetch;gt.fetch=Tr.fetch;gt.Headers=Tr.Headers;gt.Request=Tr.Request;gt.Response=Tr.Response;cf.exports=gt});var ao=u((iB,pf)=>{"use strict";var Gc=Object.prototype.hasOwnProperty,Rr=Array.isArray,lt=(function(){for(var i=[],e=0;e<256;++e)i.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return i})(),aH=n(function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(Rr(r)){for(var a=[],s=0;s<r.length;++s)typeof r[s]<"u"&&a.push(r[s]);t.obj[t.prop]=a}}},"compactQueue"),hf=n(function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(r[a]=e[a]);return r},"arrayToObject"),sH=n(function i(e,t,r){if(!t)return e;if(typeof t!="object"){if(Rr(e))e.push(t);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!Gc.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var a=e;return Rr(e)&&!Rr(t)&&(a=hf(e,r)),Rr(e)&&Rr(t)?(t.forEach(function(s,o){if(Gc.call(e,o)){var l=e[o];l&&typeof l=="object"&&s&&typeof s=="object"?e[o]=i(l,s,r):e.push(s)}else e[o]=s}),e):Object.keys(t).reduce(function(s,o){var l=t[o];return Gc.call(s,o)?s[o]=i(s[o],l,r):s[o]=l,s},a)},"merge"),oH=n(function(e,t){return Object.keys(t).reduce(function(r,a){return r[a]=t[a],r},e)},"assignSingleSource"),lH=n(function(i,e,t){var r=i.replace(/\+/g," ");if(t==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},"decode"),uH=n(function(e,t,r){if(e.length===0)return e;var a=e;if(typeof e=="symbol"?a=Symbol.prototype.toString.call(e):typeof e!="string"&&(a=String(e)),r==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var s="",o=0;o<a.length;++o){var l=a.charCodeAt(o);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122){s+=a.charAt(o);continue}if(l<128){s=s+lt[l];continue}if(l<2048){s=s+(lt[192|l>>6]+lt[128|l&63]);continue}if(l<55296||l>=57344){s=s+(lt[224|l>>12]+lt[128|l>>6&63]+lt[128|l&63]);continue}o+=1,l=65536+((l&1023)<<10|a.charCodeAt(o)&1023),s+=lt[240|l>>18]+lt[128|l>>12&63]+lt[128|l>>6&63]+lt[128|l&63]}return s},"encode"),cH=n(function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],a=0;a<t.length;++a)for(var s=t[a],o=s.obj[s.prop],l=Object.keys(o),d=0;d<l.length;++d){var h=l[d],p=o[h];typeof p=="object"&&p!==null&&r.indexOf(p)===-1&&(t.push({obj:o,prop:h}),r.push(p))}return aH(t),e},"compact"),dH=n(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),hH=n(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),pH=n(function(e,t){return[].concat(e,t)},"combine");pf.exports={arrayToObject:hf,assign:oH,combine:pH,compact:cH,decode:lH,encode:uH,isBuffer:hH,isRegExp:dH,merge:sH}});var Wc=u((aB,mf)=>{"use strict";var _H=String.prototype.replace,mH=/%20/g,yH=ao(),_f={RFC1738:"RFC1738",RFC3986:"RFC3986"};mf.exports=yH.assign({default:_f.RFC3986,formatters:{RFC1738:n(function(i){return _H.call(i,mH,"+")},"RFC1738"),RFC3986:n(function(i){return String(i)},"RFC3986")}},_f)});var xf=u((oB,bf)=>{"use strict";var gf=ao(),wi=Wc(),fH=Object.prototype.hasOwnProperty,yf={brackets:n(function(e){return e+"[]"},"brackets"),comma:"comma",indices:n(function(e,t){return e+"["+t+"]"},"indices"),repeat:n(function(e){return e},"repeat")},Ur=Array.isArray,gH=Array.prototype.push,Vc=n(function(i,e){gH.apply(i,Ur(e)?e:[e])},"pushToArray"),bH=Date.prototype.toISOString,ff=wi.default,Se={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:gf.encode,encodeValuesOnly:!1,format:ff,formatter:wi.formatters[ff],indices:!1,serializeDate:n(function(e){return bH.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},xH=n(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),wH=n(function i(e,t,r,a,s,o,l,d,h,p,w,E,P){var y=e;if(typeof l=="function"?y=l(t,y):y instanceof Date?y=p(y):r==="comma"&&Ur(y)&&(y=y.join(",")),y===null){if(a)return o&&!E?o(t,Se.encoder,P,"key"):t;y=""}if(xH(y)||gf.isBuffer(y)){if(o){var q=E?t:o(t,Se.encoder,P,"key");return[w(q)+"="+w(o(y,Se.encoder,P,"value"))]}return[w(t)+"="+w(String(y))]}var v=[];if(typeof y>"u")return v;var U;if(Ur(l))U=l;else{var be=Object.keys(y);U=d?be.sort(d):be}for(var z=0;z<U.length;++z){var k=U[z];s&&y[k]===null||(Ur(y)?Vc(v,i(y[k],typeof r=="function"?r(t,k):t,r,a,s,o,l,d,h,p,w,E,P)):Vc(v,i(y[k],t+(h?"."+k:"["+k+"]"),r,a,s,o,l,d,h,p,w,E,P)))}return v},"stringify"),vH=n(function(e){if(!e)return Se;if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||Se.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=wi.default;if(typeof e.format<"u"){if(!fH.call(wi.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var a=wi.formatters[r],s=Se.filter;return(typeof e.filter=="function"||Ur(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Se.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Se.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Se.charsetSentinel,delimiter:typeof e.delimiter>"u"?Se.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Se.encode,encoder:typeof e.encoder=="function"?e.encoder:Se.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Se.encodeValuesOnly,filter:s,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Se.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Se.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Se.strictNullHandling}},"normalizeStringifyOptions");bf.exports=function(i,e){var t=i,r=vH(e),a,s;typeof r.filter=="function"?(s=r.filter,t=s("",t)):Ur(r.filter)&&(s=r.filter,a=s);var o=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in yf?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var d=yf[l];a||(a=Object.keys(t)),r.sort&&a.sort(r.sort);for(var h=0;h<a.length;++h){var p=a[h];r.skipNulls&&t[p]===null||Vc(o,wH(t[p],p,d,r.strictNullHandling,r.skipNulls,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.formatter,r.encodeValuesOnly,r.charset))}var w=o.join(r.delimiter),E=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?E+="utf8=%26%2310003%3B&":E+="utf8=%E2%9C%93&"),w.length>0?E+w:""}});var Hf=u((uB,Sf)=>{"use strict";var vi=ao(),$c=Object.prototype.hasOwnProperty,wf=Array.isArray,xe={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:vi.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},SH=n(function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},"interpretNumericEntities"),vf=n(function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},"parseArrayValue"),HH=n(function(e,t){if(wf(e)){for(var r=[],a=0;a<e.length;a+=1)r.push(t(e[a]));return r}return t(e)},"maybeMap"),CH="utf8=%26%2310003%3B",qH="utf8=%E2%9C%93",EH=n(function(e,t){var r={},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=a.split(t.delimiter,s),l=-1,d,h=t.charset;if(t.charsetSentinel)for(d=0;d<o.length;++d)o[d].indexOf("utf8=")===0&&(o[d]===qH?h="utf-8":o[d]===CH&&(h="iso-8859-1"),l=d,d=o.length);for(d=0;d<o.length;++d)if(d!==l){var p=o[d],w=p.indexOf("]="),E=w===-1?p.indexOf("="):w+1,P,y;E===-1?(P=t.decoder(p,xe.decoder,h,"key"),y=t.strictNullHandling?null:""):(P=t.decoder(p.slice(0,E),xe.decoder,h,"key"),y=HH(vf(p.slice(E+1),t),function(q){return t.decoder(q,xe.decoder,h,"value")})),y&&t.interpretNumericEntities&&h==="iso-8859-1"&&(y=SH(y)),p.indexOf("[]=")>-1&&(y=wf(y)?[y]:y),$c.call(r,P)?r[P]=vi.combine(r[P],y):r[P]=y}return r},"parseQueryStringValues"),PH=n(function(i,e,t,r){for(var a=r?e:vf(e,t),s=i.length-1;s>=0;--s){var o,l=i[s];if(l==="[]"&&t.parseArrays)o=[].concat(a);else{o=t.plainObjects?Object.create(null):{};var d=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,h=parseInt(d,10);!t.parseArrays&&d===""?o={0:a}:!isNaN(h)&&l!==d&&String(h)===d&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=a):o[d]=a}a=o}return a},"parseObject"),AH=n(function(e,t,r,a){if(e){var s=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,d=r.depth>0&&o.exec(s),h=d?s.slice(0,d.index):s,p=[];if(h){if(!r.plainObjects&&$c.call(Object.prototype,h)&&!r.allowPrototypes)return;p.push(h)}for(var w=0;r.depth>0&&(d=l.exec(s))!==null&&w<r.depth;){if(w+=1,!r.plainObjects&&$c.call(Object.prototype,d[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(d[1])}return d&&p.push("["+s.slice(d.index)+"]"),PH(p,t,r,a)}},"parseQueryStringKeys"),DH=n(function(e){if(!e)return xe;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?xe.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?xe.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:xe.allowPrototypes,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:xe.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:xe.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:xe.comma,decoder:typeof e.decoder=="function"?e.decoder:xe.decoder,delimiter:typeof e.delimiter=="string"||vi.isRegExp(e.delimiter)?e.delimiter:xe.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:xe.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:xe.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:xe.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:xe.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:xe.strictNullHandling}},"normalizeParseOptions");Sf.exports=function(i,e){var t=DH(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?EH(i,t):i,a=t.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var l=s[o],d=AH(l,r[l],t,typeof i=="string");a=vi.merge(a,d,t)}return vi.compact(a)}});var zc=u((dB,Cf)=>{"use strict";var IH=xf(),TH=Hf(),RH=Wc();Cf.exports={formats:RH,parse:TH,stringify:IH}});var Ef=u(qf=>{function bt(i){if(typeof i!="object")return i;var e,t,r=Object.prototype.toString.call(i);if(r==="[object Object]"){if(i.constructor!==Object&&typeof i.constructor=="function"){t=new i.constructor;for(e in i)i.hasOwnProperty(e)&&t[e]!==i[e]&&(t[e]=bt(i[e]))}else{t={};for(e in i)e==="__proto__"?Object.defineProperty(t,e,{value:bt(i[e]),configurable:!0,enumerable:!0,writable:!0}):t[e]=bt(i[e])}return t}if(r==="[object Array]"){for(e=i.length,t=Array(e);e--;)t[e]=bt(i[e]);return t}return r==="[object Set]"?(t=new Set,i.forEach(function(a){t.add(bt(a))}),t):r==="[object Map]"?(t=new Map,i.forEach(function(a,s){t.set(bt(s),bt(a))}),t):r==="[object Date]"?new Date(+i):r==="[object RegExp]"?(t=new RegExp(i.source,i.flags),t.lastIndex=i.lastIndex,t):r==="[object DataView]"?new i.constructor(bt(i.buffer)):r==="[object ArrayBuffer]"?i.slice(0):r.slice(-6)==="Array]"?new i.constructor(i):i}n(bt,"klona");qf.klona=bt});var Jc=u(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.DataObject=ut.getRawData=ut.rawDataSymbol=void 0;var UH=Ef();ut.rawDataSymbol=Symbol("twurpleRawData");function OH(i){return(0,UH.klona)(i[ut.rawDataSymbol])}n(OH,"getRawData");ut.getRawData=OH;var Kc=class{static{n(this,"DataObject")}constructor(e){this[ut.rawDataSymbol]=e}};ut.DataObject=Kc});var oo=u(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.CustomError=void 0;var Zc=class extends Error{static{n(this,"CustomError")}constructor(e,t){var r;super(e,t),Object.setPrototypeOf(this,new.target.prototype),(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}};so.CustomError=Zc});var Yc=u(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.RelationAssertionError=void 0;var BH=oo(),Xc=class extends BH.CustomError{static{n(this,"RelationAssertionError")}constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}};lo.RelationAssertionError=Xc});var Pf=u(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.checkRelationAssertion=void 0;var jH=Yc();function kH(i){if(i==null)throw new jH.RelationAssertionError;return i}n(kH,"checkRelationAssertion");uo.checkRelationAssertion=kH});var ed=u(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.rtfm=void 0;function MH(i,e,t){return r=>{let a=t?function(){return`[${e}#${this[t]} - please check https://twurple.js.org/reference/${i}/classes/${e}.html for available properties]`}:function(){return`[${e} - please check https://twurple.js.org/reference/${i}/classes/${e}.html for available properties]`};Object.defineProperty(r.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:a,enumerable:!1})}}n(MH,"rtfm");co.rtfm=MH});var Af=u(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.HelixExtension=void 0;var LH=(b(),x(g)),D=Jc(),FH=ed(),td=class extends D.DataObject{static{n(this,"HelixExtension")}get authorName(){return this[D.rawDataSymbol].author_name}get bitsEnabled(){return this[D.rawDataSymbol].bits_enabled}get installable(){return this[D.rawDataSymbol].can_install}get configurationLocation(){return this[D.rawDataSymbol].configuration_location}get description(){return this[D.rawDataSymbol].description}get tosUrl(){return this[D.rawDataSymbol].eula_tos_url}get hasChatSupport(){return this[D.rawDataSymbol].has_chat_support}get iconUrl(){return this[D.rawDataSymbol].icon_url}getIconUrl(e){return this[D.rawDataSymbol].icon_urls[e]}get id(){return this[D.rawDataSymbol].id}get name(){return this[D.rawDataSymbol].name}get privacyPolicyUrl(){return this[D.rawDataSymbol].privacy_policy_url}get requestsIdentityLink(){return this[D.rawDataSymbol].request_identity_link}get screenshotUrls(){return this[D.rawDataSymbol].screenshot_urls}get state(){return this[D.rawDataSymbol].state}get subscriptionsSupportLevel(){return this[D.rawDataSymbol].subscriptions_support_level}get summary(){return this[D.rawDataSymbol].summary}get supportEmail(){return this[D.rawDataSymbol].support_email}get version(){return this[D.rawDataSymbol].version}get viewerSummary(){return this[D.rawDataSymbol].viewer_summary}get viewerSummery(){return this[D.rawDataSymbol].viewer_summary}get allowedConfigUrls(){return this[D.rawDataSymbol].allowlisted_config_urls}get allowedPanelUrls(){return this[D.rawDataSymbol].allowlisted_panel_urls}get mobileViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.mobile)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelHeight(){var e,t;return(t=(e=this[D.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.height)!==null&&t!==void 0?t:null}get panelCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get overlayViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get overlayCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get componentViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get componentAspectWidth(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_width)!==null&&t!==void 0?t:null}get componentAspectHeight(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_height)!==null&&t!==void 0?t:null}get componentAspectRatioX(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_x)!==null&&t!==void 0?t:null}get componentAspectRatioY(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_y)!==null&&t!==void 0?t:null}get componentAutoScales(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.autoscale)!==null&&t!==void 0?t:null}get componentScalePixels(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.scale_pixels)!==null&&t!==void 0?t:null}get componentTargetHeight(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.target_height)!==null&&t!==void 0?t:null}get componentSize(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.size)!==null&&t!==void 0?t:null}get componentZoom(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom)!==null&&t!==void 0?t:null}get componentZoomPixels(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom_pixels)!==null&&t!==void 0?t:null}get componentCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get configViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.config)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get configCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.config)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}};Si.HelixExtension=td;Si.HelixExtension=td=LH.__decorate([(0,FH.rtfm)("api","HelixExtension","id")],td)});var Df=u(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.HellFreezesOverError=void 0;var NH=oo(),rd=class extends NH.CustomError{static{n(this,"HellFreezesOverError")}constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}};ho.HellFreezesOverError=rd});var If=u(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.extractUserName=Or.extractUserId=void 0;function QH(i){return typeof i=="string"?i:typeof i=="number"?i.toString(10):i.id}n(QH,"extractUserId");Or.extractUserId=QH;function GH(i){return typeof i=="string"?i:i.name}n(GH,"extractUserName");Or.extractUserName=GH});var m=u(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.extractUserName=K.extractUserId=K.RelationAssertionError=K.HellFreezesOverError=K.CustomError=K.HelixExtension=K.rtfm=K.checkRelationAssertion=K.rawDataSymbol=K.getRawData=K.DataObject=void 0;var id=Jc();Object.defineProperty(K,"DataObject",{enumerable:!0,get:n(function(){return id.DataObject},"get")});Object.defineProperty(K,"getRawData",{enumerable:!0,get:n(function(){return id.getRawData},"get")});Object.defineProperty(K,"rawDataSymbol",{enumerable:!0,get:n(function(){return id.rawDataSymbol},"get")});var WH=Pf();Object.defineProperty(K,"checkRelationAssertion",{enumerable:!0,get:n(function(){return WH.checkRelationAssertion},"get")});var VH=ed();Object.defineProperty(K,"rtfm",{enumerable:!0,get:n(function(){return VH.rtfm},"get")});var $H=Af();Object.defineProperty(K,"HelixExtension",{enumerable:!0,get:n(function(){return $H.HelixExtension},"get")});var zH=oo();Object.defineProperty(K,"CustomError",{enumerable:!0,get:n(function(){return zH.CustomError},"get")});var KH=Df();Object.defineProperty(K,"HellFreezesOverError",{enumerable:!0,get:n(function(){return KH.HellFreezesOverError},"get")});var JH=Yc();Object.defineProperty(K,"RelationAssertionError",{enumerable:!0,get:n(function(){return JH.RelationAssertionError},"get")});var Tf=If();Object.defineProperty(K,"extractUserId",{enumerable:!0,get:n(function(){return Tf.extractUserId},"get")});Object.defineProperty(K,"extractUserName",{enumerable:!0,get:n(function(){return Tf.extractUserName},"get")})});var ad=u(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.HttpStatusCodeError=void 0;var ZH=m(),nd=class extends ZH.CustomError{static{n(this,"HttpStatusCodeError")}constructor(e,t,r,a,s,o){super(`Encountered HTTP status code ${e}: ${t}
7
7
 
8
8
  URL: ${r}
9
9
  Method: ${a}
10
10
  Body:
11
- ${!o&&s.length>150?`${s.slice(0,147)}...`:s}`),this._statusCode=e,this._url=r,this._method=a,this._body=s}get statusCode(){return this._statusCode}get url(){return this._url}get method(){return this._method}get body(){return this._body}};po.HttpStatusCodeError=id});var ad=u(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.transformTwitchApiResponse=Br.handleTwitchApiResponseError=void 0;var $H=$c(),zH=nd();async function KH(i,e){var t;if(!i.ok){let r=i.headers.get("Content-Type")==="application/json",a=r?JSON.stringify(await i.json(),null,2):await i.text(),s=(0,$H.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new zH.HttpStatusCodeError(i.status,i.statusText,o,(t=e.method)!==null&&t!==void 0?t:"GET",a,r)}}n(KH,"handleTwitchApiResponseError");Br.handleTwitchApiResponseError=KH;async function JH(i){if(i.status===204)return;let e=await i.text();if(e)return JSON.parse(e)}n(JH,"transformTwitchApiResponse");Br.transformTwitchApiResponse=JH});var If=u(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.getTwitchApiUrl=void 0;function ZH(i,e,t){switch(e){case"helix":{let r=i.replace(/^\//,"");return t?r==="eventsub/subscriptions"?`http://localhost:${t}/${r}`:`http://localhost:${t}/mock/${r}`:`https://api.twitch.tv/helix/${r}`}case"auth":return`https://id.twitch.tv/oauth2/${i.replace(/^\//,"")}`;case"custom":return i;default:return i}}n(ZH,"getTwitchApiUrl");_o.getTwitchApiUrl=ZH});var Of=u(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.callTwitchApi=jr.callTwitchApiRaw=void 0;var Tf=uf(),XH=$c(),Rf=ad(),YH=If();async function Uf(i,e,t,r,a={},s){var o,l;let d=(o=i.type)!==null&&o!==void 0?o:"helix",p=(0,YH.getTwitchApiUrl)(i.url,d,s),h=(0,XH.stringify)(i.query,{arrayFormat:"repeat",addQueryPrefix:!0}),w=new Tf.Headers({Accept:"application/json"}),E;i.jsonBody&&(E=JSON.stringify(i.jsonBody),w.append("Content-Type","application/json")),e&&d!=="auth"&&w.append("Client-ID",e),t&&w.append("Authorization",`${d==="helix"?r??"Bearer":"OAuth"} ${t}`);let P={...a,method:(l=i.method)!==null&&l!==void 0?l:"GET",headers:w,body:E};return await(0,Tf.default)(`${p}${h}`,P)}n(Uf,"callTwitchApiRaw");jr.callTwitchApiRaw=Uf;async function eC(i,e,t,r,a={}){let s=await Uf(i,e,t,r,a);return await(0,Rf.handleTwitchApiResponseError)(s,i),await(0,Rf.transformTwitchApiResponse)(s)}n(eC,"callTwitchApi");jr.callTwitchApi=eC});var Bf=u(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.createBroadcasterQuery=void 0;var tC=_();function rC(i){return{broadcaster_id:(0,tC.extractUserId)(i)}}n(rC,"createBroadcasterQuery");mo.createBroadcasterQuery=rC});var Y=u(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.HttpStatusCodeError=Ae.transformTwitchApiResponse=Ae.handleTwitchApiResponseError=Ae.createBroadcasterQuery=Ae.callTwitchApiRaw=Ae.callTwitchApi=void 0;var jf=Of();Object.defineProperty(Ae,"callTwitchApi",{enumerable:!0,get:n(function(){return jf.callTwitchApi},"get")});Object.defineProperty(Ae,"callTwitchApiRaw",{enumerable:!0,get:n(function(){return jf.callTwitchApiRaw},"get")});var iC=Bf();Object.defineProperty(Ae,"createBroadcasterQuery",{enumerable:!0,get:n(function(){return iC.createBroadcasterQuery},"get")});var kf=ad();Object.defineProperty(Ae,"handleTwitchApiResponseError",{enumerable:!0,get:n(function(){return kf.handleTwitchApiResponseError},"get")});Object.defineProperty(Ae,"transformTwitchApiResponse",{enumerable:!0,get:n(function(){return kf.transformTwitchApiResponse},"get")});var nC=nd();Object.defineProperty(Ae,"HttpStatusCodeError",{enumerable:!0,get:n(function(){return nC.HttpStatusCodeError},"get")})});var od=u(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.ConfigError=void 0;var aC=_(),sd=class extends aC.CustomError{static{n(this,"ConfigError")}};yo.ConfigError=sd});var Mf=u(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.HelixRateLimiter=void 0;var sC=io(),oC=Y(),ld=class extends sC.ResponseBasedRateLimiter{static{n(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:s,mockServerPort:o}){return await(0,oC.callTwitchApiRaw)(e,t,r,a,s,o)}needsToRetryAfter(e){return e.status===429&&(!e.headers.has("ratelimit-remaining")||Number(e.headers.get("ratelimit-remaining"))===0)?+e.headers.get("ratelimit-reset")*1e3-Date.now():null}getParametersFromResponse(e){let{headers:t}=e;return{limit:+t.get("ratelimit-limit"),remaining:+t.get("ratelimit-remaining"),resetsAt:+t.get("ratelimit-reset")*1e3}}};fo.HelixRateLimiter=ld});var Hi=u(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.createCacheKey=void 0;function lC(i){switch(typeof i){case"undefined":return"";case"object":{if(i===null)return"";if("cacheKey"in i)return i.cacheKey;let e=JSON.stringify(i);if(e!=="{}")return e}default:return i.toString()}}n(lC,"createSingleCacheKey");function uC(i,e,t){return[i,...e.map(lC)].join("/")+(t?"/":"")}n(uC,"createCacheKey");go.createCacheKey=uC});var Lf=u(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.Cacheable=void 0;var cC=Hi(),xt=Symbol("cache");function dC(i){var e,t;return t=class extends i{static{n(this,"_b")}constructor(){super(...arguments),this[e]=new Map}getFromCache(r){if(this._cleanCache(),this[xt].has(r)){let a=this[xt].get(r);if(a)return a.value}}setCache(r,a,s){this[xt].set(r,{value:a,expires:Date.now()+s*1e3})}removeFromCache(r,a){let s=this._getInternalCacheKey(r,a);a?this[xt].forEach((o,l)=>{l.startsWith(s)&&this[xt].delete(l)}):this[xt].delete(s)}_cleanCache(){let r=Date.now();this[xt].forEach((a,s)=>{a.expires<r&&this[xt].delete(s)})}_getInternalCacheKey(r,a){if(typeof r=="string"){let s=r;return s.endsWith("/")||(s+="/"),s}else{let s=r.shift();return(0,cC.createCacheKey)(s,r,a)}}},e=xt,t}n(dC,"Cacheable");bo.Cacheable=dC});var Ff=u(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.Cached=void 0;var hC=Hi();function pC(i=1/0,e=!1){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=(0,hC.createCacheKey)(r,o),d=this.getFromCache(l);if(d)return d;let p=await s.apply(this,o);return(p!=null||e)&&this.setCache(l,p,i),p},a}}n(pC,"Cached");xo.Cached=pC});var Nf=u(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.CachedGetter=void 0;var _C=Hi();function mC(i=1/0){return function(e,t,r){if(r.get){let a=r.get;r.get=function(){let s=(0,_C.createCacheKey)(t,[]),o=this.getFromCache(s);if(o)return o;let l=a.call(this);return this.setCache(s,l,i),l}}return r}}n(mC,"CachedGetter");wo.CachedGetter=mC});var Qf=u(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.ClearsCache=void 0;function yC(i,e){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=await s.apply(this,o),d=e===void 0?o.slice():o.slice(0,e);return this.removeFromCache([i,...d],!0),l},a}}n(yC,"ClearsCache");vo.ClearsCache=yC});var Ci=u(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createCacheKey=Qe.ClearsCache=Qe.CachedGetter=Qe.Cached=Qe.Cacheable=void 0;var fC=Lf();Object.defineProperty(Qe,"Cacheable",{enumerable:!0,get:n(function(){return fC.Cacheable},"get")});var gC=Ff();Object.defineProperty(Qe,"Cached",{enumerable:!0,get:n(function(){return gC.Cached},"get")});var bC=Nf();Object.defineProperty(Qe,"CachedGetter",{enumerable:!0,get:n(function(){return bC.CachedGetter},"get")});var xC=Qf();Object.defineProperty(Qe,"ClearsCache",{enumerable:!0,get:n(function(){return xC.ClearsCache},"get")});var wC=Hi();Object.defineProperty(Qe,"createCacheKey",{enumerable:!0,get:n(function(){return wC.createCacheKey},"get")})});var cd=u(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.Listener=void 0;var ud=class{static{n(this,"Listener")}constructor(e,t,r,a=!1){this.owner=e,this.event=t,this.listener=r,this._internal=a}unbind(){this.owner.removeListener(this)}};So.Listener=ud});var Gf=u(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.EventEmitter=void 0;var vC=cd(),dd=class{static{n(this,"EventEmitter")}constructor(){this._eventListeners=new Map,this._internalEventListeners=new Map}on(e,t){return this._addListener(!1,e,t)}addListener(e,t){return this._addListener(!1,e,t)}removeListener(e,t){this._removeListener(!1,e,t)}registerEvent(){let e=n(t=>this.addListener(e,t),"eventBinder");return e}emit(e,...t){if(this._eventListeners.has(e))for(let r of this._eventListeners.get(e))r(...t);if(this._internalEventListeners.has(e))for(let r of this._internalEventListeners.get(e))r(...t)}registerInternalEvent(){let e=n(t=>this.addInternalListener(e,t),"eventBinder");return e}addInternalListener(e,t){return this._addListener(!0,e,t)}removeInternalListener(e,t){this._removeListener(!0,e,t)}_addListener(e,t,r){let a=e?this._eventListeners:this._internalEventListeners;return a.has(t)?a.get(t).push(r):a.set(t,[r]),new vC.Listener(this,t,r,e)}_removeListener(e,t,r){let a=e?this._eventListeners:this._internalEventListeners;if(!t)a.clear();else if(typeof t=="object"){let s=t;this._removeListener(s._internal,s.event,s.listener)}else{let s=t;if(a.has(s))if(r){let o=a.get(s),l=0;for(;(l=o.indexOf(r))!==-1;)o.splice(l,1)}else a.delete(s)}}};Ho.EventEmitter=dd});var hd=u(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.Listener=kr.EventEmitter=void 0;var SC=Gf();Object.defineProperty(kr,"EventEmitter",{enumerable:!0,get:n(function(){return SC.EventEmitter},"get")});var HC=cd();Object.defineProperty(kr,"Listener",{enumerable:!0,get:n(function(){return HC.Listener},"get")})});var Co=u(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.accessTokenIsExpired=Mr.getExpiryDateOfAccessToken=void 0;var pd=C(),CC=6e4;function Wf(i){return(0,pd.mapNullable)(i.expiresIn,e=>i.obtainmentTimestamp+e*1e3-CC)}n(Wf,"getExpiryMillis");function qC(i){return(0,pd.mapNullable)(Wf(i),e=>new Date(e))}n(qC,"getExpiryDateOfAccessToken");Mr.getExpiryDateOfAccessToken=qC;function EC(i){var e;return(e=(0,pd.mapNullable)(Wf(i),t=>Date.now()>t))!==null&&e!==void 0?e:!1}n(EC,"accessTokenIsExpired");Mr.accessTokenIsExpired=EC});var Eo=u(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.InvalidTokenError=void 0;var PC=_(),_d=class extends PC.CustomError{static{n(this,"InvalidTokenError")}constructor(e){super("Invalid token supplied",e)}};qo.InvalidTokenError=_d});var Ao=u(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.InvalidTokenTypeError=void 0;var AC=_(),md=class extends AC.CustomError{static{n(this,"InvalidTokenTypeError")}};Po.InvalidTokenTypeError=md});var Vf=u(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.createRevokeTokenQuery=ct.createRefreshTokenQuery=ct.createGetAppTokenQuery=ct.createExchangeCodeQuery=void 0;function DC(i,e,t,r){return{grant_type:"authorization_code",client_id:i,client_secret:e,code:t,redirect_uri:r}}n(DC,"createExchangeCodeQuery");ct.createExchangeCodeQuery=DC;function IC(i,e){return{grant_type:"client_credentials",client_id:i,client_secret:e}}n(IC,"createGetAppTokenQuery");ct.createGetAppTokenQuery=IC;function TC(i,e,t){return{grant_type:"refresh_token",client_id:i,client_secret:e,refresh_token:t}}n(TC,"createRefreshTokenQuery");ct.createRefreshTokenQuery=TC;function RC(i,e){return{client_id:i,token:e}}n(RC,"createRevokeTokenQuery");ct.createRevokeTokenQuery=RC});var fd=u(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.TokenInfo=void 0;var UC=(b(),x(g)),OC=C(),ar=_(),yd=class extends ar.DataObject{static{n(this,"TokenInfo")}constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[ar.rawDataSymbol].client_id}get userId(){var e;return(e=this[ar.rawDataSymbol].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[ar.rawDataSymbol].login)!==null&&e!==void 0?e:null}get scopes(){return this[ar.rawDataSymbol].scopes}get expiryDate(){return(0,OC.mapNullable)(this[ar.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};qi.TokenInfo=yd;qi.TokenInfo=yd=UC.__decorate([(0,ar.rtfm)("auth","TokenInfo","clientId")],yd)});var Pi=u(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.loadAndCompareTokenInfo=ee.compareScopeSets=ee.compareScopes=ee.getValidTokenFromProviderForIntent=ee.getValidTokenFromProviderForUser=ee.getTokenInfo=ee.revokeToken=ee.refreshUserToken=ee.getAppToken=ee.exchangeCode=void 0;var Lr=Y(),Ei=Eo(),BC=Ao(),Do=Vf(),jC=fd();function gd(i){var e,t;return{accessToken:i.access_token,refreshToken:i.refresh_token||null,scope:(e=i.scope)!==null&&e!==void 0?e:[],expiresIn:(t=i.expires_in)!==null&&t!==void 0?t:null,obtainmentTimestamp:Date.now()}}n(gd,"createAccessTokenFromData");async function kC(i,e,t,r){return gd(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Do.createExchangeCodeQuery)(i,e,t,r)}))}n(kC,"exchangeCode");ee.exchangeCode=kC;async function MC(i,e){return gd(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Do.createGetAppTokenQuery)(i,e)}))}n(MC,"getAppToken");ee.getAppToken=MC;async function LC(i,e,t){return gd(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Do.createRefreshTokenQuery)(i,e,t)}))}n(LC,"refreshUserToken");ee.refreshUserToken=LC;async function FC(i,e){await(0,Lr.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,Do.createRevokeTokenQuery)(i,e)})}n(FC,"revokeToken");ee.revokeToken=FC;async function Fr(i,e){try{let t=await(0,Lr.callTwitchApi)({type:"auth",url:"validate"},e,i);return new jC.TokenInfo(t)}catch(t){throw t instanceof Lr.HttpStatusCodeError&&t.statusCode===401?new Ei.InvalidTokenError({cause:t}):t}}n(Fr,"getTokenInfo");ee.getTokenInfo=Fr;async function NC(i,e,t,r){let a=null,s=!1;try{let o=await i.getAccessTokenForUser(e,t);if(o){s=!0;let l=await Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof Ei.InvalidTokenError?a=o:r?.error(`Retrieving an access token failed: ${o.message}`)}if(s&&(r?.warn("No valid token available; trying to refresh"),i.refreshAccessTokenForUser))try{let o=await i.refreshAccessTokenForUser(e),l=await Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof Ei.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(NC,"getValidTokenFromProviderForUser");ee.getValidTokenFromProviderForUser=NC;async function QC(i,e,t,r){let a=null,s=!1;if(!i.getAccessTokenForIntent)throw new BC.InvalidTokenTypeError("This call requires an AuthProvider that supports intents.\nPlease use an auth provider that does, such as `RefreshingAuthProvider`.");try{let o=await i.getAccessTokenForIntent(e,t);if(o){s=!0;let l=await Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof Ei.InvalidTokenError?a=o:r?.error(`Retrieving an access token failed: ${o.message}`)}if(s&&(r?.warn("No valid token available; trying to refresh"),i.refreshAccessTokenForIntent))try{let o=await i.refreshAccessTokenForIntent(e),l=await Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof Ei.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(QC,"getValidTokenFromProviderForIntent");ee.getValidTokenFromProviderForIntent=QC;var GC=new Map([["channel_commercial",["channel:edit:commercial"]],["channel_editor",["channel:manage:broadcast"]],["channel_read",["channel:read:stream_key"]],["channel_subscriptions",["channel:read:subscriptions"]],["user_blocks_read",["user:read:blocked_users"]],["user_blocks_edit",["user:manage:blocked_users"]],["user_follows_edit",["user:edit:follows"]],["user_read",["user:read:email"]],["user_subscriptions",["user:read:subscriptions"]],["user:edit:broadcast",["channel:manage:broadcast","channel:manage:extensions"]]]);function $f(i,e){if(e?.length){let t=new Set(i.flatMap(r=>{var a;return[r,...(a=GC.get(r))!==null&&a!==void 0?a:[]]}));if(e.every(r=>!t.has(r))){let r=e.join(", ");throw new Error(`This token does not have any of the requested scopes (${r}) and can not be upgraded.
11
+ ${!o&&s.length>150?`${s.slice(0,147)}...`:s}`),this._statusCode=e,this._url=r,this._method=a,this._body=s}get statusCode(){return this._statusCode}get url(){return this._url}get method(){return this._method}get body(){return this._body}};po.HttpStatusCodeError=nd});var sd=u(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.transformTwitchApiResponse=Br.handleTwitchApiResponseError=void 0;var XH=zc(),YH=ad();async function eC(i,e){var t;if(!i.ok){let r=i.headers.get("Content-Type")==="application/json",a=r?JSON.stringify(await i.json(),null,2):await i.text(),s=(0,XH.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new YH.HttpStatusCodeError(i.status,i.statusText,o,(t=e.method)!==null&&t!==void 0?t:"GET",a,r)}}n(eC,"handleTwitchApiResponseError");Br.handleTwitchApiResponseError=eC;async function tC(i){if(i.status===204)return;let e=await i.text();if(e)return JSON.parse(e)}n(tC,"transformTwitchApiResponse");Br.transformTwitchApiResponse=tC});var Rf=u(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.getTwitchApiUrl=void 0;function rC(i,e,t){switch(e){case"helix":{let r=i.replace(/^\//,"");return t?r==="eventsub/subscriptions"?`http://localhost:${t}/${r}`:`http://localhost:${t}/mock/${r}`:`https://api.twitch.tv/helix/${r}`}case"auth":return`https://id.twitch.tv/oauth2/${i.replace(/^\//,"")}`;case"custom":return i;default:return i}}n(rC,"getTwitchApiUrl");_o.getTwitchApiUrl=rC});var jf=u(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.callTwitchApi=jr.callTwitchApiRaw=void 0;var Uf=df(),iC=zc(),Of=sd(),nC=Rf();async function Bf(i,e,t,r,a={},s){var o,l;let d=(o=i.type)!==null&&o!==void 0?o:"helix",h=(0,nC.getTwitchApiUrl)(i.url,d,s),p=(0,iC.stringify)(i.query,{arrayFormat:"repeat",addQueryPrefix:!0}),w=new Uf.Headers({Accept:"application/json"}),E;i.jsonBody&&(E=JSON.stringify(i.jsonBody),w.append("Content-Type","application/json")),e&&d!=="auth"&&w.append("Client-ID",e),t&&w.append("Authorization",`${d==="helix"?r??"Bearer":"OAuth"} ${t}`);let P={...a,method:(l=i.method)!==null&&l!==void 0?l:"GET",headers:w,body:E};return await(0,Uf.default)(`${h}${p}`,P)}n(Bf,"callTwitchApiRaw");jr.callTwitchApiRaw=Bf;async function aC(i,e,t,r,a={}){let s=await Bf(i,e,t,r,a);return await(0,Of.handleTwitchApiResponseError)(s,i),await(0,Of.transformTwitchApiResponse)(s)}n(aC,"callTwitchApi");jr.callTwitchApi=aC});var kf=u(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.createBroadcasterQuery=void 0;var sC=m();function oC(i){return{broadcaster_id:(0,sC.extractUserId)(i)}}n(oC,"createBroadcasterQuery");mo.createBroadcasterQuery=oC});var Y=u(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.HttpStatusCodeError=Ae.transformTwitchApiResponse=Ae.handleTwitchApiResponseError=Ae.createBroadcasterQuery=Ae.callTwitchApiRaw=Ae.callTwitchApi=void 0;var Mf=jf();Object.defineProperty(Ae,"callTwitchApi",{enumerable:!0,get:n(function(){return Mf.callTwitchApi},"get")});Object.defineProperty(Ae,"callTwitchApiRaw",{enumerable:!0,get:n(function(){return Mf.callTwitchApiRaw},"get")});var lC=kf();Object.defineProperty(Ae,"createBroadcasterQuery",{enumerable:!0,get:n(function(){return lC.createBroadcasterQuery},"get")});var Lf=sd();Object.defineProperty(Ae,"handleTwitchApiResponseError",{enumerable:!0,get:n(function(){return Lf.handleTwitchApiResponseError},"get")});Object.defineProperty(Ae,"transformTwitchApiResponse",{enumerable:!0,get:n(function(){return Lf.transformTwitchApiResponse},"get")});var uC=ad();Object.defineProperty(Ae,"HttpStatusCodeError",{enumerable:!0,get:n(function(){return uC.HttpStatusCodeError},"get")})});var ld=u(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.ConfigError=void 0;var cC=m(),od=class extends cC.CustomError{static{n(this,"ConfigError")}};yo.ConfigError=od});var Ff=u(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.HelixRateLimiter=void 0;var dC=io(),hC=Y(),ud=class extends dC.ResponseBasedRateLimiter{static{n(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:s,mockServerPort:o}){return await(0,hC.callTwitchApiRaw)(e,t,r,a,s,o)}needsToRetryAfter(e){return e.status===429&&(!e.headers.has("ratelimit-remaining")||Number(e.headers.get("ratelimit-remaining"))===0)?+e.headers.get("ratelimit-reset")*1e3-Date.now():null}getParametersFromResponse(e){let{headers:t}=e;return{limit:+t.get("ratelimit-limit"),remaining:+t.get("ratelimit-remaining"),resetsAt:+t.get("ratelimit-reset")*1e3}}};fo.HelixRateLimiter=ud});var Hi=u(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.createCacheKey=void 0;function pC(i){switch(typeof i){case"undefined":return"";case"object":{if(i===null)return"";if("cacheKey"in i)return i.cacheKey;let e=JSON.stringify(i);if(e!=="{}")return e}default:return i.toString()}}n(pC,"createSingleCacheKey");function _C(i,e,t){return[i,...e.map(pC)].join("/")+(t?"/":"")}n(_C,"createCacheKey");go.createCacheKey=_C});var Nf=u(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.Cacheable=void 0;var mC=Hi(),xt=Symbol("cache");function yC(i){var e,t;return t=class extends i{static{n(this,"_b")}constructor(){super(...arguments),this[e]=new Map}getFromCache(r){if(this._cleanCache(),this[xt].has(r)){let a=this[xt].get(r);if(a)return a.value}}setCache(r,a,s){this[xt].set(r,{value:a,expires:Date.now()+s*1e3})}removeFromCache(r,a){let s=this._getInternalCacheKey(r,a);a?this[xt].forEach((o,l)=>{l.startsWith(s)&&this[xt].delete(l)}):this[xt].delete(s)}_cleanCache(){let r=Date.now();this[xt].forEach((a,s)=>{a.expires<r&&this[xt].delete(s)})}_getInternalCacheKey(r,a){if(typeof r=="string"){let s=r;return s.endsWith("/")||(s+="/"),s}else{let s=r.shift();return(0,mC.createCacheKey)(s,r,a)}}},e=xt,t}n(yC,"Cacheable");bo.Cacheable=yC});var Qf=u(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.Cached=void 0;var fC=Hi();function gC(i=1/0,e=!1){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=(0,fC.createCacheKey)(r,o),d=this.getFromCache(l);if(d)return d;let h=await s.apply(this,o);return(h!=null||e)&&this.setCache(l,h,i),h},a}}n(gC,"Cached");xo.Cached=gC});var Gf=u(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.CachedGetter=void 0;var bC=Hi();function xC(i=1/0){return function(e,t,r){if(r.get){let a=r.get;r.get=function(){let s=(0,bC.createCacheKey)(t,[]),o=this.getFromCache(s);if(o)return o;let l=a.call(this);return this.setCache(s,l,i),l}}return r}}n(xC,"CachedGetter");wo.CachedGetter=xC});var Wf=u(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.ClearsCache=void 0;function wC(i,e){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=await s.apply(this,o),d=e===void 0?o.slice():o.slice(0,e);return this.removeFromCache([i,...d],!0),l},a}}n(wC,"ClearsCache");vo.ClearsCache=wC});var Ci=u(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createCacheKey=Qe.ClearsCache=Qe.CachedGetter=Qe.Cached=Qe.Cacheable=void 0;var vC=Nf();Object.defineProperty(Qe,"Cacheable",{enumerable:!0,get:n(function(){return vC.Cacheable},"get")});var SC=Qf();Object.defineProperty(Qe,"Cached",{enumerable:!0,get:n(function(){return SC.Cached},"get")});var HC=Gf();Object.defineProperty(Qe,"CachedGetter",{enumerable:!0,get:n(function(){return HC.CachedGetter},"get")});var CC=Wf();Object.defineProperty(Qe,"ClearsCache",{enumerable:!0,get:n(function(){return CC.ClearsCache},"get")});var qC=Hi();Object.defineProperty(Qe,"createCacheKey",{enumerable:!0,get:n(function(){return qC.createCacheKey},"get")})});var dd=u(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.Listener=void 0;var cd=class{static{n(this,"Listener")}constructor(e,t,r,a=!1){this.owner=e,this.event=t,this.listener=r,this._internal=a}unbind(){this.owner.removeListener(this)}};So.Listener=cd});var Vf=u(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.EventEmitter=void 0;var EC=dd(),hd=class{static{n(this,"EventEmitter")}constructor(){this._eventListeners=new Map,this._internalEventListeners=new Map}on(e,t){return this._addListener(!1,e,t)}addListener(e,t){return this._addListener(!1,e,t)}removeListener(e,t){this._removeListener(!1,e,t)}registerEvent(){let e=n(t=>this.addListener(e,t),"eventBinder");return e}emit(e,...t){if(this._eventListeners.has(e))for(let r of this._eventListeners.get(e))r(...t);if(this._internalEventListeners.has(e))for(let r of this._internalEventListeners.get(e))r(...t)}registerInternalEvent(){let e=n(t=>this.addInternalListener(e,t),"eventBinder");return e}addInternalListener(e,t){return this._addListener(!0,e,t)}removeInternalListener(e,t){this._removeListener(!0,e,t)}_addListener(e,t,r){let a=e?this._eventListeners:this._internalEventListeners;return a.has(t)?a.get(t).push(r):a.set(t,[r]),new EC.Listener(this,t,r,e)}_removeListener(e,t,r){let a=e?this._eventListeners:this._internalEventListeners;if(!t)a.clear();else if(typeof t=="object"){let s=t;this._removeListener(s._internal,s.event,s.listener)}else{let s=t;if(a.has(s))if(r){let o=a.get(s),l=0;for(;(l=o.indexOf(r))!==-1;)o.splice(l,1)}else a.delete(s)}}};Ho.EventEmitter=hd});var pd=u(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.Listener=kr.EventEmitter=void 0;var PC=Vf();Object.defineProperty(kr,"EventEmitter",{enumerable:!0,get:n(function(){return PC.EventEmitter},"get")});var AC=dd();Object.defineProperty(kr,"Listener",{enumerable:!0,get:n(function(){return AC.Listener},"get")})});var Co=u(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.accessTokenIsExpired=Mr.getExpiryDateOfAccessToken=void 0;var _d=C(),DC=6e4;function $f(i){return(0,_d.mapNullable)(i.expiresIn,e=>i.obtainmentTimestamp+e*1e3-DC)}n($f,"getExpiryMillis");function IC(i){return(0,_d.mapNullable)($f(i),e=>new Date(e))}n(IC,"getExpiryDateOfAccessToken");Mr.getExpiryDateOfAccessToken=IC;function TC(i){var e;return(e=(0,_d.mapNullable)($f(i),t=>Date.now()>t))!==null&&e!==void 0?e:!1}n(TC,"accessTokenIsExpired");Mr.accessTokenIsExpired=TC});var Eo=u(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.InvalidTokenError=void 0;var RC=m(),md=class extends RC.CustomError{static{n(this,"InvalidTokenError")}constructor(e){super("Invalid token supplied",e)}};qo.InvalidTokenError=md});var Ao=u(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.InvalidTokenTypeError=void 0;var UC=m(),yd=class extends UC.CustomError{static{n(this,"InvalidTokenTypeError")}};Po.InvalidTokenTypeError=yd});var zf=u(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.createRevokeTokenQuery=ct.createRefreshTokenQuery=ct.createGetAppTokenQuery=ct.createExchangeCodeQuery=void 0;function OC(i,e,t,r){return{grant_type:"authorization_code",client_id:i,client_secret:e,code:t,redirect_uri:r}}n(OC,"createExchangeCodeQuery");ct.createExchangeCodeQuery=OC;function BC(i,e){return{grant_type:"client_credentials",client_id:i,client_secret:e}}n(BC,"createGetAppTokenQuery");ct.createGetAppTokenQuery=BC;function jC(i,e,t){return{grant_type:"refresh_token",client_id:i,client_secret:e,refresh_token:t}}n(jC,"createRefreshTokenQuery");ct.createRefreshTokenQuery=jC;function kC(i,e){return{client_id:i,token:e}}n(kC,"createRevokeTokenQuery");ct.createRevokeTokenQuery=kC});var gd=u(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.TokenInfo=void 0;var MC=(b(),x(g)),LC=C(),ar=m(),fd=class extends ar.DataObject{static{n(this,"TokenInfo")}constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[ar.rawDataSymbol].client_id}get userId(){var e;return(e=this[ar.rawDataSymbol].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[ar.rawDataSymbol].login)!==null&&e!==void 0?e:null}get scopes(){return this[ar.rawDataSymbol].scopes}get expiryDate(){return(0,LC.mapNullable)(this[ar.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};qi.TokenInfo=fd;qi.TokenInfo=fd=MC.__decorate([(0,ar.rtfm)("auth","TokenInfo","clientId")],fd)});var Pi=u(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.loadAndCompareTokenInfo=ee.compareScopeSets=ee.compareScopes=ee.getValidTokenFromProviderForIntent=ee.getValidTokenFromProviderForUser=ee.getTokenInfo=ee.revokeToken=ee.refreshUserToken=ee.getAppToken=ee.exchangeCode=void 0;var Lr=Y(),Ei=Eo(),FC=Ao(),Do=zf(),NC=gd();function bd(i){var e,t;return{accessToken:i.access_token,refreshToken:i.refresh_token||null,scope:(e=i.scope)!==null&&e!==void 0?e:[],expiresIn:(t=i.expires_in)!==null&&t!==void 0?t:null,obtainmentTimestamp:Date.now()}}n(bd,"createAccessTokenFromData");async function QC(i,e,t,r){return bd(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Do.createExchangeCodeQuery)(i,e,t,r)}))}n(QC,"exchangeCode");ee.exchangeCode=QC;async function GC(i,e){return bd(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Do.createGetAppTokenQuery)(i,e)}))}n(GC,"getAppToken");ee.getAppToken=GC;async function WC(i,e,t){return bd(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Do.createRefreshTokenQuery)(i,e,t)}))}n(WC,"refreshUserToken");ee.refreshUserToken=WC;async function VC(i,e){await(0,Lr.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,Do.createRevokeTokenQuery)(i,e)})}n(VC,"revokeToken");ee.revokeToken=VC;async function Fr(i,e){try{let t=await(0,Lr.callTwitchApi)({type:"auth",url:"validate"},e,i);return new NC.TokenInfo(t)}catch(t){throw t instanceof Lr.HttpStatusCodeError&&t.statusCode===401?new Ei.InvalidTokenError({cause:t}):t}}n(Fr,"getTokenInfo");ee.getTokenInfo=Fr;async function $C(i,e,t,r){let a=null,s=!1;try{let o=await i.getAccessTokenForUser(e,t);if(o){s=!0;let l=await Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof Ei.InvalidTokenError?a=o:r?.error(`Retrieving an access token failed: ${o.message}`)}if(s&&(r?.warn("No valid token available; trying to refresh"),i.refreshAccessTokenForUser))try{let o=await i.refreshAccessTokenForUser(e),l=await Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof Ei.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n($C,"getValidTokenFromProviderForUser");ee.getValidTokenFromProviderForUser=$C;async function zC(i,e,t,r){let a=null,s=!1;if(!i.getAccessTokenForIntent)throw new FC.InvalidTokenTypeError("This call requires an AuthProvider that supports intents.\nPlease use an auth provider that does, such as `RefreshingAuthProvider`.");try{let o=await i.getAccessTokenForIntent(e,t);if(o){s=!0;let l=await Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof Ei.InvalidTokenError?a=o:r?.error(`Retrieving an access token failed: ${o.message}`)}if(s&&(r?.warn("No valid token available; trying to refresh"),i.refreshAccessTokenForIntent))try{let o=await i.refreshAccessTokenForIntent(e),l=await Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof Ei.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(zC,"getValidTokenFromProviderForIntent");ee.getValidTokenFromProviderForIntent=zC;var KC=new Map([["channel_commercial",["channel:edit:commercial"]],["channel_editor",["channel:manage:broadcast"]],["channel_read",["channel:read:stream_key"]],["channel_subscriptions",["channel:read:subscriptions"]],["user_blocks_read",["user:read:blocked_users"]],["user_blocks_edit",["user:manage:blocked_users"]],["user_follows_edit",["user:edit:follows"]],["user_read",["user:read:email"]],["user_subscriptions",["user:read:subscriptions"]],["user:edit:broadcast",["channel:manage:broadcast","channel:manage:extensions"]]]);function Kf(i,e){if(e?.length){let t=new Set(i.flatMap(r=>{var a;return[r,...(a=KC.get(r))!==null&&a!==void 0?a:[]]}));if(e.every(r=>!t.has(r))){let r=e.join(", ");throw new Error(`This token does not have any of the requested scopes (${r}) and can not be upgraded.
12
12
  If you need dynamically upgrading scopes, please implement the AuthProvider interface accordingly:
13
13
 
14
- https://twurple.js.org/reference/auth/interfaces/AuthProvider.html`)}}}n($f,"compareScopes");ee.compareScopes=$f;function zf(i,e){for(let t of e)$f(i,t)}n(zf,"compareScopeSets");ee.compareScopeSets=zf;async function WC(i,e,t,r,a){if(a?.length||!t){let s=await Fr(e,i);if(!s.userId)throw new Error("Trying to use an app access token as a user access token");let o=r??s.scopes;return a&&zf(o,a.filter(l=>!!l)),[o,s.userId]}return[r,t]}n(WC,"loadAndCompareTokenInfo");ee.loadAndCompareTokenInfo=WC});var To=u(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.TokenFetcher=void 0;var Kf=C(),bd=class{static{n(this,"TokenFetcher")}constructor(e){this._newTokenScopeSets=[],this._newTokenPromise=null,this._queuedScopeSets=[],this._queueExecutor=null,this._queuePromise=null,this._executor=e}async fetch(...e){var t;let r=e.filter(l=>!!l);if(this._newTokenPromise){if(!r.length)return await this._newTokenPromise;if(this._queueExecutor?this._queuedScopeSets.push(...r):this._queuedScopeSets=[...r],!this._queuePromise){let{promise:l,resolve:d,reject:p}=(0,Kf.promiseWithResolvers)();this._queuePromise=l,this._queueExecutor=async()=>{var h;if(this._queuePromise){this._newTokenScopeSets=this._queuedScopeSets,this._queuedScopeSets=[],this._newTokenPromise=this._queuePromise,this._queuePromise=null,this._queueExecutor=null;try{d(await this._executor(this._newTokenScopeSets))}catch(w){p(w)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(h=this._queueExecutor)===null||h===void 0||h.call(this)}}}}return await this._queuePromise}this._newTokenScopeSets=[...r];let{promise:a,resolve:s,reject:o}=(0,Kf.promiseWithResolvers)();this._newTokenPromise=a;try{s(await this._executor(this._newTokenScopeSets))}catch(l){o(l)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(t=this._queueExecutor)===null||t===void 0||t.call(this)}return await a}};Io.TokenFetcher=bd});var Zf=u(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.AppTokenAuthProvider=void 0;var Ro=(b(),x(g)),xd=C(),Jf=_(),VC=Co(),$C=Pi(),zC=To(),Nr=class{static{n(this,"AppTokenAuthProvider")}constructor(e,t,r=[]){this._clientId=e,this._clientSecret=t,this._impliedScopes=r,this._fetcher=new zC.TokenFetcher(async a=>await this._fetch(a))}get clientId(){return this._clientId}get currentScopes(){return this._impliedScopes}async getAccessTokenForUser(e,...t){if(t.every(r=>{var a;return(a=r?.some(s=>this._impliedScopes.includes(s)))!==null&&a!==void 0?a:!0}))return{...await this.getAppAccessToken(),userId:(0,Jf.extractUserId)(e)};throw new Error("Can not get user access token for AppTokenAuthProvider")}getCurrentScopesForUser(){return this._impliedScopes}async getAnyAccessToken(){return await this._fetcher.fetch()}async getAppAccessToken(e=!1){return e&&(this._token=void 0),await this._fetcher.fetch()}async _fetch(e){if(e.length>0)for(let t of e)if(this._impliedScopes.length){if(t.every(r=>!this._impliedScopes.includes(r)))throw new Error(`One of the scopes ${t.join(", ")} requested but only the scope ${this._impliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${t.join(", ")} requested but the client credentials flow does not support scopes`);return!this._token||(0,VC.accessTokenIsExpired)(this._token)?this._token=await(0,$C.getAppToken)(this._clientId,this._clientSecret):this._token}};Ai.AppTokenAuthProvider=Nr;Ro.__decorate([(0,xd.Enumerable)(!1)],Nr.prototype,"_clientSecret",void 0);Ro.__decorate([(0,xd.Enumerable)(!1)],Nr.prototype,"_token",void 0);Ro.__decorate([(0,xd.Enumerable)(!1)],Nr.prototype,"_fetcher",void 0);Ai.AppTokenAuthProvider=Nr=Ro.__decorate([(0,Jf.rtfm)("auth","AppTokenAuthProvider","clientId")],Nr)});var vd=u(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.CachedRefreshFailureError=void 0;var KC=_(),wd=class extends KC.CustomError{static{n(this,"CachedRefreshFailureError")}constructor(e){super(`The user context for the user ${e} has been disabled.
14
+ https://twurple.js.org/reference/auth/interfaces/AuthProvider.html`)}}}n(Kf,"compareScopes");ee.compareScopes=Kf;function Jf(i,e){for(let t of e)Kf(i,t)}n(Jf,"compareScopeSets");ee.compareScopeSets=Jf;async function JC(i,e,t,r,a){if(a?.length||!t){let s=await Fr(e,i);if(!s.userId)throw new Error("Trying to use an app access token as a user access token");let o=r??s.scopes;return a&&Jf(o,a.filter(l=>!!l)),[o,s.userId]}return[r,t]}n(JC,"loadAndCompareTokenInfo");ee.loadAndCompareTokenInfo=JC});var To=u(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.TokenFetcher=void 0;var Zf=C(),xd=class{static{n(this,"TokenFetcher")}constructor(e){this._newTokenScopeSets=[],this._newTokenPromise=null,this._queuedScopeSets=[],this._queueExecutor=null,this._queuePromise=null,this._executor=e}async fetch(...e){var t;let r=e.filter(l=>!!l);if(this._newTokenPromise){if(!r.length)return await this._newTokenPromise;if(this._queueExecutor?this._queuedScopeSets.push(...r):this._queuedScopeSets=[...r],!this._queuePromise){let{promise:l,resolve:d,reject:h}=(0,Zf.promiseWithResolvers)();this._queuePromise=l,this._queueExecutor=async()=>{var p;if(this._queuePromise){this._newTokenScopeSets=this._queuedScopeSets,this._queuedScopeSets=[],this._newTokenPromise=this._queuePromise,this._queuePromise=null,this._queueExecutor=null;try{d(await this._executor(this._newTokenScopeSets))}catch(w){h(w)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(p=this._queueExecutor)===null||p===void 0||p.call(this)}}}}return await this._queuePromise}this._newTokenScopeSets=[...r];let{promise:a,resolve:s,reject:o}=(0,Zf.promiseWithResolvers)();this._newTokenPromise=a;try{s(await this._executor(this._newTokenScopeSets))}catch(l){o(l)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(t=this._queueExecutor)===null||t===void 0||t.call(this)}return await a}};Io.TokenFetcher=xd});var Yf=u(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.AppTokenAuthProvider=void 0;var Ro=(b(),x(g)),wd=C(),Xf=m(),ZC=Co(),XC=Pi(),YC=To(),Nr=class{static{n(this,"AppTokenAuthProvider")}constructor(e,t,r=[]){this._clientId=e,this._clientSecret=t,this._impliedScopes=r,this._fetcher=new YC.TokenFetcher(async a=>await this._fetch(a))}get clientId(){return this._clientId}get currentScopes(){return this._impliedScopes}async getAccessTokenForUser(e,...t){if(t.every(r=>{var a;return(a=r?.some(s=>this._impliedScopes.includes(s)))!==null&&a!==void 0?a:!0}))return{...await this.getAppAccessToken(),userId:(0,Xf.extractUserId)(e)};throw new Error("Can not get user access token for AppTokenAuthProvider")}getCurrentScopesForUser(){return this._impliedScopes}async getAnyAccessToken(){return await this._fetcher.fetch()}async getAppAccessToken(e=!1){return e&&(this._token=void 0),await this._fetcher.fetch()}async _fetch(e){if(e.length>0)for(let t of e)if(this._impliedScopes.length){if(t.every(r=>!this._impliedScopes.includes(r)))throw new Error(`One of the scopes ${t.join(", ")} requested but only the scope ${this._impliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${t.join(", ")} requested but the client credentials flow does not support scopes`);return!this._token||(0,ZC.accessTokenIsExpired)(this._token)?this._token=await(0,XC.getAppToken)(this._clientId,this._clientSecret):this._token}};Ai.AppTokenAuthProvider=Nr;Ro.__decorate([(0,wd.Enumerable)(!1)],Nr.prototype,"_clientSecret",void 0);Ro.__decorate([(0,wd.Enumerable)(!1)],Nr.prototype,"_token",void 0);Ro.__decorate([(0,wd.Enumerable)(!1)],Nr.prototype,"_fetcher",void 0);Ai.AppTokenAuthProvider=Nr=Ro.__decorate([(0,Xf.rtfm)("auth","AppTokenAuthProvider","clientId")],Nr)});var Sd=u(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.CachedRefreshFailureError=void 0;var eq=m(),vd=class extends eq.CustomError{static{n(this,"CachedRefreshFailureError")}constructor(e){super(`The user context for the user ${e} has been disabled.
15
15
  This happened because the access token became invalid (e.g. by expiry) and refreshing it failed (e.g. because the account's password was changed).
16
16
 
17
- Use .addUser(), .addUserForToken() or .addUserForCode() for the same user context to re-enable the user with a new, valid token.`),this.userId=e}};Uo.CachedRefreshFailureError=wd});var Hd=u(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.IntermediateUserRemovalError=void 0;var JC=_(),Sd=class extends JC.CustomError{static{n(this,"IntermediateUserRemovalError")}constructor(e){super(`User ${e} was removed while trying to fetch a token.
17
+ Use .addUser(), .addUserForToken() or .addUserForCode() for the same user context to re-enable the user with a new, valid token.`),this.userId=e}};Uo.CachedRefreshFailureError=vd});var Cd=u(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.IntermediateUserRemovalError=void 0;var tq=m(),Hd=class extends tq.CustomError{static{n(this,"IntermediateUserRemovalError")}constructor(e){super(`User ${e} was removed while trying to fetch a token.
18
18
 
19
- Make sure you're not executing any actions when you want to remove a user.`),this.userId=e}};Oo.IntermediateUserRemovalError=Sd});var qd=u(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.UnknownIntentError=void 0;var ZC=_(),Cd=class extends ZC.CustomError{static{n(this,"UnknownIntentError")}constructor(e){super(`Unknown intent: ${e}`),this.intent=e}};Bo.UnknownIntentError=Cd});var eg=u(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.RefreshingAuthProvider=void 0;var Qr=(b(),x(g)),Di=C(),XC=hd(),Ge=_(),Ed=Co(),Xf=vd(),YC=Hd(),Pd=Eo(),eq=Ao(),tq=qd(),dt=Pi(),Yf=To(),Lt=class extends XC.EventEmitter{static{n(this,"RefreshingAuthProvider")}constructor(e){var t;super(),this._userAccessTokens=new Map,this._userTokenFetchers=new Map,this._intentToUserId=new Map,this._userIdToIntents=new Map,this._cachedRefreshFailures=new Set,this.onRefresh=this.registerEvent(),this.onRefreshFailure=this.registerEvent(),this._clientId=e.clientId,this._clientSecret=e.clientSecret,this._redirectUri=e.redirectUri,this._appImpliedScopes=(t=e.appImpliedScopes)!==null&&t!==void 0?t:[],this._appTokenFetcher=new Yf.TokenFetcher(async r=>await this._fetchAppToken(r))}addUser(e,t,r){let a=(0,Ge.extractUserId)(e);if(!t.refreshToken)throw new Error(`Trying to add user ${a} without refresh token`);this._cachedRefreshFailures.delete(a),this._userAccessTokens.set(a,{...t,userId:a}),this._userTokenFetchers.has(a)||this._userTokenFetchers.set(a,new Yf.TokenFetcher(async s=>await this._fetchUserToken(a,s))),r&&this.addIntentsToUser(e,r)}async addUserForToken(e,t){let r=null;if(e.accessToken&&!(0,Ed.accessTokenIsExpired)(e))try{let l=await(0,dt.getTokenInfo)(e.accessToken);r=[e,l]}catch(l){if(!(l instanceof Pd.InvalidTokenError))throw l}if(!r){if(!e.refreshToken)throw new Pd.InvalidTokenError;let l=await(0,dt.refreshUserToken)(this._clientId,this._clientSecret,e.refreshToken),d=await(0,dt.getTokenInfo)(l.accessToken);this.emit(this.onRefresh,d.userId,l),r=[l,d]}let[a,s]=r;if(!s.userId)throw new eq.InvalidTokenTypeError("Could not determine a user ID for your token; you might be trying to disguise an app token as a user token.");let o=a.scope?a:{...a,scope:s.scopes};return this.addUser(s.userId,o,t),s.userId}async addUserForCode(e,t){if(!this._redirectUri)throw new Error("This method requires you to pass a `redirectUri` as a configuration property");let r=await(0,dt.exchangeCode)(this._clientId,this._clientSecret,e,this._redirectUri);return await this.addUserForToken(r,t)}hasUser(e){return this._userTokenFetchers.has((0,Ge.extractUserId)(e))}removeUser(e){let t=(0,Ge.extractUserId)(e);if(this._userIdToIntents.has(t)){let r=this._userIdToIntents.get(t);for(let a of r)this._intentToUserId.delete(a);this._userIdToIntents.delete(t)}this._userAccessTokens.delete(t),this._userTokenFetchers.delete(t),this._cachedRefreshFailures.delete(t)}addIntentsToUser(e,t){let r=(0,Ge.extractUserId)(e);if(!this._userAccessTokens.has(r))throw new Error("Trying to add intents to a user that was not added to this provider");for(let a of t)this._intentToUserId.has(a)&&this._userIdToIntents.get(this._intentToUserId.get(a)).delete(a),this._intentToUserId.set(a,r),this._userIdToIntents.has(r)?this._userIdToIntents.get(r).add(a):this._userIdToIntents.set(r,new Set([a]))}getIntentsForUser(e){let t=(0,Ge.extractUserId)(e);return this._userIdToIntents.has(t)?Array.from(this._userIdToIntents.get(t)):[]}removeIntents(e){var t;for(let r of e)if(this._intentToUserId.has(r)){let a=this._intentToUserId.get(r);(t=this._userIdToIntents.get(a))===null||t===void 0||t.delete(r),this._intentToUserId.delete(r)}}async refreshAccessTokenForUser(e){let t=(0,Ge.extractUserId)(e);if(this._cachedRefreshFailures.has(t))throw new Xf.CachedRefreshFailureError(t);let r=this._userAccessTokens.get(t);if(!r)throw new Error("Trying to refresh token for user that was not added to the provider");let a=await this._refreshUserTokenWithCallback(t,r.refreshToken);return this._checkIntermediateUserRemoval(t),this._userAccessTokens.set(t,{...a,userId:t}),this.emit(this.onRefresh,t,a),{...a,userId:t}}async refreshAccessTokenForIntent(e){if(!this._intentToUserId.has(e))throw new tq.UnknownIntentError(e);let t=this._intentToUserId.get(e);return await this.refreshAccessTokenForUser(t)}get clientId(){return this._clientId}getCurrentScopesForUser(e){var t;let r=this._userAccessTokens.get((0,Ge.extractUserId)(e));if(!r)throw new Error("Trying to get scopes for user that was not added to the provider");return(t=r.scope)!==null&&t!==void 0?t:[]}async getAccessTokenForUser(e,...t){let r=(0,Ge.extractUserId)(e),a=this._userTokenFetchers.get(r);if(!a)return null;if(this._cachedRefreshFailures.has(r))throw new Xf.CachedRefreshFailureError(r);return(0,dt.compareScopeSets)(this.getCurrentScopesForUser(r),t.filter(Boolean)),await a.fetch(...t)}async getAccessTokenForIntent(e,...t){if(!this._intentToUserId.has(e))return null;let r=this._intentToUserId.get(e),a=await this.getAccessTokenForUser(r,...t);if(!a)throw new Ge.HellFreezesOverError(`Found intent ${e} corresponding to user ID ${r} but no token was found`);return{...a,userId:r}}async getAnyAccessToken(e){if(e){let t=(0,Ge.extractUserId)(e);if(this._userAccessTokens.has(t)){let r=await this.getAccessTokenForUser(t);if(!r)throw new Ge.HellFreezesOverError(`Token for user ID ${t} exists but nothing was returned by getAccessTokenForUser`);return{...r,userId:t}}}return await this.getAppAccessToken()}async getAppAccessToken(e=!1){return e&&(this._appAccessToken=void 0),await this._appTokenFetcher.fetch(...this._appImpliedScopes.map(t=>[t]))}_checkIntermediateUserRemoval(e){if(!this._userTokenFetchers.has(e))throw this._cachedRefreshFailures.delete(e),new YC.IntermediateUserRemovalError(e)}async _fetchUserToken(e,t){let r=this._userAccessTokens.get(e);if(!r)throw new Error("Trying to get token for user that was not added to the provider");if(r.accessToken&&!(0,Ed.accessTokenIsExpired)(r))try{if(r.scope)return(0,dt.compareScopeSets)(r.scope,t),r;let[s=[]]=await(0,dt.loadAndCompareTokenInfo)(this._clientId,r.accessToken,e,r.scope,t),o={...r,scope:s};return this._checkIntermediateUserRemoval(e),this._userAccessTokens.set(e,o),o}catch(s){if(!(s instanceof Pd.InvalidTokenError))throw s}this._checkIntermediateUserRemoval(e);let a=await this.refreshAccessTokenForUser(e);return(0,dt.compareScopeSets)(a.scope,t),a}async _refreshUserTokenWithCallback(e,t){try{return await(0,dt.refreshUserToken)(this.clientId,this._clientSecret,t)}catch(r){throw this._cachedRefreshFailures.add(e),this.emit(this.onRefreshFailure,e,r),r}}async _fetchAppToken(e){if(e.length>0)for(let t of e)if(this._appImpliedScopes.length){if(t.every(r=>!this._appImpliedScopes.includes(r)))throw new Error(`One of the scopes ${t.join(", ")} requested but only the scope ${this._appImpliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${t.join(", ")} requested but the client credentials flow does not support scopes`);return!this._appAccessToken||(0,Ed.accessTokenIsExpired)(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await(0,dt.getAppToken)(this._clientId,this._clientSecret)}};Ii.RefreshingAuthProvider=Lt;Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_clientSecret",void 0);Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_userAccessTokens",void 0);Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_userTokenFetchers",void 0);Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_appAccessToken",void 0);Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_appTokenFetcher",void 0);Ii.RefreshingAuthProvider=Lt=Qr.__decorate([(0,Ge.rtfm)("auth","RefreshingAuthProvider","clientId")],Lt)});var rg=u(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.StaticAuthProvider=void 0;var Ad=(b(),x(g)),tg=C(),rq=_(),iq=Pi(),Ti=class{static{n(this,"StaticAuthProvider")}constructor(e,t,r){this._clientId=e||"",this._accessToken=typeof t=="string"?{accessToken:t,refreshToken:null,scope:r??[],expiresIn:null,obtainmentTimestamp:Date.now()}:t,this._scopes=r}get clientId(){return this._clientId}async getAccessTokenForUser(e,...t){return await this._getAccessToken(t)}async getAccessTokenForIntent(e,...t){return await this._getAccessToken(t)}async getAnyAccessToken(){return await this._getAccessToken()}getCurrentScopesForUser(){var e;return(e=this._scopes)!==null&&e!==void 0?e:[]}async _getAccessToken(e){let[t,r]=await(0,iq.loadAndCompareTokenInfo)(this._clientId,this._accessToken.accessToken,this._userId,this._scopes,e);return this._scopes=t,this._userId=r,{...this._accessToken,userId:r}}};Ri.StaticAuthProvider=Ti;Ad.__decorate([(0,tg.Enumerable)(!1)],Ti.prototype,"_clientId",void 0);Ad.__decorate([(0,tg.Enumerable)(!1)],Ti.prototype,"_accessToken",void 0);Ri.StaticAuthProvider=Ti=Ad.__decorate([(0,rq.rtfm)("auth","StaticAuthProvider","clientId")],Ti)});var Dd=u(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.UnknownIntentError=T.InvalidTokenTypeError=T.InvalidTokenError=T.IntermediateUserRemovalError=T.CachedRefreshFailureError=T.StaticAuthProvider=T.RefreshingAuthProvider=T.AppTokenAuthProvider=T.TokenInfo=T.TokenFetcher=T.revokeToken=T.refreshUserToken=T.getValidTokenFromProviderForIntent=T.getValidTokenFromProviderForUser=T.getTokenInfo=T.getAppToken=T.exchangeCode=T.getExpiryDateOfAccessToken=T.accessTokenIsExpired=void 0;var ig=Co();Object.defineProperty(T,"accessTokenIsExpired",{enumerable:!0,get:n(function(){return ig.accessTokenIsExpired},"get")});Object.defineProperty(T,"getExpiryDateOfAccessToken",{enumerable:!0,get:n(function(){return ig.getExpiryDateOfAccessToken},"get")});var sr=Pi();Object.defineProperty(T,"exchangeCode",{enumerable:!0,get:n(function(){return sr.exchangeCode},"get")});Object.defineProperty(T,"getAppToken",{enumerable:!0,get:n(function(){return sr.getAppToken},"get")});Object.defineProperty(T,"getTokenInfo",{enumerable:!0,get:n(function(){return sr.getTokenInfo},"get")});Object.defineProperty(T,"getValidTokenFromProviderForUser",{enumerable:!0,get:n(function(){return sr.getValidTokenFromProviderForUser},"get")});Object.defineProperty(T,"getValidTokenFromProviderForIntent",{enumerable:!0,get:n(function(){return sr.getValidTokenFromProviderForIntent},"get")});Object.defineProperty(T,"refreshUserToken",{enumerable:!0,get:n(function(){return sr.refreshUserToken},"get")});Object.defineProperty(T,"revokeToken",{enumerable:!0,get:n(function(){return sr.revokeToken},"get")});var nq=To();Object.defineProperty(T,"TokenFetcher",{enumerable:!0,get:n(function(){return nq.TokenFetcher},"get")});var aq=fd();Object.defineProperty(T,"TokenInfo",{enumerable:!0,get:n(function(){return aq.TokenInfo},"get")});var sq=Zf();Object.defineProperty(T,"AppTokenAuthProvider",{enumerable:!0,get:n(function(){return sq.AppTokenAuthProvider},"get")});var oq=eg();Object.defineProperty(T,"RefreshingAuthProvider",{enumerable:!0,get:n(function(){return oq.RefreshingAuthProvider},"get")});var lq=rg();Object.defineProperty(T,"StaticAuthProvider",{enumerable:!0,get:n(function(){return lq.StaticAuthProvider},"get")});var uq=vd();Object.defineProperty(T,"CachedRefreshFailureError",{enumerable:!0,get:n(function(){return uq.CachedRefreshFailureError},"get")});var cq=Hd();Object.defineProperty(T,"IntermediateUserRemovalError",{enumerable:!0,get:n(function(){return cq.IntermediateUserRemovalError},"get")});var dq=Eo();Object.defineProperty(T,"InvalidTokenError",{enumerable:!0,get:n(function(){return dq.InvalidTokenError},"get")});var hq=Ao();Object.defineProperty(T,"InvalidTokenTypeError",{enumerable:!0,get:n(function(){return hq.InvalidTokenTypeError},"get")});var pq=qd();Object.defineProperty(T,"UnknownIntentError",{enumerable:!0,get:n(function(){return pq.UnknownIntentError},"get")})});var ag=u((Fj,ng)=>{function We(i,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}n(We,"RetryOperation");ng.exports=We;We.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};We.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};We.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var e=new Date().getTime();if(i&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},t),this._options.unref&&this._timer.unref(),!0};We.prototype.attempt=function(i,e){this._fn=i,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};We.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};We.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};We.prototype.start=We.prototype.try;We.prototype.errors=function(){return this._errors};We.prototype.attempts=function(){return this._attempts};We.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},e=null,t=0,r=0;r<this._errors.length;r++){var a=this._errors[r],s=a.message,o=(i[s]||0)+1;i[s]=o,o>=t&&(e=a,t=o)}return e}});var sg=u(or=>{var _q=ag();or.operation=function(i){var e=or.timeouts(i);return new _q(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};or.timeouts=function(i){if(i instanceof Array)return[].concat(i);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in i)e[t]=i[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],a=0;a<e.retries;a++)r.push(this.createTimeout(a,e));return i&&i.forever&&!r.length&&r.push(this.createTimeout(a,e)),r.sort(function(s,o){return s-o}),r};or.createTimeout=function(i,e){var t=e.randomize?Math.random()+1:1,r=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,i));return r=Math.min(r,e.maxTimeout),r};or.wrap=function(i,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var r in i)typeof i[r]=="function"&&t.push(r)}for(var a=0;a<t.length;a++){var s=t[a],o=i[s];i[s]=n(function(d){var p=or.operation(e),h=Array.prototype.slice.call(arguments,1),w=h.pop();h.push(function(E){p.retry(E)||(E&&(arguments[0]=p.mainError()),w.apply(this,arguments))}),p.attempt(function(){d.apply(i,h)})},"retryWrapper").bind(i,o),i[s].options=e}}});var lg=u((Wj,og)=>{og.exports=sg()});var ug=u(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.createBitsLeaderboardQuery=void 0;function mq(i={}){let{count:e=10,period:t="all",startDate:r,contextUserId:a}=i;return{count:e.toString(),period:t,started_at:r?.toISOString(),user_id:a}}n(mq,"createBitsLeaderboardQuery");jo.createBitsLeaderboardQuery=mq});var G=u(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.BaseApi=void 0;var yq=(b(),x(g)),fq=C(),ko=class{static{n(this,"BaseApi")}constructor(e){this._client=e}_getUserContextIdWithDefault(e){var t;return(t=this._client._getUserIdFromRequestContext(e))!==null&&t!==void 0?t:e}};Mo.BaseApi=ko;yq.__decorate([(0,fq.Enumerable)(!1)],ko.prototype,"_client",void 0)});var Id=u(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.HelixBitsLeaderboardEntry=void 0;var cg=(b(),x(g)),gq=C(),wt=_(),Lo=class extends wt.DataObject{static{n(this,"HelixBitsLeaderboardEntry")}constructor(e,t){super(e),this._client=t}get userId(){return this[wt.rawDataSymbol].user_id}get userName(){return this[wt.rawDataSymbol].user_login}get userDisplayName(){return this[wt.rawDataSymbol].user_name}get rank(){return this[wt.rawDataSymbol].rank}get amount(){return this[wt.rawDataSymbol].score}async getUser(){return(0,wt.checkRelationAssertion)(await this._client.users.getUserById(this[wt.rawDataSymbol].user_id))}};Ui.HelixBitsLeaderboardEntry=Lo;cg.__decorate([(0,gq.Enumerable)(!1)],Lo.prototype,"_client",void 0);Ui.HelixBitsLeaderboardEntry=Lo=cg.__decorate([(0,wt.rtfm)("api","HelixBitsLeaderboardEntry","userId")],Lo)});var Rd=u(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.HelixBitsLeaderboard=void 0;var Td=(b(),x(g)),dg=Ci(),bq=C(),Fo=_(),xq=Id(),Oi=class extends Fo.DataObject{static{n(this,"HelixBitsLeaderboard")}constructor(e,t){super(e),this._client=t}get entries(){return this[Fo.rawDataSymbol].data.map(e=>new xq.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[Fo.rawDataSymbol].total}};Bi.HelixBitsLeaderboard=Oi;Td.__decorate([(0,bq.Enumerable)(!1)],Oi.prototype,"_client",void 0);Td.__decorate([(0,dg.CachedGetter)()],Oi.prototype,"entries",null);Bi.HelixBitsLeaderboard=Oi=Td.__decorate([dg.Cacheable,(0,Fo.rtfm)("api","HelixBitsLeaderboard")],Oi)});var Od=u(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.HelixCheermoteList=void 0;var wq=(b(),x(g)),vq=C(),ji=_(),Ud=class extends ji.DataObject{static{n(this,"HelixCheermoteList")}constructor(e){super((0,vq.indexBy)(e,t=>t.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,t,r){e=e.toLowerCase();let{background:a,state:s,scale:o}=r,{tiers:l}=this[ji.rawDataSymbol][e],d=l.sort((p,h)=>h.min_bits-p.min_bits).find(p=>p.min_bits<=t);if(!d)throw new ji.HellFreezesOverError(`Cheermote "${e}" does not have an applicable tier for ${t} bits`);return{url:d.images[a][s][o],color:d.color}}getPossibleNames(){return Object.keys(this[ji.rawDataSymbol])}};ki.HelixCheermoteList=Ud;ki.HelixCheermoteList=Ud=wq.__decorate([(0,ji.rtfm)("api","HelixCheermoteList")],Ud)});var kd=u(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.HelixBitsApi=void 0;var Sq=(b(),x(g)),hg=C(),Hq=Y(),Bd=_(),Cq=ug(),qq=G(),Eq=Rd(),Pq=Od(),jd=class extends qq.BaseApi{static{n(this,"HelixBitsApi")}async getLeaderboard(e,t={}){let r=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:(0,Bd.extractUserId)(e),scopes:["bits:read"],query:(0,Cq.createBitsLeaderboardQuery)(t)});return new Eq.HelixBitsLeaderboard(r,this._client)}async getCheermotes(e){let t=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:(0,hg.mapOptional)(e,Bd.extractUserId),query:(0,hg.mapOptional)(e,Hq.createBroadcasterQuery)});return new Pq.HelixCheermoteList(t.data)}};Mi.HelixBitsApi=jd;Mi.HelixBitsApi=jd=Sq.__decorate([(0,Bd.rtfm)("api","HelixBitsApi")],jd)});var _g=u(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.createFollowedChannelQuery=Ve.createChannelFollowerQuery=Ve.createChannelVipUpdateQuery=Ve.createChannelCommercialBody=Ve.createChannelUpdateBody=void 0;var pg=C(),lr=_();function Aq(i){var e;return{game_id:i.gameId,broadcaster_language:i.language,title:i.title,delay:(e=i.delay)===null||e===void 0?void 0:e.toString(),tags:i.tags,content_classification_labels:i.contentClassificationLabels,is_branded_content:i.isBrandedContent}}n(Aq,"createChannelUpdateBody");Ve.createChannelUpdateBody=Aq;function Dq(i,e){return{broadcaster_id:(0,lr.extractUserId)(i),length:e}}n(Dq,"createChannelCommercialBody");Ve.createChannelCommercialBody=Dq;function Iq(i,e){return{broadcaster_id:(0,lr.extractUserId)(i),user_id:(0,lr.extractUserId)(e)}}n(Iq,"createChannelVipUpdateQuery");Ve.createChannelVipUpdateQuery=Iq;function Tq(i,e){return{broadcaster_id:(0,lr.extractUserId)(i),user_id:(0,pg.mapOptional)(e,lr.extractUserId)}}n(Tq,"createChannelFollowerQuery");Ve.createChannelFollowerQuery=Tq;function Rq(i,e){return{broadcaster_id:(0,pg.mapOptional)(e,lr.extractUserId),user_id:(0,lr.extractUserId)(i)}}n(Rq,"createFollowedChannelQuery");Ve.createFollowedChannelQuery=Rq});var je=u($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.createChannelUsersCheckQuery=$e.createGetByIdsQuery=$e.createModeratorActionQuery=$e.createUserQuery=$e.createSingleKeyQuery=void 0;var No=_();function Uq(i,e){return{[i]:e}}n(Uq,"createSingleKeyQuery");$e.createSingleKeyQuery=Uq;function Oq(i){return{user_id:(0,No.extractUserId)(i)}}n(Oq,"createUserQuery");$e.createUserQuery=Oq;function Bq(i,e){return{broadcaster_id:i,moderator_id:e}}n(Bq,"createModeratorActionQuery");$e.createModeratorActionQuery=Bq;function jq(i,e){return{broadcaster_id:(0,No.extractUserId)(i),id:e}}n(jq,"createGetByIdsQuery");$e.createGetByIdsQuery=jq;function kq(i,e){return{broadcaster_id:(0,No.extractUserId)(i),user_id:e.map(No.extractUserId)}}n(kq,"createChannelUsersCheckQuery");$e.createChannelUsersCheckQuery=kq});var Go=u(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.HelixUserRelation=void 0;var mg=(b(),x(g)),Mq=C(),ur=_(),Qo=class extends ur.DataObject{static{n(this,"HelixUserRelation")}constructor(e,t){super(e),this._client=t}get id(){return this[ur.rawDataSymbol].user_id}get name(){return this[ur.rawDataSymbol].user_login}get displayName(){return this[ur.rawDataSymbol].user_name}async getUser(){return(0,ur.checkRelationAssertion)(await this._client.users.getUserById(this[ur.rawDataSymbol].user_id))}};Li.HelixUserRelation=Qo;mg.__decorate([(0,Mq.Enumerable)(!1)],Qo.prototype,"_client",void 0);Li.HelixUserRelation=Qo=mg.__decorate([(0,ur.rtfm)("api","HelixUserRelation","id")],Qo)});var Ft=u(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.HelixRequestBatcher=void 0;var Lq=(b(),x(g)),Md=C(),Wo=class{static{n(this,"HelixRequestBatcher")}constructor(e,t,r,a,s,o=100){this._callOptions=e,this._queryParamName=t,this._matchKey=r,this._mapper=s,this._limitPerRequest=o,this._requestedIds=[],this._requestResolversById=new Map,this._waitTimer=null,this._client=a,this._delay=a._batchDelay}async request(e){let{promise:t,resolve:r,reject:a}=(0,Md.promiseWithResolvers)();return this._requestedIds.includes(e)||this._requestedIds.push(e),this._requestResolversById.has(e)?this._requestResolversById.get(e).push({resolve:r,reject:a}):this._requestResolversById.set(e,[{resolve:r,reject:a}]),this._waitTimer&&(clearTimeout(this._waitTimer),this._waitTimer=null),this._requestedIds.length>=this._limitPerRequest?this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest)):this._waitTimer=setTimeout(()=>{this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest))},this._delay),await t}async _handleBatch(e){var t;try{let{data:r}=await this._doRequest(e),a=(0,Md.indexBy)(r,this._matchKey);for(let s of e){for(let o of(t=this._requestResolversById.get(s))!==null&&t!==void 0?t:[])Object.prototype.hasOwnProperty.call(a,s)?o.resolve(this._mapper(a[s])):o.resolve(null);this._requestResolversById.delete(s)}}catch{await Promise.all(e.map(async a=>{var s,o;try{let l=await this._doRequest([a]);for(let d of(s=this._requestResolversById.get(a))!==null&&s!==void 0?s:[])d.resolve(l.data.length?this._mapper(l.data[0]):null)}catch(l){for(let d of(o=this._requestResolversById.get(a))!==null&&o!==void 0?o:[])d.reject(l)}this._requestResolversById.delete(a)}))}}async _doRequest(e){return await this._client.callApi({type:"helix",...this._callOptions,query:{...this._callOptions.query,[this._queryParamName]:e}})}};Vo.HelixRequestBatcher=Wo;Lq.__decorate([(0,Md.Enumerable)(!1)],Wo.prototype,"_client",void 0)});var oe=u(Fi=>{"use strict";var Ld;Object.defineProperty(Fi,"__esModule",{value:!0});Fi.HelixPaginatedRequest=void 0;var yg=(b(),x(g)),Fq=C(),Nq=_();Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(Ld=Symbol.asyncIterator)!==null&&Ld!==void 0?Ld:Symbol.for("Symbol.asyncIterator"));var $o=class{static{n(this,"HelixPaginatedRequest")}constructor(e,t,r,a=100){this._callOptions=e,this._mapper=r,this._limitPerPage=a,this._isFinished=!1,this._client=t}get current(){var e;return(e=this._currentData)===null||e===void 0?void 0:e.data}async getNext(){var e;if(this._isFinished)return[];let t=await this._fetchData();return!((e=t.data)===null||e===void 0)&&e.length?this._processResult(t):(this._isFinished=!0,[])}async getAll(){this.reset();let e=[];do{let t=await this.getNext();if(!t.length)break;e.push(...t)}while(this._currentCursor);return this.reset(),e}get currentCursor(){return this._currentCursor}reset(){this._currentCursor=void 0,this._isFinished=!1,this._currentData=void 0}async*[Symbol.asyncIterator](){for(this.reset();;){let e=await this.getNext();if(!e.length)break;yield*e[Symbol.iterator]()}}async _fetchData(e={}){return await this._client.callApi({type:"helix",...this._callOptions,...e,query:{...this._callOptions.query,after:this._currentCursor,first:this._limitPerPage.toString(),...e.query}})}_processResult(e){var t;return this._currentCursor=typeof e.pagination=="string"?e.pagination:(t=e.pagination)===null||t===void 0?void 0:t.cursor,this._currentCursor===void 0&&(this._isFinished=!0),this._currentData=e,e.data.reduce((r,a)=>{let s=this._mapper(a);return Array.isArray(s)?[...r,...s]:[...r,s]},[])}};Fi.HelixPaginatedRequest=$o;yg.__decorate([(0,Fq.Enumerable)(!1)],$o.prototype,"_client",void 0);Fi.HelixPaginatedRequest=$o=yg.__decorate([(0,Nq.rtfm)("api","HelixPaginatedRequest")],$o)});var Gr=u(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.HelixPaginatedRequestWithTotal=void 0;var Qq=(b(),x(g)),Gq=_(),Wq=oe(),Fd=class extends Wq.HelixPaginatedRequest{static{n(this,"HelixPaginatedRequestWithTotal")}async getTotalCount(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total}};Ni.HelixPaginatedRequestWithTotal=Fd;Ni.HelixPaginatedRequestWithTotal=Fd=Qq.__decorate([(0,Gq.rtfm)("api","HelixPaginatedRequestWithTotal")],Fd)});var pe=u(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.createPaginatedResultWithTotal=Wr.createPaginatedResult=void 0;function Vq(i,e,t){var r;let a;return{get data(){var s,o;return a??(a=(o=(s=i.data)===null||s===void 0?void 0:s.map(l=>new e(l,t)))!==null&&o!==void 0?o:[])},cursor:typeof i.pagination=="string"?i.pagination:(r=i.pagination)===null||r===void 0?void 0:r.cursor}}n(Vq,"createPaginatedResult");Wr.createPaginatedResult=Vq;function $q(i,e,t){let r;return{get data(){var a,s;return r??(r=(s=(a=i.data)===null||a===void 0?void 0:a.map(o=>new e(o,t)))!==null&&s!==void 0?s:[])},cursor:i.pagination.cursor,total:i.total}}n($q,"createPaginatedResultWithTotal");Wr.createPaginatedResultWithTotal=$q});var le=u(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.createPaginationQuery=void 0;function zq({after:i,before:e,limit:t}={}){return{after:i,before:e,first:t?.toString()}}n(zq,"createPaginationQuery");zo.createPaginationQuery=zq});var Nd=u(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.HelixChannel=void 0;var fg=(b(),x(g)),Kq=C(),me=_(),Ko=class extends me.DataObject{static{n(this,"HelixChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[me.rawDataSymbol].broadcaster_id}get name(){return this[me.rawDataSymbol].broadcaster_login}get displayName(){return this[me.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,me.checkRelationAssertion)(await this._client.users.getUserById(this[me.rawDataSymbol].broadcaster_id))}get language(){return this[me.rawDataSymbol].broadcaster_language}get gameId(){return this[me.rawDataSymbol].game_id}get gameName(){return this[me.rawDataSymbol].game_name}async getGame(){return this[me.rawDataSymbol].game_id?(0,me.checkRelationAssertion)(await this._client.games.getGameById(this[me.rawDataSymbol].game_id)):null}get title(){return this[me.rawDataSymbol].title}get delay(){return this[me.rawDataSymbol].delay}get tags(){return this[me.rawDataSymbol].tags}get contentClassificationLabels(){return this[me.rawDataSymbol].content_classification_labels}get isBrandedContent(){return this[me.rawDataSymbol].is_branded_content}};Qi.HelixChannel=Ko;fg.__decorate([(0,Kq.Enumerable)(!1)],Ko.prototype,"_client",void 0);Qi.HelixChannel=Ko=fg.__decorate([(0,me.rtfm)("api","HelixChannel","id")],Ko)});var Qd=u(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.HelixChannelEditor=void 0;var gg=(b(),x(g)),Jq=C(),cr=_(),Jo=class extends cr.DataObject{static{n(this,"HelixChannelEditor")}constructor(e,t){super(e),this._client=t}get userId(){return this[cr.rawDataSymbol].user_id}get userDisplayName(){return this[cr.rawDataSymbol].user_name}async getUser(){return(0,cr.checkRelationAssertion)(await this._client.users.getUserById(this[cr.rawDataSymbol].user_id))}get creationDate(){return new Date(this[cr.rawDataSymbol].created_at)}};Gi.HelixChannelEditor=Jo;gg.__decorate([(0,Jq.Enumerable)(!1)],Jo.prototype,"_client",void 0);Gi.HelixChannelEditor=Jo=gg.__decorate([(0,cr.rtfm)("api","HelixChannelEditor","userId")],Jo)});var Gd=u(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.HelixChannelFollower=void 0;var bg=(b(),x(g)),Zq=C(),Nt=_(),Zo=class extends Nt.DataObject{static{n(this,"HelixChannelFollower")}constructor(e,t){super(e),this._client=t}get userId(){return this[Nt.rawDataSymbol].user_id}get userName(){return this[Nt.rawDataSymbol].user_login}get userDisplayName(){return this[Nt.rawDataSymbol].user_name}async getUser(){return(0,Nt.checkRelationAssertion)(await this._client.users.getUserById(this[Nt.rawDataSymbol].user_id))}get followDate(){return new Date(this[Nt.rawDataSymbol].followed_at)}};Wi.HelixChannelFollower=Zo;bg.__decorate([(0,Zq.Enumerable)(!1)],Zo.prototype,"_client",void 0);Wi.HelixChannelFollower=Zo=bg.__decorate([(0,Nt.rtfm)("api","HelixChannelFollower","userId")],Zo)});var Wd=u(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.HelixFollowedChannel=void 0;var xg=(b(),x(g)),Xq=C(),Qt=_(),Xo=class extends Qt.DataObject{static{n(this,"HelixFollowedChannel")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Qt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Qt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Qt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Qt.checkRelationAssertion)(await this._client.users.getUserById(this[Qt.rawDataSymbol].broadcaster_id))}get followDate(){return new Date(this[Qt.rawDataSymbol].followed_at)}};Vi.HelixFollowedChannel=Xo;xg.__decorate([(0,Xq.Enumerable)(!1)],Xo.prototype,"_client",void 0);Vi.HelixFollowedChannel=Xo=xg.__decorate([(0,Qt.rtfm)("api","HelixFollowedChannel","broadcasterId")],Xo)});var $d=u($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.HelixAdSchedule=void 0;var Yq=(b(),x(g)),et=_(),Vd=class extends et.DataObject{static{n(this,"HelixAdSchedule")}get snoozeCount(){return this[et.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return this[et.rawDataSymbol].snooze_refresh_at?new Date(this[et.rawDataSymbol].snooze_refresh_at*1e3):null}get nextAdDate(){return this[et.rawDataSymbol].next_ad_at?new Date(this[et.rawDataSymbol].next_ad_at*1e3):null}get duration(){return this[et.rawDataSymbol].duration}get lastAdDate(){return this[et.rawDataSymbol].last_ad_at?new Date(this[et.rawDataSymbol].last_ad_at*1e3):null}get prerollFreeTime(){return this[et.rawDataSymbol].preroll_free_time}};$i.HelixAdSchedule=Vd;$i.HelixAdSchedule=Vd=Yq.__decorate([(0,et.rtfm)("api","HelixAdSchedule")],Vd)});var wg=u(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.HelixSnoozeNextAdResult=void 0;var eE=(b(),x(g)),zi=_(),zd=class extends zi.DataObject{static{n(this,"HelixSnoozeNextAdResult")}get snoozeCount(){return this[zi.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return new Date(this[zi.rawDataSymbol].snooze_refresh_at*1e3)}get nextAdDate(){return new Date(this[zi.rawDataSymbol].next_ad_at*1e3)}};Ki.HelixSnoozeNextAdResult=zd;Ki.HelixSnoozeNextAdResult=zd=eE.__decorate([(0,zi.rtfm)("api","HelixSnoozeNextAdResult")],zd)});var Xd=u(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.HelixChannelApi=void 0;var qg=(b(),x(g)),Eg=C(),dr=Y(),ue=_(),vt=_g(),vg=je(),Kd=Go(),tE=Ft(),rE=oe(),Sg=Gr(),Jd=pe(),Yo=le(),iE=G(),Zd=Nd(),nE=Qd(),Hg=Gd(),Cg=Wd(),aE=$d(),sE=wg(),el=class extends iE.BaseApi{static{n(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new tE.HelixRequestBatcher({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new Zd.HelixChannel(e,this._client))}async getChannelInfoById(e){let t=(0,ue.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"channels",userId:t,query:(0,dr.createBroadcasterQuery)(t)});return(0,Eg.mapNullable)(r.data[0],a=>new Zd.HelixChannel(a,this._client))}async getChannelInfoByIdBatched(e){return await this._getChannelByIdBatcher.request((0,ue.extractUserId)(e))}async getChannelInfoByIds(e){let t=e.map(ue.extractUserId);return(await this._client.callApi({type:"helix",url:"channels",query:(0,vg.createSingleKeyQuery)("broadcaster_id",t)})).data.map(a=>new Zd.HelixChannel(a,this._client))}async updateChannelInfo(e,t){await this._client.callApi({type:"helix",url:"channels",method:"PATCH",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:broadcast"],query:(0,dr.createBroadcasterQuery)(e),jsonBody:(0,vt.createChannelUpdateBody)(t)})}async startChannelCommercial(e,t){await this._client.callApi({type:"helix",url:"channels/commercial",method:"POST",userId:(0,ue.extractUserId)(e),scopes:["channel:edit:commercial"],jsonBody:(0,vt.createChannelCommercialBody)(e,t)})}async getChannelEditors(e){return(await this._client.callApi({type:"helix",url:"channels/editors",userId:(0,ue.extractUserId)(e),scopes:["channel:read:editors"],query:(0,dr.createBroadcasterQuery)(e)})).data.map(r=>new nE.HelixChannelEditor(r,this._client))}async getVips(e,t){let r=await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,ue.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:{...(0,dr.createBroadcasterQuery)(e),...(0,Yo.createPaginationQuery)(t)}});return(0,Jd.createPaginatedResult)(r,Kd.HelixUserRelation,this._client)}getVipsPaginated(e){return new rE.HelixPaginatedRequest({url:"channels/vips",userId:(0,ue.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,dr.createBroadcasterQuery)(e)},this._client,t=>new Kd.HelixUserRelation(t,this._client))}async checkVipForUsers(e,t){return(await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,ue.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,vg.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Kd.HelixUserRelation(a,this._client))}async checkVipForUser(e,t){let r=(0,ue.extractUserId)(t);return(await this.checkVipForUsers(e,[r])).some(s=>s.id===r)}async addVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"POST",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,vt.createChannelVipUpdateQuery)(e,t)})}async removeVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"DELETE",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,vt.createChannelVipUpdateQuery)(e,t)})}async getChannelFollowerCount(e){return(await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,ue.extractUserId)(e),query:{...(0,vt.createChannelFollowerQuery)(e),...(0,Yo.createPaginationQuery)({limit:1})}})).total}async getChannelFollowers(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,ue.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:{...(0,vt.createChannelFollowerQuery)(e,t),...(0,Yo.createPaginationQuery)(r)}});return(0,Jd.createPaginatedResultWithTotal)(a,Hg.HelixChannelFollower,this._client)}getChannelFollowersPaginated(e){return new Sg.HelixPaginatedRequestWithTotal({url:"channels/followers",method:"GET",userId:(0,ue.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:(0,vt.createChannelFollowerQuery)(e)},this._client,t=>new Hg.HelixChannelFollower(t,this._client))}async getFollowedChannels(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:(0,ue.extractUserId)(e),scopes:["user:read:follows"],query:{...(0,vt.createFollowedChannelQuery)(e,t),...(0,Yo.createPaginationQuery)(r)}});return(0,Jd.createPaginatedResultWithTotal)(a,Cg.HelixFollowedChannel,this._client)}getFollowedChannelsPaginated(e,t){return new Sg.HelixPaginatedRequestWithTotal({url:"channels/followed",method:"GET",userId:(0,ue.extractUserId)(e),scopes:["user:read:follows"],query:(0,vt.createFollowedChannelQuery)(e,t)},this._client,r=>new Cg.HelixFollowedChannel(r,this._client))}async getAdSchedule(e){let t=await this._client.callApi({type:"helix",url:"channels/ads",method:"GET",userId:(0,ue.extractUserId)(e),scopes:["channel:read:ads"],query:(0,dr.createBroadcasterQuery)(e)});return new aE.HelixAdSchedule(t.data[0])}async snoozeNextAd(e){let t=await this._client.callApi({type:"helix",url:"channels/ads/schedule/snooze",method:"POST",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:ads"],query:(0,dr.createBroadcasterQuery)(e)});return new sE.HelixSnoozeNextAdResult(t.data[0])}};Ji.HelixChannelApi=el;qg.__decorate([(0,Eg.Enumerable)(!1)],el.prototype,"_getChannelByIdBatcher",void 0);Ji.HelixChannelApi=el=qg.__decorate([(0,ue.rtfm)("api","HelixChannelApi")],el)});var Pg=u(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.createRedemptionsForBroadcasterQuery=ze.createRewardRedemptionsByIdsQuery=ze.createCustomRewardBody=ze.createCustomRewardChangeQuery=ze.createCustomRewardsQuery=void 0;var tl=_();function oE(i,e){return{broadcaster_id:(0,tl.extractUserId)(i),only_manageable_rewards:e?.toString()}}n(oE,"createCustomRewardsQuery");ze.createCustomRewardsQuery=oE;function lE(i,e){return{broadcaster_id:(0,tl.extractUserId)(i),id:e}}n(lE,"createCustomRewardChangeQuery");ze.createCustomRewardChangeQuery=lE;function uE(i){var e,t,r;let a={title:i.title,cost:i.cost,prompt:i.prompt,background_color:i.backgroundColor,is_enabled:i.isEnabled,is_user_input_required:i.userInputRequired,should_redemptions_skip_request_queue:i.autoFulfill};return i.maxRedemptionsPerStream!==void 0&&(a.is_max_per_stream_enabled=!!i.maxRedemptionsPerStream,a.max_per_stream=(e=i.maxRedemptionsPerStream)!==null&&e!==void 0?e:0),i.maxRedemptionsPerUserPerStream!==void 0&&(a.is_max_per_user_per_stream_enabled=!!i.maxRedemptionsPerUserPerStream,a.max_per_user_per_stream=(t=i.maxRedemptionsPerUserPerStream)!==null&&t!==void 0?t:0),i.globalCooldown!==void 0&&(a.is_global_cooldown_enabled=!!i.globalCooldown,a.global_cooldown_seconds=(r=i.globalCooldown)!==null&&r!==void 0?r:0),"isPaused"in i&&(a.is_paused=i.isPaused),a}n(uE,"createCustomRewardBody");ze.createCustomRewardBody=uE;function cE(i,e,t){return{broadcaster_id:(0,tl.extractUserId)(i),reward_id:e,id:t}}n(cE,"createRewardRedemptionsByIdsQuery");ze.createRewardRedemptionsByIdsQuery=cE;function dE(i,e,t,r){return{broadcaster_id:(0,tl.extractUserId)(i),reward_id:e,status:t,sort:r.newestFirst?"NEWEST":"OLDEST"}}n(dE,"createRedemptionsForBroadcasterQuery");ze.createRedemptionsForBroadcasterQuery=dE});var Yd=u(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.HelixCustomReward=void 0;var Ag=(b(),x(g)),hE=C(),M=_(),rl=class extends M.DataObject{static{n(this,"HelixCustomReward")}constructor(e,t){super(e),this._client=t}get id(){return this[M.rawDataSymbol].id}get broadcasterId(){return this[M.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[M.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[M.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,M.checkRelationAssertion)(await this._client.users.getUserById(this[M.rawDataSymbol].broadcaster_id))}getImageUrl(e){var t,r;let a=`url_${e}x`;return(r=(t=this[M.rawDataSymbol].image)===null||t===void 0?void 0:t[a])!==null&&r!==void 0?r:this[M.rawDataSymbol].default_image[a]}get backgroundColor(){return this[M.rawDataSymbol].background_color}get isEnabled(){return this[M.rawDataSymbol].is_enabled}get cost(){return this[M.rawDataSymbol].cost}get title(){return this[M.rawDataSymbol].title}get prompt(){return this[M.rawDataSymbol].prompt}get userInputRequired(){return this[M.rawDataSymbol].is_user_input_required}get maxRedemptionsPerStream(){return this[M.rawDataSymbol].max_per_stream_setting.is_enabled?this[M.rawDataSymbol].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[M.rawDataSymbol].max_per_user_per_stream_setting.is_enabled?this[M.rawDataSymbol].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[M.rawDataSymbol].global_cooldown_setting.is_enabled?this[M.rawDataSymbol].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[M.rawDataSymbol].is_paused}get isInStock(){return this[M.rawDataSymbol].is_in_stock}get redemptionsThisStream(){return this[M.rawDataSymbol].redemptions_redeemed_current_stream}get autoFulfill(){return this[M.rawDataSymbol].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[M.rawDataSymbol].cooldown_expires_at?new Date(this[M.rawDataSymbol].cooldown_expires_at):null}};Zi.HelixCustomReward=rl;Ag.__decorate([(0,hE.Enumerable)(!1)],rl.prototype,"_client",void 0);Zi.HelixCustomReward=rl=Ag.__decorate([(0,M.rtfm)("api","HelixCustomReward","id")],rl)});var eh=u(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.HelixCustomRewardRedemption=void 0;var Dg=(b(),x(g)),pE=C(),Q=_(),il=class extends Q.DataObject{static{n(this,"HelixCustomRewardRedemption")}constructor(e,t){super(e),this._client=t}get id(){return this[Q.rawDataSymbol].id}get broadcasterId(){return this[Q.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Q.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Q.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Q.checkRelationAssertion)(await this._client.users.getUserById(this[Q.rawDataSymbol].broadcaster_id))}get userId(){return this[Q.rawDataSymbol].user_id}get userName(){return this[Q.rawDataSymbol].user_login}get userDisplayName(){return this[Q.rawDataSymbol].user_name}async getUser(){return(0,Q.checkRelationAssertion)(await this._client.users.getUserById(this[Q.rawDataSymbol].user_id))}get userInput(){return this[Q.rawDataSymbol].user_input}get isFulfilled(){return this[Q.rawDataSymbol].status==="FULFILLED"}get isCanceled(){return this[Q.rawDataSymbol].status==="CANCELED"}get redemptionDate(){return new Date(this[Q.rawDataSymbol].redeemed_at)}get rewardId(){return this[Q.rawDataSymbol].reward.id}get rewardTitle(){return this[Q.rawDataSymbol].reward.title}get rewardPrompt(){return this[Q.rawDataSymbol].reward.prompt}get rewardCost(){return this[Q.rawDataSymbol].reward.cost}async getReward(){return(0,Q.checkRelationAssertion)(await this._client.channelPoints.getCustomRewardById(this[Q.rawDataSymbol].broadcaster_id,this[Q.rawDataSymbol].reward.id))}async updateStatus(e){return(await this._client.channelPoints.updateRedemptionStatusByIds(this[Q.rawDataSymbol].broadcaster_id,this[Q.rawDataSymbol].reward.id,[this[Q.rawDataSymbol].id],e))[0]}};Xi.HelixCustomRewardRedemption=il;Dg.__decorate([(0,pE.Enumerable)(!1)],il.prototype,"_client",void 0);Xi.HelixCustomRewardRedemption=il=Dg.__decorate([(0,Q.rtfm)("api","HelixCustomRewardRedemption","id")],il)});var rh=u(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.HelixChannelPointsApi=void 0;var _E=(b(),x(g)),mE=Y(),ht=_(),St=Pg(),yE=je(),fE=oe(),gE=pe(),bE=le(),xE=G(),nl=Yd(),al=eh(),th=class extends xE.BaseApi{static{n(this,"HelixChannelPointsApi")}async getCustomRewards(e,t){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,St.createCustomRewardsQuery)(e,t)})).data.map(a=>new nl.HelixCustomReward(a,this._client))}async getCustomRewardsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,yE.createGetByIdsQuery)(e,t)})).data.map(a=>new nl.HelixCustomReward(a,this._client)):[]}async getCustomRewardById(e,t){let r=await this.getCustomRewardsByIds(e,[t]);return r.length?r[0]:null}async createCustomReward(e,t){let r=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"POST",userId:(0,ht.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,mE.createBroadcasterQuery)(e),jsonBody:(0,St.createCustomRewardBody)(t)});return new nl.HelixCustomReward(r.data[0],this._client)}async updateCustomReward(e,t,r){let a=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"PATCH",userId:(0,ht.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,St.createCustomRewardChangeQuery)(e,t),jsonBody:(0,St.createCustomRewardBody)(r)});return new nl.HelixCustomReward(a.data[0],this._client)}async deleteCustomReward(e,t){await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"DELETE",userId:(0,ht.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,St.createCustomRewardChangeQuery)(e,t)})}async getRedemptionsByIds(e,t,r){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,St.createRewardRedemptionsByIdsQuery)(e,t,r)})).data.map(s=>new al.HelixCustomRewardRedemption(s,this._client)):[]}async getRedemptionById(e,t,r){let a=await this.getRedemptionsByIds(e,t,[r]);return a.length?a[0]:null}async getRedemptionsForBroadcaster(e,t,r,a){let s=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...(0,St.createRedemptionsForBroadcasterQuery)(e,t,r,a),...(0,bE.createPaginationQuery)(a)}});return(0,gE.createPaginatedResult)(s,al.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,r,a){return new fE.HelixPaginatedRequest({url:"channel_points/custom_rewards/redemptions",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,St.createRedemptionsForBroadcasterQuery)(e,t,r,a)},this._client,s=>new al.HelixCustomRewardRedemption(s,this._client),50)}async updateRedemptionStatusByIds(e,t,r,a){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",method:"PATCH",userId:(0,ht.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,St.createRewardRedemptionsByIdsQuery)(e,t,r),jsonBody:{status:a}})).data.map(o=>new al.HelixCustomRewardRedemption(o,this._client)):[]}};Yi.HelixChannelPointsApi=th;Yi.HelixChannelPointsApi=th=_E.__decorate([(0,ht.rtfm)("api","HelixChannelPointsApi")],th)});var sl=u(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.HelixCharityCampaignAmount=void 0;var wE=(b(),x(g)),en=_(),ih=class extends en.DataObject{static{n(this,"HelixCharityCampaignAmount")}get value(){return this[en.rawDataSymbol].value}get decimalPlaces(){return this[en.rawDataSymbol].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[en.rawDataSymbol].currency}};tn.HelixCharityCampaignAmount=ih;tn.HelixCharityCampaignAmount=ih=wE.__decorate([(0,en.rtfm)("api","HelixCharityCampaignAmount")],ih)});var nh=u(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.HelixCharityCampaign=void 0;var Tg=(b(),x(g)),vE=C(),De=_(),Ig=sl(),ol=class extends De.DataObject{static{n(this,"HelixCharityCampaign")}constructor(e,t){super(e),this._client=t}get id(){return this[De.rawDataSymbol].id}get broadcasterId(){return this[De.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[De.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[De.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,De.checkRelationAssertion)(await this._client.users.getUserById(this[De.rawDataSymbol].broadcaster_id))}get charityName(){return this[De.rawDataSymbol].charity_name}get charityDescription(){return this[De.rawDataSymbol].charity_description}get charityLogo(){return this[De.rawDataSymbol].charity_logo}get charityWebsite(){return this[De.rawDataSymbol].charity_website}get currentAmount(){return new Ig.HelixCharityCampaignAmount(this[De.rawDataSymbol].current_amount)}get targetAmount(){return new Ig.HelixCharityCampaignAmount(this[De.rawDataSymbol].target_amount)}};rn.HelixCharityCampaign=ol;Tg.__decorate([(0,vE.Enumerable)(!1)],ol.prototype,"_client",void 0);rn.HelixCharityCampaign=ol=Tg.__decorate([(0,De.rtfm)("api","HelixCharityCampaign","id")],ol)});var ah=u(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.HelixCharityCampaignDonation=void 0;var Rg=(b(),x(g)),SE=C(),Ht=_(),HE=sl(),ll=class extends Ht.DataObject{static{n(this,"HelixCharityCampaignDonation")}constructor(e,t){super(e),this._client=t}get campaignId(){return this[Ht.rawDataSymbol].campaign_id}get donorId(){return this[Ht.rawDataSymbol].user_id}get donorName(){return this[Ht.rawDataSymbol].user_login}get donorDisplayName(){return this[Ht.rawDataSymbol].user_name}async getDonor(){return(0,Ht.checkRelationAssertion)(await this._client.users.getUserById(this[Ht.rawDataSymbol].user_id))}get amount(){return new HE.HelixCharityCampaignAmount(this[Ht.rawDataSymbol].amount)}};nn.HelixCharityCampaignDonation=ll;Rg.__decorate([(0,SE.Enumerable)(!1)],ll.prototype,"_client",void 0);nn.HelixCharityCampaignDonation=ll=Rg.__decorate([(0,Ht.rtfm)("api","HelixCharityCampaignDonation")],ll)});var lh=u(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.HelixCharityApi=void 0;var CE=(b(),x(g)),Ug=Y(),sh=_(),qE=pe(),EE=le(),PE=G(),AE=nh(),DE=ah(),oh=class extends PE.BaseApi{static{n(this,"HelixCharityApi")}async getCharityCampaign(e){let t=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:(0,sh.extractUserId)(e),scopes:["channel:read:charity"],query:(0,Ug.createBroadcasterQuery)(e)});return new AE.HelixCharityCampaign(t.data[0],this._client)}async getCharityCampaignDonations(e,t){let r=await this._client.callApi({type:"helix",url:"charity/donations",userId:(0,sh.extractUserId)(e),scopes:["channel:read:charity"],query:{...(0,Ug.createBroadcasterQuery)(e),...(0,EE.createPaginationQuery)(t)}});return(0,qE.createPaginatedResult)(r,DE.HelixCharityCampaignDonation,this._client)}};an.HelixCharityApi=oh;an.HelixCharityApi=oh=CE.__decorate([(0,sh.rtfm)("api","HelixCharityApi")],oh)});var Og=u(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.createSendChatMessageAsAppBody=Ie.createSendChatMessageBody=Ie.createSendChatMessageQuery=Ie.createShoutoutQuery=Ie.createChatColorUpdateQuery=Ie.createChatSettingsUpdateBody=void 0;var uh=_();function IE(i){return{slow_mode:i.slowModeEnabled,slow_mode_wait_time:i.slowModeDelay,follower_mode:i.followerOnlyModeEnabled,follower_mode_duration:i.followerOnlyModeDelay,subscriber_mode:i.subscriberOnlyModeEnabled,emote_mode:i.emoteOnlyModeEnabled,unique_chat_mode:i.uniqueChatModeEnabled,non_moderator_chat_delay:i.nonModeratorChatDelayEnabled,non_moderator_chat_delay_duration:i.nonModeratorChatDelay}}n(IE,"createChatSettingsUpdateBody");Ie.createChatSettingsUpdateBody=IE;function TE(i,e){return{user_id:(0,uh.extractUserId)(i),color:e}}n(TE,"createChatColorUpdateQuery");Ie.createChatColorUpdateQuery=TE;function RE(i,e,t){return{from_broadcaster_id:(0,uh.extractUserId)(i),to_broadcaster_id:(0,uh.extractUserId)(e),moderator_id:t}}n(RE,"createShoutoutQuery");Ie.createShoutoutQuery=RE;function UE(i,e){return{broadcaster_id:i,sender_id:e}}n(UE,"createSendChatMessageQuery");Ie.createSendChatMessageQuery=UE;function OE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId}}n(OE,"createSendChatMessageBody");Ie.createSendChatMessageBody=OE;function BE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId,for_source_only:e?.forSourceOnly}}n(BE,"createSendChatMessageAsAppBody");Ie.createSendChatMessageAsAppBody=BE});var dh=u(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.HelixEmoteBase=void 0;var tt=_(),ch=class extends tt.DataObject{static{n(this,"HelixEmoteBase")}get id(){return this[tt.rawDataSymbol].id}get name(){return this[tt.rawDataSymbol].name}get formats(){return this[tt.rawDataSymbol].format}get scales(){return this[tt.rawDataSymbol].scale}get themeModes(){return this[tt.rawDataSymbol].theme_mode}getStaticImageUrl(e="1.0",t="light"){return this[tt.rawDataSymbol].format.includes("static")&&this[tt.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"static",t):null}getAnimatedImageUrl(e="1.0",t="light"){return this[tt.rawDataSymbol].format.includes("animated")&&this[tt.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"animated",t):null}getFormattedImageUrl(e="1.0",t="static",r="light"){return`https://static-cdn.jtvnw.net/emoticons/v2/${this[tt.rawDataSymbol].id}/${t}/${r}/${e}`}};ul.HelixEmoteBase=ch});var on=u(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.HelixEmote=void 0;var jE=(b(),x(g)),Bg=_(),kE=dh(),hh=class extends kE.HelixEmoteBase{static{n(this,"HelixEmote")}getImageUrl(e){return this[Bg.rawDataSymbol].images[`url_${e}x`]}};sn.HelixEmote=hh;sn.HelixEmote=hh=jE.__decorate([(0,Bg.rtfm)("api","HelixEmote","id")],hh)});var ph=u(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.HelixChannelEmote=void 0;var jg=(b(),x(g)),ME=C(),ln=_(),LE=on(),cl=class extends LE.HelixEmote{static{n(this,"HelixChannelEmote")}constructor(e,t){super(e),this._client=t}get tier(){return this[ln.rawDataSymbol].tier||null}get type(){return this[ln.rawDataSymbol].emote_type}get emoteSetId(){return this[ln.rawDataSymbol].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[ln.rawDataSymbol].emote_set_id])}};un.HelixChannelEmote=cl;jg.__decorate([(0,ME.Enumerable)(!1)],cl.prototype,"_client",void 0);un.HelixChannelEmote=cl=jg.__decorate([(0,ln.rtfm)("api","HelixChannelEmote","id")],cl)});var mh=u(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.HelixChatBadgeVersion=void 0;var FE=(b(),x(g)),Gt=_(),_h=class extends Gt.DataObject{static{n(this,"HelixChatBadgeVersion")}get id(){return this[Gt.rawDataSymbol].id}getImageUrl(e){return this[Gt.rawDataSymbol][`image_url_${e}x`]}get title(){return this[Gt.rawDataSymbol].title}get description(){return this[Gt.rawDataSymbol].description}get clickAction(){return this[Gt.rawDataSymbol].click_action}get clickUrl(){return this[Gt.rawDataSymbol].click_url}};cn.HelixChatBadgeVersion=_h;cn.HelixChatBadgeVersion=_h=FE.__decorate([(0,Gt.rtfm)("api","HelixChatBadgeVersion","id")],_h)});var yh=u(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.HelixChatBadgeSet=void 0;var kg=(b(),x(g)),Mg=Ci(),dl=_(),NE=mh(),hl=class extends dl.DataObject{static{n(this,"HelixChatBadgeSet")}get id(){return this[dl.rawDataSymbol].set_id}get versions(){return this[dl.rawDataSymbol].versions.map(e=>new NE.HelixChatBadgeVersion(e))}getVersion(e){var t;return(t=this.versions.find(r=>r.id===e))!==null&&t!==void 0?t:null}};dn.HelixChatBadgeSet=hl;kg.__decorate([(0,Mg.CachedGetter)()],hl.prototype,"versions",null);dn.HelixChatBadgeSet=hl=kg.__decorate([Mg.Cacheable,(0,dl.rtfm)("api","HelixChatBadgeSet","id")],hl)});var fh=u(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.HelixChatChatter=void 0;var Lg=(b(),x(g)),QE=C(),hr=_(),pl=class extends hr.DataObject{static{n(this,"HelixChatChatter")}constructor(e,t){super(e),this._client=t}get userId(){return this[hr.rawDataSymbol].user_id}get userName(){return this[hr.rawDataSymbol].user_login}get userDisplayName(){return this[hr.rawDataSymbol].user_name}async getUser(){return(0,hr.checkRelationAssertion)(await this._client.users.getUserById(this[hr.rawDataSymbol].user_id))}};hn.HelixChatChatter=pl;Lg.__decorate([(0,QE.Enumerable)(!1)],pl.prototype,"_client",void 0);hn.HelixChatChatter=pl=Lg.__decorate([(0,hr.rtfm)("api","HelixChatChatter")],pl)});var _l=u(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.HelixChatSettings=void 0;var GE=(b(),x(g)),pt=_(),gh=class extends pt.DataObject{static{n(this,"HelixChatSettings")}get broadcasterId(){return this[pt.rawDataSymbol].broadcaster_id}get slowModeEnabled(){return this[pt.rawDataSymbol].slow_mode}get slowModeDelay(){return this[pt.rawDataSymbol].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[pt.rawDataSymbol].follower_mode}get followerOnlyModeDelay(){return this[pt.rawDataSymbol].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[pt.rawDataSymbol].subscriber_mode}get emoteOnlyModeEnabled(){return this[pt.rawDataSymbol].emote_mode}get uniqueChatModeEnabled(){return this[pt.rawDataSymbol].unique_chat_mode}};pn.HelixChatSettings=gh;pn.HelixChatSettings=gh=GE.__decorate([(0,pt.rtfm)("api","HelixChatSettings","broadcasterId")],gh)});var bh=u(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.HelixEmoteFromSet=void 0;var Fg=(b(),x(g)),WE=C(),pr=_(),VE=on(),ml=class extends VE.HelixEmote{static{n(this,"HelixEmoteFromSet")}constructor(e,t){super(e),this._client=t}get type(){return this[pr.rawDataSymbol].emote_type}get emoteSetId(){return this[pr.rawDataSymbol].emote_set_id}get ownerId(){switch(this[pr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return this[pr.rawDataSymbol].owner_id}}async getOwner(){switch(this[pr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[pr.rawDataSymbol].owner_id)}}};_n.HelixEmoteFromSet=ml;Fg.__decorate([(0,WE.Enumerable)(!1)],ml.prototype,"_client",void 0);_n.HelixEmoteFromSet=ml=Fg.__decorate([(0,pr.rtfm)("api","HelixEmoteFromSet","id")],ml)});var xh=u(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.HelixUserEmote=void 0;var Ng=(b(),x(g)),Wt=_(),$E=dh(),zE=C(),yl=class extends $E.HelixEmoteBase{static{n(this,"HelixUserEmote")}constructor(e,t){super(e),this._client=t}get type(){return this[Wt.rawDataSymbol].emote_type}get emoteSetId(){return this[Wt.rawDataSymbol].emote_set_id||null}get ownerId(){return this[Wt.rawDataSymbol].owner_id||null}async getAllEmotesFromSet(){return this[Wt.rawDataSymbol].emote_set_id?await this._client.chat.getEmotesFromSets([this[Wt.rawDataSymbol].emote_set_id]):null}async getOwner(){return this[Wt.rawDataSymbol].owner_id?await this._client.users.getUserById(this[Wt.rawDataSymbol].owner_id):null}};mn.HelixUserEmote=yl;Ng.__decorate([(0,zE.Enumerable)(!1)],yl.prototype,"_client",void 0);mn.HelixUserEmote=yl=Ng.__decorate([(0,Wt.rtfm)("api","HelixUserEmote","id")],yl)});var Sh=u(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.HelixPrivilegedChatSettings=void 0;var KE=(b(),x(g)),wh=_(),JE=_l(),vh=class extends JE.HelixChatSettings{static{n(this,"HelixPrivilegedChatSettings")}get nonModeratorChatDelayEnabled(){return this[wh.rawDataSymbol].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[wh.rawDataSymbol].non_moderator_chat_delay_duration}};yn.HelixPrivilegedChatSettings=vh;yn.HelixPrivilegedChatSettings=vh=KE.__decorate([(0,wh.rtfm)("api","HelixPrivilegedChatSettings","broadcasterId")],vh)});var Ch=u(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.HelixSentChatMessage=void 0;var ZE=(b(),x(g)),Vr=_(),Hh=class extends Vr.DataObject{static{n(this,"HelixSentChatMessage")}get id(){return this[Vr.rawDataSymbol].message_id}get isSent(){return this[Vr.rawDataSymbol].is_sent}get dropReasonCode(){var e;return(e=this[Vr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.code}get dropReasonMessage(){var e;return(e=this[Vr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.message}};fn.HelixSentChatMessage=Hh;fn.HelixSentChatMessage=Hh=ZE.__decorate([(0,Vr.rtfm)("api","HelixSentChatMessage","id")],Hh)});var Qg=u(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.createSharedChatSessionQuery=void 0;var XE=_();function YE(i){return{broadcaster_id:(0,XE.extractUserId)(i)}}n(YE,"createSharedChatSessionQuery");fl.createSharedChatSessionQuery=YE});var qh=u(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.HelixSharedChatSessionParticipant=void 0;var Gg=(b(),x(g)),eP=C(),gn=_(),gl=class extends gn.DataObject{static{n(this,"HelixSharedChatSessionParticipant")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[gn.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,gn.checkRelationAssertion)(await this._client.users.getUserById(this[gn.rawDataSymbol].broadcaster_id))}};bn.HelixSharedChatSessionParticipant=gl;Gg.__decorate([(0,eP.Enumerable)(!1)],gl.prototype,"_client",void 0);bn.HelixSharedChatSessionParticipant=gl=Gg.__decorate([(0,gn.rtfm)("api","HelixSharedChatSessionParticipant","broadcasterId")],gl)});var Eh=u(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.HelixSharedChatSession=void 0;var Wg=(b(),x(g)),tP=C(),Ct=_(),rP=qh(),bl=class extends Ct.DataObject{static{n(this,"HelixSharedChatSession")}constructor(e,t){super(e),this._client=t}get sessionId(){return this[Ct.rawDataSymbol].session_id}get hostBroadcasterId(){return this[Ct.rawDataSymbol].host_broadcaster_id}async getHostBroadcaster(){return(0,Ct.checkRelationAssertion)(await this._client.users.getUserById(this[Ct.rawDataSymbol].host_broadcaster_id))}get participants(){return this[Ct.rawDataSymbol].participants.map(e=>new rP.HelixSharedChatSessionParticipant(e,this._client))}get createdDate(){return new Date(this[Ct.rawDataSymbol].created_at)}get updatedDate(){return new Date(this[Ct.rawDataSymbol].updated_at)}};xn.HelixSharedChatSession=bl;Wg.__decorate([(0,tP.Enumerable)(!1)],bl.prototype,"_client",void 0);xn.HelixSharedChatSession=bl=Wg.__decorate([(0,Ct.rtfm)("api","HelixSharedChatSession","sessionId")],bl)});var Dh=u(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.HelixChatApi=void 0;var iP=(b(),x(g)),Ph=Y(),Z=_(),_r=Og(),Vt=je(),nP=oe(),aP=Gr(),Vg=pe(),$g=le(),sP=G(),oP=ph(),zg=yh(),Kg=fh(),lP=_l(),uP=on(),cP=bh(),Jg=xh(),Zg=Sh(),Xg=Ch(),dP=Qg(),hP=Eh(),Ah=class extends sP.BaseApi{static{n(this,"HelixChatApi")}async getChatters(e,t){let r=(0,Z.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/chatters",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:{...this._createModeratorActionQuery(r),...(0,$g.createPaginationQuery)(t)}});return(0,Vg.createPaginatedResultWithTotal)(a,Kg.HelixChatChatter,this._client)}getChattersPaginated(e){let t=(0,Z.extractUserId)(e);return new aP.HelixPaginatedRequestWithTotal({url:"chat/chatters",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(t)},this._client,r=>new Kg.HelixChatChatter(r,this._client),1e3)}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(t=>new zg.HelixChatBadgeSet(t))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:(0,Z.extractUserId)(e),query:(0,Ph.createBroadcasterQuery)(e)})).data.map(r=>new zg.HelixChatBadgeSet(r))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(t=>new uP.HelixEmote(t))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:(0,Z.extractUserId)(e),query:(0,Ph.createBroadcasterQuery)(e)})).data.map(r=>new oP.HelixChannelEmote(r,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:(0,Vt.createSingleKeyQuery)("emote_set_id",e)})).data.map(r=>new cP.HelixEmoteFromSet(r,this._client))}async getUserEmotes(e,t){let r=(0,Z.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/emotes/user",userId:(0,Z.extractUserId)(e),scopes:["user:read:emotes"],query:{...(0,Vt.createSingleKeyQuery)("user_id",r),...(0,Vt.createSingleKeyQuery)("broadcasterId",t?.broadcaster?(0,Z.extractUserId)(t.broadcaster):void 0),...(0,$g.createPaginationQuery)(t)}});return(0,Vg.createPaginatedResult)(a,Jg.HelixUserEmote,this._client)}getUserEmotesPaginated(e,t){let r=(0,Z.extractUserId)(e);return new nP.HelixPaginatedRequest({url:"chat/emotes/user",userId:r,scopes:["user:read:emotes"],query:{...(0,Vt.createSingleKeyQuery)("user_id",r),...(0,Vt.createSingleKeyQuery)("broadcasterId",t?(0,Z.extractUserId)(t):void 0)}},this._client,a=>new Jg.HelixUserEmote(a,this._client))}async getSettings(e){let t=await this._client.callApi({type:"helix",url:"chat/settings",userId:(0,Z.extractUserId)(e),query:(0,Ph.createBroadcasterQuery)(e)});return new lP.HelixChatSettings(t.data[0])}async getSettingsPrivileged(e){let t=(0,Z.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"chat/settings",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chat_settings"],query:this._createModeratorActionQuery(t)});return new Zg.HelixPrivilegedChatSettings(r.data[0])}async updateSettings(e,t){let r=(0,Z.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/settings",method:"PATCH",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:chat_settings"],query:this._createModeratorActionQuery(r),jsonBody:(0,_r.createChatSettingsUpdateBody)(t)});return new Zg.HelixPrivilegedChatSettings(a.data[0])}async sendChatMessage(e,t,r){let a=(0,Z.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",userId:a,canOverrideScopedUserContext:!0,scopes:["user:write:chat"],query:(0,_r.createSendChatMessageQuery)(a,this._getUserContextIdWithDefault(a)),jsonBody:(0,_r.createSendChatMessageBody)(t,r)});return new Xg.HelixSentChatMessage(s.data[0])}async sendChatMessageAsApp(e,t,r,a){let s=(0,Z.extractUserId)(e),o=(0,Z.extractUserId)(t),l=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",forceType:"app",query:(0,_r.createSendChatMessageQuery)(o,s),jsonBody:(0,_r.createSendChatMessageAsAppBody)(r,a)});return new Xg.HelixSentChatMessage(l.data[0])}async sendAnnouncement(e,t){let r=(0,Z.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/announcements",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:announcements"],query:this._createModeratorActionQuery(r),jsonBody:{message:t.message,color:t.color}})}async getColorsForUsers(e){let t=await this._client.callApi({type:"helix",url:"chat/color",query:(0,Vt.createSingleKeyQuery)("user_id",e.map(Z.extractUserId))});return new Map(t.data.map(r=>[r.user_id,r.color||null]))}async getColorForUser(e){let t=await this._client.callApi({type:"helix",url:"chat/color",userId:(0,Z.extractUserId)(e),query:(0,Vt.createSingleKeyQuery)("user_id",(0,Z.extractUserId)(e))});if(t.data.length)return t.data[0].color||null}async setColorForUser(e,t){await this._client.callApi({type:"helix",url:"chat/color",method:"PUT",userId:(0,Z.extractUserId)(e),scopes:["user:manage:chat_color"],query:(0,_r.createChatColorUpdateQuery)(e,t)})}async shoutoutUser(e,t){let r=(0,Z.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:(0,_r.createShoutoutQuery)(e,t,this._getUserContextIdWithDefault(r))})}async getSharedChatSession(e){let t=(0,Z.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"shared_chat/session",userId:t,query:(0,dP.createSharedChatSessionQuery)(t)});return r.data.length===0?null:new hP.HelixSharedChatSession(r.data[0],this._client)}_createModeratorActionQuery(e){return(0,Vt.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};wn.HelixChatApi=Ah;wn.HelixChatApi=Ah=iP.__decorate([(0,Z.rtfm)("api","HelixChatApi")],Ah)});var Yg=u($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.createClipQuery=$r.createClipCreateQuery=void 0;var pP=_();function _P(i,e){return{broadcaster_id:(0,pP.extractUserId)(i),has_delay:e.toString()}}n(_P,"createClipCreateQuery");$r.createClipCreateQuery=_P;function mP(i){let{filterType:e,ids:t,startDate:r,endDate:a,isFeatured:s}=i;return{[e]:t,started_at:r,ended_at:a,is_featured:s?.toString()}}n(mP,"createClipQuery");$r.createClipQuery=mP});var Ih=u(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.HelixClip=void 0;var eb=(b(),x(g)),yP=C(),L=_(),xl=class extends L.DataObject{static{n(this,"HelixClip")}constructor(e,t){super(e),this._client=t}get id(){return this[L.rawDataSymbol].id}get url(){return this[L.rawDataSymbol].url}get embedUrl(){return this[L.rawDataSymbol].embed_url}get broadcasterId(){return this[L.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[L.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,L.checkRelationAssertion)(await this._client.users.getUserById(this[L.rawDataSymbol].broadcaster_id))}get creatorId(){return this[L.rawDataSymbol].creator_id}get creatorDisplayName(){return this[L.rawDataSymbol].creator_name}async getCreator(){return(0,L.checkRelationAssertion)(await this._client.users.getUserById(this[L.rawDataSymbol].creator_id))}get videoId(){return this[L.rawDataSymbol].video_id}async getVideo(){return(0,L.checkRelationAssertion)(await this._client.videos.getVideoById(this[L.rawDataSymbol].video_id))}get gameId(){return this[L.rawDataSymbol].game_id}async getGame(){return this[L.rawDataSymbol].game_id?(0,L.checkRelationAssertion)(await this._client.games.getGameById(this[L.rawDataSymbol].game_id)):null}get language(){return this[L.rawDataSymbol].language}get title(){return this[L.rawDataSymbol].title}get views(){return this[L.rawDataSymbol].view_count}get creationDate(){return new Date(this[L.rawDataSymbol].created_at)}get thumbnailUrl(){return this[L.rawDataSymbol].thumbnail_url}get duration(){return this[L.rawDataSymbol].duration}get vodOffset(){return this[L.rawDataSymbol].vod_offset}get isFeatured(){return this[L.rawDataSymbol].is_featured}};vn.HelixClip=xl;eb.__decorate([(0,yP.Enumerable)(!1)],xl.prototype,"_client",void 0);vn.HelixClip=xl=eb.__decorate([(0,L.rtfm)("api","HelixClip","id")],xl)});var Uh=u(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.HelixClipApi=void 0;var tb=(b(),x(g)),fP=C(),zr=_(),Th=Yg(),gP=Ft(),bP=oe(),xP=pe(),wP=le(),vP=G(),Rh=Ih(),wl=class extends vP.BaseApi{static{n(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new gP.HelixRequestBatcher({url:"clips"},"id","id",this._client,e=>new Rh.HelixClip(e,this._client))}async getClipsForBroadcaster(e,t={}){return await this._getClips({...t,filterType:"broadcaster_id",ids:(0,zr.extractUserId)(e),userId:(0,zr.extractUserId)(e)})}getClipsForBroadcasterPaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"broadcaster_id",ids:(0,zr.extractUserId)(e),userId:(0,zr.extractUserId)(e)})}async getClipsForGame(e,t={}){return await this._getClips({...t,filterType:"game_id",ids:e})}getClipsForGamePaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"game_id",ids:e})}async getClipsByIds(e){return(await this._getClips({filterType:"id",ids:e})).data}async getClipById(e){let t=await this.getClipsByIds([e]);return t.length?t[0]:null}async getClipByIdBatched(e){return await this._getClipByIdBatcher.request(e)}async createClip(e){let{channel:t,createAfterDelay:r=!1}=e;return(await this._client.callApi({type:"helix",url:"clips",method:"POST",userId:(0,zr.extractUserId)(t),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:(0,Th.createClipCreateQuery)(t,r)})).data[0].id}async _getClips(e){if(!e.ids.length)return{data:[]};let t=await this._client.callApi({type:"helix",url:"clips",userId:e.userId,query:{...(0,Th.createClipQuery)(e),...(0,wP.createPaginationQuery)(e)}});return(0,xP.createPaginatedResult)(t,Rh.HelixClip,this._client)}_getClipsPaginated(e){return new bP.HelixPaginatedRequest({url:"clips",userId:e.userId,query:(0,Th.createClipQuery)(e)},this._client,t=>new Rh.HelixClip(t,this._client))}};Sn.HelixClipApi=wl;tb.__decorate([(0,fP.Enumerable)(!1)],wl.prototype,"_getClipByIdBatcher",void 0);Sn.HelixClipApi=wl=tb.__decorate([(0,zr.rtfm)("api","HelixClipApi")],wl)});var Bh=u(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.HelixContentClassificationLabel=void 0;var vl=_(),Oh=class extends vl.DataObject{static{n(this,"HelixContentClassificationLabel")}get id(){return this[vl.rawDataSymbol].id}get name(){return this[vl.rawDataSymbol].name}get description(){return this[vl.rawDataSymbol].description}};Sl.HelixContentClassificationLabel=Oh});var kh=u(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.HelixContentClassificationLabelApi=void 0;var SP=(b(),x(g)),HP=_(),CP=G(),qP=Bh(),jh=class extends CP.BaseApi{static{n(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(r=>new qP.HelixContentClassificationLabel(r))}};Hn.HelixContentClassificationLabelApi=jh;Hn.HelixContentClassificationLabelApi=jh=SP.__decorate([(0,HP.rtfm)("api","HelixContentClassificationLabelApi")],jh)});var rb=u(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.createDropsEntitlementUpdateBody=Kr.createDropsEntitlementQuery=void 0;var EP=C(),PP=_();function AP(i,e){return{user_id:e?(0,EP.mapOptional)(i.user,PP.extractUserId):void 0,game_id:i.gameId,fulfillment_status:i.fulfillmentStatus}}n(AP,"createDropsEntitlementQuery");Kr.createDropsEntitlementQuery=AP;function DP(i,e){return{fulfillment_status:e,entitlement_ids:i}}n(DP,"createDropsEntitlementUpdateBody");Kr.createDropsEntitlementUpdateBody=DP});var Mh=u(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.HelixDropsEntitlement=void 0;var ib=(b(),x(g)),IP=C(),ke=_(),Hl=class extends ke.DataObject{static{n(this,"HelixDropsEntitlement")}constructor(e,t){super(e),this._client=t}get id(){return this[ke.rawDataSymbol].id}get rewardId(){return this[ke.rawDataSymbol].benefit_id}get grantDate(){return new Date(this[ke.rawDataSymbol].timestamp)}get userId(){return this[ke.rawDataSymbol].user_id}async getUser(){return(0,ke.checkRelationAssertion)(await this._client.users.getUserById(this[ke.rawDataSymbol].user_id))}get gameId(){return this[ke.rawDataSymbol].game_id}async getGame(){return(0,ke.checkRelationAssertion)(await this._client.games.getGameById(this[ke.rawDataSymbol].game_id))}get fulfillmentStatus(){return this[ke.rawDataSymbol].fulfillment_status}get updateDate(){return new Date(this[ke.rawDataSymbol].last_updated)}};Cn.HelixDropsEntitlement=Hl;ib.__decorate([(0,IP.Enumerable)(!1)],Hl.prototype,"_client",void 0);Cn.HelixDropsEntitlement=Hl=ib.__decorate([(0,ke.rtfm)("api","HelixDropsEntitlement")],Hl)});var Qh=u(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.HelixEntitlementApi=void 0;var nb=(b(),x(g)),Fh=C(),Nh=_(),Lh=rb(),TP=Ft(),RP=oe(),UP=pe(),OP=le(),BP=G(),Cl=Mh(),ql=class extends BP.BaseApi{static{n(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new TP.HelixRequestBatcher({url:"entitlements/drops"},"id","id",this._client,e=>new Cl.HelixDropsEntitlement(e,this._client))}async getDropsEntitlements(e,t=!1){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:(0,Fh.mapOptional)(e.user,Nh.extractUserId),forceType:e.user&&t?"app":void 0,query:{...(0,Lh.createDropsEntitlementQuery)(e,t),...(0,OP.createPaginationQuery)(e)}});return(0,UP.createPaginatedResult)(r,Cl.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new RP.HelixPaginatedRequest({url:"entitlements/drops",userId:(0,Fh.mapOptional)(e.user,Nh.extractUserId),forceType:e.user&&t?"app":void 0,query:(0,Lh.createDropsEntitlementQuery)(e,t)},this._client,r=>new Cl.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(r=>new Cl.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementById(e){var t;return(t=(await this.getDropsEntitlementsByIds([e]))[0])!==null&&t!==void 0?t:null}async getDropsEntitlementByIdBatched(e){return await this._getDropsEntitlementByIdBatcher.request(e)}async updateDropsEntitlements(e,t){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",method:"PATCH",jsonBody:(0,Lh.createDropsEntitlementUpdateBody)(e,t)});return new Map(r.data.flatMap(a=>a.ids.map(s=>[s,a.status])))}};qn.HelixEntitlementApi=ql;nb.__decorate([(0,Fh.Enumerable)(!1)],ql.prototype,"_getDropsEntitlementByIdBatcher",void 0);qn.HelixEntitlementApi=ql=nb.__decorate([(0,Nh.rtfm)("api","HelixEntitlementApi")],ql)});var sb=u(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.createEventSubConduitShardsUpdateCondition=ye.createEventSubConduitUpdateCondition=ye.createEventSubConduitCondition=ye.createEventSubDropEntitlementGrantCondition=ye.createEventSubUserCondition=ye.createEventSubModeratorCondition=ye.createEventSubRewardCondition=ye.createEventSubBroadcasterCondition=void 0;var ab=_();function jP(i){return{broadcaster_user_id:(0,ab.extractUserId)(i)}}n(jP,"createEventSubBroadcasterCondition");ye.createEventSubBroadcasterCondition=jP;function kP(i,e){return{broadcaster_user_id:(0,ab.extractUserId)(i),reward_id:e}}n(kP,"createEventSubRewardCondition");ye.createEventSubRewardCondition=kP;function MP(i,e){return{broadcaster_user_id:i,moderator_user_id:e}}n(MP,"createEventSubModeratorCondition");ye.createEventSubModeratorCondition=MP;function LP(i,e){return{broadcaster_user_id:i,user_id:e}}n(LP,"createEventSubUserCondition");ye.createEventSubUserCondition=LP;function FP(i){return{organization_id:i.organizationId,category_id:i.categoryId,campaign_id:i.campaignId}}n(FP,"createEventSubDropEntitlementGrantCondition");ye.createEventSubDropEntitlementGrantCondition=FP;function NP(i,e){return{conduit_id:i,status:e}}n(NP,"createEventSubConduitCondition");ye.createEventSubConduitCondition=NP;function QP(i,e){return{id:i,shard_count:e.toString()}}n(QP,"createEventSubConduitUpdateCondition");ye.createEventSubConduitUpdateCondition=QP;function GP(i,e){return{conduit_id:i,shards:e}}n(GP,"createEventSubConduitShardsUpdateCondition");ye.createEventSubConduitShardsUpdateCondition=GP});var Pl=u(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.HelixEventSubSubscription=void 0;var ob=(b(),x(g)),WP=C(),Ke=_(),El=class extends Ke.DataObject{static{n(this,"HelixEventSubSubscription")}constructor(e,t){super(e),this._client=t}get id(){return this[Ke.rawDataSymbol].id}get status(){return this[Ke.rawDataSymbol].status}get type(){return this[Ke.rawDataSymbol].type}get cost(){return this[Ke.rawDataSymbol].cost}get condition(){return this[Ke.rawDataSymbol].condition}get creationDate(){return new Date(this[Ke.rawDataSymbol].created_at)}get transportMethod(){return this[Ke.rawDataSymbol].transport.method}async unsubscribe(){await this._client.eventSub.deleteSubscription(this[Ke.rawDataSymbol].id)}get _transport(){return this[Ke.rawDataSymbol].transport}set _status(e){this[Ke.rawDataSymbol].status=e}};En.HelixEventSubSubscription=El;ob.__decorate([(0,WP.Enumerable)(!1)],El.prototype,"_client",void 0);En.HelixEventSubSubscription=El=ob.__decorate([(0,Ke.rtfm)("api","HelixEventSubSubscription","id")],El)});var Wh=u(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.HelixPaginatedEventSubSubscriptionsRequest=void 0;var VP=(b(),x(g)),$P=_(),zP=Gr(),KP=Pl(),Gh=class extends zP.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,r){super({url:"eventsub/subscriptions",userId:t,query:e},r,a=>new KP.HelixEventSubSubscription(a,r))}async getTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total_cost}async getMaxTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).max_total_cost}};Pn.HelixPaginatedEventSubSubscriptionsRequest=Gh;Pn.HelixPaginatedEventSubSubscriptionsRequest=Gh=VP.__decorate([(0,$P.rtfm)("api","HelixPaginatedEventSubSubscriptionsRequest")],Gh)});var Vh=u(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.HelixEventSubConduit=void 0;var lb=(b(),x(g)),JP=C(),mr=_(),Al=class extends mr.DataObject{static{n(this,"HelixEventSubConduit")}constructor(e,t){super(e),this._client=t}get id(){return this[mr.rawDataSymbol].id}get shardCount(){return this[mr.rawDataSymbol].shard_count}async update(e){return await this._client.eventSub.updateConduit(this[mr.rawDataSymbol].id,e)}async delete(){await this._client.eventSub.deleteConduit(this[mr.rawDataSymbol].id)}async getShards(){return await this._client.eventSub.getConduitShards(this[mr.rawDataSymbol].id)}};An.HelixEventSubConduit=Al;lb.__decorate([(0,JP.Enumerable)(!1)],Al.prototype,"_client",void 0);An.HelixEventSubConduit=Al=lb.__decorate([(0,mr.rtfm)("api","HelixEventSubConduit")],Al)});var zh=u(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.HelixEventSubConduitShard=void 0;var ZP=(b(),x(g)),Dn=_(),$h=class extends Dn.DataObject{static{n(this,"HelixEventSubConduitShard")}get id(){return this[Dn.rawDataSymbol].id}get status(){return this[Dn.rawDataSymbol].status}get transportMethod(){return this[Dn.rawDataSymbol].transport.method}};In.HelixEventSubConduitShard=$h;In.HelixEventSubConduitShard=$h=ZP.__decorate([(0,Dn.rtfm)("api","HelixEventSubConduitShard")],$h)});var Xh=u(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.HelixEventSubApi=void 0;var XP=(b(),x(g)),YP=C(),R=_(),S=sb(),rt=je(),eA=oe(),Tn=pe(),Rn=le(),tA=G(),Un=Pl(),Dl=Wh(),Kh=Vh(),Jh=zh(),Zh=class extends tA.BaseApi{static{n(this,"HelixEventSubApi")}async getSubscriptions(e){let t=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:(0,Rn.createPaginationQuery)(e)});return{...(0,Tn.createPaginatedResultWithTotal)(t,Un.HelixEventSubSubscription,this._client),totalCost:t.total_cost,maxTotalCost:t.max_total_cost}}getSubscriptionsPaginated(){return new Dl.HelixPaginatedEventSubSubscriptionsRequest({},void 0,this._client)}async getSubscriptionsForStatus(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Rn.createPaginationQuery)(t),status:e}});return{...(0,Tn.createPaginatedResultWithTotal)(r,Un.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new Dl.HelixPaginatedEventSubSubscriptionsRequest({status:e},void 0,this._client)}async getSubscriptionsForType(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Rn.createPaginationQuery)(t),type:e}});return{...(0,Tn.createPaginatedResultWithTotal)(r,Un.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForTypePaginated(e){return new Dl.HelixPaginatedEventSubSubscriptionsRequest({type:e},void 0,this._client)}async getSubscriptionsForUser(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:(0,R.extractUserId)(e),query:{...(0,rt.createSingleKeyQuery)("user_id",(0,R.extractUserId)(e)),...(0,Rn.createPaginationQuery)(t)}});return{...(0,Tn.createPaginatedResultWithTotal)(r,Un.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForUserPaginated(e){let t=(0,R.extractUserId)(e);return new Dl.HelixPaginatedEventSubSubscriptionsRequest((0,rt.createSingleKeyQuery)("user_id",t),t,this._client)}async createSubscription(e,t,r,a,s,o,l,d){let p=a.method==="webhook"||a.method==="conduit",h=p?void 0:o;if(!p&&!s)throw new Error(`Transport ${a.method} can only handle subscriptions with user context`);let w={type:e,version:t,condition:r,transport:a};d&&(w.is_batching_enabled=!0);let E=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:h,userId:(0,YP.mapOptional)(s,R.extractUserId),canOverrideScopedUserContext:l,forceType:p?"app":"user",jsonBody:w});return new Un.HelixEventSubSubscription(E.data[0],this._client)}async deleteSubscription(e){await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"DELETE",query:{id:e}})}async deleteAllSubscriptions(){await this._deleteSubscriptionsWithCondition()}async deleteBrokenSubscriptions(){await this._deleteSubscriptionsWithCondition(e=>e.status!=="enabled"&&e.status!=="webhook_callback_verification_pending")}async subscribeToStreamOnlineEvents(e,t){return await this.createSubscription("stream.online","1",(0,S.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToStreamOfflineEvents(e,t){return await this.createSubscription("stream.offline","1",(0,S.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelUpdateEvents(e,t){return await this.createSubscription("channel.update","2",(0,S.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelFollowEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.follow","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:followers"],!0)}async subscribeToChannelSubscriptionEvents(e,t){return await this.createSubscription("channel.subscribe","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionGiftEvents(e,t){return await this.createSubscription("channel.subscription.gift","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionMessageEvents(e,t){return await this.createSubscription("channel.subscription.message","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionEndEvents(e,t){return await this.createSubscription("channel.subscription.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelCheerEvents(e,t){return await this.createSubscription("channel.cheer","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["bits:read"])}async subscribeToChannelCharityCampaignStartEvents(e,t){return await this.createSubscription("channel.charity_campaign.start","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignStopEvents(e,t){return await this.createSubscription("channel.charity_campaign.stop","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityDonationEvents(e,t){return await this.createSubscription("channel.charity_campaign.donate","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignProgressEvents(e,t){return await this.createSubscription("channel.charity_campaign.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelBanEvents(e,t){return await this.createSubscription("channel.ban","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelUnbanEvents(e,t){return await this.createSubscription("channel.unban","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelShieldModeBeginEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shield_mode.begin","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shield_mode.end","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelModeratorAddEvents(e,t){return await this.createSubscription("channel.moderator.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelModeratorRemoveEvents(e,t){return await this.createSubscription("channel.moderator.remove","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelRaidEventsFrom(e,t){return await this.createSubscription("channel.raid","1",(0,rt.createSingleKeyQuery)("from_broadcaster_user_id",(0,R.extractUserId)(e)),t,e)}async subscribeToChannelRaidEventsTo(e,t){return await this.createSubscription("channel.raid","1",(0,rt.createSingleKeyQuery)("to_broadcaster_user_id",(0,R.extractUserId)(e)),t,e)}async subscribeToChannelRewardAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,S.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,S.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,S.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,S.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelAutomaticRewardRedemptionAddEvents(e,t){return await this.createSubscription("channel.channel_points_automatic_reward_redemption.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelAutomaticRewardRedemptionAddV2Events(e,t){return await this.createSubscription("channel.channel_points_automatic_reward_redemption.add","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelPollBeginEvents(e,t){return await this.createSubscription("channel.poll.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollProgressEvents(e,t){return await this.createSubscription("channel.poll.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollEndEvents(e,t){return await this.createSubscription("channel.poll.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPredictionBeginEvents(e,t){return await this.createSubscription("channel.prediction.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionProgressEvents(e,t){return await this.createSubscription("channel.prediction.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionLockEvents(e,t){return await this.createSubscription("channel.prediction.lock","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionEndEvents(e,t){return await this.createSubscription("channel.prediction.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelGoalBeginEvents(e,t){return await this.createSubscription("channel.goal.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalProgressEvents(e,t){return await this.createSubscription("channel.goal.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalEndEvents(e,t){return await this.createSubscription("channel.goal.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelHypeTrainBeginEvents(e,t){return await this.createSubscription("channel.hype_train.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressEvents(e,t){return await this.createSubscription("channel.hype_train.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndEvents(e,t){return await this.createSubscription("channel.hype_train.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainBeginV2Events(e,t){return await this.createSubscription("channel.hype_train.begin","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressV2Events(e,t){return await this.createSubscription("channel.hype_train.progress","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndV2Events(e,t){return await this.createSubscription("channel.hype_train.end","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelShoutoutCreateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shoutout.create","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shoutout.receive","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelAdBreakBeginEvents(e,t){return await this.createSubscription("channel.ad_break.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:ads"])}async subscribeToChannelChatClearEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.clear","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatClearUserMessagesEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.clear_user_messages","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageDeleteEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.message_delete","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatNotificationEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.notification","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.message","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatSettingsUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat_settings.update","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelUnbanRequestCreateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.unban_request.create","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelUnbanRequestResolveEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.unban_request.resolve","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelModerateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.moderate","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,[],!0)}async subscribeToChannelWarningAcknowledgeEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.warning.acknowledge","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelWarningSendEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.warning.send","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelVipAddEvents(e,t){return await this.createSubscription("channel.vip.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToChannelVipRemoveEvents(e,t){return await this.createSubscription("channel.vip.remove","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToExtensionBitsTransactionCreateEvents(e,t){return await this.createSubscription("extension.bits_transaction.create","1",(0,rt.createSingleKeyQuery)("extension_client_id",e),t)}async subscribeToUserAuthorizationGrantEvents(e,t){return await this.createSubscription("user.authorization.grant","1",(0,rt.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserAuthorizationRevokeEvents(e,t){return await this.createSubscription("user.authorization.revoke","1",(0,rt.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserUpdateEvents(e,t,r){return await this.createSubscription("user.update","1",(0,rt.createSingleKeyQuery)("user_id",(0,R.extractUserId)(e)),t,e,r?["user:read:email"]:void 0)}async subscribeToUserWhisperMessageEvents(e,t){return await this.createSubscription("user.whisper.message","1",(0,rt.createSingleKeyQuery)("user_id",(0,R.extractUserId)(e)),t,e,["user:read:whispers","user:manage:whispers"])}async subscribeToDropEntitlementGrantEvents(e,t){return await this.createSubscription("drop.entitlement.grant","1",(0,S.createEventSubDropEntitlementGrantCondition)(e),t,void 0,void 0,!1,!0)}async subscribeToAutoModMessageHoldEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.message.hold","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.message.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageHoldV2Events(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.message.hold","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateV2Events(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.message.update","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModSettingsUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.settings.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:automod_settings"],!0)}async subscribeToAutoModTermsUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.terms.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToChannelChatUserMessageHoldEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_hold","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatUserMessageUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_update","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelSuspiciousUserUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSuspiciousUserMessageEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.message","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSharedChatSessionBeginEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shared_chat.begin","1",(0,S.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shared_chat.update","1",(0,S.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionEndEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shared_chat.end","1",(0,S.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelBitsUseEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.bits.use","1",(0,S.createEventSubBroadcasterCondition)(r),t,r,["bits:read"])}async getConduits(){return(await this._client.callApi({type:"helix",url:"eventsub/conduits"})).data.map(t=>new Kh.HelixEventSubConduit(t,this._client))}async createConduit(e){let t=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"POST",query:{...(0,rt.createSingleKeyQuery)("shard_count",e.toString())}});return new Kh.HelixEventSubConduit(t.data[0],this._client)}async updateConduit(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"PATCH",query:(0,S.createEventSubConduitUpdateCondition)(e,t)});return new Kh.HelixEventSubConduit(r.data[0],this._client)}async deleteConduit(e){await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"DELETE",query:{...(0,rt.createSingleKeyQuery)("id",e)}})}async getConduitShards(e,t,r){let a=await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",query:{...(0,S.createEventSubConduitCondition)(e,t),...(0,Rn.createPaginationQuery)(r)}});return{...(0,Tn.createPaginatedResult)(a,Jh.HelixEventSubConduitShard,this._client)}}getConduitShardsPaginated(e,t){return new eA.HelixPaginatedRequest({url:"eventsub/conduits/shards",query:(0,S.createEventSubConduitCondition)(e,t)},this._client,r=>new Jh.HelixEventSubConduitShard(r))}async updateConduitShards(e,t){return(await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",method:"PATCH",jsonBody:(0,S.createEventSubConduitShardsUpdateCondition)(e,t)})).data.map(a=>new Jh.HelixEventSubConduitShard(a))}async _deleteSubscriptionsWithCondition(e){let t=this.getSubscriptionsPaginated();for await(let r of t)(!e||e(r))&&await r.unsubscribe()}};On.HelixEventSubApi=Zh;On.HelixEventSubApi=Zh=XP.__decorate([(0,R.rtfm)("api","HelixEventSubApi")],Zh)});var ub=u($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.createExtensionTransactionQuery=$t.createExtensionProductBody=$t.createReleasedExtensionFilter=void 0;function rA(i,e){return{extension_id:i,extension_version:e}}n(rA,"createReleasedExtensionFilter");$t.createReleasedExtensionFilter=rA;function iA(i){return{sku:i.sku,cost:{amount:i.cost,type:"bits"},display_name:i.displayName,in_development:i.inDevelopment,expiration:i.expirationDate,is_broadcast:i.broadcast}}n(iA,"createExtensionProductBody");$t.createExtensionProductBody=iA;function nA(i,e){return{extension_id:i,id:e.transactionIds}}n(nA,"createExtensionTransactionQuery");$t.createExtensionTransactionQuery=nA});var Yh=u(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.HelixChannelReference=void 0;var cb=(b(),x(g)),aA=C(),Te=_(),Il=class extends Te.DataObject{static{n(this,"HelixChannelReference")}constructor(e,t){super(e),this._client=t}get id(){return this[Te.rawDataSymbol].broadcaster_id}get displayName(){return this[Te.rawDataSymbol].broadcaster_name}async getChannel(){return(0,Te.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[Te.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,Te.checkRelationAssertion)(await this._client.users.getUserById(this[Te.rawDataSymbol].broadcaster_id))}get gameId(){return this[Te.rawDataSymbol].game_id}get gameName(){return this[Te.rawDataSymbol].game_name}async getGame(){return this[Te.rawDataSymbol].game_id?(0,Te.checkRelationAssertion)(await this._client.games.getGameById(this[Te.rawDataSymbol].game_id)):null}get title(){return this[Te.rawDataSymbol].title}};Bn.HelixChannelReference=Il;cb.__decorate([(0,aA.Enumerable)(!1)],Il.prototype,"_client",void 0);Bn.HelixChannelReference=Il=cb.__decorate([(0,Te.rtfm)("api","HelixChannelReference","id")],Il)});var tp=u(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.HelixExtensionBitsProduct=void 0;var sA=(b(),x(g)),oA=C(),zt=_(),ep=class extends zt.DataObject{static{n(this,"HelixExtensionBitsProduct")}get sku(){return this[zt.rawDataSymbol].sku}get cost(){return this[zt.rawDataSymbol].cost.amount}get displayName(){return this[zt.rawDataSymbol].display_name}get inDevelopment(){return this[zt.rawDataSymbol].in_development}get isBroadcast(){return this[zt.rawDataSymbol].is_broadcast}get expirationDate(){return(0,oA.mapNullable)(this[zt.rawDataSymbol].expiration,e=>new Date(e))}};jn.HelixExtensionBitsProduct=ep;jn.HelixExtensionBitsProduct=ep=sA.__decorate([(0,zt.rtfm)("api","HelixExtensionBitsProduct","sku")],ep)});var rp=u(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.HelixExtensionTransaction=void 0;var db=(b(),x(g)),lA=C(),_e=_(),Tl=class extends _e.DataObject{static{n(this,"HelixExtensionTransaction")}constructor(e,t){super(e),this._client=t}get id(){return this[_e.rawDataSymbol].id}get transactionDate(){return new Date(this[_e.rawDataSymbol].timestamp)}get broadcasterId(){return this[_e.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[_e.rawDataSymbol].broadcaster_name}get broadcasterDisplayName(){return this[_e.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,_e.checkRelationAssertion)(await this._client.users.getUserById(this[_e.rawDataSymbol].broadcaster_id))}get userId(){return this[_e.rawDataSymbol].user_id}get userName(){return this[_e.rawDataSymbol].user_login}get userDisplayName(){return this[_e.rawDataSymbol].user_name}async getUser(){return(0,_e.checkRelationAssertion)(await this._client.users.getUserById(this[_e.rawDataSymbol].user_id))}get productType(){return this[_e.rawDataSymbol].product_type}get productSku(){return this[_e.rawDataSymbol].product_data.sku}get productCost(){return this[_e.rawDataSymbol].product_data.cost.amount}get productDisplayName(){return this[_e.rawDataSymbol].product_data.displayName}get productInDevelopment(){return this[_e.rawDataSymbol].product_data.inDevelopment}};kn.HelixExtensionTransaction=Tl;db.__decorate([(0,lA.Enumerable)(!1)],Tl.prototype,"_client",void 0);kn.HelixExtensionTransaction=Tl=db.__decorate([(0,_e.rtfm)("api","HelixExtensionTransaction","id")],Tl)});var ap=u(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.HelixExtensionsApi=void 0;var uA=(b(),x(g)),gb=_(),Rl=ub(),ip=je(),hb=oe(),pb=pe(),_b=le(),cA=G(),mb=Yh(),yb=tp(),fb=rp(),np=class extends cA.BaseApi{static{n(this,"HelixExtensionsApi")}async getReleasedExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/released",query:(0,Rl.createReleasedExtensionFilter)(e,t)});return new gb.HelixExtension(r.data[0])}async getLiveChannelsWithExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/live",query:{...(0,ip.createSingleKeyQuery)("extension_id",e),...(0,_b.createPaginationQuery)(t)}});return(0,pb.createPaginatedResult)(r,mb.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new hb.HelixPaginatedRequest({url:"extensions/live",query:(0,ip.createSingleKeyQuery)("extension_id",e)},this._client,t=>new mb.HelixChannelReference(t,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:(0,ip.createSingleKeyQuery)("should_include_all",e?.toString())})).data.map(r=>new yb.HelixExtensionBitsProduct(r))}async putExtensionBitsProduct(e){let t=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:(0,Rl.createExtensionProductBody)(e)});return new yb.HelixExtensionBitsProduct(t.data[0])}async getExtensionTransactions(e,t={}){let r=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...(0,Rl.createExtensionTransactionQuery)(e,t),...(0,_b.createPaginationQuery)(t)}});return(0,pb.createPaginatedResult)(r,fb.HelixExtensionTransaction,this._client)}getExtensionTransactionsPaginated(e,t={}){return new hb.HelixPaginatedRequest({url:"extensions/transactions",forceType:"app",query:(0,Rl.createExtensionTransactionQuery)(e,t)},this._client,r=>new fb.HelixExtensionTransaction(r,this._client))}};Mn.HelixExtensionsApi=np;Mn.HelixExtensionsApi=np=uA.__decorate([(0,gb.rtfm)("api","HelixExtensionsApi")],np)});var Ol=u(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.HelixGame=void 0;var bb=(b(),x(g)),dA=C(),qt=_(),Ul=class extends qt.DataObject{static{n(this,"HelixGame")}constructor(e,t){super(e),this._client=t}get id(){return this[qt.rawDataSymbol].id}get name(){return this[qt.rawDataSymbol].name}get boxArtUrl(){return this[qt.rawDataSymbol].box_art_url}get igdbId(){return this[qt.rawDataSymbol].igdb_id||null}getBoxArtUrl(e,t){return this[qt.rawDataSymbol].box_art_url.replace("{width}",e.toString()).replace("{height}",t.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[qt.rawDataSymbol].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[qt.rawDataSymbol].id})}};Ln.HelixGame=Ul;bb.__decorate([(0,dA.Enumerable)(!1)],Ul.prototype,"_client",void 0);Ln.HelixGame=Ul=bb.__decorate([(0,qt.rtfm)("api","HelixGame","id")],Ul)});var lp=u(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.HelixGameApi=void 0;var Bl=(b(),x(g)),op=C(),hA=_(),sp=Ft(),pA=oe(),_A=pe(),mA=le(),yA=G(),Jr=Ol(),Zr=class extends yA.BaseApi{static{n(this,"HelixGameApi")}constructor(){super(...arguments),this._getGameByIdBatcher=new sp.HelixRequestBatcher({url:"games"},"id","id",this._client,e=>new Jr.HelixGame(e,this._client)),this._getGameByNameBatcher=new sp.HelixRequestBatcher({url:"games"},"name","name",this._client,e=>new Jr.HelixGame(e,this._client)),this._getGameByIgdbIdBatcher=new sp.HelixRequestBatcher({url:"games"},"igdb_id","igdb_id",this._client,e=>new Jr.HelixGame(e,this._client))}async getGamesByIds(e){return await this._getGames("id",e)}async getGamesByNames(e){return await this._getGames("name",e)}async getGamesByIgdbIds(e){return await this._getGames("igdb_id",e)}async getGameById(e){var t;return(t=(await this._getGames("id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByName(e){var t;return(t=(await this._getGames("name",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIgdbId(e){var t;return(t=(await this._getGames("igdb_id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIdBatched(e){return await this._getGameByIdBatcher.request(e)}async getGameByNameBatched(e){return await this._getGameByNameBatcher.request(e)}async getGameByIgdbIdBatched(e){return await this._getGameByIgdbIdBatcher.request(e)}async getTopGames(e){let t=await this._client.callApi({type:"helix",url:"games/top",query:(0,mA.createPaginationQuery)(e)});return(0,_A.createPaginatedResult)(t,Jr.HelixGame,this._client)}getTopGamesPaginated(){return new pA.HelixPaginatedRequest({url:"games/top"},this._client,e=>new Jr.HelixGame(e,this._client))}async _getGames(e,t){return t.length?(await this._client.callApi({type:"helix",url:"games",query:{[e]:t}})).data.map(a=>new Jr.HelixGame(a,this._client)):[]}};Fn.HelixGameApi=Zr;Bl.__decorate([(0,op.Enumerable)(!1)],Zr.prototype,"_getGameByIdBatcher",void 0);Bl.__decorate([(0,op.Enumerable)(!1)],Zr.prototype,"_getGameByNameBatcher",void 0);Bl.__decorate([(0,op.Enumerable)(!1)],Zr.prototype,"_getGameByIgdbIdBatcher",void 0);Fn.HelixGameApi=Zr=Bl.__decorate([(0,hA.rtfm)("api","HelixGameApi")],Zr)});var up=u(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.HelixGoal=void 0;var xb=(b(),x(g)),fA=C(),Me=_(),jl=class extends Me.DataObject{static{n(this,"HelixGoal")}constructor(e,t){super(e),this._client=t}get id(){return this[Me.rawDataSymbol].id}get broadcasterId(){return this[Me.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[Me.rawDataSymbol].broadcaster_name}get broadcasterName(){return this[Me.rawDataSymbol].broadcaster_login}async getBroadcaster(){return(0,Me.checkRelationAssertion)(await this._client.users.getUserById(this[Me.rawDataSymbol].broadcaster_id))}get type(){return this[Me.rawDataSymbol].type}get description(){return this[Me.rawDataSymbol].description}get currentAmount(){return this[Me.rawDataSymbol].current_amount}get targetAmount(){return this[Me.rawDataSymbol].target_amount}get creationDate(){return this[Me.rawDataSymbol].created_at}};Nn.HelixGoal=jl;xb.__decorate([(0,fA.Enumerable)(!1)],jl.prototype,"_client",void 0);Nn.HelixGoal=jl=xb.__decorate([(0,Me.rtfm)("api","HelixGoal","id")],jl)});var dp=u(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.HelixGoalApi=void 0;var gA=(b(),x(g)),bA=Y(),wb=_(),xA=G(),wA=up(),cp=class extends xA.BaseApi{static{n(this,"HelixGoalApi")}async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:(0,wb.extractUserId)(e),scopes:["channel:read:goals"],query:(0,bA.createBroadcasterQuery)(e)})).data.map(r=>new wA.HelixGoal(r,this._client))}};Qn.HelixGoalApi=cp;Qn.HelixGoalApi=cp=gA.__decorate([(0,wb.rtfm)("api","HelixGoalApi")],cp)});var hp=u(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.HelixHypeTrainContribution=void 0;var vb=(b(),x(g)),vA=C(),yr=_(),kl=class extends yr.DataObject{static{n(this,"HelixHypeTrainContribution")}constructor(e,t){super(e),this._client=t}get userId(){return this[yr.rawDataSymbol].user}async getUser(){return(0,yr.checkRelationAssertion)(await this._client.users.getUserById(this[yr.rawDataSymbol].user))}get type(){return this[yr.rawDataSymbol].type}get total(){return this[yr.rawDataSymbol].total}};Gn.HelixHypeTrainContribution=kl;vb.__decorate([(0,vA.Enumerable)(!1)],kl.prototype,"_client",void 0);Gn.HelixHypeTrainContribution=kl=vb.__decorate([(0,yr.rtfm)("api","HelixHypeTrainContribution","userId")],kl)});var pp=u(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.HelixHypeTrainEvent=void 0;var Hb=(b(),x(g)),SA=C(),fe=_(),Sb=hp(),Ml=class extends fe.DataObject{static{n(this,"HelixHypeTrainEvent")}constructor(e,t){super(e),this._client=t}get eventId(){return this[fe.rawDataSymbol].id}get eventType(){return this[fe.rawDataSymbol].event_type}get eventDate(){return new Date(this[fe.rawDataSymbol].event_timestamp)}get eventVersion(){return this[fe.rawDataSymbol].version}get id(){return this[fe.rawDataSymbol].event_data.id}get broadcasterId(){return this[fe.rawDataSymbol].event_data.broadcaster_id}async getBroadcaster(){return(0,fe.checkRelationAssertion)(await this._client.users.getUserById(this[fe.rawDataSymbol].event_data.broadcaster_id))}get level(){return this[fe.rawDataSymbol].event_data.level}get startDate(){return new Date(this[fe.rawDataSymbol].event_data.started_at)}get expiryDate(){return new Date(this[fe.rawDataSymbol].event_data.expires_at)}get cooldownDate(){return new Date(this[fe.rawDataSymbol].event_data.cooldown_end_time)}get total(){return this[fe.rawDataSymbol].event_data.total}get goal(){return this[fe.rawDataSymbol].event_data.goal}get lastContribution(){return new Sb.HelixHypeTrainContribution(this[fe.rawDataSymbol].event_data.last_contribution,this._client)}get topContributions(){return this[fe.rawDataSymbol].event_data.top_contributions.map(e=>new Sb.HelixHypeTrainContribution(e,this._client))}};Wn.HelixHypeTrainEvent=Ml;Hb.__decorate([(0,SA.Enumerable)(!1)],Ml.prototype,"_client",void 0);Wn.HelixHypeTrainEvent=Ml=Hb.__decorate([(0,fe.rtfm)("api","HelixHypeTrainEvent","id")],Ml)});var mp=u(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.HelixHypeTrainApi=void 0;var Cb=Y(),qb=_(),HA=oe(),CA=pe(),qA=le(),EA=G(),Eb=pp(),_p=class extends EA.BaseApi{static{n(this,"HelixHypeTrainApi")}async getHypeTrainEventsForBroadcaster(e,t){let r=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:(0,qb.extractUserId)(e),scopes:["channel:read:hype_train"],query:{...(0,Cb.createBroadcasterQuery)(e),...(0,qA.createPaginationQuery)(t)}});return(0,CA.createPaginatedResult)(r,Eb.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new HA.HelixPaginatedRequest({url:"hypetrain/events",userId:(0,qb.extractUserId)(e),scopes:["channel:read:hype_train"],query:(0,Cb.createBroadcasterQuery)(e)},this._client,t=>new Eb.HelixHypeTrainEvent(t,this._client))}};Ll.HelixHypeTrainApi=_p});var Pb=u(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.createWarnUserBody=ce.createCheckAutoModStatusBody=ce.createUpdateShieldModeStatusBody=ce.createBanUserBody=ce.createAutoModSettingsBody=ce.createAutoModProcessBody=ce.createResolveUnbanRequestQuery=ce.createModeratorModifyQuery=ce.createModerationUserListQuery=void 0;var Kt=_();function PA(i,e){return{broadcaster_id:(0,Kt.extractUserId)(i),user_id:e?.userId}}n(PA,"createModerationUserListQuery");ce.createModerationUserListQuery=PA;function AA(i,e){return{broadcaster_id:(0,Kt.extractUserId)(i),user_id:(0,Kt.extractUserId)(e)}}n(AA,"createModeratorModifyQuery");ce.createModeratorModifyQuery=AA;function DA(i,e,t,r,a){return{unban_request_id:t,broadcaster_id:(0,Kt.extractUserId)(i),moderator_id:(0,Kt.extractUserId)(e),status:r?"approved":"denied",resolution_text:a}}n(DA,"createResolveUnbanRequestQuery");ce.createResolveUnbanRequestQuery=DA;function IA(i,e,t){return{user_id:(0,Kt.extractUserId)(i),msg_id:e,action:t?"ALLOW":"DENY"}}n(IA,"createAutoModProcessBody");ce.createAutoModProcessBody=IA;function TA(i){return{overall_level:i.overallLevel,aggression:i.aggression,bullying:i.bullying,disability:i.disability,misogyny:i.misogyny,race_ethnicity_or_religion:i.raceEthnicityOrReligion,sex_based_terms:i.sexBasedTerms,sexuality_sex_or_gender:i.sexualitySexOrGender,swearing:i.swearing}}n(TA,"createAutoModSettingsBody");ce.createAutoModSettingsBody=TA;function RA(i){return{data:{duration:i.duration,reason:i.reason,user_id:(0,Kt.extractUserId)(i.user)}}}n(RA,"createBanUserBody");ce.createBanUserBody=RA;function UA(i){return{is_active:i}}n(UA,"createUpdateShieldModeStatusBody");ce.createUpdateShieldModeStatusBody=UA;function OA(i){return{data:i.map(e=>({msg_id:e.messageId,msg_text:e.messageText}))}}n(OA,"createCheckAutoModStatusBody");ce.createCheckAutoModStatusBody=OA;function BA(i,e){return{data:{user_id:(0,Kt.extractUserId)(i),reason:e}}}n(BA,"createWarnUserBody");ce.createWarnUserBody=BA});var Ab=u(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.HelixAutoModSettings=void 0;var jA=(b(),x(g)),Re=_(),yp=class extends Re.DataObject{static{n(this,"HelixAutoModSettings")}get broadcasterId(){return this[Re.rawDataSymbol].broadcaster_id}get moderatorId(){return this[Re.rawDataSymbol].moderator_id}get overallLevel(){return this[Re.rawDataSymbol].overall_level?this[Re.rawDataSymbol].overall_level:null}get disability(){return this[Re.rawDataSymbol].disability}get aggression(){return this[Re.rawDataSymbol].aggression}get sexualitySexOrGender(){return this[Re.rawDataSymbol].sexuality_sex_or_gender}get misogyny(){return this[Re.rawDataSymbol].misogyny}get bullying(){return this[Re.rawDataSymbol].bullying}get swearing(){return this[Re.rawDataSymbol].swearing}get raceEthnicityOrReligion(){return this[Re.rawDataSymbol].race_ethnicity_or_religion}get sexBasedTerms(){return this[Re.rawDataSymbol].sex_based_terms}};Vn.HelixAutoModSettings=yp;Vn.HelixAutoModSettings=yp=jA.__decorate([(0,Re.rtfm)("api","HelixAutoModSettings","broadcasterId")],yp)});var Db=u($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.HelixAutoModStatus=void 0;var kA=(b(),x(g)),Fl=_(),fp=class extends Fl.DataObject{static{n(this,"HelixAutoModStatus")}get messageId(){return this[Fl.rawDataSymbol].msg_id}get isPermitted(){return this[Fl.rawDataSymbol].is_permitted}};$n.HelixAutoModStatus=fp;$n.HelixAutoModStatus=fp=kA.__decorate([(0,Fl.rtfm)("api","HelixAutoModStatus","messageId")],fp)});var Nl=u(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.HelixBanUser=void 0;var gp=(b(),x(g)),bp=C(),Et=_(),zn=class extends Et.DataObject{static{n(this,"HelixBanUser")}constructor(e,t,r){super(e),this._expiryTimestamp=t,this._client=r}get creationDate(){return new Date(this[Et.rawDataSymbol].created_at)}get expiryDate(){return(0,bp.mapNullable)(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[Et.rawDataSymbol].moderator_id}async getModerator(){return(0,Et.checkRelationAssertion)(await this._client.users.getUserById(this[Et.rawDataSymbol].moderator_id))}get userId(){return this[Et.rawDataSymbol].user_id}async getUser(){return(0,Et.checkRelationAssertion)(await this._client.users.getUserById(this[Et.rawDataSymbol].user_id))}};Kn.HelixBanUser=zn;gp.__decorate([(0,bp.Enumerable)(!1)],zn.prototype,"_client",void 0);gp.__decorate([(0,bp.Enumerable)(!1)],zn.prototype,"_expiryTimestamp",void 0);Kn.HelixBanUser=zn=gp.__decorate([(0,Et.rtfm)("api","HelixBanUser","userId")],zn)});var wp=u(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.HelixBan=void 0;var MA=(b(),x(g)),Xr=_(),LA=Nl(),xp=class extends LA.HelixBanUser{static{n(this,"HelixBan")}constructor(e,t){super(e,e.expires_at||null,t)}get userName(){return this[Xr.rawDataSymbol].user_login}get userDisplayName(){return this[Xr.rawDataSymbol].user_name}get moderatorName(){return this[Xr.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[Xr.rawDataSymbol].moderator_name}get reason(){return this[Xr.rawDataSymbol].reason||null}};Jn.HelixBan=xp;Jn.HelixBan=xp=MA.__decorate([(0,Xr.rtfm)("api","HelixBan","userId")],xp)});var Sp=u(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.HelixBlockedTerm=void 0;var FA=(b(),x(g)),_t=_(),vp=class extends _t.DataObject{static{n(this,"HelixBlockedTerm")}get broadcasterId(){return this[_t.rawDataSymbol].broadcaster_id}get creationDate(){return new Date(this[_t.rawDataSymbol].created_at)}get expirationDate(){return this[_t.rawDataSymbol].expires_at?new Date(this[_t.rawDataSymbol].expires_at):null}get id(){return this[_t.rawDataSymbol].id}get moderatorId(){return this[_t.rawDataSymbol].moderator_id}get text(){return this[_t.rawDataSymbol].text}get updatedDate(){return new Date(this[_t.rawDataSymbol].updated_at)}};Zn.HelixBlockedTerm=vp;Zn.HelixBlockedTerm=vp=FA.__decorate([(0,_t.rtfm)("api","HelixBlockedTerm","id")],vp)});var Hp=u(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.HelixModeratedChannel=void 0;var Ib=(b(),x(g)),NA=C(),Pt=_(),Ql=class extends Pt.DataObject{static{n(this,"HelixModeratedChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[Pt.rawDataSymbol].broadcaster_id}get name(){return this[Pt.rawDataSymbol].broadcaster_login}get displayName(){return this[Pt.rawDataSymbol].broadcaster_name}async getChannel(){return(0,Pt.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[Pt.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,Pt.checkRelationAssertion)(await this._client.users.getUserById(this[Pt.rawDataSymbol].broadcaster_id))}};Xn.HelixModeratedChannel=Ql;Ib.__decorate([(0,NA.Enumerable)(!1)],Ql.prototype,"_client",void 0);Xn.HelixModeratedChannel=Ql=Ib.__decorate([(0,Pt.rtfm)("api","HelixModeratedChannel","id")],Ql)});var Cp=u(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.HelixModerator=void 0;var Tb=(b(),x(g)),QA=C(),fr=_(),Gl=class extends fr.DataObject{static{n(this,"HelixModerator")}constructor(e,t){super(e),this._client=t}get userId(){return this[fr.rawDataSymbol].user_id}get userName(){return this[fr.rawDataSymbol].user_login}get userDisplayName(){return this[fr.rawDataSymbol].user_name}async getUser(){return(0,fr.checkRelationAssertion)(await this._client.users.getUserById(this[fr.rawDataSymbol].user_id))}};Yn.HelixModerator=Gl;Tb.__decorate([(0,QA.Enumerable)(!1)],Gl.prototype,"_client",void 0);Yn.HelixModerator=Gl=Tb.__decorate([(0,fr.rtfm)("api","HelixModerator","userId")],Gl)});var qp=u(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.HelixShieldModeStatus=void 0;var Rb=(b(),x(g)),GA=C(),mt=_(),Wl=class extends mt.DataObject{static{n(this,"HelixShieldModeStatus")}constructor(e,t){super(e),this._client=t}get isActive(){return this[mt.rawDataSymbol].is_active}get moderatorId(){return this[mt.rawDataSymbol].moderator_id}get moderatorName(){return this[mt.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[mt.rawDataSymbol].moderator_name}async getModerator(){return(0,mt.checkRelationAssertion)(await this._client.users.getUserById(this[mt.rawDataSymbol].moderator_id))}get lastActivationDate(){return this[mt.rawDataSymbol].last_activated_at===""?null:new Date(this[mt.rawDataSymbol].last_activated_at)}};ea.HelixShieldModeStatus=Wl;Rb.__decorate([(0,GA.Enumerable)(!1)],Wl.prototype,"_client",void 0);ea.HelixShieldModeStatus=Wl=Rb.__decorate([(0,mt.rtfm)("api","HelixShieldModeStatus")],Wl)});var Ep=u(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.HelixUnbanRequest=void 0;var Ub=(b(),x(g)),Ob=C(),te=_(),Vl=class extends te.DataObject{static{n(this,"HelixUnbanRequest")}constructor(e,t){super(e),this._client=t}get id(){return this[te.rawDataSymbol].id}get broadcasterId(){return this[te.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[te.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[te.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[te.rawDataSymbol].moderator_id}get moderatorName(){return this[te.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[te.rawDataSymbol].moderator_name}async getModerator(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].moderator_id))}get userId(){return this[te.rawDataSymbol].user_id}get userName(){return this[te.rawDataSymbol].user_login}get userDisplayName(){return this[te.rawDataSymbol].user_name}async getUser(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].user_id))}get message(){return this[te.rawDataSymbol].text}get creationDate(){return new Date(this[te.rawDataSymbol].created_at)}get resolutionMessage(){return this[te.rawDataSymbol].resolution_text||null}get resolutionDate(){return(0,Ob.mapNullable)(this[te.rawDataSymbol].resolved_at,e=>new Date(e))}};ta.HelixUnbanRequest=Vl;Ub.__decorate([(0,Ob.Enumerable)(!1)],Vl.prototype,"_client",void 0);ta.HelixUnbanRequest=Vl=Ub.__decorate([(0,te.rtfm)("api","HelixUnbanRequest","id")],Vl)});var Pp=u(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.HelixWarning=void 0;var Bb=(b(),x(g)),WA=C(),Je=_(),$l=class extends Je.DataObject{static{n(this,"HelixWarning")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Je.rawDataSymbol].user_id}async getBroadcaster(){return(0,Je.checkRelationAssertion)(await this._client.users.getUserById(this[Je.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[Je.rawDataSymbol].moderator_id}async getModerator(){return(0,Je.checkRelationAssertion)(await this._client.users.getUserById(this[Je.rawDataSymbol].moderator_id))}get userId(){return this[Je.rawDataSymbol].user_id}async getUser(){return(0,Je.checkRelationAssertion)(await this._client.users.getUserById(this[Je.rawDataSymbol].user_id))}get reason(){return this[Je.rawDataSymbol].reason}};ra.HelixWarning=$l;Bb.__decorate([(0,WA.Enumerable)(!1)],$l.prototype,"_client",void 0);ra.HelixWarning=$l=Bb.__decorate([(0,Je.rtfm)("api","HelixWarning","userId")],$l)});var Tp=u(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.HelixModerationApi=void 0;var VA=(b(),x(g)),Ap=Y(),F=_(),gr=je(),it=Pb(),zl=oe(),ia=pe(),na=le(),$A=G(),jb=Ab(),zA=Db(),kb=wp(),KA=Nl(),Mb=Sp(),Lb=Hp(),Fb=Cp(),Nb=qp(),Dp=Ep(),JA=Pp(),Ip=class extends $A.BaseApi{static{n(this,"HelixModerationApi")}async getBannedUsers(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/banned",userId:(0,F.extractUserId)(e),scopes:["moderation:read"],query:{...(0,it.createModerationUserListQuery)(e,t),...(0,na.createPaginationQuery)(t)}});return(0,ia.createPaginatedResult)(r,kb.HelixBan,this._client)}getBannedUsersPaginated(e){return new zl.HelixPaginatedRequest({url:"moderation/banned",userId:(0,F.extractUserId)(e),scopes:["moderation:read"],query:(0,Ap.createBroadcasterQuery)(e)},this._client,t=>new kb.HelixBan(t,this._client),50)}async checkUserBan(e,t){let r=(0,F.extractUserId)(t);return(await this.getBannedUsers(e,{userId:r})).data.some(s=>s.userId===r)}async getModerators(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/moderators",userId:(0,F.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:{...(0,it.createModerationUserListQuery)(e,t),...(0,na.createPaginationQuery)(t)}});return(0,ia.createPaginatedResult)(r,Fb.HelixModerator,this._client)}getModeratorsPaginated(e){return new zl.HelixPaginatedRequest({url:"moderation/moderators",userId:(0,F.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:(0,Ap.createBroadcasterQuery)(e)},this._client,t=>new Fb.HelixModerator(t,this._client))}async getModeratedChannels(e,t){let r=(0,F.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/channels",userId:r,scopes:["user:read:moderated_channels"],query:{...(0,gr.createSingleKeyQuery)("user_id",r),...(0,na.createPaginationQuery)(t)}});return(0,ia.createPaginatedResult)(a,Lb.HelixModeratedChannel,this._client)}getModeratedChannelsPaginated(e){let t=(0,F.extractUserId)(e);return new zl.HelixPaginatedRequest({url:"moderation/channels",userId:t,scopes:["user:read:moderated_channels"],query:(0,gr.createSingleKeyQuery)("user_id",t)},this._client,r=>new Lb.HelixModeratedChannel(r,this._client))}async checkUserMod(e,t){let r=(0,F.extractUserId)(t);return(await this.getModerators(e,{userId:r})).data.some(s=>s.userId===r)}async addModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"POST",userId:(0,F.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,it.createModeratorModifyQuery)(e,t)})}async removeModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"DELETE",userId:(0,F.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,it.createModeratorModifyQuery)(e,t)})}async checkAutoModStatus(e,t){return(await this._client.callApi({type:"helix",url:"moderation/enforcements/status",method:"POST",userId:(0,F.extractUserId)(e),scopes:["moderation:read"],query:(0,Ap.createBroadcasterQuery)(e),jsonBody:(0,it.createCheckAutoModStatusBody)(t)})).data.map(a=>new zA.HelixAutoModStatus(a))}async processHeldAutoModMessage(e,t,r){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:(0,F.extractUserId)(e),scopes:["moderator:manage:automod"],jsonBody:(0,it.createAutoModProcessBody)(e,t,r)})}async getAutoModSettings(e){let t=(0,F.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",userId:t,scopes:["moderator:read:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)})).data.map(a=>new jb.HelixAutoModSettings(a))}async updateAutoModSettings(e,t){let r=(0,F.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",method:"PUT",userId:r,scopes:["moderator:manage:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,it.createAutoModSettingsBody)(t)})).data.map(s=>new jb.HelixAutoModSettings(s))}async banUser(e,t){let r=(0,F.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/bans",method:"POST",userId:r,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,it.createBanUserBody)(t)})).data.map(s=>new KA.HelixBanUser(s,s.end_time,this._client))}async unbanUser(e,t){let r=(0,F.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/bans",method:"DELETE",userId:r,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,gr.createSingleKeyQuery)("user_id",(0,F.extractUserId)(t))}})}async getBlockedTerms(e,t){let r=(0,F.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/blocked_terms",userId:r,scopes:["moderator:read:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,na.createPaginationQuery)(t)}});return(0,ia.createPaginatedResult)(a,Mb.HelixBlockedTerm,this._client)}async addBlockedTerm(e,t){let r=(0,F.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"POST",userId:r,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:{text:t}})).data.map(s=>new Mb.HelixBlockedTerm(s))}async removeBlockedTerm(e,t,r){let a=(0,F.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"DELETE",userId:a,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(a),id:r}})}async deleteChatMessages(e,t){let r=(0,F.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/chat",method:"DELETE",userId:r,scopes:["moderator:manage:chat_messages"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,gr.createSingleKeyQuery)("message_id",t)}})}async getShieldModeStatus(e){let t=(0,F.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"GET",userId:t,scopes:["moderator:read:shield_mode","moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)});return new Nb.HelixShieldModeStatus(r.data[0],this._client)}async updateShieldModeStatus(e,t){let r=(0,F.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"PUT",userId:r,scopes:["moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,it.createUpdateShieldModeStatusBody)(t)});return new Nb.HelixShieldModeStatus(a.data[0],this._client)}async getUnbanRequests(e,t,r){let a=(0,F.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"moderation/unban_requests",method:"GET",userId:a,scopes:["moderator:read:unban_requests","moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(a),...(0,gr.createSingleKeyQuery)("status",t),...(0,na.createPaginationQuery)(r)}});return(0,ia.createPaginatedResult)(s,Dp.HelixUnbanRequest,this._client)}getUnbanRequestsPaginated(e,t){let r=(0,F.extractUserId)(e);return new zl.HelixPaginatedRequest({url:"moderation/unban_requests",method:"GET",userId:r,scopes:["moderator:read:unban_requests","moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,gr.createSingleKeyQuery)("status",t)}},this._client,a=>new Dp.HelixUnbanRequest(a,this._client))}async resolveUnbanRequest(e,t,r,a){let s=(0,F.extractUserId)(e),o=await this._client.callApi({type:"helix",url:"moderation/unban_requests",method:"PATCH",userId:s,scopes:["moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:(0,it.createResolveUnbanRequestQuery)(s,this._getUserContextIdWithDefault(s),t,r,a?.slice(0,500))});return new Dp.HelixUnbanRequest(o.data[0],this._client)}async warnUser(e,t,r){let a=(0,F.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"moderation/warnings",method:"POST",userId:a,scopes:["moderator:manage:warnings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(a),jsonBody:(0,it.createWarnUserBody)(t,r.slice(0,500))});return new JA.HelixWarning(s.data[0],this._client)}_createModeratorActionQuery(e){return(0,gr.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};aa.HelixModerationApi=Ip;aa.HelixModerationApi=Ip=VA.__decorate([(0,F.rtfm)("api","HelixModerationApi")],Ip)});var Gb=u(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.createPollEndBody=Yr.createPollBody=void 0;var Qb=_();function ZA(i,e){var t;return{broadcaster_id:(0,Qb.extractUserId)(i),title:e.title,choices:e.choices.map(r=>({title:r})),duration:e.duration,channel_points_voting_enabled:e.channelPointsPerVote!=null,channel_points_per_vote:(t=e.channelPointsPerVote)!==null&&t!==void 0?t:0}}n(ZA,"createPollBody");Yr.createPollBody=ZA;function XA(i,e,t){return{broadcaster_id:(0,Qb.extractUserId)(i),id:e,status:t?"TERMINATED":"ARCHIVED"}}n(XA,"createPollEndBody");Yr.createPollEndBody=XA});var Up=u(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.HelixPollChoice=void 0;var YA=(b(),x(g)),ei=_(),Rp=class extends ei.DataObject{static{n(this,"HelixPollChoice")}get id(){return this[ei.rawDataSymbol].id}get title(){return this[ei.rawDataSymbol].title}get totalVotes(){return this[ei.rawDataSymbol].votes}get channelPointsVotes(){return this[ei.rawDataSymbol].channel_points_votes}};sa.HelixPollChoice=Rp;sa.HelixPollChoice=Rp=YA.__decorate([(0,ei.rtfm)("api","HelixPollChoice","id")],Rp)});var Op=u(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.HelixPoll=void 0;var Wb=(b(),x(g)),eD=C(),He=_(),tD=Up(),Kl=class extends He.DataObject{static{n(this,"HelixPoll")}constructor(e,t){super(e),this._client=t}get id(){return this[He.rawDataSymbol].id}get broadcasterId(){return this[He.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[He.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[He.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,He.checkRelationAssertion)(await this._client.users.getUserById(this[He.rawDataSymbol].broadcaster_id))}get title(){return this[He.rawDataSymbol].title}get isChannelPointsVotingEnabled(){return this[He.rawDataSymbol].channel_points_voting_enabled}get channelPointsPerVote(){return this[He.rawDataSymbol].channel_points_per_vote}get status(){return this[He.rawDataSymbol].status}get durationInSeconds(){return this[He.rawDataSymbol].duration}get startDate(){return new Date(this[He.rawDataSymbol].started_at)}get endDate(){return new Date(this.startDate.getTime()+this[He.rawDataSymbol].duration*1e3)}get choices(){return this[He.rawDataSymbol].choices.map(e=>new tD.HelixPollChoice(e))}};oa.HelixPoll=Kl;Wb.__decorate([(0,eD.Enumerable)(!1)],Kl.prototype,"_client",void 0);oa.HelixPoll=Kl=Wb.__decorate([(0,He.rtfm)("api","HelixPoll","id")],Kl)});var jp=u(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.HelixPollApi=void 0;var rD=(b(),x(g)),Vb=Y(),ti=_(),iD=je(),$b=Gb(),nD=oe(),aD=pe(),sD=le(),oD=G(),la=Op(),Bp=class extends oD.BaseApi{static{n(this,"HelixPollApi")}async getPolls(e,t){let r=await this._client.callApi({type:"helix",url:"polls",userId:(0,ti.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:{...(0,Vb.createBroadcasterQuery)(e),...(0,sD.createPaginationQuery)(t)}});return(0,aD.createPaginatedResult)(r,la.HelixPoll,this._client)}getPollsPaginated(e){return new nD.HelixPaginatedRequest({url:"polls",userId:(0,ti.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,Vb.createBroadcasterQuery)(e)},this._client,t=>new la.HelixPoll(t,this._client),20)}async getPollsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"polls",userId:(0,ti.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,iD.createGetByIdsQuery)(e,t)})).data.map(a=>new la.HelixPoll(a,this._client)):[]}async getPollById(e,t){let r=await this.getPollsByIds(e,[t]);return r.length?r[0]:null}async createPoll(e,t){let r=await this._client.callApi({type:"helix",url:"polls",method:"POST",userId:(0,ti.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,$b.createPollBody)(e,t)});return new la.HelixPoll(r.data[0],this._client)}async endPoll(e,t,r=!0){let a=await this._client.callApi({type:"helix",url:"polls",method:"PATCH",userId:(0,ti.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,$b.createPollEndBody)(e,t,r)});return new la.HelixPoll(a.data[0],this._client)}};ua.HelixPollApi=Bp;ua.HelixPollApi=Bp=rD.__decorate([(0,ti.rtfm)("api","HelixPollApi")],Bp)});var Kb=u(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.createEndPredictionBody=ri.createPredictionBody=void 0;var zb=_();function lD(i,e){return{broadcaster_id:(0,zb.extractUserId)(i),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}n(lD,"createPredictionBody");ri.createPredictionBody=lD;function uD(i,e,t,r){return{broadcaster_id:(0,zb.extractUserId)(i),id:e,status:t,winning_outcome_id:r}}n(uD,"createEndPredictionBody");ri.createEndPredictionBody=uD});var kp=u(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.HelixPredictor=void 0;var Jb=(b(),x(g)),cD=C(),Jt=_(),Jl=class extends Jt.DataObject{static{n(this,"HelixPredictor")}constructor(e,t){super(e),this._client=t}get userId(){return this[Jt.rawDataSymbol].user_id}get userName(){return this[Jt.rawDataSymbol].user_login}get userDisplayName(){return this[Jt.rawDataSymbol].user_name}async getUser(){return await this._client.users.getUserById(this[Jt.rawDataSymbol].user_id)}get channelPointsUsed(){return this[Jt.rawDataSymbol].channel_points_used}get channelPointsWon(){return this[Jt.rawDataSymbol].channel_points_won}};ca.HelixPredictor=Jl;Jb.__decorate([(0,cD.Enumerable)(!1)],Jl.prototype,"_client",void 0);ca.HelixPredictor=Jl=Jb.__decorate([(0,Jt.rtfm)("api","HelixPredictor","userId")],Jl)});var Mp=u(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.HelixPredictionOutcome=void 0;var Zb=(b(),x(g)),dD=C(),Zt=_(),hD=kp(),Zl=class extends Zt.DataObject{static{n(this,"HelixPredictionOutcome")}constructor(e,t){super(e),this._client=t}get id(){return this[Zt.rawDataSymbol].id}get title(){return this[Zt.rawDataSymbol].title}get users(){return this[Zt.rawDataSymbol].users}get totalChannelPoints(){return this[Zt.rawDataSymbol].channel_points}get color(){return this[Zt.rawDataSymbol].color}get topPredictors(){var e,t;return(t=(e=this[Zt.rawDataSymbol].top_predictors)===null||e===void 0?void 0:e.map(r=>new hD.HelixPredictor(r,this._client)))!==null&&t!==void 0?t:[]}};da.HelixPredictionOutcome=Zl;Zb.__decorate([(0,dD.Enumerable)(!1)],Zl.prototype,"_client",void 0);da.HelixPredictionOutcome=Zl=Zb.__decorate([(0,Zt.rtfm)("api","HelixPredictionOutcome","id")],Zl)});var Lp=u(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.HelixPrediction=void 0;var Yb=(b(),x(g)),pD=C(),re=_(),Xb=Mp(),Xl=class extends re.DataObject{static{n(this,"HelixPrediction")}constructor(e,t){super(e),this._client=t}get id(){return this[re.rawDataSymbol].id}get broadcasterId(){return this[re.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[re.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[re.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,re.checkRelationAssertion)(await this._client.users.getUserById(this[re.rawDataSymbol].broadcaster_id))}get title(){return this[re.rawDataSymbol].title}get status(){return this[re.rawDataSymbol].status}get autoLockAfter(){return this[re.rawDataSymbol].prediction_window}get creationDate(){return new Date(this[re.rawDataSymbol].created_at)}get endDate(){return this[re.rawDataSymbol].ended_at?new Date(this[re.rawDataSymbol].ended_at):null}get lockDate(){return this[re.rawDataSymbol].locked_at?new Date(this[re.rawDataSymbol].locked_at):null}get outcomes(){return this[re.rawDataSymbol].outcomes.map(e=>new Xb.HelixPredictionOutcome(e,this._client))}get winningOutcomeId(){return this[re.rawDataSymbol].winning_outcome_id||null}get winningOutcome(){if(!this[re.rawDataSymbol].winning_outcome_id)return null;let e=this[re.rawDataSymbol].outcomes.find(t=>t.id===this[re.rawDataSymbol].winning_outcome_id);if(!e)throw new re.HellFreezesOverError("Winning outcome not found in outcomes array");return new Xb.HelixPredictionOutcome(e,this._client)}};ha.HelixPrediction=Xl;Yb.__decorate([(0,pD.Enumerable)(!1)],Xl.prototype,"_client",void 0);ha.HelixPrediction=Xl=Yb.__decorate([(0,re.rtfm)("api","HelixPrediction","id")],Xl)});var Np=u(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.HelixPredictionApi=void 0;var _D=(b(),x(g)),ex=Y(),ii=_(),mD=je(),tx=Kb(),yD=oe(),fD=pe(),gD=le(),bD=G(),pa=Lp(),Fp=class extends bD.BaseApi{static{n(this,"HelixPredictionApi")}async getPredictions(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",userId:(0,ii.extractUserId)(e),scopes:["channel:read:predictions"],query:{...(0,ex.createBroadcasterQuery)(e),...(0,gD.createPaginationQuery)(t)}});return(0,fD.createPaginatedResult)(r,pa.HelixPrediction,this._client)}getPredictionsPaginated(e){return new yD.HelixPaginatedRequest({url:"predictions",userId:(0,ii.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,ex.createBroadcasterQuery)(e)},this._client,t=>new pa.HelixPrediction(t,this._client),20)}async getPredictionsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"predictions",userId:(0,ii.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,mD.createGetByIdsQuery)(e,t)})).data.map(a=>new pa.HelixPrediction(a,this._client)):[]}async getPredictionById(e,t){let r=await this.getPredictionsByIds(e,[t]);return r.length?r[0]:null}async createPrediction(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",method:"POST",userId:(0,ii.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,tx.createPredictionBody)(e,t)});return new pa.HelixPrediction(r.data[0],this._client)}async lockPrediction(e,t){return await this._endPrediction(e,t,"LOCKED")}async resolvePrediction(e,t,r){return await this._endPrediction(e,t,"RESOLVED",r)}async cancelPrediction(e,t){return await this._endPrediction(e,t,"CANCELED")}async _endPrediction(e,t,r,a){let s=await this._client.callApi({type:"helix",url:"predictions",method:"PATCH",userId:(0,ii.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,tx.createEndPredictionBody)(e,t,r,a)});return new pa.HelixPrediction(s.data[0],this._client)}};_a.HelixPredictionApi=Fp;_a.HelixPredictionApi=Fp=_D.__decorate([(0,ii.rtfm)("api","HelixPredictionApi")],Fp)});var ix=u(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});Yl.createRaidStartQuery=void 0;var rx=_();function xD(i,e){return{from_broadcaster_id:(0,rx.extractUserId)(i),to_broadcaster_id:(0,rx.extractUserId)(e)}}n(xD,"createRaidStartQuery");Yl.createRaidStartQuery=xD});var Gp=u(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.HelixRaid=void 0;var wD=(b(),x(g)),eu=_(),Qp=class extends eu.DataObject{static{n(this,"HelixRaid")}get creationDate(){return new Date(this[eu.rawDataSymbol].created_at)}get targetIsMature(){return this[eu.rawDataSymbol].is_mature}};ma.HelixRaid=Qp;ma.HelixRaid=Qp=wD.__decorate([(0,eu.rtfm)("api","HelixRaid")],Qp)});var $p=u(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.HelixRaidApi=void 0;var vD=(b(),x(g)),SD=Y(),Wp=_(),HD=ix(),CD=G(),qD=Gp(),Vp=class extends CD.BaseApi{static{n(this,"HelixRaidApi")}async startRaid(e,t){let r=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:(0,Wp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,HD.createRaidStartQuery)(e,t)});return new qD.HelixRaid(r.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:(0,Wp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,SD.createBroadcasterQuery)(e)})}};ya.HelixRaidApi=Vp;ya.HelixRaidApi=Vp=vD.__decorate([(0,Wp.rtfm)("api","HelixRaidApi")],Vp)});var zp=u(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.createScheduleSegmentUpdateBody=Ze.createScheduleSegmentModifyQuery=Ze.createScheduleSegmentBody=Ze.createScheduleSettingsUpdateQuery=Ze.createScheduleQuery=void 0;var tu=_();function ED(i,e){var t;return{broadcaster_id:(0,tu.extractUserId)(i),start_time:e?.startDate,utc_offset:(t=e?.utcOffset)===null||t===void 0?void 0:t.toString()}}n(ED,"createScheduleQuery");Ze.createScheduleQuery=ED;function PD(i,e){return e.vacation?{broadcaster_id:(0,tu.extractUserId)(i),is_vacation_enabled:"true",vacation_start_time:e.vacation.startDate,vacation_end_time:e.vacation.endDate,timezone:e.vacation.timezone}:{broadcaster_id:(0,tu.extractUserId)(i),is_vacation_enabled:"false"}}n(PD,"createScheduleSettingsUpdateQuery");Ze.createScheduleSettingsUpdateQuery=PD;function AD(i){return{start_time:i.startDate,timezone:i.timezone,is_recurring:i.isRecurring,duration:i.duration,category_id:i.categoryId,title:i.title}}n(AD,"createScheduleSegmentBody");Ze.createScheduleSegmentBody=AD;function DD(i,e){return{broadcaster_id:(0,tu.extractUserId)(i),id:e}}n(DD,"createScheduleSegmentModifyQuery");Ze.createScheduleSegmentModifyQuery=DD;function ID(i){return{start_time:i.startDate,timezone:i.timezone,is_canceled:i.isCanceled,duration:i.duration,category_id:i.categoryId,title:i.title}}n(ID,"createScheduleSegmentUpdateBody");Ze.createScheduleSegmentUpdateBody=ID});var ga=u(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.HelixScheduleSegment=void 0;var nx=(b(),x(g)),ax=C(),nt=_(),ru=class extends nt.DataObject{static{n(this,"HelixScheduleSegment")}constructor(e,t){super(e),this._client=t}get id(){return this[nt.rawDataSymbol].id}get startDate(){return new Date(this[nt.rawDataSymbol].start_time)}get endDate(){return new Date(this[nt.rawDataSymbol].end_time)}get title(){return this[nt.rawDataSymbol].title}get cancelEndDate(){return(0,ax.mapNullable)(this[nt.rawDataSymbol].canceled_until,e=>new Date(e))}get categoryId(){var e,t;return(t=(e=this[nt.rawDataSymbol].category)===null||e===void 0?void 0:e.id)!==null&&t!==void 0?t:null}get categoryName(){var e,t;return(t=(e=this[nt.rawDataSymbol].category)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:null}async getCategory(){var e;let t=(e=this[nt.rawDataSymbol].category)===null||e===void 0?void 0:e.id;return t?await this._client.games.getGameById(t):null}get isRecurring(){return this[nt.rawDataSymbol].is_recurring}};fa.HelixScheduleSegment=ru;nx.__decorate([(0,ax.Enumerable)(!1)],ru.prototype,"_client",void 0);fa.HelixScheduleSegment=ru=nx.__decorate([(0,nt.rtfm)("api","HelixScheduleSegment","id")],ru)});var Jp=u(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.HelixPaginatedScheduleSegmentRequest=void 0;var TD=(b(),x(g)),RD=_(),UD=zp(),OD=oe(),BD=ga(),Kp=class extends OD.HelixPaginatedRequest{static{n(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,r){super({url:"schedule",query:(0,UD.createScheduleQuery)(e,r)},t,a=>new BD.HelixScheduleSegment(a,t),25)}async _fetchData(e={}){var t;let r=await super._fetchData(e);return{data:(t=r.data.segments)!==null&&t!==void 0?t:[],pagination:r.pagination}}};ba.HelixPaginatedScheduleSegmentRequest=Kp;ba.HelixPaginatedScheduleSegmentRequest=Kp=TD.__decorate([(0,RD.rtfm)("api","HelixPaginatedScheduleSegmentRequest")],Kp)});var Zp=u(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.HelixSchedule=void 0;var sx=(b(),x(g)),jD=C(),yt=_(),kD=ga(),iu=class extends yt.DataObject{static{n(this,"HelixSchedule")}constructor(e,t){super(e),this._client=t}get segments(){var e,t;return(t=(e=this[yt.rawDataSymbol].segments)===null||e===void 0?void 0:e.map(r=>new kD.HelixScheduleSegment(r,this._client)))!==null&&t!==void 0?t:[]}get broadcasterId(){return this[yt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[yt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[yt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,yt.checkRelationAssertion)(await this._client.users.getUserById(this[yt.rawDataSymbol].broadcaster_id))}get vacationStartDate(){var e;let t=(e=this[yt.rawDataSymbol].vacation)===null||e===void 0?void 0:e.start_time;return t?new Date(t):null}get vacationEndDate(){var e;let t=(e=this[yt.rawDataSymbol].vacation)===null||e===void 0?void 0:e.end_time;return t?new Date(t):null}};xa.HelixSchedule=iu;sx.__decorate([(0,jD.Enumerable)(!1)],iu.prototype,"_client",void 0);xa.HelixSchedule=iu=sx.__decorate([(0,yt.rtfm)("api","HelixSchedule","broadcasterId")],iu)});var e_=u(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.HelixScheduleApi=void 0;var ox=Y(),ni=_(),MD=je(),ai=zp(),LD=le(),FD=G(),ND=Jp(),QD=Zp(),Xp=ga(),Yp=class extends FD.BaseApi{static{n(this,"HelixScheduleApi")}async getSchedule(e,t){let r=await this._client.callApi({type:"helix",url:"schedule",userId:(0,ni.extractUserId)(e),query:{...(0,ai.createScheduleQuery)(e,t),...(0,LD.createPaginationQuery)(t)}});return{data:new QD.HelixSchedule(r.data,this._client),cursor:r.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new ND.HelixPaginatedScheduleSegmentRequest(e,this._client,t)}async getScheduleSegmentsByIds(e,t){var r,a;return(a=(r=(await this._client.callApi({type:"helix",url:"schedule",userId:(0,ni.extractUserId)(e),query:(0,MD.createGetByIdsQuery)(e,t)})).data.segments)===null||r===void 0?void 0:r.map(o=>new Xp.HelixScheduleSegment(o,this._client)))!==null&&a!==void 0?a:[]}async getScheduleSegmentById(e,t){let r=await this.getScheduleSegmentsByIds(e,[t]);return r.length?r[0]:null}async getScheduleAsIcal(e){return await this._client.callApi({type:"helix",url:"schedule/icalendar",query:(0,ox.createBroadcasterQuery)(e)})}async updateScheduleSettings(e,t){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ai.createScheduleSettingsUpdateQuery)(e,t)})}async createScheduleSegment(e,t){let r=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ox.createBroadcasterQuery)(e),jsonBody:(0,ai.createScheduleSegmentBody)(t)});return new Xp.HelixScheduleSegment(r.data.segments[0],this._client)}async updateScheduleSegment(e,t,r){let a=await this._client.callApi({type:"helix",url:"schedule/segment",method:"PATCH",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ai.createScheduleSegmentModifyQuery)(e,t),jsonBody:(0,ai.createScheduleSegmentUpdateBody)(r)});return new Xp.HelixScheduleSegment(a.data.segments[0],this._client)}async deleteScheduleSegment(e,t){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ai.createScheduleSegmentModifyQuery)(e,t)})}};nu.HelixScheduleApi=Yp});var lx=u(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.createSearchChannelsQuery=void 0;function GD(i,e){var t;return{query:i,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}n(GD,"createSearchChannelsQuery");au.createSearchChannelsQuery=GD});var t_=u(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.HelixChannelSearchResult=void 0;var ux=(b(),x(g)),WD=C(),ge=_(),su=class extends ge.DataObject{static{n(this,"HelixChannelSearchResult")}constructor(e,t){super(e),this._client=t}get language(){return this[ge.rawDataSymbol].broadcaster_language}get id(){return this[ge.rawDataSymbol].id}get name(){return this[ge.rawDataSymbol].broadcaster_login}get displayName(){return this[ge.rawDataSymbol].display_name}async getUser(){return(0,ge.checkRelationAssertion)(await this._client.users.getUserById(this[ge.rawDataSymbol].id))}get gameId(){return this[ge.rawDataSymbol].game_id}get gameName(){return this[ge.rawDataSymbol].game_name}async getGame(){return this[ge.rawDataSymbol].game_id?(0,ge.checkRelationAssertion)(await this._client.games.getGameById(this[ge.rawDataSymbol].game_id)):null}get isLive(){return this[ge.rawDataSymbol].is_live}get tags(){return this[ge.rawDataSymbol].tags}get thumbnailUrl(){return this[ge.rawDataSymbol].thumbnail_url}get startDate(){return this[ge.rawDataSymbol].is_live?new Date(this[ge.rawDataSymbol].started_at):null}};wa.HelixChannelSearchResult=su;ux.__decorate([(0,WD.Enumerable)(!1)],su.prototype,"_client",void 0);wa.HelixChannelSearchResult=su=ux.__decorate([(0,ge.rtfm)("api","HelixChannelSearchResult","id")],su)});var i_=u(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.HelixSearchApi=void 0;var VD=(b(),x(g)),$D=_(),cx=lx(),dx=oe(),hx=pe(),px=le(),zD=G(),_x=Ol(),mx=t_(),r_=class extends zD.BaseApi{static{n(this,"HelixSearchApi")}async searchCategories(e,t){let r=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...(0,px.createPaginationQuery)(t)}});return(0,hx.createPaginatedResult)(r,_x.HelixGame,this._client)}searchCategoriesPaginated(e){return new dx.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new _x.HelixGame(t,this._client))}async searchChannels(e,t={}){let r=await this._client.callApi({type:"helix",url:"search/channels",query:{...(0,cx.createSearchChannelsQuery)(e,t),...(0,px.createPaginationQuery)(t)}});return(0,hx.createPaginatedResult)(r,mx.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new dx.HelixPaginatedRequest({url:"search/channels",query:(0,cx.createSearchChannelsQuery)(e,t)},this._client,r=>new mx.HelixChannelSearchResult(r,this._client))}};va.HelixSearchApi=r_;va.HelixSearchApi=r_=VD.__decorate([(0,$D.rtfm)("api","HelixSearchApi")],r_)});var a_=u(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.StreamNotLiveError=void 0;var KD=_(),n_=class extends KD.CustomError{static{n(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};ou.StreamNotLiveError=n_});var yx=u(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.createVideoQuery=Xt.createStreamMarkerBody=Xt.createStreamQuery=void 0;var JD=_();function ZD(i){return{game_id:i.game,language:i.language,type:i.type,user_id:i.userId,user_login:i.userName}}n(ZD,"createStreamQuery");Xt.createStreamQuery=ZD;function XD(i,e){return{user_id:(0,JD.extractUserId)(i),description:e}}n(XD,"createStreamMarkerBody");Xt.createStreamMarkerBody=XD;function YD(i){return{video_id:i}}n(YD,"createVideoQuery");Xt.createVideoQuery=YD});var s_=u(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.HelixStream=void 0;var fx=(b(),x(g)),eI=C(),ie=_(),lu=class extends ie.DataObject{static{n(this,"HelixStream")}constructor(e,t){super(e),this._client=t}get id(){return this[ie.rawDataSymbol].id}get userId(){return this[ie.rawDataSymbol].user_id}get userName(){return this[ie.rawDataSymbol].user_login}get userDisplayName(){return this[ie.rawDataSymbol].user_name}async getUser(){return(0,ie.checkRelationAssertion)(await this._client.users.getUserById(this[ie.rawDataSymbol].user_id))}get gameId(){return this[ie.rawDataSymbol].game_id}get gameName(){return this[ie.rawDataSymbol].game_name}async getGame(){return this[ie.rawDataSymbol].game_id?(0,ie.checkRelationAssertion)(await this._client.games.getGameById(this[ie.rawDataSymbol].game_id)):null}get type(){return this[ie.rawDataSymbol].type}get title(){return this[ie.rawDataSymbol].title}get viewers(){return this[ie.rawDataSymbol].viewer_count}get startDate(){return new Date(this[ie.rawDataSymbol].started_at)}get language(){return this[ie.rawDataSymbol].language}get thumbnailUrl(){return this[ie.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[ie.rawDataSymbol].thumbnail_url.replace("{width}",e.toString()).replace("{height}",t.toString())}get tags(){return this[ie.rawDataSymbol].tags}get isMature(){return this[ie.rawDataSymbol].is_mature}};Sa.HelixStream=lu;fx.__decorate([(0,eI.Enumerable)(!1)],lu.prototype,"_client",void 0);Sa.HelixStream=lu=fx.__decorate([(0,ie.rtfm)("api","HelixStream","id")],lu)});var cu=u(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.HelixStreamMarker=void 0;var gx=(b(),x(g)),tI=C(),si=_(),uu=class extends si.DataObject{static{n(this,"HelixStreamMarker")}constructor(e,t){super(e),this._client=t}get id(){return this[si.rawDataSymbol].id}get creationDate(){return new Date(this[si.rawDataSymbol].created_at)}get description(){return this[si.rawDataSymbol].description}get positionInSeconds(){return this[si.rawDataSymbol].position_seconds}};Ha.HelixStreamMarker=uu;gx.__decorate([(0,tI.Enumerable)(!1)],uu.prototype,"_client",void 0);Ha.HelixStreamMarker=uu=gx.__decorate([(0,si.rtfm)("api","HelixStreamMarker","id")],uu)});var u_=u(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.HelixStreamMarkerWithVideo=void 0;var rI=(b(),x(g)),o_=_(),iI=cu(),l_=class extends iI.HelixStreamMarker{static{n(this,"HelixStreamMarkerWithVideo")}constructor(e,t,r){super(e,r),this._videoId=t}get url(){return this[o_.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,o_.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};Ca.HelixStreamMarkerWithVideo=l_;Ca.HelixStreamMarkerWithVideo=l_=rI.__decorate([(0,o_.rtfm)("api","HelixStreamMarkerWithVideo","id")],l_)});var d_=u(Pa=>{"use strict";var li;Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HelixStreamApi=void 0;var c_=(b(),x(g)),qa=C(),bx=Y(),Ue=_(),nI=a_(),du=je(),oi=yx(),xx=Ft(),hu=oe(),wx=pe(),pu=le(),aI=G(),br=s_(),sI=cu(),oI=u_(),Ea=li=class extends aI.BaseApi{static{n(this,"HelixStreamApi")}constructor(){super(...arguments),this._getStreamByUserIdBatcher=new xx.HelixRequestBatcher({url:"streams"},"user_id","user_id",this._client,e=>new br.HelixStream(e,this._client)),this._getStreamByUserNameBatcher=new xx.HelixRequestBatcher({url:"streams"},"user_login","user_login",this._client,e=>new br.HelixStream(e,this._client))}async getStreams(e={}){let t=await this._client.callApi({url:"streams",type:"helix",query:{...(0,oi.createStreamQuery)(e),...(0,pu.createPaginationQuery)(e)}});return(0,wx.createPaginatedResult)(t,br.HelixStream,this._client)}getStreamsPaginated(e={}){return new hu.HelixPaginatedRequest({url:"streams",query:(0,oi.createStreamQuery)(e)},this._client,t=>new br.HelixStream(t,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(Ue.extractUserName)})).data}async getStreamByUserName(e){var t;return(t=(await this.getStreamsByUserNames([e]))[0])!==null&&t!==void 0?t:null}async getStreamByUserNameBatched(e){return await this._getStreamByUserNameBatcher.request((0,Ue.extractUserName)(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(Ue.extractUserId)})).data}async getStreamByUserId(e){let t=(0,Ue.extractUserId)(e),r=await this._client.callApi({url:"streams",type:"helix",userId:t,query:(0,oi.createStreamQuery)({userId:t})});return(0,qa.mapNullable)(r.data[0],a=>new br.HelixStream(a,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request((0,Ue.extractUserId)(e))}async getStreamMarkersForUser(e,t){var r;let a=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,du.createUserQuery)(e),...(0,pu.createPaginationQuery)(t)},userId:(0,Ue.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,qa.flatten)(a.data.map(s=>li._mapGetStreamMarkersResult(s,this._client))),cursor:(r=a.pagination)===null||r===void 0?void 0:r.cursor}}getStreamMarkersForUserPaginated(e){return new hu.HelixPaginatedRequest({url:"streams/markers",query:(0,du.createUserQuery)(e),userId:(0,Ue.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,t=>li._mapGetStreamMarkersResult(t,this._client))}async getStreamMarkersForVideo(e,t,r){var a;let s=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,oi.createVideoQuery)(t),...(0,pu.createPaginationQuery)(r)},userId:(0,Ue.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,qa.flatten)(s.data.map(o=>li._mapGetStreamMarkersResult(o,this._client))),cursor:(a=s.pagination)===null||a===void 0?void 0:a.cursor}}getStreamMarkersForVideoPaginated(e,t){return new hu.HelixPaginatedRequest({url:"streams/markers",query:(0,oi.createVideoQuery)(t),userId:(0,Ue.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,r=>li._mapGetStreamMarkersResult(r,this._client))}async createStreamMarker(e,t){try{let r=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:(0,Ue.extractUserId)(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:(0,oi.createStreamMarkerBody)(e,t)});return new sI.HelixStreamMarker(r.data[0],this._client)}catch(r){throw r instanceof bx.HttpStatusCodeError&&r.statusCode===404?new nI.StreamNotLiveError({cause:r}):r}}async getStreamKey(e){let t=(0,Ue.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:t,scopes:["channel:read:stream_key"],query:(0,bx.createBroadcasterQuery)(e)})).data[0].stream_key}async getFollowedStreams(e,t){let r=(0,Ue.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"streams/followed",userId:r,scopes:["user:read:follows"],query:{...(0,du.createSingleKeyQuery)("user_id",r),...(0,pu.createPaginationQuery)(t)}});return(0,wx.createPaginatedResult)(a,br.HelixStream,this._client)}getFollowedStreamsPaginated(e){let t=(0,Ue.extractUserId)(e);return new hu.HelixPaginatedRequest({url:"streams/followed",userId:t,scopes:["user:read:follows"],query:(0,du.createSingleKeyQuery)("user_id",t)},this._client,r=>new br.HelixStream(r,this._client))}static _mapGetStreamMarkersResult(e,t){return e.videos.reduce((r,a)=>[...r,...a.markers.map(s=>new oI.HelixStreamMarkerWithVideo(s,a.video_id,t))],[])}};Pa.HelixStreamApi=Ea;c_.__decorate([(0,qa.Enumerable)(!1)],Ea.prototype,"_getStreamByUserIdBatcher",void 0);c_.__decorate([(0,qa.Enumerable)(!1)],Ea.prototype,"_getStreamByUserNameBatcher",void 0);Pa.HelixStreamApi=Ea=li=c_.__decorate([(0,Ue.rtfm)("api","HelixStreamApi")],Ea)});var Sx=u(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.createSubscriptionCheckQuery=void 0;var vx=_();function lI(i,e){return{broadcaster_id:(0,vx.extractUserId)(i),user_id:(0,vx.extractUserId)(e)}}n(lI,"createSubscriptionCheckQuery");_u.createSubscriptionCheckQuery=lI});var yu=u(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.HelixUserSubscription=void 0;var Hx=(b(),x(g)),uI=C(),Yt=_(),mu=class extends Yt.DataObject{static{n(this,"HelixUserSubscription")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Yt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Yt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Yt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[Yt.rawDataSymbol].broadcaster_id)}get isGift(){return this[Yt.rawDataSymbol].is_gift}get tier(){return this[Yt.rawDataSymbol].tier}};Aa.HelixUserSubscription=mu;Hx.__decorate([(0,uI.Enumerable)(!1)],mu.prototype,"_client",void 0);Aa.HelixUserSubscription=mu=Hx.__decorate([(0,Yt.rtfm)("api","HelixUserSubscription","broadcasterId")],mu)});var fu=u(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.HelixSubscription=void 0;var cI=(b(),x(g)),de=_(),dI=yu(),h_=class extends dI.HelixUserSubscription{static{n(this,"HelixSubscription")}get broadcasterId(){return this[de.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[de.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[de.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].broadcaster_id))}get gifterId(){return this[de.rawDataSymbol].is_gift?this[de.rawDataSymbol].gifter_id:null}get gifterName(){return this[de.rawDataSymbol].is_gift?this[de.rawDataSymbol].gifter_login:null}get gifterDisplayName(){return this[de.rawDataSymbol].is_gift?this[de.rawDataSymbol].gifter_name:null}async getGifter(){return this[de.rawDataSymbol].is_gift?(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].gifter_id)):null}get userId(){return this[de.rawDataSymbol].user_id}get userName(){return this[de.rawDataSymbol].user_login}get userDisplayName(){return this[de.rawDataSymbol].user_name}async getUser(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].user_id))}};Da.HelixSubscription=h_;Da.HelixSubscription=h_=cI.__decorate([(0,de.rtfm)("api","HelixSubscription","userId")],h_)});var __=u(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.HelixPaginatedSubscriptionsRequest=void 0;var hI=(b(),x(g)),pI=Y(),Cx=_(),_I=Gr(),mI=fu(),p_=class extends _I.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,Cx.extractUserId)(e),query:(0,pI.createBroadcasterQuery)(e)},t,r=>new mI.HelixSubscription(r,t))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};Ia.HelixPaginatedSubscriptionsRequest=p_;Ia.HelixPaginatedSubscriptionsRequest=p_=hI.__decorate([(0,Cx.rtfm)("api","HelixPaginatedSubscriptionsRequest")],p_)});var y_=u(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.HelixSubscriptionApi=void 0;var yI=(b(),x(g)),qx=Y(),gu=_(),fI=je(),gI=Sx(),bI=pe(),xI=le(),wI=G(),vI=__(),Ex=fu(),SI=yu(),m_=class extends wI.BaseApi{static{n(this,"HelixSubscriptionApi")}async getSubscriptions(e,t){let r=await this._client.callApi({url:"subscriptions",scopes:["channel:read:subscriptions"],type:"helix",userId:(0,gu.extractUserId)(e),query:{...(0,qx.createBroadcasterQuery)(e),...(0,xI.createPaginationQuery)(t)}});return{...(0,bI.createPaginatedResultWithTotal)(r,Ex.HelixSubscription,this._client),points:r.points}}getSubscriptionsPaginated(e){return new vI.HelixPaginatedSubscriptionsRequest(e,this._client)}async getSubscriptionsForUsers(e,t){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:(0,gu.extractUserId)(e),scopes:["channel:read:subscriptions"],query:(0,fI.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Ex.HelixSubscription(a,this._client))}async getSubscriptionForUser(e,t){let r=await this.getSubscriptionsForUsers(e,[t]);return r.length?r[0]:null}async checkUserSubscription(e,t){try{let r=await this._client.callApi({type:"helix",url:"subscriptions/user",userId:(0,gu.extractUserId)(e),scopes:["user:read:subscriptions"],query:(0,gI.createSubscriptionCheckQuery)(t,e)});return new SI.HelixUserSubscription(r.data[0],this._client)}catch(r){if(r instanceof qx.HttpStatusCodeError&&r.statusCode===404)return null;throw r}}};Ta.HelixSubscriptionApi=m_;Ta.HelixSubscriptionApi=m_=yI.__decorate([(0,gu.rtfm)("api","HelixSubscriptionApi")],m_)});var xu=u(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.HelixTeam=void 0;var Px=(b(),x(g)),HI=C(),at=_(),bu=class extends at.DataObject{static{n(this,"HelixTeam")}constructor(e,t){super(e),this._client=t}get id(){return this[at.rawDataSymbol].id}get name(){return this[at.rawDataSymbol].team_name}get displayName(){return this[at.rawDataSymbol].team_display_name}get backgroundImageUrl(){return this[at.rawDataSymbol].background_image_url}get bannerUrl(){return this[at.rawDataSymbol].banner}get creationDate(){return new Date(this[at.rawDataSymbol].created_at)}get updateDate(){return new Date(this[at.rawDataSymbol].updated_at)}get info(){return this[at.rawDataSymbol].info}get logoThumbnailUrl(){return this[at.rawDataSymbol].thumbnail_url}async getUserRelations(){return(await this._client.teams.getTeamById(this.id)).userRelations}};Ra.HelixTeam=bu;Px.__decorate([(0,HI.Enumerable)(!1)],bu.prototype,"_client",void 0);Ra.HelixTeam=bu=Px.__decorate([(0,at.rtfm)("api","HelixTeam","id")],bu)});var g_=u(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.HelixTeamWithUsers=void 0;var CI=(b(),x(g)),Ax=_(),qI=Go(),EI=xu(),f_=class extends EI.HelixTeam{static{n(this,"HelixTeamWithUsers")}get userRelations(){return this[Ax.rawDataSymbol].users.map(e=>new qI.HelixUserRelation(e,this._client))}};Ua.HelixTeamWithUsers=f_;Ua.HelixTeamWithUsers=f_=CI.__decorate([(0,Ax.rtfm)("api","HelixTeamWithUsers","id")],f_)});var w_=u(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.HelixTeamApi=void 0;var PI=(b(),x(g)),b_=Y(),Ix=_(),AI=G(),DI=xu(),Dx=g_(),x_=class extends AI.BaseApi{static{n(this,"HelixTeamApi")}async getTeamsForBroadcaster(e){var t,r;return(r=(t=(await this._client.callApi({type:"helix",url:"teams/channel",userId:(0,Ix.extractUserId)(e),query:(0,b_.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(s=>new DI.HelixTeam(s,this._client)))!==null&&r!==void 0?r:[]}async getTeamById(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{id:e}});return new Dx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof b_.HttpStatusCodeError&&t.statusCode===500)return null;throw t}}async getTeamByName(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{name:e}});return new Dx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof b_.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};Oa.HelixTeamApi=x_;Oa.HelixTeamApi=x_=PI.__decorate([(0,Ix.rtfm)("api","HelixTeamApi")],x_)});var Rx=u(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.createUserBlockDeleteQuery=ui.createUserBlockCreateQuery=void 0;var Tx=_();function II(i,e){return{target_user_id:(0,Tx.extractUserId)(i),source_context:e.sourceContext,reason:e.reason}}n(II,"createUserBlockCreateQuery");ui.createUserBlockCreateQuery=II;function TI(i){return{target_user_id:(0,Tx.extractUserId)(i)}}n(TI,"createUserBlockDeleteQuery");ui.createUserBlockDeleteQuery=TI});var Su=u(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.HelixBaseExtension=void 0;var wu=_(),v_=class extends wu.DataObject{static{n(this,"HelixBaseExtension")}get id(){return this[wu.rawDataSymbol].id}get version(){return this[wu.rawDataSymbol].version}get name(){return this[wu.rawDataSymbol].name}};vu.HelixBaseExtension=v_});var H_=u(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.HelixInstalledExtension=void 0;var RI=(b(),x(g)),UI=_(),OI=Su(),S_=class extends OI.HelixBaseExtension{static{n(this,"HelixInstalledExtension")}constructor(e,t,r){super(r),this._slotType=e,this._slotId=t}get slotType(){return this._slotType}get slotId(){return this._slotId}};Ba.HelixInstalledExtension=S_;Ba.HelixInstalledExtension=S_=RI.__decorate([(0,UI.rtfm)("api","HelixInstalledExtension","id")],S_)});var E_=u(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.HelixInstalledExtensionList=void 0;var BI=(b(),x(g)),ja=_(),C_=H_(),q_=class extends ja.DataObject{static{n(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let r=this[ja.rawDataSymbol][e][t];return r.active?new C_.HelixInstalledExtension(e,t,r):null}getExtensionsForSlotType(e){return[...Object.entries(this[ja.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,r])=>new C_.HelixInstalledExtension(e,t,r))}getAllExtensions(){return[...Object.entries(this[ja.rawDataSymbol])].flatMap(([e,t])=>[...Object.entries(t)].filter(r=>r[1].active).map(([r,a])=>new C_.HelixInstalledExtension(e,r,a)))}};ka.HelixInstalledExtensionList=q_;ka.HelixInstalledExtensionList=q_=BI.__decorate([(0,ja.rtfm)("api","HelixInstalledExtensionList")],q_)});var D_=u(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.HelixUserExtension=void 0;var jI=(b(),x(g)),P_=_(),kI=Su(),A_=class extends kI.HelixBaseExtension{static{n(this,"HelixUserExtension")}get canActivate(){return this[P_.rawDataSymbol].can_activate}get types(){return this[P_.rawDataSymbol].type}};Ma.HelixUserExtension=A_;Ma.HelixUserExtension=A_=jI.__decorate([(0,P_.rtfm)("api","HelixUserExtension","id")],A_)});var Cu=u(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.HelixUser=void 0;var Ux=(b(),x(g)),MI=C(),st=_(),Hu=class extends st.DataObject{static{n(this,"HelixUser")}constructor(e,t){super(e),this._client=t}get id(){return this[st.rawDataSymbol].id}get name(){return this[st.rawDataSymbol].login}get displayName(){return this[st.rawDataSymbol].display_name}get description(){return this[st.rawDataSymbol].description}get type(){return this[st.rawDataSymbol].type}get broadcasterType(){return this[st.rawDataSymbol].broadcaster_type}get profilePictureUrl(){return this[st.rawDataSymbol].profile_image_url}get offlinePlaceholderUrl(){return this[st.rawDataSymbol].offline_image_url}get creationDate(){return new Date(this[st.rawDataSymbol].created_at)}async getStream(){return await this._client.streams.getStreamByUserId(this)}async getFollowedChannels(){return await this._client.channels.getFollowedChannels(this)}async getFollowedChannel(e){var t;return(t=(await this._client.channels.getFollowedChannels(this,e)).data[0])!==null&&t!==void 0?t:null}async follows(e){return await this.getFollowedChannel(e)!==null}async getChannelFollowers(){return await this._client.channels.getChannelFollowers(this)}async getChannelFollower(e){var t;return(t=(await this._client.channels.getChannelFollowers(this,e)).data[0])!==null&&t!==void 0?t:null}async isFollowedBy(e){return await this.getChannelFollower(e)!==null}async getSubscriptionTo(e){return await this._client.subscriptions.checkUserSubscription(this,e)}async isSubscribedTo(e){return await this.getSubscriptionTo(e)!==null}async getSubscriber(e){return await this._client.subscriptions.getSubscriptionForUser(this,e)}async hasSubscriber(e){return await this.getSubscriber(e)!==null}};La.HelixUser=Hu;Ux.__decorate([(0,MI.Enumerable)(!1)],Hu.prototype,"_client",void 0);La.HelixUser=Hu=Ux.__decorate([(0,st.rtfm)("api","HelixUser","id")],Hu)});var T_=u(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.HelixPrivilegedUser=void 0;var LI=(b(),x(g)),Ox=_(),FI=Cu(),I_=class extends FI.HelixUser{static{n(this,"HelixPrivilegedUser")}get email(){return this[Ox.rawDataSymbol].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};Fa.HelixPrivilegedUser=I_;Fa.HelixPrivilegedUser=I_=LI.__decorate([(0,Ox.rtfm)("api","HelixPrivilegedUser","id")],I_)});var R_=u(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.HelixUserBlock=void 0;var Bx=(b(),x(g)),NI=C(),xr=_(),qu=class extends xr.DataObject{static{n(this,"HelixUserBlock")}constructor(e,t){super(e),this._client=t}get userId(){return this[xr.rawDataSymbol].user_id}get userName(){return this[xr.rawDataSymbol].user_login}get userDisplayName(){return this[xr.rawDataSymbol].display_name}async getUser(){return(0,xr.checkRelationAssertion)(await this._client.users.getUserById(this[xr.rawDataSymbol].user_id))}};Na.HelixUserBlock=qu;Bx.__decorate([(0,NI.Enumerable)(!1)],qu.prototype,"_client",void 0);Na.HelixUserBlock=qu=Bx.__decorate([(0,xr.rtfm)("api","HelixUserBlock","userId")],qu)});var B_=u(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.HelixUserApi=void 0;var U_=(b(),x(g)),O_=C(),jx=Y(),we=_(),QI=je(),kx=Rx(),Mx=Ft(),GI=oe(),WI=pe(),VI=le(),$I=G(),Lx=E_(),zI=D_(),Fx=T_(),Eu=Cu(),Nx=R_(),Qa=class extends $I.BaseApi{static{n(this,"HelixUserApi")}constructor(){super(...arguments),this._getUserByIdBatcher=new Mx.HelixRequestBatcher({url:"users"},"id","id",this._client,e=>new Eu.HelixUser(e,this._client)),this._getUserByNameBatcher=new Mx.HelixRequestBatcher({url:"users"},"login","login",this._client,e=>new Eu.HelixUser(e,this._client))}async getUsersByIds(e){return await this._getUsers("id",e.map(we.extractUserId))}async getUsersByNames(e){return await this._getUsers("login",e.map(we.extractUserName))}async getUserById(e){let t=(0,we.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"users",userId:t,query:{id:t}});return(0,O_.mapNullable)(r.data[0],a=>new Eu.HelixUser(a,this._client))}async getUserByIdBatched(e){return await this._getUserByIdBatcher.request((0,we.extractUserId)(e))}async getUserByName(e){let t=await this._getUsers("login",[(0,we.extractUserName)(e)]);return t.length?t[0]:null}async getUserByNameBatched(e){return await this._getUserByNameBatcher.request((0,we.extractUserName)(e))}async getAuthenticatedUser(e,t=!1){var r;let a=await this._client.callApi({type:"helix",url:"users",forceType:"user",userId:(0,we.extractUserId)(e),scopes:t?["user:read:email"]:void 0});if(!(!((r=a.data)===null||r===void 0)&&r.length))throw new we.HellFreezesOverError("Could not get authenticated user");return new Fx.HelixPrivilegedUser(a.data[0],this._client)}async updateAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users",method:"PUT",userId:(0,we.extractUserId)(e),scopes:["user:edit"],query:{description:t.description}});return new Fx.HelixPrivilegedUser(r.data[0],this._client)}async getBlocks(e,t){let r=await this._client.callApi({type:"helix",url:"users/blocks",userId:(0,we.extractUserId)(e),scopes:["user:read:blocked_users"],query:{...(0,jx.createBroadcasterQuery)(e),...(0,VI.createPaginationQuery)(t)}});return(0,WI.createPaginatedResult)(r,Nx.HelixUserBlock,this._client)}getBlocksPaginated(e){return new GI.HelixPaginatedRequest({url:"users/blocks",userId:(0,we.extractUserId)(e),scopes:["user:read:blocked_users"],query:(0,jx.createBroadcasterQuery)(e)},this._client,t=>new Nx.HelixUserBlock(t,this._client))}async createBlock(e,t,r={}){await this._client.callApi({type:"helix",url:"users/blocks",method:"PUT",userId:(0,we.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,kx.createUserBlockCreateQuery)(t,r)})}async deleteBlock(e,t){await this._client.callApi({type:"helix",url:"users/blocks",method:"DELETE",userId:(0,we.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,kx.createUserBlockDeleteQuery)(t)})}async getExtensionsForAuthenticatedUser(e,t=!1){return(await this._client.callApi({type:"helix",url:"users/extensions/list",userId:(0,we.extractUserId)(e),scopes:t?["channel:manage:extensions"]:["user:read:broadcast","channel:manage:extensions"]})).data.map(a=>new zI.HelixUserExtension(a))}async getActiveExtensions(e,t=!1){let r=(0,we.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"users/extensions",userId:r,scopes:t?["user:read:broadcast","channel:manage:extensions"]:void 0,query:(0,QI.createSingleKeyQuery)("user_id",r)});return new Lx.HelixInstalledExtensionList(a.data)}async updateActiveExtensionsForAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users/extensions",method:"PUT",userId:(0,we.extractUserId)(e),scopes:["channel:manage:extensions"],jsonBody:{data:t}});return new Lx.HelixInstalledExtensionList(r.data)}async _getUsers(e,t){if(t.length===0)return[];let r={[e]:t};return(await this._client.callApi({type:"helix",url:"users",query:r})).data.map(s=>new Eu.HelixUser(s,this._client))}};Ga.HelixUserApi=Qa;U_.__decorate([(0,O_.Enumerable)(!1)],Qa.prototype,"_getUserByIdBatcher",void 0);U_.__decorate([(0,O_.Enumerable)(!1)],Qa.prototype,"_getUserByNameBatcher",void 0);Ga.HelixUserApi=Qa=U_.__decorate([(0,we.rtfm)("api","HelixUserApi")],Qa)});var k_=u(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.HelixVideo=void 0;var j_=(b(),x(g)),Qx=Ci(),KI=C(),j=_(),Wa=class extends j.DataObject{static{n(this,"HelixVideo")}constructor(e,t){super(e),this._client=t}get id(){return this[j.rawDataSymbol].id}get userId(){return this[j.rawDataSymbol].user_id}get userName(){return this[j.rawDataSymbol].user_login}get userDisplayName(){return this[j.rawDataSymbol].user_name}async getUser(){return(0,j.checkRelationAssertion)(await this._client.users.getUserById(this[j.rawDataSymbol].user_id))}get title(){return this[j.rawDataSymbol].title}get description(){return this[j.rawDataSymbol].description}get creationDate(){return new Date(this[j.rawDataSymbol].created_at)}get publishDate(){return new Date(this[j.rawDataSymbol].published_at)}get url(){return this[j.rawDataSymbol].url}get thumbnailUrl(){return this[j.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[j.rawDataSymbol].thumbnail_url.replace("%{width}",e.toString()).replace("%{height}",t.toString())}get isPublic(){return this[j.rawDataSymbol].viewable==="public"}get views(){return this[j.rawDataSymbol].view_count}get language(){return this[j.rawDataSymbol].language}get type(){return this[j.rawDataSymbol].type}get duration(){return this[j.rawDataSymbol].duration}get durationInSeconds(){let e=this[j.rawDataSymbol].duration.match(/\d+[hms]/g);if(!e)throw new j.HellFreezesOverError(`Could not parse duration string: ${this[j.rawDataSymbol].duration}`);return e.map(t=>{let r=/(\d+)([hms])/.exec(t);if(!r)throw new j.HellFreezesOverError(`Could not parse partial duration string: ${t}`);let[,a,s]=r;return parseInt(a,10)*{h:3600,m:60,s:1}[s]}).reduce((t,r)=>t+r)}get streamId(){return this[j.rawDataSymbol].stream_id}get mutedSegmentData(){var e,t;return(t=(e=this[j.rawDataSymbol].muted_segments)===null||e===void 0?void 0:e.slice())!==null&&t!==void 0?t:[]}isMutedAt(e,t,r=!1){if(this[j.rawDataSymbol].muted_segments===null)return!1;if(t==null)return this[j.rawDataSymbol].muted_segments.some(s=>s.offset<=e&&e<=s.offset+s.duration);let a=e+t;return r?this[j.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return e<o&&s.offset<a}):this[j.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return s.offset<=e&&a<=o})}};Va.HelixVideo=Wa;j_.__decorate([(0,KI.Enumerable)(!1)],Wa.prototype,"_client",void 0);j_.__decorate([(0,Qx.CachedGetter)()],Wa.prototype,"durationInSeconds",null);Va.HelixVideo=Wa=j_.__decorate([Qx.Cacheable,(0,j.rtfm)("api","HelixVideo","id")],Wa)});var L_=u($a=>{"use strict";var Pu;Object.defineProperty($a,"__esModule",{value:!0});$a.HelixVideoApi=void 0;var Gx=(b(),x(g)),JI=C(),Au=_(),ZI=Ft(),XI=oe(),YI=pe(),e1=le(),t1=G(),M_=k_(),Du=Pu=class extends t1.BaseApi{static{n(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new ZI.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new M_.HelixVideo(e,this._client))}async getVideosByIds(e){return(await this._getVideos("id",e)).data}async getVideoById(e){let t=await this.getVideosByIds([e]);return t.length?t[0]:null}async getVideoByIdBatched(e){return await this._getVideoByIdBatcher.request(e)}async getVideosByUser(e,t={}){let r=(0,Au.extractUserId)(e);return await this._getVideos("user_id",[r],t)}getVideosByUserPaginated(e,t={}){let r=(0,Au.extractUserId)(e);return this._getVideosPaginated("user_id",[r],t)}async getVideosByGame(e,t={}){return await this._getVideos("game_id",[e],t)}getVideosByGamePaginated(e,t={}){return this._getVideosPaginated("game_id",[e],t)}async deleteVideosByIds(e,t){await this._client.callApi({type:"helix",url:"videos",method:"DELETE",scopes:["channel:manage:videos"],userId:(0,Au.extractUserId)(e),query:{id:t}})}async _getVideos(e,t,r={}){if(!t.length)return{data:[]};let a=await this._client.callApi({type:"helix",url:"videos",userId:e==="user_id"?t[0]:void 0,query:{...Pu._makeVideosQuery(e,t,r),...(0,e1.createPaginationQuery)(r)}});return(0,YI.createPaginatedResult)(a,M_.HelixVideo,this._client)}_getVideosPaginated(e,t,r={}){return new XI.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:Pu._makeVideosQuery(e,t,r)},this._client,a=>new M_.HelixVideo(a,this._client))}static _makeVideosQuery(e,t,r={}){let{language:a,period:s,orderBy:o,type:l}=r;return{[e]:t,language:a,period:s,sort:o,type:l}}};$a.HelixVideoApi=Du;Gx.__decorate([(0,JI.Enumerable)(!1)],Du.prototype,"_getVideoByIdBatcher",void 0);$a.HelixVideoApi=Du=Pu=Gx.__decorate([(0,Au.rtfm)("api","HelixVideoApi")],Du)});var Vx=u(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.createWhisperQuery=void 0;var Wx=_();function r1(i,e){return{from_user_id:(0,Wx.extractUserId)(i),to_user_id:(0,Wx.extractUserId)(e)}}n(r1,"createWhisperQuery");Iu.createWhisperQuery=r1});var N_=u(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.HelixWhisperApi=void 0;var i1=(b(),x(g)),$x=_(),n1=Vx(),a1=G(),F_=class extends a1.BaseApi{static{n(this,"HelixWhisperApi")}async sendWhisper(e,t,r){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:(0,$x.extractUserId)(e),scopes:["user:manage:whispers"],query:(0,n1.createWhisperQuery)(e,t),jsonBody:{message:r}})}};za.HelixWhisperApi=F_;za.HelixWhisperApi=F_=i1.__decorate([(0,$x.rtfm)("api","HelixWhisperApi")],F_)});var G_=u(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.ApiReportedRequest=void 0;var Q_=class{static{n(this,"ApiReportedRequest")}constructor(e,t,r){this._options=e,this._httpStatus=t,this._resolvedUserId=r}get options(){return this._options}get httpStatus(){return this._httpStatus}get resolvedUserId(){return this._resolvedUserId}};Tu.ApiReportedRequest=Q_});var Uu=u(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.BaseApiClient=void 0;var W=(b(),x(g)),V=Ci(),s1=io(),o1=C(),l1=hd(),ci=Y(),Ru=Dd(),zx=_(),u1=lg(),c1=kd(),d1=Xd(),h1=rh(),p1=lh(),_1=Dh(),m1=Uh(),y1=kh(),f1=Qh(),g1=Xh(),b1=ap(),x1=lp(),w1=dp(),v1=mp(),S1=Tp(),H1=jp(),C1=Np(),q1=$p(),E1=e_(),P1=i_(),A1=d_(),D1=y_(),I1=w_(),T1=B_(),R1=L_(),U1=N_(),O1=G_(),N=class extends l1.EventEmitter{static{n(this,"BaseApiClient")}constructor(e,t,r){super(),this.onRequest=this.registerEvent(),this._config=e,this._logger=t,this._rateLimiter=r}async requestScopesForUser(e,t){await this._config.authProvider.getAccessTokenForUser(e,...t.map(r=>[r]))}async getTokenInfo(){try{let e=await this.callApi({type:"auth",url:"validate"});return new Ru.TokenInfo(e)}catch(e){throw e instanceof ci.HttpStatusCodeError&&e.statusCode===401?new Ru.InvalidTokenError({cause:e}):e}}async callApi(e){var t;let{authProvider:r}=this._config;if(!((t=e.auth)!==null&&t!==void 0?t:!0))return await(0,ci.callTwitchApi)(e,r.clientId,void 0,void 0,this._config.fetchOptions);let s=!1;if(e.forceType)switch(e.forceType){case"app":{if(!r.getAppAccessToken)throw new Error("Tried to make an API call that requires an app access token but your auth provider does not support that");let d=await r.getAppAccessToken();return await this._callApiUsingInitialToken(e,d)}case"user":{s=!0;break}default:throw new zx.HellFreezesOverError(`Unknown forced token type: ${e.forceType}`)}if(e.scopes&&(s=!0),s){let d=e.canOverrideScopedUserContext?this._getUserIdFromRequestContext(e.userId):e.userId;if(!d)throw new Error("Tried to make an API call with a user context but no context user ID");let p=await r.getAccessTokenForUser(d,e.scopes);if(!p)throw new Error(`Tried to make an API call with a user context for user ID ${d} but no token was found`);if((0,Ru.accessTokenIsExpired)(p)&&r.refreshAccessTokenForUser){let h=await r.refreshAccessTokenForUser(d);return await this._callApiUsingInitialToken(e,h,!0)}return await this._callApiUsingInitialToken(e,p)}let o=this._getUserIdFromRequestContext(e.userId),l=o===null?await r.getAnyAccessToken():await r.getAnyAccessToken(o??e.userId);if((0,Ru.accessTokenIsExpired)(l)&&l.userId&&r.refreshAccessTokenForUser){let d=await r.refreshAccessTokenForUser(l.userId);return await this._callApiUsingInitialToken(e,d,!0)}return await this._callApiUsingInitialToken(e,l)}get bits(){return new c1.HelixBitsApi(this)}get channels(){return new d1.HelixChannelApi(this)}get channelPoints(){return new h1.HelixChannelPointsApi(this)}get charity(){return new p1.HelixCharityApi(this)}get chat(){return new _1.HelixChatApi(this)}get clips(){return new m1.HelixClipApi(this)}get contentClassificationLabels(){return new y1.HelixContentClassificationLabelApi(this)}get entitlements(){return new f1.HelixEntitlementApi(this)}get eventSub(){return new g1.HelixEventSubApi(this)}get extensions(){return new b1.HelixExtensionsApi(this)}get games(){return new x1.HelixGameApi(this)}get hypeTrain(){return new v1.HelixHypeTrainApi(this)}get goals(){return new w1.HelixGoalApi(this)}get moderation(){return new S1.HelixModerationApi(this)}get polls(){return new H1.HelixPollApi(this)}get predictions(){return new C1.HelixPredictionApi(this)}get raids(){return new q1.HelixRaidApi(this)}get schedule(){return new E1.HelixScheduleApi(this)}get search(){return new P1.HelixSearchApi(this)}get streams(){return new A1.HelixStreamApi(this)}get subscriptions(){return new D1.HelixSubscriptionApi(this)}get teams(){return new I1.HelixTeamApi(this)}get users(){return new T1.HelixUserApi(this)}get videos(){return new R1.HelixVideoApi(this)}get whispers(){return new U1.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof s1.ResponseBasedRateLimiter?this._rateLimiter.stats:null}get _authProvider(){return this._config.authProvider}get _mockServerPort(){return this._config.mockServerPort}get _batchDelay(){var e;return(e=this._config.batchDelay)!==null&&e!==void 0?e:0}_getUserIdFromRequestContext(e){return e}async _callApiUsingInitialToken(e,t,r=!1){var a;let{authProvider:s}=this._config,{authorizationType:o}=s,l=await this._callApiInternal(e,s.clientId,t.accessToken,o);if(l.status===401&&!r){if(t.userId){if(s.refreshAccessTokenForUser){let d=await s.refreshAccessTokenForUser(t.userId);l=await this._callApiInternal(e,s.clientId,d.accessToken,o)}}else if(s.getAppAccessToken){let d=await s.getAppAccessToken(!0);l=await this._callApiInternal(e,s.clientId,d.accessToken,o)}}return this.emit(this.onRequest,new O1.ApiReportedRequest(e,l.status,(a=t.userId)!==null&&a!==void 0?a:null)),await(0,ci.handleTwitchApiResponseError)(l,e),await(0,ci.transformTwitchApiResponse)(l)}async _callApiInternal(e,t,r,a){var s,o,l;let{fetchOptions:d,mockServerPort:p}=this._config,h=(s=e.type)!==null&&s!==void 0?s:"helix";this._logger.debug(`Calling ${h} API: ${(o=e.method)!==null&&o!==void 0?o:"GET"} ${e.url}`),this._logger.trace(`Query: ${JSON.stringify(e.query)}`),e.jsonBody&&this._logger.trace(`Request body: ${JSON.stringify(e.jsonBody)}`);let w=u1.operation({retries:3,minTimeout:500,factor:2}),{promise:E,resolve:P,reject:y}=(0,o1.promiseWithResolvers)();w.attempt(async()=>{try{let v=h==="helix"?await this._rateLimiter.request({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:d,mockServerPort:p}):await(0,ci.callTwitchApiRaw)(e,t,r,a,d,p);!v.ok&&v.status>=500&&v.status<600&&await(0,ci.handleTwitchApiResponseError)(v,e),P(v)}catch(v){if(w.retry(v))return;y(w.mainError())}});let q=await E;return this._logger.debug(`Called ${h} API: ${(l=e.method)!==null&&l!==void 0?l:"GET"} ${e.url} - result: ${q.status}`),q}};Ka.BaseApiClient=N;W.__decorate([(0,V.CachedGetter)()],N.prototype,"bits",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"channels",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"channelPoints",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"charity",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"chat",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"clips",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"contentClassificationLabels",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"entitlements",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"eventSub",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"extensions",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"games",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"hypeTrain",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"goals",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"moderation",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"polls",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"predictions",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"raids",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"schedule",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"search",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"streams",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"subscriptions",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"teams",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"users",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"videos",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"whispers",null);Ka.BaseApiClient=N=W.__decorate([V.Cacheable,(0,zx.rtfm)("api","ApiClient")],N)});var Kx=u(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.NoContextApiClient=void 0;var B1=(b(),x(g)),j1=_(),k1=Uu(),W_=class extends k1.BaseApiClient{static{n(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};Ja.NoContextApiClient=W_;Ja.NoContextApiClient=W_=B1.__decorate([(0,j1.rtfm)("api","ApiClient")],W_)});var Jx=u(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.UserContextApiClient=void 0;var M1=(b(),x(g)),L1=_(),F1=Uu(),V_=class extends F1.BaseApiClient{static{n(this,"UserContextApiClient")}constructor(e,t,r,a){super(e,t,r),this._userId=a}_getUserIdFromRequestContext(){return this._userId}};Za.UserContextApiClient=V_;Za.UserContextApiClient=V_=M1.__decorate([(0,L1.rtfm)("api","ApiClient")],V_)});var ew=u(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.ApiClient=void 0;var N1=(b(),x(g)),Q1=fi(),G1=bi(),Zx=io(),W1=Y(),Yx=_(),V1=od(),$1=Mf(),z1=Uu(),K1=Kx(),Xx=Jx(),$_=class extends z1.BaseApiClient{static{n(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new V1.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,G1.createLogger)({name:"twurple:api:client",...e.logger}),Q1.isNode?new Zx.PartitionedRateLimiter({getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey"),createChild:n(()=>new $1.HelixRateLimiter({logger:t}),"createChild")}):new Zx.PartitionedTimeBasedRateLimiter({logger:t,bucketSize:800,timeFrame:64e3,doRequest:n(async({options:r,clientId:a,accessToken:s,authorizationType:o,fetchOptions:l,mockServerPort:d})=>await(0,W1.callTwitchApiRaw)(r,a,s,o,l,d),"doRequest"),getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey")}))}async asUser(e,t){let r=new Xx.UserContextApiClient(this._config,this._logger,this._rateLimiter,(0,Yx.extractUserId)(e));return await t(r)}async asIntent(e,t){if(!this._authProvider.getAccessTokenForIntent)throw new Error("Trying to use intents with an auth provider that does not support them");for(let r of e){let a=await this._authProvider.getAccessTokenForIntent(r);if(a){let s=new Xx.UserContextApiClient(this._config,this._logger,this._rateLimiter,a.userId);return await t(s)}}throw new Error(`Intents [${e.join(", ")}] not found in auth provider`)}async withoutUser(e){let t=new K1.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};Xa.ApiClient=$_;Xa.ApiClient=$_=N1.__decorate([(0,Yx.rtfm)("api","ApiClient")],$_)});var rw=u(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});Ya.HelixFollow=void 0;var tw=(b(),x(g)),J1=C(),Le=_(),Ou=class extends Le.DataObject{static{n(this,"HelixFollow")}constructor(e,t){super(e),this._client=t}get userId(){return this[Le.rawDataSymbol].from_id}get userName(){return this[Le.rawDataSymbol].from_login}get userDisplayName(){return this[Le.rawDataSymbol].from_name}async getUser(){return(0,Le.checkRelationAssertion)(await this._client.users.getUserById(this[Le.rawDataSymbol].from_id))}get followedUserId(){return this[Le.rawDataSymbol].to_id}get followedUserName(){return this[Le.rawDataSymbol].to_login}get followedUserDisplayName(){return this[Le.rawDataSymbol].to_name}async getFollowedUser(){return(0,Le.checkRelationAssertion)(await this._client.users.getUserById(this[Le.rawDataSymbol].to_id))}get followDate(){return new Date(this[Le.rawDataSymbol].followed_at)}};Ya.HelixFollow=Ou;tw.__decorate([(0,J1.Enumerable)(!1)],Ou.prototype,"_client",void 0);Ya.HelixFollow=Ou=tw.__decorate([(0,Le.rtfm)("api","HelixFollow")],Ou)});var iw=u(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.HelixGoal=c.HelixGoalApi=c.HelixGame=c.HelixGameApi=c.HelixExtensionTransaction=c.HelixExtensionBitsProduct=c.HelixExtensionsApi=c.HelixPaginatedEventSubSubscriptionsRequest=c.HelixEventSubSubscription=c.HelixEventSubConduitShard=c.HelixEventSubConduit=c.HelixEventSubApi=c.HelixDropsEntitlement=c.HelixEntitlementApi=c.HelixContentClassificationLabel=c.HelixContentClassificationLabelApi=c.HelixClip=c.HelixClipApi=c.HelixSharedChatSession=c.HelixSharedChatSessionParticipant=c.HelixSentChatMessage=c.HelixPrivilegedChatSettings=c.HelixUserEmote=c.HelixEmoteFromSet=c.HelixChannelEmote=c.HelixEmote=c.HelixChatChatter=c.HelixChatSettings=c.HelixChatBadgeVersion=c.HelixChatBadgeSet=c.HelixChatApi=c.HelixCharityCampaignAmount=c.HelixCharityCampaignDonation=c.HelixCharityCampaign=c.HelixCharityApi=c.HelixCustomRewardRedemption=c.HelixCustomReward=c.HelixChannelPointsApi=c.HelixChannelReference=c.HelixFollowedChannel=c.HelixChannelFollower=c.HelixChannelEditor=c.HelixChannel=c.HelixAdSchedule=c.HelixChannelApi=c.HelixCheermoteList=c.HelixBitsLeaderboardEntry=c.HelixBitsLeaderboard=c.HelixBitsApi=c.ApiClient=void 0;c.HelixVideo=c.HelixVideoApi=c.HelixUserExtension=c.HelixInstalledExtensionList=c.HelixInstalledExtension=c.HelixBaseExtension=c.HelixUser=c.HelixPrivilegedUser=c.HelixFollow=c.HelixUserBlock=c.HelixUserApi=c.HelixTeamWithUsers=c.HelixTeam=c.HelixTeamApi=c.HelixUserSubscription=c.HelixSubscription=c.HelixSubscriptionApi=c.HelixPaginatedSubscriptionsRequest=c.HelixStreamMarkerWithVideo=c.HelixStreamMarker=c.HelixStream=c.HelixStreamApi=c.HelixChannelSearchResult=c.HelixSearchApi=c.HelixPaginatedScheduleSegmentRequest=c.HelixScheduleSegment=c.HelixSchedule=c.HelixScheduleApi=c.HelixUserRelation=c.HelixRaid=c.HelixRaidApi=c.HelixPredictor=c.HelixPredictionOutcome=c.HelixPrediction=c.HelixPredictionApi=c.HelixPollChoice=c.HelixPoll=c.HelixPollApi=c.HelixWarning=c.HelixUnbanRequest=c.HelixShieldModeStatus=c.HelixBlockedTerm=c.HelixBanUser=c.HelixModeratedChannel=c.HelixModerator=c.HelixBan=c.HelixModerationApi=c.HelixHypeTrainEvent=c.HelixHypeTrainContribution=c.HelixHypeTrainApi=void 0;c.HellFreezesOverError=c.HelixExtension=c.extractUserName=c.extractUserId=c.HelixPaginatedRequestWithTotal=c.HelixPaginatedRequest=c.ApiReportedRequest=c.StreamNotLiveError=c.ConfigError=c.HelixWhisperApi=void 0;var Z1=ew();Object.defineProperty(c,"ApiClient",{enumerable:!0,get:n(function(){return Z1.ApiClient},"get")});var X1=kd();Object.defineProperty(c,"HelixBitsApi",{enumerable:!0,get:n(function(){return X1.HelixBitsApi},"get")});var Y1=Rd();Object.defineProperty(c,"HelixBitsLeaderboard",{enumerable:!0,get:n(function(){return Y1.HelixBitsLeaderboard},"get")});var eT=Id();Object.defineProperty(c,"HelixBitsLeaderboardEntry",{enumerable:!0,get:n(function(){return eT.HelixBitsLeaderboardEntry},"get")});var tT=Od();Object.defineProperty(c,"HelixCheermoteList",{enumerable:!0,get:n(function(){return tT.HelixCheermoteList},"get")});var rT=Xd();Object.defineProperty(c,"HelixChannelApi",{enumerable:!0,get:n(function(){return rT.HelixChannelApi},"get")});var iT=$d();Object.defineProperty(c,"HelixAdSchedule",{enumerable:!0,get:n(function(){return iT.HelixAdSchedule},"get")});var nT=Nd();Object.defineProperty(c,"HelixChannel",{enumerable:!0,get:n(function(){return nT.HelixChannel},"get")});var aT=Qd();Object.defineProperty(c,"HelixChannelEditor",{enumerable:!0,get:n(function(){return aT.HelixChannelEditor},"get")});var sT=Gd();Object.defineProperty(c,"HelixChannelFollower",{enumerable:!0,get:n(function(){return sT.HelixChannelFollower},"get")});var oT=Wd();Object.defineProperty(c,"HelixFollowedChannel",{enumerable:!0,get:n(function(){return oT.HelixFollowedChannel},"get")});var lT=Yh();Object.defineProperty(c,"HelixChannelReference",{enumerable:!0,get:n(function(){return lT.HelixChannelReference},"get")});var uT=rh();Object.defineProperty(c,"HelixChannelPointsApi",{enumerable:!0,get:n(function(){return uT.HelixChannelPointsApi},"get")});var cT=Yd();Object.defineProperty(c,"HelixCustomReward",{enumerable:!0,get:n(function(){return cT.HelixCustomReward},"get")});var dT=eh();Object.defineProperty(c,"HelixCustomRewardRedemption",{enumerable:!0,get:n(function(){return dT.HelixCustomRewardRedemption},"get")});var hT=lh();Object.defineProperty(c,"HelixCharityApi",{enumerable:!0,get:n(function(){return hT.HelixCharityApi},"get")});var pT=nh();Object.defineProperty(c,"HelixCharityCampaign",{enumerable:!0,get:n(function(){return pT.HelixCharityCampaign},"get")});var _T=ah();Object.defineProperty(c,"HelixCharityCampaignDonation",{enumerable:!0,get:n(function(){return _T.HelixCharityCampaignDonation},"get")});var mT=sl();Object.defineProperty(c,"HelixCharityCampaignAmount",{enumerable:!0,get:n(function(){return mT.HelixCharityCampaignAmount},"get")});var yT=Dh();Object.defineProperty(c,"HelixChatApi",{enumerable:!0,get:n(function(){return yT.HelixChatApi},"get")});var fT=yh();Object.defineProperty(c,"HelixChatBadgeSet",{enumerable:!0,get:n(function(){return fT.HelixChatBadgeSet},"get")});var gT=mh();Object.defineProperty(c,"HelixChatBadgeVersion",{enumerable:!0,get:n(function(){return gT.HelixChatBadgeVersion},"get")});var bT=_l();Object.defineProperty(c,"HelixChatSettings",{enumerable:!0,get:n(function(){return bT.HelixChatSettings},"get")});var xT=fh();Object.defineProperty(c,"HelixChatChatter",{enumerable:!0,get:n(function(){return xT.HelixChatChatter},"get")});var wT=on();Object.defineProperty(c,"HelixEmote",{enumerable:!0,get:n(function(){return wT.HelixEmote},"get")});var vT=ph();Object.defineProperty(c,"HelixChannelEmote",{enumerable:!0,get:n(function(){return vT.HelixChannelEmote},"get")});var ST=bh();Object.defineProperty(c,"HelixEmoteFromSet",{enumerable:!0,get:n(function(){return ST.HelixEmoteFromSet},"get")});var HT=xh();Object.defineProperty(c,"HelixUserEmote",{enumerable:!0,get:n(function(){return HT.HelixUserEmote},"get")});var CT=Sh();Object.defineProperty(c,"HelixPrivilegedChatSettings",{enumerable:!0,get:n(function(){return CT.HelixPrivilegedChatSettings},"get")});var qT=Ch();Object.defineProperty(c,"HelixSentChatMessage",{enumerable:!0,get:n(function(){return qT.HelixSentChatMessage},"get")});var ET=qh();Object.defineProperty(c,"HelixSharedChatSessionParticipant",{enumerable:!0,get:n(function(){return ET.HelixSharedChatSessionParticipant},"get")});var PT=Eh();Object.defineProperty(c,"HelixSharedChatSession",{enumerable:!0,get:n(function(){return PT.HelixSharedChatSession},"get")});var AT=Uh();Object.defineProperty(c,"HelixClipApi",{enumerable:!0,get:n(function(){return AT.HelixClipApi},"get")});var DT=Ih();Object.defineProperty(c,"HelixClip",{enumerable:!0,get:n(function(){return DT.HelixClip},"get")});var IT=kh();Object.defineProperty(c,"HelixContentClassificationLabelApi",{enumerable:!0,get:n(function(){return IT.HelixContentClassificationLabelApi},"get")});var TT=Bh();Object.defineProperty(c,"HelixContentClassificationLabel",{enumerable:!0,get:n(function(){return TT.HelixContentClassificationLabel},"get")});var RT=Qh();Object.defineProperty(c,"HelixEntitlementApi",{enumerable:!0,get:n(function(){return RT.HelixEntitlementApi},"get")});var UT=Mh();Object.defineProperty(c,"HelixDropsEntitlement",{enumerable:!0,get:n(function(){return UT.HelixDropsEntitlement},"get")});var OT=Xh();Object.defineProperty(c,"HelixEventSubApi",{enumerable:!0,get:n(function(){return OT.HelixEventSubApi},"get")});var BT=Vh();Object.defineProperty(c,"HelixEventSubConduit",{enumerable:!0,get:n(function(){return BT.HelixEventSubConduit},"get")});var jT=zh();Object.defineProperty(c,"HelixEventSubConduitShard",{enumerable:!0,get:n(function(){return jT.HelixEventSubConduitShard},"get")});var kT=Pl();Object.defineProperty(c,"HelixEventSubSubscription",{enumerable:!0,get:n(function(){return kT.HelixEventSubSubscription},"get")});var MT=Wh();Object.defineProperty(c,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:n(function(){return MT.HelixPaginatedEventSubSubscriptionsRequest},"get")});var LT=ap();Object.defineProperty(c,"HelixExtensionsApi",{enumerable:!0,get:n(function(){return LT.HelixExtensionsApi},"get")});var FT=tp();Object.defineProperty(c,"HelixExtensionBitsProduct",{enumerable:!0,get:n(function(){return FT.HelixExtensionBitsProduct},"get")});var NT=rp();Object.defineProperty(c,"HelixExtensionTransaction",{enumerable:!0,get:n(function(){return NT.HelixExtensionTransaction},"get")});var QT=lp();Object.defineProperty(c,"HelixGameApi",{enumerable:!0,get:n(function(){return QT.HelixGameApi},"get")});var GT=Ol();Object.defineProperty(c,"HelixGame",{enumerable:!0,get:n(function(){return GT.HelixGame},"get")});var WT=dp();Object.defineProperty(c,"HelixGoalApi",{enumerable:!0,get:n(function(){return WT.HelixGoalApi},"get")});var VT=up();Object.defineProperty(c,"HelixGoal",{enumerable:!0,get:n(function(){return VT.HelixGoal},"get")});var $T=mp();Object.defineProperty(c,"HelixHypeTrainApi",{enumerable:!0,get:n(function(){return $T.HelixHypeTrainApi},"get")});var zT=hp();Object.defineProperty(c,"HelixHypeTrainContribution",{enumerable:!0,get:n(function(){return zT.HelixHypeTrainContribution},"get")});var KT=pp();Object.defineProperty(c,"HelixHypeTrainEvent",{enumerable:!0,get:n(function(){return KT.HelixHypeTrainEvent},"get")});var JT=Tp();Object.defineProperty(c,"HelixModerationApi",{enumerable:!0,get:n(function(){return JT.HelixModerationApi},"get")});var ZT=wp();Object.defineProperty(c,"HelixBan",{enumerable:!0,get:n(function(){return ZT.HelixBan},"get")});var XT=Cp();Object.defineProperty(c,"HelixModerator",{enumerable:!0,get:n(function(){return XT.HelixModerator},"get")});var YT=Hp();Object.defineProperty(c,"HelixModeratedChannel",{enumerable:!0,get:n(function(){return YT.HelixModeratedChannel},"get")});var eR=Nl();Object.defineProperty(c,"HelixBanUser",{enumerable:!0,get:n(function(){return eR.HelixBanUser},"get")});var tR=Sp();Object.defineProperty(c,"HelixBlockedTerm",{enumerable:!0,get:n(function(){return tR.HelixBlockedTerm},"get")});var rR=qp();Object.defineProperty(c,"HelixShieldModeStatus",{enumerable:!0,get:n(function(){return rR.HelixShieldModeStatus},"get")});var iR=Ep();Object.defineProperty(c,"HelixUnbanRequest",{enumerable:!0,get:n(function(){return iR.HelixUnbanRequest},"get")});var nR=Pp();Object.defineProperty(c,"HelixWarning",{enumerable:!0,get:n(function(){return nR.HelixWarning},"get")});var aR=jp();Object.defineProperty(c,"HelixPollApi",{enumerable:!0,get:n(function(){return aR.HelixPollApi},"get")});var sR=Op();Object.defineProperty(c,"HelixPoll",{enumerable:!0,get:n(function(){return sR.HelixPoll},"get")});var oR=Up();Object.defineProperty(c,"HelixPollChoice",{enumerable:!0,get:n(function(){return oR.HelixPollChoice},"get")});var lR=Np();Object.defineProperty(c,"HelixPredictionApi",{enumerable:!0,get:n(function(){return lR.HelixPredictionApi},"get")});var uR=Lp();Object.defineProperty(c,"HelixPrediction",{enumerable:!0,get:n(function(){return uR.HelixPrediction},"get")});var cR=Mp();Object.defineProperty(c,"HelixPredictionOutcome",{enumerable:!0,get:n(function(){return cR.HelixPredictionOutcome},"get")});var dR=kp();Object.defineProperty(c,"HelixPredictor",{enumerable:!0,get:n(function(){return dR.HelixPredictor},"get")});var hR=$p();Object.defineProperty(c,"HelixRaidApi",{enumerable:!0,get:n(function(){return hR.HelixRaidApi},"get")});var pR=Gp();Object.defineProperty(c,"HelixRaid",{enumerable:!0,get:n(function(){return pR.HelixRaid},"get")});var _R=Go();Object.defineProperty(c,"HelixUserRelation",{enumerable:!0,get:n(function(){return _R.HelixUserRelation},"get")});var mR=e_();Object.defineProperty(c,"HelixScheduleApi",{enumerable:!0,get:n(function(){return mR.HelixScheduleApi},"get")});var yR=Zp();Object.defineProperty(c,"HelixSchedule",{enumerable:!0,get:n(function(){return yR.HelixSchedule},"get")});var fR=ga();Object.defineProperty(c,"HelixScheduleSegment",{enumerable:!0,get:n(function(){return fR.HelixScheduleSegment},"get")});var gR=Jp();Object.defineProperty(c,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:n(function(){return gR.HelixPaginatedScheduleSegmentRequest},"get")});var bR=i_();Object.defineProperty(c,"HelixSearchApi",{enumerable:!0,get:n(function(){return bR.HelixSearchApi},"get")});var xR=t_();Object.defineProperty(c,"HelixChannelSearchResult",{enumerable:!0,get:n(function(){return xR.HelixChannelSearchResult},"get")});var wR=d_();Object.defineProperty(c,"HelixStreamApi",{enumerable:!0,get:n(function(){return wR.HelixStreamApi},"get")});var vR=s_();Object.defineProperty(c,"HelixStream",{enumerable:!0,get:n(function(){return vR.HelixStream},"get")});var SR=cu();Object.defineProperty(c,"HelixStreamMarker",{enumerable:!0,get:n(function(){return SR.HelixStreamMarker},"get")});var HR=u_();Object.defineProperty(c,"HelixStreamMarkerWithVideo",{enumerable:!0,get:n(function(){return HR.HelixStreamMarkerWithVideo},"get")});var CR=__();Object.defineProperty(c,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:n(function(){return CR.HelixPaginatedSubscriptionsRequest},"get")});var qR=y_();Object.defineProperty(c,"HelixSubscriptionApi",{enumerable:!0,get:n(function(){return qR.HelixSubscriptionApi},"get")});var ER=fu();Object.defineProperty(c,"HelixSubscription",{enumerable:!0,get:n(function(){return ER.HelixSubscription},"get")});var PR=yu();Object.defineProperty(c,"HelixUserSubscription",{enumerable:!0,get:n(function(){return PR.HelixUserSubscription},"get")});var AR=w_();Object.defineProperty(c,"HelixTeamApi",{enumerable:!0,get:n(function(){return AR.HelixTeamApi},"get")});var DR=xu();Object.defineProperty(c,"HelixTeam",{enumerable:!0,get:n(function(){return DR.HelixTeam},"get")});var IR=g_();Object.defineProperty(c,"HelixTeamWithUsers",{enumerable:!0,get:n(function(){return IR.HelixTeamWithUsers},"get")});var TR=B_();Object.defineProperty(c,"HelixUserApi",{enumerable:!0,get:n(function(){return TR.HelixUserApi},"get")});var RR=R_();Object.defineProperty(c,"HelixUserBlock",{enumerable:!0,get:n(function(){return RR.HelixUserBlock},"get")});var UR=rw();Object.defineProperty(c,"HelixFollow",{enumerable:!0,get:n(function(){return UR.HelixFollow},"get")});var OR=T_();Object.defineProperty(c,"HelixPrivilegedUser",{enumerable:!0,get:n(function(){return OR.HelixPrivilegedUser},"get")});var BR=Cu();Object.defineProperty(c,"HelixUser",{enumerable:!0,get:n(function(){return BR.HelixUser},"get")});var jR=Su();Object.defineProperty(c,"HelixBaseExtension",{enumerable:!0,get:n(function(){return jR.HelixBaseExtension},"get")});var kR=H_();Object.defineProperty(c,"HelixInstalledExtension",{enumerable:!0,get:n(function(){return kR.HelixInstalledExtension},"get")});var MR=E_();Object.defineProperty(c,"HelixInstalledExtensionList",{enumerable:!0,get:n(function(){return MR.HelixInstalledExtensionList},"get")});var LR=D_();Object.defineProperty(c,"HelixUserExtension",{enumerable:!0,get:n(function(){return LR.HelixUserExtension},"get")});var FR=L_();Object.defineProperty(c,"HelixVideoApi",{enumerable:!0,get:n(function(){return FR.HelixVideoApi},"get")});var NR=k_();Object.defineProperty(c,"HelixVideo",{enumerable:!0,get:n(function(){return NR.HelixVideo},"get")});var QR=N_();Object.defineProperty(c,"HelixWhisperApi",{enumerable:!0,get:n(function(){return QR.HelixWhisperApi},"get")});var GR=od();Object.defineProperty(c,"ConfigError",{enumerable:!0,get:n(function(){return GR.ConfigError},"get")});var WR=a_();Object.defineProperty(c,"StreamNotLiveError",{enumerable:!0,get:n(function(){return WR.StreamNotLiveError},"get")});var VR=G_();Object.defineProperty(c,"ApiReportedRequest",{enumerable:!0,get:n(function(){return VR.ApiReportedRequest},"get")});var $R=oe();Object.defineProperty(c,"HelixPaginatedRequest",{enumerable:!0,get:n(function(){return $R.HelixPaginatedRequest},"get")});var zR=Gr();Object.defineProperty(c,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:n(function(){return zR.HelixPaginatedRequestWithTotal},"get")});var Bu=_();Object.defineProperty(c,"extractUserId",{enumerable:!0,get:n(function(){return Bu.extractUserId},"get")});Object.defineProperty(c,"extractUserName",{enumerable:!0,get:n(function(){return Bu.extractUserName},"get")});Object.defineProperty(c,"HelixExtension",{enumerable:!0,get:n(function(){return Bu.HelixExtension},"get")});Object.defineProperty(c,"HellFreezesOverError",{enumerable:!0,get:n(function(){return Bu.HellFreezesOverError},"get")})});var cw=u(($G,uw)=>{var nw=Fu(),KR=Gu(),aw=rs(),er=Tt(),sw=Vu(),ow=zu(),lw=Ju(),ju=Gm(),{ApiClient:JR}=iw(),{AppTokenAuthProvider:ZR}=Dd(),z_=class{static{n(this,"EmoteFetcher")}constructor(e,t,r){if(r&&r.apiClient)this.apiClient=r.apiClient;else if(e!==void 0&&t!==void 0){let a=new ZR(e,t);this.apiClient=new JR({authProvider:a})}this.emotes=new aw,this.channels=new aw,this.ffzModifiersFetched=!1}get globalChannel(){return this.channels.get(null)}_setupChannel(e,t=null){let r=this.channels.get(e);return r||(r=new KR(this,e),this.channels.set(e,r)),t&&(r.format=t),r}_getRawTwitchEmotes(e){if(!this.apiClient)throw new Error("Client id or client secret not provided.");return e?this.apiClient.chat.getChannelEmotes(e):this.apiClient.chat.getGlobalEmotes()}_cacheTwitchEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new lw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawBTTVEmotes(e){let t=e?er.BTTV.Channel(e):er.BTTV.Global;return ju.get(t).then(r=>r.data instanceof Array?r.data:[...r.data.channelEmotes,...r.data.sharedEmotes])}_cacheBTTVEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new nw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawFFZEmoteSet(e){let t=er.FFZ.Set(e);return ju.get(t).then(r=>r.data.set.emoticons)}_getRawFFZEmotes(e){let t=er.FFZ.Channel(e);return ju.get(t).then(r=>{let a=[];for(let s of Object.keys(r.data.sets)){let o=r.data.sets[s];a.push(...o.emoticons)}return a})}_cacheFFZEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new sw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawSevenTVEmotes(e){let t=e?er.SevenTV.Channel(e):er.SevenTV.Global;return ju.get(t).then(r=>r.data)}_cacheSevenTVEmote(e,t,r,a=null){let s=this._setupChannel(e,r),o=a||new ow(s,t.id,t);return this.emotes.set(o.code,o),s.emotes.set(o.code,o),o}fetchTwitchEmotes(e=null){return this._getRawTwitchEmotes(e).then(t=>{for(let r of t)this._cacheTwitchEmote(e,{code:r.name,id:r.id,formats:r.formats});return this.channels.get(e).emotes.filter(r=>r.type==="twitch")})}fetchBTTVEmotes(e=null){return this._getRawBTTVEmotes(e).then(t=>{for(let r of t)this._cacheBTTVEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="bttv")})}async fetchFFZEmotes(e=null){return this.ffzModifiersFetched||(this.ffzModifiersFetched=!0,await this._getRawFFZEmoteSet(er.FFZ.sets.Modifiers).then(t=>{for(let r of t)this._cacheFFZEmote(null,r)})),e?this._getRawFFZEmotes(e).then(t=>{for(let r of t)this._cacheFFZEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="ffz")}):this._getRawFFZEmoteSet(er.FFZ.sets.Global).then(t=>{for(let r of t)this._cacheFFZEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="ffz")})}fetchSevenTVEmotes(e=null,t="webp"){return this._getRawSevenTVEmotes(e).then(r=>{if("emotes"in r)for(let a of r.emotes)this._cacheSevenTVEmote(e,a,t);else for(let a of r.emote_set.emotes)this._cacheSevenTVEmote(e,a,t);return this.channels.get(e).emotes.filter(a=>a.type==="7tv")})}fromObject(e){let t=[],r={bttv:{class:nw,cache:n((a,s,o)=>this._cacheBTTVEmote(s,null,o),"cache")},ffz:{class:sw,cache:n((a,s,o)=>this._cacheFFZEmote(s,null,o),"cache")},"7tv":{class:ow,cache:n((a,s,o)=>this._cacheSevenTVEmote(s,null,a.imageType,o),"cache")},twitch:{class:lw,cache:n((a,s,o)=>this._cacheTwitchEmote(s,null,o),"cache")}};for(let a of e){let{type:s}=a;if(!Object.keys(r).includes(s))throw new TypeError(`Unknown type: ${s}`);let o=r[s].class;this._setupChannel(a.channel_id,s==="7tv"?a.imageType:null);let l=o.fromObject(a,this.channels.get(a.channel_id));r[s].cache(a,a.channel_id,l),t.push(l)}return t}};uw.exports=z_});var hw=u((KG,dw)=>{var XR=Tt(),K_=class{static{n(this,"EmoteParser")}constructor(e,t={}){this.fetcher=e,this.options=Object.assign({template:"",type:"markdown",match:/:(.+?):/g},t),this._validateOptions(this.options)}_validateOptions(e){if(e.template&&typeof e.template!="string")throw new TypeError("Template must be a string");if(!["markdown","html","bbcode","plain"].includes(e.type))throw new TypeError("Parse type must be one of `markdown`, `html`, `bbcode`, or `plain`");if(!(e.match instanceof RegExp)||!e.match.global)throw new TypeError("Match must be a global RegExp.")}parse(e,t=0){return e.replace(this.options.match,(a,s)=>{let o=this.fetcher.emotes.get(s);if(!o)return a;if(o.modifier)return"";let l=this.options.template||XR.Templates[this.options.type],d=o.toLink(t);return l.replace(/{link}/g,d).replace(/{name}/g,o.code).replace(/{size}/g,t).replace(/{creator}/g,o.ownerName||"global")})}};dw.exports=K_});var YR=u((ZG,pw)=>{pw.exports={BTTVEmote:Fu(),Channel:Gu(),Collection:rs(),Constants:Tt(),Emote:vr(),EmoteFetcher:cw(),EmoteParser:hw(),FFZEmote:Vu(),SevenTVEmote:zu(),TwitchEmote:Ju()}});export default YR();
19
+ Make sure you're not executing any actions when you want to remove a user.`),this.userId=e}};Oo.IntermediateUserRemovalError=Hd});var Ed=u(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.UnknownIntentError=void 0;var rq=m(),qd=class extends rq.CustomError{static{n(this,"UnknownIntentError")}constructor(e){super(`Unknown intent: ${e}`),this.intent=e}};Bo.UnknownIntentError=qd});var rg=u(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.RefreshingAuthProvider=void 0;var Qr=(b(),x(g)),Di=C(),iq=pd(),Ge=m(),Pd=Co(),eg=Sd(),nq=Cd(),Ad=Eo(),aq=Ao(),sq=Ed(),dt=Pi(),tg=To(),Lt=class extends iq.EventEmitter{static{n(this,"RefreshingAuthProvider")}constructor(e){var t;super(),this._userAccessTokens=new Map,this._userTokenFetchers=new Map,this._intentToUserId=new Map,this._userIdToIntents=new Map,this._cachedRefreshFailures=new Set,this.onRefresh=this.registerEvent(),this.onRefreshFailure=this.registerEvent(),this._clientId=e.clientId,this._clientSecret=e.clientSecret,this._redirectUri=e.redirectUri,this._appImpliedScopes=(t=e.appImpliedScopes)!==null&&t!==void 0?t:[],this._appTokenFetcher=new tg.TokenFetcher(async r=>await this._fetchAppToken(r))}addUser(e,t,r){let a=(0,Ge.extractUserId)(e);if(!t.refreshToken)throw new Error(`Trying to add user ${a} without refresh token`);this._cachedRefreshFailures.delete(a),this._userAccessTokens.set(a,{...t,userId:a}),this._userTokenFetchers.has(a)||this._userTokenFetchers.set(a,new tg.TokenFetcher(async s=>await this._fetchUserToken(a,s))),r&&this.addIntentsToUser(e,r)}async addUserForToken(e,t){let r=null;if(e.accessToken&&!(0,Pd.accessTokenIsExpired)(e))try{let l=await(0,dt.getTokenInfo)(e.accessToken);r=[e,l]}catch(l){if(!(l instanceof Ad.InvalidTokenError))throw l}if(!r){if(!e.refreshToken)throw new Ad.InvalidTokenError;let l=await(0,dt.refreshUserToken)(this._clientId,this._clientSecret,e.refreshToken),d=await(0,dt.getTokenInfo)(l.accessToken);this.emit(this.onRefresh,d.userId,l),r=[l,d]}let[a,s]=r;if(!s.userId)throw new aq.InvalidTokenTypeError("Could not determine a user ID for your token; you might be trying to disguise an app token as a user token.");let o=a.scope?a:{...a,scope:s.scopes};return this.addUser(s.userId,o,t),s.userId}async addUserForCode(e,t){if(!this._redirectUri)throw new Error("This method requires you to pass a `redirectUri` as a configuration property");let r=await(0,dt.exchangeCode)(this._clientId,this._clientSecret,e,this._redirectUri);return await this.addUserForToken(r,t)}hasUser(e){return this._userTokenFetchers.has((0,Ge.extractUserId)(e))}removeUser(e){let t=(0,Ge.extractUserId)(e);if(this._userIdToIntents.has(t)){let r=this._userIdToIntents.get(t);for(let a of r)this._intentToUserId.delete(a);this._userIdToIntents.delete(t)}this._userAccessTokens.delete(t),this._userTokenFetchers.delete(t),this._cachedRefreshFailures.delete(t)}addIntentsToUser(e,t){let r=(0,Ge.extractUserId)(e);if(!this._userAccessTokens.has(r))throw new Error("Trying to add intents to a user that was not added to this provider");for(let a of t)this._intentToUserId.has(a)&&this._userIdToIntents.get(this._intentToUserId.get(a)).delete(a),this._intentToUserId.set(a,r),this._userIdToIntents.has(r)?this._userIdToIntents.get(r).add(a):this._userIdToIntents.set(r,new Set([a]))}getIntentsForUser(e){let t=(0,Ge.extractUserId)(e);return this._userIdToIntents.has(t)?Array.from(this._userIdToIntents.get(t)):[]}removeIntents(e){var t;for(let r of e)if(this._intentToUserId.has(r)){let a=this._intentToUserId.get(r);(t=this._userIdToIntents.get(a))===null||t===void 0||t.delete(r),this._intentToUserId.delete(r)}}async refreshAccessTokenForUser(e){let t=(0,Ge.extractUserId)(e);if(this._cachedRefreshFailures.has(t))throw new eg.CachedRefreshFailureError(t);let r=this._userAccessTokens.get(t);if(!r)throw new Error("Trying to refresh token for user that was not added to the provider");let a=await this._refreshUserTokenWithCallback(t,r.refreshToken);return this._checkIntermediateUserRemoval(t),this._userAccessTokens.set(t,{...a,userId:t}),this.emit(this.onRefresh,t,a),{...a,userId:t}}async refreshAccessTokenForIntent(e){if(!this._intentToUserId.has(e))throw new sq.UnknownIntentError(e);let t=this._intentToUserId.get(e);return await this.refreshAccessTokenForUser(t)}get clientId(){return this._clientId}getCurrentScopesForUser(e){var t;let r=this._userAccessTokens.get((0,Ge.extractUserId)(e));if(!r)throw new Error("Trying to get scopes for user that was not added to the provider");return(t=r.scope)!==null&&t!==void 0?t:[]}async getAccessTokenForUser(e,...t){let r=(0,Ge.extractUserId)(e),a=this._userTokenFetchers.get(r);if(!a)return null;if(this._cachedRefreshFailures.has(r))throw new eg.CachedRefreshFailureError(r);return(0,dt.compareScopeSets)(this.getCurrentScopesForUser(r),t.filter(Boolean)),await a.fetch(...t)}async getAccessTokenForIntent(e,...t){if(!this._intentToUserId.has(e))return null;let r=this._intentToUserId.get(e),a=await this.getAccessTokenForUser(r,...t);if(!a)throw new Ge.HellFreezesOverError(`Found intent ${e} corresponding to user ID ${r} but no token was found`);return{...a,userId:r}}async getAnyAccessToken(e){if(e){let t=(0,Ge.extractUserId)(e);if(this._userAccessTokens.has(t)){let r=await this.getAccessTokenForUser(t);if(!r)throw new Ge.HellFreezesOverError(`Token for user ID ${t} exists but nothing was returned by getAccessTokenForUser`);return{...r,userId:t}}}return await this.getAppAccessToken()}async getAppAccessToken(e=!1){return e&&(this._appAccessToken=void 0),await this._appTokenFetcher.fetch(...this._appImpliedScopes.map(t=>[t]))}_checkIntermediateUserRemoval(e){if(!this._userTokenFetchers.has(e))throw this._cachedRefreshFailures.delete(e),new nq.IntermediateUserRemovalError(e)}async _fetchUserToken(e,t){let r=this._userAccessTokens.get(e);if(!r)throw new Error("Trying to get token for user that was not added to the provider");if(r.accessToken&&!(0,Pd.accessTokenIsExpired)(r))try{if(r.scope)return(0,dt.compareScopeSets)(r.scope,t),r;let[s=[]]=await(0,dt.loadAndCompareTokenInfo)(this._clientId,r.accessToken,e,r.scope,t),o={...r,scope:s};return this._checkIntermediateUserRemoval(e),this._userAccessTokens.set(e,o),o}catch(s){if(!(s instanceof Ad.InvalidTokenError))throw s}this._checkIntermediateUserRemoval(e);let a=await this.refreshAccessTokenForUser(e);return(0,dt.compareScopeSets)(a.scope,t),a}async _refreshUserTokenWithCallback(e,t){try{return await(0,dt.refreshUserToken)(this.clientId,this._clientSecret,t)}catch(r){throw this._cachedRefreshFailures.add(e),this.emit(this.onRefreshFailure,e,r),r}}async _fetchAppToken(e){if(e.length>0)for(let t of e)if(this._appImpliedScopes.length){if(t.every(r=>!this._appImpliedScopes.includes(r)))throw new Error(`One of the scopes ${t.join(", ")} requested but only the scope ${this._appImpliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${t.join(", ")} requested but the client credentials flow does not support scopes`);return!this._appAccessToken||(0,Pd.accessTokenIsExpired)(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await(0,dt.getAppToken)(this._clientId,this._clientSecret)}};Ii.RefreshingAuthProvider=Lt;Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_clientSecret",void 0);Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_userAccessTokens",void 0);Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_userTokenFetchers",void 0);Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_appAccessToken",void 0);Qr.__decorate([(0,Di.Enumerable)(!1)],Lt.prototype,"_appTokenFetcher",void 0);Ii.RefreshingAuthProvider=Lt=Qr.__decorate([(0,Ge.rtfm)("auth","RefreshingAuthProvider","clientId")],Lt)});var ng=u(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.StaticAuthProvider=void 0;var Dd=(b(),x(g)),ig=C(),oq=m(),lq=Pi(),Ti=class{static{n(this,"StaticAuthProvider")}constructor(e,t,r){this._clientId=e||"",this._accessToken=typeof t=="string"?{accessToken:t,refreshToken:null,scope:r??[],expiresIn:null,obtainmentTimestamp:Date.now()}:t,this._scopes=r}get clientId(){return this._clientId}async getAccessTokenForUser(e,...t){return await this._getAccessToken(t)}async getAccessTokenForIntent(e,...t){return await this._getAccessToken(t)}async getAnyAccessToken(){return await this._getAccessToken()}getCurrentScopesForUser(){var e;return(e=this._scopes)!==null&&e!==void 0?e:[]}async _getAccessToken(e){let[t,r]=await(0,lq.loadAndCompareTokenInfo)(this._clientId,this._accessToken.accessToken,this._userId,this._scopes,e);return this._scopes=t,this._userId=r,{...this._accessToken,userId:r}}};Ri.StaticAuthProvider=Ti;Dd.__decorate([(0,ig.Enumerable)(!1)],Ti.prototype,"_clientId",void 0);Dd.__decorate([(0,ig.Enumerable)(!1)],Ti.prototype,"_accessToken",void 0);Ri.StaticAuthProvider=Ti=Dd.__decorate([(0,oq.rtfm)("auth","StaticAuthProvider","clientId")],Ti)});var Id=u(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.UnknownIntentError=T.InvalidTokenTypeError=T.InvalidTokenError=T.IntermediateUserRemovalError=T.CachedRefreshFailureError=T.StaticAuthProvider=T.RefreshingAuthProvider=T.AppTokenAuthProvider=T.TokenInfo=T.TokenFetcher=T.revokeToken=T.refreshUserToken=T.getValidTokenFromProviderForIntent=T.getValidTokenFromProviderForUser=T.getTokenInfo=T.getAppToken=T.exchangeCode=T.getExpiryDateOfAccessToken=T.accessTokenIsExpired=void 0;var ag=Co();Object.defineProperty(T,"accessTokenIsExpired",{enumerable:!0,get:n(function(){return ag.accessTokenIsExpired},"get")});Object.defineProperty(T,"getExpiryDateOfAccessToken",{enumerable:!0,get:n(function(){return ag.getExpiryDateOfAccessToken},"get")});var sr=Pi();Object.defineProperty(T,"exchangeCode",{enumerable:!0,get:n(function(){return sr.exchangeCode},"get")});Object.defineProperty(T,"getAppToken",{enumerable:!0,get:n(function(){return sr.getAppToken},"get")});Object.defineProperty(T,"getTokenInfo",{enumerable:!0,get:n(function(){return sr.getTokenInfo},"get")});Object.defineProperty(T,"getValidTokenFromProviderForUser",{enumerable:!0,get:n(function(){return sr.getValidTokenFromProviderForUser},"get")});Object.defineProperty(T,"getValidTokenFromProviderForIntent",{enumerable:!0,get:n(function(){return sr.getValidTokenFromProviderForIntent},"get")});Object.defineProperty(T,"refreshUserToken",{enumerable:!0,get:n(function(){return sr.refreshUserToken},"get")});Object.defineProperty(T,"revokeToken",{enumerable:!0,get:n(function(){return sr.revokeToken},"get")});var uq=To();Object.defineProperty(T,"TokenFetcher",{enumerable:!0,get:n(function(){return uq.TokenFetcher},"get")});var cq=gd();Object.defineProperty(T,"TokenInfo",{enumerable:!0,get:n(function(){return cq.TokenInfo},"get")});var dq=Yf();Object.defineProperty(T,"AppTokenAuthProvider",{enumerable:!0,get:n(function(){return dq.AppTokenAuthProvider},"get")});var hq=rg();Object.defineProperty(T,"RefreshingAuthProvider",{enumerable:!0,get:n(function(){return hq.RefreshingAuthProvider},"get")});var pq=ng();Object.defineProperty(T,"StaticAuthProvider",{enumerable:!0,get:n(function(){return pq.StaticAuthProvider},"get")});var _q=Sd();Object.defineProperty(T,"CachedRefreshFailureError",{enumerable:!0,get:n(function(){return _q.CachedRefreshFailureError},"get")});var mq=Cd();Object.defineProperty(T,"IntermediateUserRemovalError",{enumerable:!0,get:n(function(){return mq.IntermediateUserRemovalError},"get")});var yq=Eo();Object.defineProperty(T,"InvalidTokenError",{enumerable:!0,get:n(function(){return yq.InvalidTokenError},"get")});var fq=Ao();Object.defineProperty(T,"InvalidTokenTypeError",{enumerable:!0,get:n(function(){return fq.InvalidTokenTypeError},"get")});var gq=Ed();Object.defineProperty(T,"UnknownIntentError",{enumerable:!0,get:n(function(){return gq.UnknownIntentError},"get")})});var og=u((Vj,sg)=>{function We(i,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}n(We,"RetryOperation");sg.exports=We;We.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};We.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};We.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var e=new Date().getTime();if(i&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},t),this._options.unref&&this._timer.unref(),!0};We.prototype.attempt=function(i,e){this._fn=i,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};We.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};We.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};We.prototype.start=We.prototype.try;We.prototype.errors=function(){return this._errors};We.prototype.attempts=function(){return this._attempts};We.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},e=null,t=0,r=0;r<this._errors.length;r++){var a=this._errors[r],s=a.message,o=(i[s]||0)+1;i[s]=o,o>=t&&(e=a,t=o)}return e}});var lg=u(or=>{var bq=og();or.operation=function(i){var e=or.timeouts(i);return new bq(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};or.timeouts=function(i){if(i instanceof Array)return[].concat(i);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in i)e[t]=i[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],a=0;a<e.retries;a++)r.push(this.createTimeout(a,e));return i&&i.forever&&!r.length&&r.push(this.createTimeout(a,e)),r.sort(function(s,o){return s-o}),r};or.createTimeout=function(i,e){var t=e.randomize?Math.random()+1:1,r=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,i));return r=Math.min(r,e.maxTimeout),r};or.wrap=function(i,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var r in i)typeof i[r]=="function"&&t.push(r)}for(var a=0;a<t.length;a++){var s=t[a],o=i[s];i[s]=n(function(d){var h=or.operation(e),p=Array.prototype.slice.call(arguments,1),w=p.pop();p.push(function(E){h.retry(E)||(E&&(arguments[0]=h.mainError()),w.apply(this,arguments))}),h.attempt(function(){d.apply(i,p)})},"retryWrapper").bind(i,o),i[s].options=e}}});var cg=u((Jj,ug)=>{ug.exports=lg()});var dg=u(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.createBitsLeaderboardQuery=void 0;function xq(i={}){let{count:e=10,period:t="all",startDate:r,contextUserId:a}=i;return{count:e.toString(),period:t,started_at:r?.toISOString(),user_id:a}}n(xq,"createBitsLeaderboardQuery");jo.createBitsLeaderboardQuery=xq});var G=u(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.BaseApi=void 0;var wq=(b(),x(g)),vq=C(),ko=class{static{n(this,"BaseApi")}constructor(e){this._client=e}_getUserContextIdWithDefault(e){var t;return(t=this._client._getUserIdFromRequestContext(e))!==null&&t!==void 0?t:e}};Mo.BaseApi=ko;wq.__decorate([(0,vq.Enumerable)(!1)],ko.prototype,"_client",void 0)});var Td=u(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.HelixBitsLeaderboardEntry=void 0;var hg=(b(),x(g)),Sq=C(),wt=m(),Lo=class extends wt.DataObject{static{n(this,"HelixBitsLeaderboardEntry")}constructor(e,t){super(e),this._client=t}get userId(){return this[wt.rawDataSymbol].user_id}get userName(){return this[wt.rawDataSymbol].user_login}get userDisplayName(){return this[wt.rawDataSymbol].user_name}get rank(){return this[wt.rawDataSymbol].rank}get amount(){return this[wt.rawDataSymbol].score}async getUser(){return(0,wt.checkRelationAssertion)(await this._client.users.getUserById(this[wt.rawDataSymbol].user_id))}};Ui.HelixBitsLeaderboardEntry=Lo;hg.__decorate([(0,Sq.Enumerable)(!1)],Lo.prototype,"_client",void 0);Ui.HelixBitsLeaderboardEntry=Lo=hg.__decorate([(0,wt.rtfm)("api","HelixBitsLeaderboardEntry","userId")],Lo)});var Ud=u(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.HelixBitsLeaderboard=void 0;var Rd=(b(),x(g)),pg=Ci(),Hq=C(),Fo=m(),Cq=Td(),Oi=class extends Fo.DataObject{static{n(this,"HelixBitsLeaderboard")}constructor(e,t){super(e),this._client=t}get entries(){return this[Fo.rawDataSymbol].data.map(e=>new Cq.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[Fo.rawDataSymbol].total}};Bi.HelixBitsLeaderboard=Oi;Rd.__decorate([(0,Hq.Enumerable)(!1)],Oi.prototype,"_client",void 0);Rd.__decorate([(0,pg.CachedGetter)()],Oi.prototype,"entries",null);Bi.HelixBitsLeaderboard=Oi=Rd.__decorate([pg.Cacheable,(0,Fo.rtfm)("api","HelixBitsLeaderboard")],Oi)});var Bd=u(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.HelixCheermoteList=void 0;var qq=(b(),x(g)),Eq=C(),ji=m(),Od=class extends ji.DataObject{static{n(this,"HelixCheermoteList")}constructor(e){super((0,Eq.indexBy)(e,t=>t.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,t,r){e=e.toLowerCase();let{background:a,state:s,scale:o}=r,{tiers:l}=this[ji.rawDataSymbol][e],d=l.sort((h,p)=>p.min_bits-h.min_bits).find(h=>h.min_bits<=t);if(!d)throw new ji.HellFreezesOverError(`Cheermote "${e}" does not have an applicable tier for ${t} bits`);return{url:d.images[a][s][o],color:d.color}}getPossibleNames(){return Object.keys(this[ji.rawDataSymbol])}};ki.HelixCheermoteList=Od;ki.HelixCheermoteList=Od=qq.__decorate([(0,ji.rtfm)("api","HelixCheermoteList")],Od)});var Md=u(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.HelixBitsApi=void 0;var Pq=(b(),x(g)),_g=C(),Aq=Y(),jd=m(),Dq=dg(),Iq=G(),Tq=Ud(),Rq=Bd(),kd=class extends Iq.BaseApi{static{n(this,"HelixBitsApi")}async getLeaderboard(e,t={}){let r=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:(0,jd.extractUserId)(e),scopes:["bits:read"],query:(0,Dq.createBitsLeaderboardQuery)(t)});return new Tq.HelixBitsLeaderboard(r,this._client)}async getCheermotes(e){let t=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:(0,_g.mapOptional)(e,jd.extractUserId),query:(0,_g.mapOptional)(e,Aq.createBroadcasterQuery)});return new Rq.HelixCheermoteList(t.data)}};Mi.HelixBitsApi=kd;Mi.HelixBitsApi=kd=Pq.__decorate([(0,jd.rtfm)("api","HelixBitsApi")],kd)});var yg=u(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.createFollowedChannelQuery=Ve.createChannelFollowerQuery=Ve.createChannelVipUpdateQuery=Ve.createChannelCommercialBody=Ve.createChannelUpdateBody=void 0;var mg=C(),lr=m();function Uq(i){var e;return{game_id:i.gameId,broadcaster_language:i.language,title:i.title,delay:(e=i.delay)===null||e===void 0?void 0:e.toString(),tags:i.tags,content_classification_labels:i.contentClassificationLabels,is_branded_content:i.isBrandedContent}}n(Uq,"createChannelUpdateBody");Ve.createChannelUpdateBody=Uq;function Oq(i,e){return{broadcaster_id:(0,lr.extractUserId)(i),length:e}}n(Oq,"createChannelCommercialBody");Ve.createChannelCommercialBody=Oq;function Bq(i,e){return{broadcaster_id:(0,lr.extractUserId)(i),user_id:(0,lr.extractUserId)(e)}}n(Bq,"createChannelVipUpdateQuery");Ve.createChannelVipUpdateQuery=Bq;function jq(i,e){return{broadcaster_id:(0,lr.extractUserId)(i),user_id:(0,mg.mapOptional)(e,lr.extractUserId)}}n(jq,"createChannelFollowerQuery");Ve.createChannelFollowerQuery=jq;function kq(i,e){return{broadcaster_id:(0,mg.mapOptional)(e,lr.extractUserId),user_id:(0,lr.extractUserId)(i)}}n(kq,"createFollowedChannelQuery");Ve.createFollowedChannelQuery=kq});var je=u($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.createChannelUsersCheckQuery=$e.createGetByIdsQuery=$e.createModeratorActionQuery=$e.createUserQuery=$e.createSingleKeyQuery=void 0;var No=m();function Mq(i,e){return{[i]:e}}n(Mq,"createSingleKeyQuery");$e.createSingleKeyQuery=Mq;function Lq(i){return{user_id:(0,No.extractUserId)(i)}}n(Lq,"createUserQuery");$e.createUserQuery=Lq;function Fq(i,e){return{broadcaster_id:i,moderator_id:e}}n(Fq,"createModeratorActionQuery");$e.createModeratorActionQuery=Fq;function Nq(i,e){return{broadcaster_id:(0,No.extractUserId)(i),id:e}}n(Nq,"createGetByIdsQuery");$e.createGetByIdsQuery=Nq;function Qq(i,e){return{broadcaster_id:(0,No.extractUserId)(i),user_id:e.map(No.extractUserId)}}n(Qq,"createChannelUsersCheckQuery");$e.createChannelUsersCheckQuery=Qq});var Go=u(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.HelixUserRelation=void 0;var fg=(b(),x(g)),Gq=C(),ur=m(),Qo=class extends ur.DataObject{static{n(this,"HelixUserRelation")}constructor(e,t){super(e),this._client=t}get id(){return this[ur.rawDataSymbol].user_id}get name(){return this[ur.rawDataSymbol].user_login}get displayName(){return this[ur.rawDataSymbol].user_name}async getUser(){return(0,ur.checkRelationAssertion)(await this._client.users.getUserById(this[ur.rawDataSymbol].user_id))}};Li.HelixUserRelation=Qo;fg.__decorate([(0,Gq.Enumerable)(!1)],Qo.prototype,"_client",void 0);Li.HelixUserRelation=Qo=fg.__decorate([(0,ur.rtfm)("api","HelixUserRelation","id")],Qo)});var Ft=u(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.HelixRequestBatcher=void 0;var Wq=(b(),x(g)),Ld=C(),Wo=class{static{n(this,"HelixRequestBatcher")}constructor(e,t,r,a,s,o=100){this._callOptions=e,this._queryParamName=t,this._matchKey=r,this._mapper=s,this._limitPerRequest=o,this._requestedIds=[],this._requestResolversById=new Map,this._waitTimer=null,this._client=a,this._delay=a._batchDelay}async request(e){let{promise:t,resolve:r,reject:a}=(0,Ld.promiseWithResolvers)();return this._requestedIds.includes(e)||this._requestedIds.push(e),this._requestResolversById.has(e)?this._requestResolversById.get(e).push({resolve:r,reject:a}):this._requestResolversById.set(e,[{resolve:r,reject:a}]),this._waitTimer&&(clearTimeout(this._waitTimer),this._waitTimer=null),this._requestedIds.length>=this._limitPerRequest?this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest)):this._waitTimer=setTimeout(()=>{this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest))},this._delay),await t}async _handleBatch(e){var t;try{let{data:r}=await this._doRequest(e),a=(0,Ld.indexBy)(r,this._matchKey);for(let s of e){for(let o of(t=this._requestResolversById.get(s))!==null&&t!==void 0?t:[])Object.prototype.hasOwnProperty.call(a,s)?o.resolve(this._mapper(a[s])):o.resolve(null);this._requestResolversById.delete(s)}}catch{await Promise.all(e.map(async a=>{var s,o;try{let l=await this._doRequest([a]);for(let d of(s=this._requestResolversById.get(a))!==null&&s!==void 0?s:[])d.resolve(l.data.length?this._mapper(l.data[0]):null)}catch(l){for(let d of(o=this._requestResolversById.get(a))!==null&&o!==void 0?o:[])d.reject(l)}this._requestResolversById.delete(a)}))}}async _doRequest(e){return await this._client.callApi({type:"helix",...this._callOptions,query:{...this._callOptions.query,[this._queryParamName]:e}})}};Vo.HelixRequestBatcher=Wo;Wq.__decorate([(0,Ld.Enumerable)(!1)],Wo.prototype,"_client",void 0)});var oe=u(Fi=>{"use strict";var Fd;Object.defineProperty(Fi,"__esModule",{value:!0});Fi.HelixPaginatedRequest=void 0;var gg=(b(),x(g)),Vq=C(),$q=m();Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(Fd=Symbol.asyncIterator)!==null&&Fd!==void 0?Fd:Symbol.for("Symbol.asyncIterator"));var $o=class{static{n(this,"HelixPaginatedRequest")}constructor(e,t,r,a=100){this._callOptions=e,this._mapper=r,this._limitPerPage=a,this._isFinished=!1,this._client=t}get current(){var e;return(e=this._currentData)===null||e===void 0?void 0:e.data}async getNext(){var e;if(this._isFinished)return[];let t=await this._fetchData();return!((e=t.data)===null||e===void 0)&&e.length?this._processResult(t):(this._isFinished=!0,[])}async getAll(){this.reset();let e=[];do{let t=await this.getNext();if(!t.length)break;e.push(...t)}while(this._currentCursor);return this.reset(),e}get currentCursor(){return this._currentCursor}reset(){this._currentCursor=void 0,this._isFinished=!1,this._currentData=void 0}async*[Symbol.asyncIterator](){for(this.reset();;){let e=await this.getNext();if(!e.length)break;yield*e[Symbol.iterator]()}}async _fetchData(e={}){return await this._client.callApi({type:"helix",...this._callOptions,...e,query:{...this._callOptions.query,after:this._currentCursor,first:this._limitPerPage.toString(),...e.query}})}_processResult(e){var t;return this._currentCursor=typeof e.pagination=="string"?e.pagination:(t=e.pagination)===null||t===void 0?void 0:t.cursor,this._currentCursor===void 0&&(this._isFinished=!0),this._currentData=e,e.data.reduce((r,a)=>{let s=this._mapper(a);return Array.isArray(s)?[...r,...s]:[...r,s]},[])}};Fi.HelixPaginatedRequest=$o;gg.__decorate([(0,Vq.Enumerable)(!1)],$o.prototype,"_client",void 0);Fi.HelixPaginatedRequest=$o=gg.__decorate([(0,$q.rtfm)("api","HelixPaginatedRequest")],$o)});var Gr=u(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.HelixPaginatedRequestWithTotal=void 0;var zq=(b(),x(g)),Kq=m(),Jq=oe(),Nd=class extends Jq.HelixPaginatedRequest{static{n(this,"HelixPaginatedRequestWithTotal")}async getTotalCount(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total}};Ni.HelixPaginatedRequestWithTotal=Nd;Ni.HelixPaginatedRequestWithTotal=Nd=zq.__decorate([(0,Kq.rtfm)("api","HelixPaginatedRequestWithTotal")],Nd)});var pe=u(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.createPaginatedResultWithTotal=Wr.createPaginatedResult=void 0;function Zq(i,e,t){var r;let a;return{get data(){var s,o;return a??(a=(o=(s=i.data)===null||s===void 0?void 0:s.map(l=>new e(l,t)))!==null&&o!==void 0?o:[])},cursor:typeof i.pagination=="string"?i.pagination:(r=i.pagination)===null||r===void 0?void 0:r.cursor}}n(Zq,"createPaginatedResult");Wr.createPaginatedResult=Zq;function Xq(i,e,t){let r;return{get data(){var a,s;return r??(r=(s=(a=i.data)===null||a===void 0?void 0:a.map(o=>new e(o,t)))!==null&&s!==void 0?s:[])},cursor:i.pagination.cursor,total:i.total}}n(Xq,"createPaginatedResultWithTotal");Wr.createPaginatedResultWithTotal=Xq});var le=u(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.createPaginationQuery=void 0;function Yq({after:i,before:e,limit:t}={}){return{after:i,before:e,first:t?.toString()}}n(Yq,"createPaginationQuery");zo.createPaginationQuery=Yq});var Qd=u(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.HelixChannel=void 0;var bg=(b(),x(g)),eE=C(),me=m(),Ko=class extends me.DataObject{static{n(this,"HelixChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[me.rawDataSymbol].broadcaster_id}get name(){return this[me.rawDataSymbol].broadcaster_login}get displayName(){return this[me.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,me.checkRelationAssertion)(await this._client.users.getUserById(this[me.rawDataSymbol].broadcaster_id))}get language(){return this[me.rawDataSymbol].broadcaster_language}get gameId(){return this[me.rawDataSymbol].game_id}get gameName(){return this[me.rawDataSymbol].game_name}async getGame(){return this[me.rawDataSymbol].game_id?(0,me.checkRelationAssertion)(await this._client.games.getGameById(this[me.rawDataSymbol].game_id)):null}get title(){return this[me.rawDataSymbol].title}get delay(){return this[me.rawDataSymbol].delay}get tags(){return this[me.rawDataSymbol].tags}get contentClassificationLabels(){return this[me.rawDataSymbol].content_classification_labels}get isBrandedContent(){return this[me.rawDataSymbol].is_branded_content}};Qi.HelixChannel=Ko;bg.__decorate([(0,eE.Enumerable)(!1)],Ko.prototype,"_client",void 0);Qi.HelixChannel=Ko=bg.__decorate([(0,me.rtfm)("api","HelixChannel","id")],Ko)});var Gd=u(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.HelixChannelEditor=void 0;var xg=(b(),x(g)),tE=C(),cr=m(),Jo=class extends cr.DataObject{static{n(this,"HelixChannelEditor")}constructor(e,t){super(e),this._client=t}get userId(){return this[cr.rawDataSymbol].user_id}get userDisplayName(){return this[cr.rawDataSymbol].user_name}async getUser(){return(0,cr.checkRelationAssertion)(await this._client.users.getUserById(this[cr.rawDataSymbol].user_id))}get creationDate(){return new Date(this[cr.rawDataSymbol].created_at)}};Gi.HelixChannelEditor=Jo;xg.__decorate([(0,tE.Enumerable)(!1)],Jo.prototype,"_client",void 0);Gi.HelixChannelEditor=Jo=xg.__decorate([(0,cr.rtfm)("api","HelixChannelEditor","userId")],Jo)});var Wd=u(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.HelixChannelFollower=void 0;var wg=(b(),x(g)),rE=C(),Nt=m(),Zo=class extends Nt.DataObject{static{n(this,"HelixChannelFollower")}constructor(e,t){super(e),this._client=t}get userId(){return this[Nt.rawDataSymbol].user_id}get userName(){return this[Nt.rawDataSymbol].user_login}get userDisplayName(){return this[Nt.rawDataSymbol].user_name}async getUser(){return(0,Nt.checkRelationAssertion)(await this._client.users.getUserById(this[Nt.rawDataSymbol].user_id))}get followDate(){return new Date(this[Nt.rawDataSymbol].followed_at)}};Wi.HelixChannelFollower=Zo;wg.__decorate([(0,rE.Enumerable)(!1)],Zo.prototype,"_client",void 0);Wi.HelixChannelFollower=Zo=wg.__decorate([(0,Nt.rtfm)("api","HelixChannelFollower","userId")],Zo)});var Vd=u(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.HelixFollowedChannel=void 0;var vg=(b(),x(g)),iE=C(),Qt=m(),Xo=class extends Qt.DataObject{static{n(this,"HelixFollowedChannel")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Qt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Qt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Qt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Qt.checkRelationAssertion)(await this._client.users.getUserById(this[Qt.rawDataSymbol].broadcaster_id))}get followDate(){return new Date(this[Qt.rawDataSymbol].followed_at)}};Vi.HelixFollowedChannel=Xo;vg.__decorate([(0,iE.Enumerable)(!1)],Xo.prototype,"_client",void 0);Vi.HelixFollowedChannel=Xo=vg.__decorate([(0,Qt.rtfm)("api","HelixFollowedChannel","broadcasterId")],Xo)});var zd=u($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.HelixAdSchedule=void 0;var nE=(b(),x(g)),et=m(),$d=class extends et.DataObject{static{n(this,"HelixAdSchedule")}get snoozeCount(){return this[et.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return this[et.rawDataSymbol].snooze_refresh_at?new Date(this[et.rawDataSymbol].snooze_refresh_at*1e3):null}get nextAdDate(){return this[et.rawDataSymbol].next_ad_at?new Date(this[et.rawDataSymbol].next_ad_at*1e3):null}get duration(){return this[et.rawDataSymbol].duration}get lastAdDate(){return this[et.rawDataSymbol].last_ad_at?new Date(this[et.rawDataSymbol].last_ad_at*1e3):null}get prerollFreeTime(){return this[et.rawDataSymbol].preroll_free_time}};$i.HelixAdSchedule=$d;$i.HelixAdSchedule=$d=nE.__decorate([(0,et.rtfm)("api","HelixAdSchedule")],$d)});var Sg=u(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.HelixSnoozeNextAdResult=void 0;var aE=(b(),x(g)),zi=m(),Kd=class extends zi.DataObject{static{n(this,"HelixSnoozeNextAdResult")}get snoozeCount(){return this[zi.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return new Date(this[zi.rawDataSymbol].snooze_refresh_at*1e3)}get nextAdDate(){return new Date(this[zi.rawDataSymbol].next_ad_at*1e3)}};Ki.HelixSnoozeNextAdResult=Kd;Ki.HelixSnoozeNextAdResult=Kd=aE.__decorate([(0,zi.rtfm)("api","HelixSnoozeNextAdResult")],Kd)});var Yd=u(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.HelixChannelApi=void 0;var Pg=(b(),x(g)),Ag=C(),dr=Y(),ue=m(),vt=yg(),Hg=je(),Jd=Go(),sE=Ft(),oE=oe(),Cg=Gr(),Zd=pe(),Yo=le(),lE=G(),Xd=Qd(),uE=Gd(),qg=Wd(),Eg=Vd(),cE=zd(),dE=Sg(),el=class extends lE.BaseApi{static{n(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new sE.HelixRequestBatcher({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new Xd.HelixChannel(e,this._client))}async getChannelInfoById(e){let t=(0,ue.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"channels",userId:t,query:(0,dr.createBroadcasterQuery)(t)});return(0,Ag.mapNullable)(r.data[0],a=>new Xd.HelixChannel(a,this._client))}async getChannelInfoByIdBatched(e){return await this._getChannelByIdBatcher.request((0,ue.extractUserId)(e))}async getChannelInfoByIds(e){let t=e.map(ue.extractUserId);return(await this._client.callApi({type:"helix",url:"channels",query:(0,Hg.createSingleKeyQuery)("broadcaster_id",t)})).data.map(a=>new Xd.HelixChannel(a,this._client))}async updateChannelInfo(e,t){await this._client.callApi({type:"helix",url:"channels",method:"PATCH",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:broadcast"],query:(0,dr.createBroadcasterQuery)(e),jsonBody:(0,vt.createChannelUpdateBody)(t)})}async startChannelCommercial(e,t){await this._client.callApi({type:"helix",url:"channels/commercial",method:"POST",userId:(0,ue.extractUserId)(e),scopes:["channel:edit:commercial"],jsonBody:(0,vt.createChannelCommercialBody)(e,t)})}async getChannelEditors(e){return(await this._client.callApi({type:"helix",url:"channels/editors",userId:(0,ue.extractUserId)(e),scopes:["channel:read:editors"],query:(0,dr.createBroadcasterQuery)(e)})).data.map(r=>new uE.HelixChannelEditor(r,this._client))}async getVips(e,t){let r=await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,ue.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:{...(0,dr.createBroadcasterQuery)(e),...(0,Yo.createPaginationQuery)(t)}});return(0,Zd.createPaginatedResult)(r,Jd.HelixUserRelation,this._client)}getVipsPaginated(e){return new oE.HelixPaginatedRequest({url:"channels/vips",userId:(0,ue.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,dr.createBroadcasterQuery)(e)},this._client,t=>new Jd.HelixUserRelation(t,this._client))}async checkVipForUsers(e,t){return(await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,ue.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,Hg.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Jd.HelixUserRelation(a,this._client))}async checkVipForUser(e,t){let r=(0,ue.extractUserId)(t);return(await this.checkVipForUsers(e,[r])).some(s=>s.id===r)}async addVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"POST",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,vt.createChannelVipUpdateQuery)(e,t)})}async removeVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"DELETE",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,vt.createChannelVipUpdateQuery)(e,t)})}async getChannelFollowerCount(e){return(await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,ue.extractUserId)(e),query:{...(0,vt.createChannelFollowerQuery)(e),...(0,Yo.createPaginationQuery)({limit:1})}})).total}async getChannelFollowers(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,ue.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:{...(0,vt.createChannelFollowerQuery)(e,t),...(0,Yo.createPaginationQuery)(r)}});return(0,Zd.createPaginatedResultWithTotal)(a,qg.HelixChannelFollower,this._client)}getChannelFollowersPaginated(e){return new Cg.HelixPaginatedRequestWithTotal({url:"channels/followers",method:"GET",userId:(0,ue.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:(0,vt.createChannelFollowerQuery)(e)},this._client,t=>new qg.HelixChannelFollower(t,this._client))}async getFollowedChannels(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:(0,ue.extractUserId)(e),scopes:["user:read:follows"],query:{...(0,vt.createFollowedChannelQuery)(e,t),...(0,Yo.createPaginationQuery)(r)}});return(0,Zd.createPaginatedResultWithTotal)(a,Eg.HelixFollowedChannel,this._client)}getFollowedChannelsPaginated(e,t){return new Cg.HelixPaginatedRequestWithTotal({url:"channels/followed",method:"GET",userId:(0,ue.extractUserId)(e),scopes:["user:read:follows"],query:(0,vt.createFollowedChannelQuery)(e,t)},this._client,r=>new Eg.HelixFollowedChannel(r,this._client))}async getAdSchedule(e){let t=await this._client.callApi({type:"helix",url:"channels/ads",method:"GET",userId:(0,ue.extractUserId)(e),scopes:["channel:read:ads"],query:(0,dr.createBroadcasterQuery)(e)});return new cE.HelixAdSchedule(t.data[0])}async snoozeNextAd(e){let t=await this._client.callApi({type:"helix",url:"channels/ads/schedule/snooze",method:"POST",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:ads"],query:(0,dr.createBroadcasterQuery)(e)});return new dE.HelixSnoozeNextAdResult(t.data[0])}};Ji.HelixChannelApi=el;Pg.__decorate([(0,Ag.Enumerable)(!1)],el.prototype,"_getChannelByIdBatcher",void 0);Ji.HelixChannelApi=el=Pg.__decorate([(0,ue.rtfm)("api","HelixChannelApi")],el)});var Dg=u(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.createRedemptionsForBroadcasterQuery=ze.createRewardRedemptionsByIdsQuery=ze.createCustomRewardBody=ze.createCustomRewardChangeQuery=ze.createCustomRewardsQuery=void 0;var tl=m();function hE(i,e){return{broadcaster_id:(0,tl.extractUserId)(i),only_manageable_rewards:e?.toString()}}n(hE,"createCustomRewardsQuery");ze.createCustomRewardsQuery=hE;function pE(i,e){return{broadcaster_id:(0,tl.extractUserId)(i),id:e}}n(pE,"createCustomRewardChangeQuery");ze.createCustomRewardChangeQuery=pE;function _E(i){var e,t,r;let a={title:i.title,cost:i.cost,prompt:i.prompt,background_color:i.backgroundColor,is_enabled:i.isEnabled,is_user_input_required:i.userInputRequired,should_redemptions_skip_request_queue:i.autoFulfill};return i.maxRedemptionsPerStream!==void 0&&(a.is_max_per_stream_enabled=!!i.maxRedemptionsPerStream,a.max_per_stream=(e=i.maxRedemptionsPerStream)!==null&&e!==void 0?e:0),i.maxRedemptionsPerUserPerStream!==void 0&&(a.is_max_per_user_per_stream_enabled=!!i.maxRedemptionsPerUserPerStream,a.max_per_user_per_stream=(t=i.maxRedemptionsPerUserPerStream)!==null&&t!==void 0?t:0),i.globalCooldown!==void 0&&(a.is_global_cooldown_enabled=!!i.globalCooldown,a.global_cooldown_seconds=(r=i.globalCooldown)!==null&&r!==void 0?r:0),"isPaused"in i&&(a.is_paused=i.isPaused),a}n(_E,"createCustomRewardBody");ze.createCustomRewardBody=_E;function mE(i,e,t){return{broadcaster_id:(0,tl.extractUserId)(i),reward_id:e,id:t}}n(mE,"createRewardRedemptionsByIdsQuery");ze.createRewardRedemptionsByIdsQuery=mE;function yE(i,e,t,r){return{broadcaster_id:(0,tl.extractUserId)(i),reward_id:e,status:t,sort:r.newestFirst?"NEWEST":"OLDEST"}}n(yE,"createRedemptionsForBroadcasterQuery");ze.createRedemptionsForBroadcasterQuery=yE});var eh=u(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.HelixCustomReward=void 0;var Ig=(b(),x(g)),fE=C(),M=m(),rl=class extends M.DataObject{static{n(this,"HelixCustomReward")}constructor(e,t){super(e),this._client=t}get id(){return this[M.rawDataSymbol].id}get broadcasterId(){return this[M.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[M.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[M.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,M.checkRelationAssertion)(await this._client.users.getUserById(this[M.rawDataSymbol].broadcaster_id))}getImageUrl(e){var t,r;let a=`url_${e}x`;return(r=(t=this[M.rawDataSymbol].image)===null||t===void 0?void 0:t[a])!==null&&r!==void 0?r:this[M.rawDataSymbol].default_image[a]}get backgroundColor(){return this[M.rawDataSymbol].background_color}get isEnabled(){return this[M.rawDataSymbol].is_enabled}get cost(){return this[M.rawDataSymbol].cost}get title(){return this[M.rawDataSymbol].title}get prompt(){return this[M.rawDataSymbol].prompt}get userInputRequired(){return this[M.rawDataSymbol].is_user_input_required}get maxRedemptionsPerStream(){return this[M.rawDataSymbol].max_per_stream_setting.is_enabled?this[M.rawDataSymbol].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[M.rawDataSymbol].max_per_user_per_stream_setting.is_enabled?this[M.rawDataSymbol].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[M.rawDataSymbol].global_cooldown_setting.is_enabled?this[M.rawDataSymbol].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[M.rawDataSymbol].is_paused}get isInStock(){return this[M.rawDataSymbol].is_in_stock}get redemptionsThisStream(){return this[M.rawDataSymbol].redemptions_redeemed_current_stream}get autoFulfill(){return this[M.rawDataSymbol].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[M.rawDataSymbol].cooldown_expires_at?new Date(this[M.rawDataSymbol].cooldown_expires_at):null}};Zi.HelixCustomReward=rl;Ig.__decorate([(0,fE.Enumerable)(!1)],rl.prototype,"_client",void 0);Zi.HelixCustomReward=rl=Ig.__decorate([(0,M.rtfm)("api","HelixCustomReward","id")],rl)});var th=u(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.HelixCustomRewardRedemption=void 0;var Tg=(b(),x(g)),gE=C(),Q=m(),il=class extends Q.DataObject{static{n(this,"HelixCustomRewardRedemption")}constructor(e,t){super(e),this._client=t}get id(){return this[Q.rawDataSymbol].id}get broadcasterId(){return this[Q.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Q.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Q.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Q.checkRelationAssertion)(await this._client.users.getUserById(this[Q.rawDataSymbol].broadcaster_id))}get userId(){return this[Q.rawDataSymbol].user_id}get userName(){return this[Q.rawDataSymbol].user_login}get userDisplayName(){return this[Q.rawDataSymbol].user_name}async getUser(){return(0,Q.checkRelationAssertion)(await this._client.users.getUserById(this[Q.rawDataSymbol].user_id))}get userInput(){return this[Q.rawDataSymbol].user_input}get isFulfilled(){return this[Q.rawDataSymbol].status==="FULFILLED"}get isCanceled(){return this[Q.rawDataSymbol].status==="CANCELED"}get redemptionDate(){return new Date(this[Q.rawDataSymbol].redeemed_at)}get rewardId(){return this[Q.rawDataSymbol].reward.id}get rewardTitle(){return this[Q.rawDataSymbol].reward.title}get rewardPrompt(){return this[Q.rawDataSymbol].reward.prompt}get rewardCost(){return this[Q.rawDataSymbol].reward.cost}async getReward(){return(0,Q.checkRelationAssertion)(await this._client.channelPoints.getCustomRewardById(this[Q.rawDataSymbol].broadcaster_id,this[Q.rawDataSymbol].reward.id))}async updateStatus(e){return(await this._client.channelPoints.updateRedemptionStatusByIds(this[Q.rawDataSymbol].broadcaster_id,this[Q.rawDataSymbol].reward.id,[this[Q.rawDataSymbol].id],e))[0]}};Xi.HelixCustomRewardRedemption=il;Tg.__decorate([(0,gE.Enumerable)(!1)],il.prototype,"_client",void 0);Xi.HelixCustomRewardRedemption=il=Tg.__decorate([(0,Q.rtfm)("api","HelixCustomRewardRedemption","id")],il)});var ih=u(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.HelixChannelPointsApi=void 0;var bE=(b(),x(g)),xE=Y(),ht=m(),St=Dg(),wE=je(),vE=oe(),SE=pe(),HE=le(),CE=G(),nl=eh(),al=th(),rh=class extends CE.BaseApi{static{n(this,"HelixChannelPointsApi")}async getCustomRewards(e,t){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,St.createCustomRewardsQuery)(e,t)})).data.map(a=>new nl.HelixCustomReward(a,this._client))}async getCustomRewardsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,wE.createGetByIdsQuery)(e,t)})).data.map(a=>new nl.HelixCustomReward(a,this._client)):[]}async getCustomRewardById(e,t){let r=await this.getCustomRewardsByIds(e,[t]);return r.length?r[0]:null}async createCustomReward(e,t){let r=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"POST",userId:(0,ht.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,xE.createBroadcasterQuery)(e),jsonBody:(0,St.createCustomRewardBody)(t)});return new nl.HelixCustomReward(r.data[0],this._client)}async updateCustomReward(e,t,r){let a=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"PATCH",userId:(0,ht.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,St.createCustomRewardChangeQuery)(e,t),jsonBody:(0,St.createCustomRewardBody)(r)});return new nl.HelixCustomReward(a.data[0],this._client)}async deleteCustomReward(e,t){await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"DELETE",userId:(0,ht.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,St.createCustomRewardChangeQuery)(e,t)})}async getRedemptionsByIds(e,t,r){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,St.createRewardRedemptionsByIdsQuery)(e,t,r)})).data.map(s=>new al.HelixCustomRewardRedemption(s,this._client)):[]}async getRedemptionById(e,t,r){let a=await this.getRedemptionsByIds(e,t,[r]);return a.length?a[0]:null}async getRedemptionsForBroadcaster(e,t,r,a){let s=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...(0,St.createRedemptionsForBroadcasterQuery)(e,t,r,a),...(0,HE.createPaginationQuery)(a)}});return(0,SE.createPaginatedResult)(s,al.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,r,a){return new vE.HelixPaginatedRequest({url:"channel_points/custom_rewards/redemptions",userId:(0,ht.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,St.createRedemptionsForBroadcasterQuery)(e,t,r,a)},this._client,s=>new al.HelixCustomRewardRedemption(s,this._client),50)}async updateRedemptionStatusByIds(e,t,r,a){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",method:"PATCH",userId:(0,ht.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,St.createRewardRedemptionsByIdsQuery)(e,t,r),jsonBody:{status:a}})).data.map(o=>new al.HelixCustomRewardRedemption(o,this._client)):[]}};Yi.HelixChannelPointsApi=rh;Yi.HelixChannelPointsApi=rh=bE.__decorate([(0,ht.rtfm)("api","HelixChannelPointsApi")],rh)});var sl=u(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.HelixCharityCampaignAmount=void 0;var qE=(b(),x(g)),en=m(),nh=class extends en.DataObject{static{n(this,"HelixCharityCampaignAmount")}get value(){return this[en.rawDataSymbol].value}get decimalPlaces(){return this[en.rawDataSymbol].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[en.rawDataSymbol].currency}};tn.HelixCharityCampaignAmount=nh;tn.HelixCharityCampaignAmount=nh=qE.__decorate([(0,en.rtfm)("api","HelixCharityCampaignAmount")],nh)});var ah=u(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.HelixCharityCampaign=void 0;var Ug=(b(),x(g)),EE=C(),De=m(),Rg=sl(),ol=class extends De.DataObject{static{n(this,"HelixCharityCampaign")}constructor(e,t){super(e),this._client=t}get id(){return this[De.rawDataSymbol].id}get broadcasterId(){return this[De.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[De.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[De.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,De.checkRelationAssertion)(await this._client.users.getUserById(this[De.rawDataSymbol].broadcaster_id))}get charityName(){return this[De.rawDataSymbol].charity_name}get charityDescription(){return this[De.rawDataSymbol].charity_description}get charityLogo(){return this[De.rawDataSymbol].charity_logo}get charityWebsite(){return this[De.rawDataSymbol].charity_website}get currentAmount(){return new Rg.HelixCharityCampaignAmount(this[De.rawDataSymbol].current_amount)}get targetAmount(){return new Rg.HelixCharityCampaignAmount(this[De.rawDataSymbol].target_amount)}};rn.HelixCharityCampaign=ol;Ug.__decorate([(0,EE.Enumerable)(!1)],ol.prototype,"_client",void 0);rn.HelixCharityCampaign=ol=Ug.__decorate([(0,De.rtfm)("api","HelixCharityCampaign","id")],ol)});var sh=u(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.HelixCharityCampaignDonation=void 0;var Og=(b(),x(g)),PE=C(),Ht=m(),AE=sl(),ll=class extends Ht.DataObject{static{n(this,"HelixCharityCampaignDonation")}constructor(e,t){super(e),this._client=t}get campaignId(){return this[Ht.rawDataSymbol].campaign_id}get donorId(){return this[Ht.rawDataSymbol].user_id}get donorName(){return this[Ht.rawDataSymbol].user_login}get donorDisplayName(){return this[Ht.rawDataSymbol].user_name}async getDonor(){return(0,Ht.checkRelationAssertion)(await this._client.users.getUserById(this[Ht.rawDataSymbol].user_id))}get amount(){return new AE.HelixCharityCampaignAmount(this[Ht.rawDataSymbol].amount)}};nn.HelixCharityCampaignDonation=ll;Og.__decorate([(0,PE.Enumerable)(!1)],ll.prototype,"_client",void 0);nn.HelixCharityCampaignDonation=ll=Og.__decorate([(0,Ht.rtfm)("api","HelixCharityCampaignDonation")],ll)});var uh=u(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.HelixCharityApi=void 0;var DE=(b(),x(g)),Bg=Y(),oh=m(),IE=pe(),TE=le(),RE=G(),UE=ah(),OE=sh(),lh=class extends RE.BaseApi{static{n(this,"HelixCharityApi")}async getCharityCampaign(e){let t=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:(0,oh.extractUserId)(e),scopes:["channel:read:charity"],query:(0,Bg.createBroadcasterQuery)(e)});return new UE.HelixCharityCampaign(t.data[0],this._client)}async getCharityCampaignDonations(e,t){let r=await this._client.callApi({type:"helix",url:"charity/donations",userId:(0,oh.extractUserId)(e),scopes:["channel:read:charity"],query:{...(0,Bg.createBroadcasterQuery)(e),...(0,TE.createPaginationQuery)(t)}});return(0,IE.createPaginatedResult)(r,OE.HelixCharityCampaignDonation,this._client)}};an.HelixCharityApi=lh;an.HelixCharityApi=lh=DE.__decorate([(0,oh.rtfm)("api","HelixCharityApi")],lh)});var jg=u(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.createSendChatMessageAsAppBody=Ie.createSendChatMessageBody=Ie.createSendChatMessageQuery=Ie.createShoutoutQuery=Ie.createChatColorUpdateQuery=Ie.createChatSettingsUpdateBody=void 0;var ch=m();function BE(i){return{slow_mode:i.slowModeEnabled,slow_mode_wait_time:i.slowModeDelay,follower_mode:i.followerOnlyModeEnabled,follower_mode_duration:i.followerOnlyModeDelay,subscriber_mode:i.subscriberOnlyModeEnabled,emote_mode:i.emoteOnlyModeEnabled,unique_chat_mode:i.uniqueChatModeEnabled,non_moderator_chat_delay:i.nonModeratorChatDelayEnabled,non_moderator_chat_delay_duration:i.nonModeratorChatDelay}}n(BE,"createChatSettingsUpdateBody");Ie.createChatSettingsUpdateBody=BE;function jE(i,e){return{user_id:(0,ch.extractUserId)(i),color:e}}n(jE,"createChatColorUpdateQuery");Ie.createChatColorUpdateQuery=jE;function kE(i,e,t){return{from_broadcaster_id:(0,ch.extractUserId)(i),to_broadcaster_id:(0,ch.extractUserId)(e),moderator_id:t}}n(kE,"createShoutoutQuery");Ie.createShoutoutQuery=kE;function ME(i,e){return{broadcaster_id:i,sender_id:e}}n(ME,"createSendChatMessageQuery");Ie.createSendChatMessageQuery=ME;function LE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId}}n(LE,"createSendChatMessageBody");Ie.createSendChatMessageBody=LE;function FE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId,for_source_only:e?.forSourceOnly}}n(FE,"createSendChatMessageAsAppBody");Ie.createSendChatMessageAsAppBody=FE});var hh=u(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.HelixEmoteBase=void 0;var tt=m(),dh=class extends tt.DataObject{static{n(this,"HelixEmoteBase")}get id(){return this[tt.rawDataSymbol].id}get name(){return this[tt.rawDataSymbol].name}get formats(){return this[tt.rawDataSymbol].format}get scales(){return this[tt.rawDataSymbol].scale}get themeModes(){return this[tt.rawDataSymbol].theme_mode}getStaticImageUrl(e="1.0",t="light"){return this[tt.rawDataSymbol].format.includes("static")&&this[tt.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"static",t):null}getAnimatedImageUrl(e="1.0",t="light"){return this[tt.rawDataSymbol].format.includes("animated")&&this[tt.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"animated",t):null}getFormattedImageUrl(e="1.0",t="static",r="light"){return`https://static-cdn.jtvnw.net/emoticons/v2/${this[tt.rawDataSymbol].id}/${t}/${r}/${e}`}};ul.HelixEmoteBase=dh});var on=u(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.HelixEmote=void 0;var NE=(b(),x(g)),kg=m(),QE=hh(),ph=class extends QE.HelixEmoteBase{static{n(this,"HelixEmote")}getImageUrl(e){return this[kg.rawDataSymbol].images[`url_${e}x`]}};sn.HelixEmote=ph;sn.HelixEmote=ph=NE.__decorate([(0,kg.rtfm)("api","HelixEmote","id")],ph)});var _h=u(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.HelixChannelEmote=void 0;var Mg=(b(),x(g)),GE=C(),ln=m(),WE=on(),cl=class extends WE.HelixEmote{static{n(this,"HelixChannelEmote")}constructor(e,t){super(e),this._client=t}get tier(){return this[ln.rawDataSymbol].tier||null}get type(){return this[ln.rawDataSymbol].emote_type}get emoteSetId(){return this[ln.rawDataSymbol].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[ln.rawDataSymbol].emote_set_id])}};un.HelixChannelEmote=cl;Mg.__decorate([(0,GE.Enumerable)(!1)],cl.prototype,"_client",void 0);un.HelixChannelEmote=cl=Mg.__decorate([(0,ln.rtfm)("api","HelixChannelEmote","id")],cl)});var yh=u(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.HelixChatBadgeVersion=void 0;var VE=(b(),x(g)),Gt=m(),mh=class extends Gt.DataObject{static{n(this,"HelixChatBadgeVersion")}get id(){return this[Gt.rawDataSymbol].id}getImageUrl(e){return this[Gt.rawDataSymbol][`image_url_${e}x`]}get title(){return this[Gt.rawDataSymbol].title}get description(){return this[Gt.rawDataSymbol].description}get clickAction(){return this[Gt.rawDataSymbol].click_action}get clickUrl(){return this[Gt.rawDataSymbol].click_url}};cn.HelixChatBadgeVersion=mh;cn.HelixChatBadgeVersion=mh=VE.__decorate([(0,Gt.rtfm)("api","HelixChatBadgeVersion","id")],mh)});var fh=u(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.HelixChatBadgeSet=void 0;var Lg=(b(),x(g)),Fg=Ci(),dl=m(),$E=yh(),hl=class extends dl.DataObject{static{n(this,"HelixChatBadgeSet")}get id(){return this[dl.rawDataSymbol].set_id}get versions(){return this[dl.rawDataSymbol].versions.map(e=>new $E.HelixChatBadgeVersion(e))}getVersion(e){var t;return(t=this.versions.find(r=>r.id===e))!==null&&t!==void 0?t:null}};dn.HelixChatBadgeSet=hl;Lg.__decorate([(0,Fg.CachedGetter)()],hl.prototype,"versions",null);dn.HelixChatBadgeSet=hl=Lg.__decorate([Fg.Cacheable,(0,dl.rtfm)("api","HelixChatBadgeSet","id")],hl)});var gh=u(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.HelixChatChatter=void 0;var Ng=(b(),x(g)),zE=C(),hr=m(),pl=class extends hr.DataObject{static{n(this,"HelixChatChatter")}constructor(e,t){super(e),this._client=t}get userId(){return this[hr.rawDataSymbol].user_id}get userName(){return this[hr.rawDataSymbol].user_login}get userDisplayName(){return this[hr.rawDataSymbol].user_name}async getUser(){return(0,hr.checkRelationAssertion)(await this._client.users.getUserById(this[hr.rawDataSymbol].user_id))}};hn.HelixChatChatter=pl;Ng.__decorate([(0,zE.Enumerable)(!1)],pl.prototype,"_client",void 0);hn.HelixChatChatter=pl=Ng.__decorate([(0,hr.rtfm)("api","HelixChatChatter")],pl)});var _l=u(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.HelixChatSettings=void 0;var KE=(b(),x(g)),pt=m(),bh=class extends pt.DataObject{static{n(this,"HelixChatSettings")}get broadcasterId(){return this[pt.rawDataSymbol].broadcaster_id}get slowModeEnabled(){return this[pt.rawDataSymbol].slow_mode}get slowModeDelay(){return this[pt.rawDataSymbol].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[pt.rawDataSymbol].follower_mode}get followerOnlyModeDelay(){return this[pt.rawDataSymbol].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[pt.rawDataSymbol].subscriber_mode}get emoteOnlyModeEnabled(){return this[pt.rawDataSymbol].emote_mode}get uniqueChatModeEnabled(){return this[pt.rawDataSymbol].unique_chat_mode}};pn.HelixChatSettings=bh;pn.HelixChatSettings=bh=KE.__decorate([(0,pt.rtfm)("api","HelixChatSettings","broadcasterId")],bh)});var xh=u(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.HelixEmoteFromSet=void 0;var Qg=(b(),x(g)),JE=C(),pr=m(),ZE=on(),ml=class extends ZE.HelixEmote{static{n(this,"HelixEmoteFromSet")}constructor(e,t){super(e),this._client=t}get type(){return this[pr.rawDataSymbol].emote_type}get emoteSetId(){return this[pr.rawDataSymbol].emote_set_id}get ownerId(){switch(this[pr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return this[pr.rawDataSymbol].owner_id}}async getOwner(){switch(this[pr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[pr.rawDataSymbol].owner_id)}}};_n.HelixEmoteFromSet=ml;Qg.__decorate([(0,JE.Enumerable)(!1)],ml.prototype,"_client",void 0);_n.HelixEmoteFromSet=ml=Qg.__decorate([(0,pr.rtfm)("api","HelixEmoteFromSet","id")],ml)});var wh=u(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.HelixUserEmote=void 0;var Gg=(b(),x(g)),Wt=m(),XE=hh(),YE=C(),yl=class extends XE.HelixEmoteBase{static{n(this,"HelixUserEmote")}constructor(e,t){super(e),this._client=t}get type(){return this[Wt.rawDataSymbol].emote_type}get emoteSetId(){return this[Wt.rawDataSymbol].emote_set_id||null}get ownerId(){return this[Wt.rawDataSymbol].owner_id||null}async getAllEmotesFromSet(){return this[Wt.rawDataSymbol].emote_set_id?await this._client.chat.getEmotesFromSets([this[Wt.rawDataSymbol].emote_set_id]):null}async getOwner(){return this[Wt.rawDataSymbol].owner_id?await this._client.users.getUserById(this[Wt.rawDataSymbol].owner_id):null}};mn.HelixUserEmote=yl;Gg.__decorate([(0,YE.Enumerable)(!1)],yl.prototype,"_client",void 0);mn.HelixUserEmote=yl=Gg.__decorate([(0,Wt.rtfm)("api","HelixUserEmote","id")],yl)});var Hh=u(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.HelixPrivilegedChatSettings=void 0;var eP=(b(),x(g)),vh=m(),tP=_l(),Sh=class extends tP.HelixChatSettings{static{n(this,"HelixPrivilegedChatSettings")}get nonModeratorChatDelayEnabled(){return this[vh.rawDataSymbol].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[vh.rawDataSymbol].non_moderator_chat_delay_duration}};yn.HelixPrivilegedChatSettings=Sh;yn.HelixPrivilegedChatSettings=Sh=eP.__decorate([(0,vh.rtfm)("api","HelixPrivilegedChatSettings","broadcasterId")],Sh)});var qh=u(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.HelixSentChatMessage=void 0;var rP=(b(),x(g)),Vr=m(),Ch=class extends Vr.DataObject{static{n(this,"HelixSentChatMessage")}get id(){return this[Vr.rawDataSymbol].message_id}get isSent(){return this[Vr.rawDataSymbol].is_sent}get dropReasonCode(){var e;return(e=this[Vr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.code}get dropReasonMessage(){var e;return(e=this[Vr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.message}};fn.HelixSentChatMessage=Ch;fn.HelixSentChatMessage=Ch=rP.__decorate([(0,Vr.rtfm)("api","HelixSentChatMessage","id")],Ch)});var Wg=u(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.createSharedChatSessionQuery=void 0;var iP=m();function nP(i){return{broadcaster_id:(0,iP.extractUserId)(i)}}n(nP,"createSharedChatSessionQuery");fl.createSharedChatSessionQuery=nP});var Eh=u(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.HelixSharedChatSessionParticipant=void 0;var Vg=(b(),x(g)),aP=C(),gn=m(),gl=class extends gn.DataObject{static{n(this,"HelixSharedChatSessionParticipant")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[gn.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,gn.checkRelationAssertion)(await this._client.users.getUserById(this[gn.rawDataSymbol].broadcaster_id))}};bn.HelixSharedChatSessionParticipant=gl;Vg.__decorate([(0,aP.Enumerable)(!1)],gl.prototype,"_client",void 0);bn.HelixSharedChatSessionParticipant=gl=Vg.__decorate([(0,gn.rtfm)("api","HelixSharedChatSessionParticipant","broadcasterId")],gl)});var Ph=u(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.HelixSharedChatSession=void 0;var $g=(b(),x(g)),sP=C(),Ct=m(),oP=Eh(),bl=class extends Ct.DataObject{static{n(this,"HelixSharedChatSession")}constructor(e,t){super(e),this._client=t}get sessionId(){return this[Ct.rawDataSymbol].session_id}get hostBroadcasterId(){return this[Ct.rawDataSymbol].host_broadcaster_id}async getHostBroadcaster(){return(0,Ct.checkRelationAssertion)(await this._client.users.getUserById(this[Ct.rawDataSymbol].host_broadcaster_id))}get participants(){return this[Ct.rawDataSymbol].participants.map(e=>new oP.HelixSharedChatSessionParticipant(e,this._client))}get createdDate(){return new Date(this[Ct.rawDataSymbol].created_at)}get updatedDate(){return new Date(this[Ct.rawDataSymbol].updated_at)}};xn.HelixSharedChatSession=bl;$g.__decorate([(0,sP.Enumerable)(!1)],bl.prototype,"_client",void 0);xn.HelixSharedChatSession=bl=$g.__decorate([(0,Ct.rtfm)("api","HelixSharedChatSession","sessionId")],bl)});var Ih=u(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.HelixChatApi=void 0;var lP=(b(),x(g)),Ah=Y(),Z=m(),_r=jg(),Vt=je(),uP=oe(),cP=Gr(),zg=pe(),Kg=le(),dP=G(),hP=_h(),Jg=fh(),Zg=gh(),pP=_l(),_P=on(),mP=xh(),Xg=wh(),Yg=Hh(),eb=qh(),yP=Wg(),fP=Ph(),Dh=class extends dP.BaseApi{static{n(this,"HelixChatApi")}async getChatters(e,t){let r=(0,Z.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/chatters",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:{...this._createModeratorActionQuery(r),...(0,Kg.createPaginationQuery)(t)}});return(0,zg.createPaginatedResultWithTotal)(a,Zg.HelixChatChatter,this._client)}getChattersPaginated(e){let t=(0,Z.extractUserId)(e);return new cP.HelixPaginatedRequestWithTotal({url:"chat/chatters",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(t)},this._client,r=>new Zg.HelixChatChatter(r,this._client),1e3)}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(t=>new Jg.HelixChatBadgeSet(t))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:(0,Z.extractUserId)(e),query:(0,Ah.createBroadcasterQuery)(e)})).data.map(r=>new Jg.HelixChatBadgeSet(r))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(t=>new _P.HelixEmote(t))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:(0,Z.extractUserId)(e),query:(0,Ah.createBroadcasterQuery)(e)})).data.map(r=>new hP.HelixChannelEmote(r,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:(0,Vt.createSingleKeyQuery)("emote_set_id",e)})).data.map(r=>new mP.HelixEmoteFromSet(r,this._client))}async getUserEmotes(e,t){let r=(0,Z.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/emotes/user",userId:(0,Z.extractUserId)(e),scopes:["user:read:emotes"],query:{...(0,Vt.createSingleKeyQuery)("user_id",r),...(0,Vt.createSingleKeyQuery)("broadcasterId",t?.broadcaster?(0,Z.extractUserId)(t.broadcaster):void 0),...(0,Kg.createPaginationQuery)(t)}});return(0,zg.createPaginatedResult)(a,Xg.HelixUserEmote,this._client)}getUserEmotesPaginated(e,t){let r=(0,Z.extractUserId)(e);return new uP.HelixPaginatedRequest({url:"chat/emotes/user",userId:r,scopes:["user:read:emotes"],query:{...(0,Vt.createSingleKeyQuery)("user_id",r),...(0,Vt.createSingleKeyQuery)("broadcasterId",t?(0,Z.extractUserId)(t):void 0)}},this._client,a=>new Xg.HelixUserEmote(a,this._client))}async getSettings(e){let t=await this._client.callApi({type:"helix",url:"chat/settings",userId:(0,Z.extractUserId)(e),query:(0,Ah.createBroadcasterQuery)(e)});return new pP.HelixChatSettings(t.data[0])}async getSettingsPrivileged(e){let t=(0,Z.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"chat/settings",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chat_settings"],query:this._createModeratorActionQuery(t)});return new Yg.HelixPrivilegedChatSettings(r.data[0])}async updateSettings(e,t){let r=(0,Z.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/settings",method:"PATCH",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:chat_settings"],query:this._createModeratorActionQuery(r),jsonBody:(0,_r.createChatSettingsUpdateBody)(t)});return new Yg.HelixPrivilegedChatSettings(a.data[0])}async sendChatMessage(e,t,r){let a=(0,Z.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",userId:a,canOverrideScopedUserContext:!0,scopes:["user:write:chat"],query:(0,_r.createSendChatMessageQuery)(a,this._getUserContextIdWithDefault(a)),jsonBody:(0,_r.createSendChatMessageBody)(t,r)});return new eb.HelixSentChatMessage(s.data[0])}async sendChatMessageAsApp(e,t,r,a){let s=(0,Z.extractUserId)(e),o=(0,Z.extractUserId)(t),l=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",forceType:"app",query:(0,_r.createSendChatMessageQuery)(o,s),jsonBody:(0,_r.createSendChatMessageAsAppBody)(r,a)});return new eb.HelixSentChatMessage(l.data[0])}async sendAnnouncement(e,t){let r=(0,Z.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/announcements",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:announcements"],query:this._createModeratorActionQuery(r),jsonBody:{message:t.message,color:t.color}})}async getColorsForUsers(e){let t=await this._client.callApi({type:"helix",url:"chat/color",query:(0,Vt.createSingleKeyQuery)("user_id",e.map(Z.extractUserId))});return new Map(t.data.map(r=>[r.user_id,r.color||null]))}async getColorForUser(e){let t=await this._client.callApi({type:"helix",url:"chat/color",userId:(0,Z.extractUserId)(e),query:(0,Vt.createSingleKeyQuery)("user_id",(0,Z.extractUserId)(e))});if(t.data.length)return t.data[0].color||null}async setColorForUser(e,t){await this._client.callApi({type:"helix",url:"chat/color",method:"PUT",userId:(0,Z.extractUserId)(e),scopes:["user:manage:chat_color"],query:(0,_r.createChatColorUpdateQuery)(e,t)})}async shoutoutUser(e,t){let r=(0,Z.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:(0,_r.createShoutoutQuery)(e,t,this._getUserContextIdWithDefault(r))})}async getSharedChatSession(e){let t=(0,Z.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"shared_chat/session",userId:t,query:(0,yP.createSharedChatSessionQuery)(t)});return r.data.length===0?null:new fP.HelixSharedChatSession(r.data[0],this._client)}_createModeratorActionQuery(e){return(0,Vt.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};wn.HelixChatApi=Dh;wn.HelixChatApi=Dh=lP.__decorate([(0,Z.rtfm)("api","HelixChatApi")],Dh)});var tb=u($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.createClipQuery=$r.createClipCreateQuery=void 0;var gP=m();function bP(i,e){return{broadcaster_id:(0,gP.extractUserId)(i),has_delay:e.toString()}}n(bP,"createClipCreateQuery");$r.createClipCreateQuery=bP;function xP(i){let{filterType:e,ids:t,startDate:r,endDate:a,isFeatured:s}=i;return{[e]:t,started_at:r,ended_at:a,is_featured:s?.toString()}}n(xP,"createClipQuery");$r.createClipQuery=xP});var Th=u(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.HelixClip=void 0;var rb=(b(),x(g)),wP=C(),L=m(),xl=class extends L.DataObject{static{n(this,"HelixClip")}constructor(e,t){super(e),this._client=t}get id(){return this[L.rawDataSymbol].id}get url(){return this[L.rawDataSymbol].url}get embedUrl(){return this[L.rawDataSymbol].embed_url}get broadcasterId(){return this[L.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[L.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,L.checkRelationAssertion)(await this._client.users.getUserById(this[L.rawDataSymbol].broadcaster_id))}get creatorId(){return this[L.rawDataSymbol].creator_id}get creatorDisplayName(){return this[L.rawDataSymbol].creator_name}async getCreator(){return(0,L.checkRelationAssertion)(await this._client.users.getUserById(this[L.rawDataSymbol].creator_id))}get videoId(){return this[L.rawDataSymbol].video_id}async getVideo(){return(0,L.checkRelationAssertion)(await this._client.videos.getVideoById(this[L.rawDataSymbol].video_id))}get gameId(){return this[L.rawDataSymbol].game_id}async getGame(){return this[L.rawDataSymbol].game_id?(0,L.checkRelationAssertion)(await this._client.games.getGameById(this[L.rawDataSymbol].game_id)):null}get language(){return this[L.rawDataSymbol].language}get title(){return this[L.rawDataSymbol].title}get views(){return this[L.rawDataSymbol].view_count}get creationDate(){return new Date(this[L.rawDataSymbol].created_at)}get thumbnailUrl(){return this[L.rawDataSymbol].thumbnail_url}get duration(){return this[L.rawDataSymbol].duration}get vodOffset(){return this[L.rawDataSymbol].vod_offset}get isFeatured(){return this[L.rawDataSymbol].is_featured}};vn.HelixClip=xl;rb.__decorate([(0,wP.Enumerable)(!1)],xl.prototype,"_client",void 0);vn.HelixClip=xl=rb.__decorate([(0,L.rtfm)("api","HelixClip","id")],xl)});var Oh=u(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.HelixClipApi=void 0;var ib=(b(),x(g)),vP=C(),zr=m(),Rh=tb(),SP=Ft(),HP=oe(),CP=pe(),qP=le(),EP=G(),Uh=Th(),wl=class extends EP.BaseApi{static{n(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new SP.HelixRequestBatcher({url:"clips"},"id","id",this._client,e=>new Uh.HelixClip(e,this._client))}async getClipsForBroadcaster(e,t={}){return await this._getClips({...t,filterType:"broadcaster_id",ids:(0,zr.extractUserId)(e),userId:(0,zr.extractUserId)(e)})}getClipsForBroadcasterPaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"broadcaster_id",ids:(0,zr.extractUserId)(e),userId:(0,zr.extractUserId)(e)})}async getClipsForGame(e,t={}){return await this._getClips({...t,filterType:"game_id",ids:e})}getClipsForGamePaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"game_id",ids:e})}async getClipsByIds(e){return(await this._getClips({filterType:"id",ids:e})).data}async getClipById(e){let t=await this.getClipsByIds([e]);return t.length?t[0]:null}async getClipByIdBatched(e){return await this._getClipByIdBatcher.request(e)}async createClip(e){let{channel:t,createAfterDelay:r=!1}=e;return(await this._client.callApi({type:"helix",url:"clips",method:"POST",userId:(0,zr.extractUserId)(t),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:(0,Rh.createClipCreateQuery)(t,r)})).data[0].id}async _getClips(e){if(!e.ids.length)return{data:[]};let t=await this._client.callApi({type:"helix",url:"clips",userId:e.userId,query:{...(0,Rh.createClipQuery)(e),...(0,qP.createPaginationQuery)(e)}});return(0,CP.createPaginatedResult)(t,Uh.HelixClip,this._client)}_getClipsPaginated(e){return new HP.HelixPaginatedRequest({url:"clips",userId:e.userId,query:(0,Rh.createClipQuery)(e)},this._client,t=>new Uh.HelixClip(t,this._client))}};Sn.HelixClipApi=wl;ib.__decorate([(0,vP.Enumerable)(!1)],wl.prototype,"_getClipByIdBatcher",void 0);Sn.HelixClipApi=wl=ib.__decorate([(0,zr.rtfm)("api","HelixClipApi")],wl)});var jh=u(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.HelixContentClassificationLabel=void 0;var vl=m(),Bh=class extends vl.DataObject{static{n(this,"HelixContentClassificationLabel")}get id(){return this[vl.rawDataSymbol].id}get name(){return this[vl.rawDataSymbol].name}get description(){return this[vl.rawDataSymbol].description}};Sl.HelixContentClassificationLabel=Bh});var Mh=u(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.HelixContentClassificationLabelApi=void 0;var PP=(b(),x(g)),AP=m(),DP=G(),IP=jh(),kh=class extends DP.BaseApi{static{n(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(r=>new IP.HelixContentClassificationLabel(r))}};Hn.HelixContentClassificationLabelApi=kh;Hn.HelixContentClassificationLabelApi=kh=PP.__decorate([(0,AP.rtfm)("api","HelixContentClassificationLabelApi")],kh)});var nb=u(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.createDropsEntitlementUpdateBody=Kr.createDropsEntitlementQuery=void 0;var TP=C(),RP=m();function UP(i,e){return{user_id:e?(0,TP.mapOptional)(i.user,RP.extractUserId):void 0,game_id:i.gameId,fulfillment_status:i.fulfillmentStatus}}n(UP,"createDropsEntitlementQuery");Kr.createDropsEntitlementQuery=UP;function OP(i,e){return{fulfillment_status:e,entitlement_ids:i}}n(OP,"createDropsEntitlementUpdateBody");Kr.createDropsEntitlementUpdateBody=OP});var Lh=u(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.HelixDropsEntitlement=void 0;var ab=(b(),x(g)),BP=C(),ke=m(),Hl=class extends ke.DataObject{static{n(this,"HelixDropsEntitlement")}constructor(e,t){super(e),this._client=t}get id(){return this[ke.rawDataSymbol].id}get rewardId(){return this[ke.rawDataSymbol].benefit_id}get grantDate(){return new Date(this[ke.rawDataSymbol].timestamp)}get userId(){return this[ke.rawDataSymbol].user_id}async getUser(){return(0,ke.checkRelationAssertion)(await this._client.users.getUserById(this[ke.rawDataSymbol].user_id))}get gameId(){return this[ke.rawDataSymbol].game_id}async getGame(){return(0,ke.checkRelationAssertion)(await this._client.games.getGameById(this[ke.rawDataSymbol].game_id))}get fulfillmentStatus(){return this[ke.rawDataSymbol].fulfillment_status}get updateDate(){return new Date(this[ke.rawDataSymbol].last_updated)}};Cn.HelixDropsEntitlement=Hl;ab.__decorate([(0,BP.Enumerable)(!1)],Hl.prototype,"_client",void 0);Cn.HelixDropsEntitlement=Hl=ab.__decorate([(0,ke.rtfm)("api","HelixDropsEntitlement")],Hl)});var Gh=u(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.HelixEntitlementApi=void 0;var sb=(b(),x(g)),Nh=C(),Qh=m(),Fh=nb(),jP=Ft(),kP=oe(),MP=pe(),LP=le(),FP=G(),Cl=Lh(),ql=class extends FP.BaseApi{static{n(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new jP.HelixRequestBatcher({url:"entitlements/drops"},"id","id",this._client,e=>new Cl.HelixDropsEntitlement(e,this._client))}async getDropsEntitlements(e,t=!1){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:(0,Nh.mapOptional)(e.user,Qh.extractUserId),forceType:e.user&&t?"app":void 0,query:{...(0,Fh.createDropsEntitlementQuery)(e,t),...(0,LP.createPaginationQuery)(e)}});return(0,MP.createPaginatedResult)(r,Cl.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new kP.HelixPaginatedRequest({url:"entitlements/drops",userId:(0,Nh.mapOptional)(e.user,Qh.extractUserId),forceType:e.user&&t?"app":void 0,query:(0,Fh.createDropsEntitlementQuery)(e,t)},this._client,r=>new Cl.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(r=>new Cl.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementById(e){var t;return(t=(await this.getDropsEntitlementsByIds([e]))[0])!==null&&t!==void 0?t:null}async getDropsEntitlementByIdBatched(e){return await this._getDropsEntitlementByIdBatcher.request(e)}async updateDropsEntitlements(e,t){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",method:"PATCH",jsonBody:(0,Fh.createDropsEntitlementUpdateBody)(e,t)});return new Map(r.data.flatMap(a=>a.ids.map(s=>[s,a.status])))}};qn.HelixEntitlementApi=ql;sb.__decorate([(0,Nh.Enumerable)(!1)],ql.prototype,"_getDropsEntitlementByIdBatcher",void 0);qn.HelixEntitlementApi=ql=sb.__decorate([(0,Qh.rtfm)("api","HelixEntitlementApi")],ql)});var lb=u(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.createEventSubConduitShardsUpdateCondition=ye.createEventSubConduitUpdateCondition=ye.createEventSubConduitCondition=ye.createEventSubDropEntitlementGrantCondition=ye.createEventSubUserCondition=ye.createEventSubModeratorCondition=ye.createEventSubRewardCondition=ye.createEventSubBroadcasterCondition=void 0;var ob=m();function NP(i){return{broadcaster_user_id:(0,ob.extractUserId)(i)}}n(NP,"createEventSubBroadcasterCondition");ye.createEventSubBroadcasterCondition=NP;function QP(i,e){return{broadcaster_user_id:(0,ob.extractUserId)(i),reward_id:e}}n(QP,"createEventSubRewardCondition");ye.createEventSubRewardCondition=QP;function GP(i,e){return{broadcaster_user_id:i,moderator_user_id:e}}n(GP,"createEventSubModeratorCondition");ye.createEventSubModeratorCondition=GP;function WP(i,e){return{broadcaster_user_id:i,user_id:e}}n(WP,"createEventSubUserCondition");ye.createEventSubUserCondition=WP;function VP(i){return{organization_id:i.organizationId,category_id:i.categoryId,campaign_id:i.campaignId}}n(VP,"createEventSubDropEntitlementGrantCondition");ye.createEventSubDropEntitlementGrantCondition=VP;function $P(i,e){return{conduit_id:i,status:e}}n($P,"createEventSubConduitCondition");ye.createEventSubConduitCondition=$P;function zP(i,e){return{id:i,shard_count:e.toString()}}n(zP,"createEventSubConduitUpdateCondition");ye.createEventSubConduitUpdateCondition=zP;function KP(i,e){return{conduit_id:i,shards:e}}n(KP,"createEventSubConduitShardsUpdateCondition");ye.createEventSubConduitShardsUpdateCondition=KP});var Pl=u(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.HelixEventSubSubscription=void 0;var ub=(b(),x(g)),JP=C(),Ke=m(),El=class extends Ke.DataObject{static{n(this,"HelixEventSubSubscription")}constructor(e,t){super(e),this._client=t}get id(){return this[Ke.rawDataSymbol].id}get status(){return this[Ke.rawDataSymbol].status}get type(){return this[Ke.rawDataSymbol].type}get cost(){return this[Ke.rawDataSymbol].cost}get condition(){return this[Ke.rawDataSymbol].condition}get creationDate(){return new Date(this[Ke.rawDataSymbol].created_at)}get transportMethod(){return this[Ke.rawDataSymbol].transport.method}async unsubscribe(){await this._client.eventSub.deleteSubscription(this[Ke.rawDataSymbol].id)}get _transport(){return this[Ke.rawDataSymbol].transport}set _status(e){this[Ke.rawDataSymbol].status=e}};En.HelixEventSubSubscription=El;ub.__decorate([(0,JP.Enumerable)(!1)],El.prototype,"_client",void 0);En.HelixEventSubSubscription=El=ub.__decorate([(0,Ke.rtfm)("api","HelixEventSubSubscription","id")],El)});var Vh=u(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.HelixPaginatedEventSubSubscriptionsRequest=void 0;var ZP=(b(),x(g)),XP=m(),YP=Gr(),eA=Pl(),Wh=class extends YP.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,r){super({url:"eventsub/subscriptions",userId:t,query:e},r,a=>new eA.HelixEventSubSubscription(a,r))}async getTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total_cost}async getMaxTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).max_total_cost}};Pn.HelixPaginatedEventSubSubscriptionsRequest=Wh;Pn.HelixPaginatedEventSubSubscriptionsRequest=Wh=ZP.__decorate([(0,XP.rtfm)("api","HelixPaginatedEventSubSubscriptionsRequest")],Wh)});var $h=u(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.HelixEventSubConduit=void 0;var cb=(b(),x(g)),tA=C(),mr=m(),Al=class extends mr.DataObject{static{n(this,"HelixEventSubConduit")}constructor(e,t){super(e),this._client=t}get id(){return this[mr.rawDataSymbol].id}get shardCount(){return this[mr.rawDataSymbol].shard_count}async update(e){return await this._client.eventSub.updateConduit(this[mr.rawDataSymbol].id,e)}async delete(){await this._client.eventSub.deleteConduit(this[mr.rawDataSymbol].id)}async getShards(){return await this._client.eventSub.getConduitShards(this[mr.rawDataSymbol].id)}};An.HelixEventSubConduit=Al;cb.__decorate([(0,tA.Enumerable)(!1)],Al.prototype,"_client",void 0);An.HelixEventSubConduit=Al=cb.__decorate([(0,mr.rtfm)("api","HelixEventSubConduit")],Al)});var Kh=u(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.HelixEventSubConduitShard=void 0;var rA=(b(),x(g)),Dn=m(),zh=class extends Dn.DataObject{static{n(this,"HelixEventSubConduitShard")}get id(){return this[Dn.rawDataSymbol].id}get status(){return this[Dn.rawDataSymbol].status}get transportMethod(){return this[Dn.rawDataSymbol].transport.method}};In.HelixEventSubConduitShard=zh;In.HelixEventSubConduitShard=zh=rA.__decorate([(0,Dn.rtfm)("api","HelixEventSubConduitShard")],zh)});var Yh=u(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.HelixEventSubApi=void 0;var iA=(b(),x(g)),nA=C(),R=m(),S=lb(),rt=je(),aA=oe(),Tn=pe(),Rn=le(),sA=G(),Un=Pl(),Dl=Vh(),Jh=$h(),Zh=Kh(),Xh=class extends sA.BaseApi{static{n(this,"HelixEventSubApi")}async getSubscriptions(e){let t=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:(0,Rn.createPaginationQuery)(e)});return{...(0,Tn.createPaginatedResultWithTotal)(t,Un.HelixEventSubSubscription,this._client),totalCost:t.total_cost,maxTotalCost:t.max_total_cost}}getSubscriptionsPaginated(){return new Dl.HelixPaginatedEventSubSubscriptionsRequest({},void 0,this._client)}async getSubscriptionsForStatus(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Rn.createPaginationQuery)(t),status:e}});return{...(0,Tn.createPaginatedResultWithTotal)(r,Un.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new Dl.HelixPaginatedEventSubSubscriptionsRequest({status:e},void 0,this._client)}async getSubscriptionsForType(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Rn.createPaginationQuery)(t),type:e}});return{...(0,Tn.createPaginatedResultWithTotal)(r,Un.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForTypePaginated(e){return new Dl.HelixPaginatedEventSubSubscriptionsRequest({type:e},void 0,this._client)}async getSubscriptionsForUser(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:(0,R.extractUserId)(e),query:{...(0,rt.createSingleKeyQuery)("user_id",(0,R.extractUserId)(e)),...(0,Rn.createPaginationQuery)(t)}});return{...(0,Tn.createPaginatedResultWithTotal)(r,Un.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForUserPaginated(e){let t=(0,R.extractUserId)(e);return new Dl.HelixPaginatedEventSubSubscriptionsRequest((0,rt.createSingleKeyQuery)("user_id",t),t,this._client)}async createSubscription(e,t,r,a,s,o,l,d){let h=a.method==="webhook"||a.method==="conduit",p=h?void 0:o;if(!h&&!s)throw new Error(`Transport ${a.method} can only handle subscriptions with user context`);let w={type:e,version:t,condition:r,transport:a};d&&(w.is_batching_enabled=!0);let E=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:p,userId:(0,nA.mapOptional)(s,R.extractUserId),canOverrideScopedUserContext:l,forceType:h?"app":"user",jsonBody:w});return new Un.HelixEventSubSubscription(E.data[0],this._client)}async deleteSubscription(e){await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"DELETE",query:{id:e}})}async deleteAllSubscriptions(){await this._deleteSubscriptionsWithCondition()}async deleteBrokenSubscriptions(){await this._deleteSubscriptionsWithCondition(e=>e.status!=="enabled"&&e.status!=="webhook_callback_verification_pending")}async subscribeToStreamOnlineEvents(e,t){return await this.createSubscription("stream.online","1",(0,S.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToStreamOfflineEvents(e,t){return await this.createSubscription("stream.offline","1",(0,S.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelUpdateEvents(e,t){return await this.createSubscription("channel.update","2",(0,S.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelFollowEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.follow","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:followers"],!0)}async subscribeToChannelSubscriptionEvents(e,t){return await this.createSubscription("channel.subscribe","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionGiftEvents(e,t){return await this.createSubscription("channel.subscription.gift","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionMessageEvents(e,t){return await this.createSubscription("channel.subscription.message","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionEndEvents(e,t){return await this.createSubscription("channel.subscription.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelCheerEvents(e,t){return await this.createSubscription("channel.cheer","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["bits:read"])}async subscribeToChannelCharityCampaignStartEvents(e,t){return await this.createSubscription("channel.charity_campaign.start","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignStopEvents(e,t){return await this.createSubscription("channel.charity_campaign.stop","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityDonationEvents(e,t){return await this.createSubscription("channel.charity_campaign.donate","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignProgressEvents(e,t){return await this.createSubscription("channel.charity_campaign.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelBanEvents(e,t){return await this.createSubscription("channel.ban","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelUnbanEvents(e,t){return await this.createSubscription("channel.unban","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelShieldModeBeginEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shield_mode.begin","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shield_mode.end","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelModeratorAddEvents(e,t){return await this.createSubscription("channel.moderator.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelModeratorRemoveEvents(e,t){return await this.createSubscription("channel.moderator.remove","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelRaidEventsFrom(e,t){return await this.createSubscription("channel.raid","1",(0,rt.createSingleKeyQuery)("from_broadcaster_user_id",(0,R.extractUserId)(e)),t,e)}async subscribeToChannelRaidEventsTo(e,t){return await this.createSubscription("channel.raid","1",(0,rt.createSingleKeyQuery)("to_broadcaster_user_id",(0,R.extractUserId)(e)),t,e)}async subscribeToChannelRewardAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,S.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,S.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,S.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,S.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelAutomaticRewardRedemptionAddEvents(e,t){return await this.createSubscription("channel.channel_points_automatic_reward_redemption.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelAutomaticRewardRedemptionAddV2Events(e,t){return await this.createSubscription("channel.channel_points_automatic_reward_redemption.add","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelPollBeginEvents(e,t){return await this.createSubscription("channel.poll.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollProgressEvents(e,t){return await this.createSubscription("channel.poll.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollEndEvents(e,t){return await this.createSubscription("channel.poll.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPredictionBeginEvents(e,t){return await this.createSubscription("channel.prediction.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionProgressEvents(e,t){return await this.createSubscription("channel.prediction.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionLockEvents(e,t){return await this.createSubscription("channel.prediction.lock","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionEndEvents(e,t){return await this.createSubscription("channel.prediction.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelGoalBeginEvents(e,t){return await this.createSubscription("channel.goal.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalProgressEvents(e,t){return await this.createSubscription("channel.goal.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalEndEvents(e,t){return await this.createSubscription("channel.goal.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelHypeTrainBeginEvents(e,t){return await this.createSubscription("channel.hype_train.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressEvents(e,t){return await this.createSubscription("channel.hype_train.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndEvents(e,t){return await this.createSubscription("channel.hype_train.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainBeginV2Events(e,t){return await this.createSubscription("channel.hype_train.begin","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressV2Events(e,t){return await this.createSubscription("channel.hype_train.progress","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndV2Events(e,t){return await this.createSubscription("channel.hype_train.end","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelShoutoutCreateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shoutout.create","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shoutout.receive","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelAdBreakBeginEvents(e,t){return await this.createSubscription("channel.ad_break.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:ads"])}async subscribeToChannelChatClearEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.clear","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatClearUserMessagesEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.clear_user_messages","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageDeleteEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.message_delete","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatNotificationEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.notification","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.message","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatSettingsUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat_settings.update","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelUnbanRequestCreateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.unban_request.create","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelUnbanRequestResolveEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.unban_request.resolve","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelModerateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.moderate","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,[],!0)}async subscribeToChannelWarningAcknowledgeEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.warning.acknowledge","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelWarningSendEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.warning.send","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelVipAddEvents(e,t){return await this.createSubscription("channel.vip.add","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToChannelVipRemoveEvents(e,t){return await this.createSubscription("channel.vip.remove","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToExtensionBitsTransactionCreateEvents(e,t){return await this.createSubscription("extension.bits_transaction.create","1",(0,rt.createSingleKeyQuery)("extension_client_id",e),t)}async subscribeToUserAuthorizationGrantEvents(e,t){return await this.createSubscription("user.authorization.grant","1",(0,rt.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserAuthorizationRevokeEvents(e,t){return await this.createSubscription("user.authorization.revoke","1",(0,rt.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserUpdateEvents(e,t,r){return await this.createSubscription("user.update","1",(0,rt.createSingleKeyQuery)("user_id",(0,R.extractUserId)(e)),t,e,r?["user:read:email"]:void 0)}async subscribeToUserWhisperMessageEvents(e,t){return await this.createSubscription("user.whisper.message","1",(0,rt.createSingleKeyQuery)("user_id",(0,R.extractUserId)(e)),t,e,["user:read:whispers","user:manage:whispers"])}async subscribeToDropEntitlementGrantEvents(e,t){return await this.createSubscription("drop.entitlement.grant","1",(0,S.createEventSubDropEntitlementGrantCondition)(e),t,void 0,void 0,!1,!0)}async subscribeToAutoModMessageHoldEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.message.hold","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.message.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageHoldV2Events(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.message.hold","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateV2Events(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.message.update","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModSettingsUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.settings.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:automod_settings"],!0)}async subscribeToAutoModTermsUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("automod.terms.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToChannelChatUserMessageHoldEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_hold","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatUserMessageUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_update","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelSuspiciousUserUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSuspiciousUserMessageEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.message","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSharedChatSessionBeginEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shared_chat.begin","1",(0,S.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionUpdateEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shared_chat.update","1",(0,S.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionEndEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.shared_chat.end","1",(0,S.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelBitsUseEvents(e,t){let r=(0,R.extractUserId)(e);return await this.createSubscription("channel.bits.use","1",(0,S.createEventSubBroadcasterCondition)(r),t,r,["bits:read"])}async getConduits(){return(await this._client.callApi({type:"helix",url:"eventsub/conduits"})).data.map(t=>new Jh.HelixEventSubConduit(t,this._client))}async createConduit(e){let t=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"POST",query:{...(0,rt.createSingleKeyQuery)("shard_count",e.toString())}});return new Jh.HelixEventSubConduit(t.data[0],this._client)}async updateConduit(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"PATCH",query:(0,S.createEventSubConduitUpdateCondition)(e,t)});return new Jh.HelixEventSubConduit(r.data[0],this._client)}async deleteConduit(e){await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"DELETE",query:{...(0,rt.createSingleKeyQuery)("id",e)}})}async getConduitShards(e,t,r){let a=await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",query:{...(0,S.createEventSubConduitCondition)(e,t),...(0,Rn.createPaginationQuery)(r)}});return{...(0,Tn.createPaginatedResult)(a,Zh.HelixEventSubConduitShard,this._client)}}getConduitShardsPaginated(e,t){return new aA.HelixPaginatedRequest({url:"eventsub/conduits/shards",query:(0,S.createEventSubConduitCondition)(e,t)},this._client,r=>new Zh.HelixEventSubConduitShard(r))}async updateConduitShards(e,t){return(await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",method:"PATCH",jsonBody:(0,S.createEventSubConduitShardsUpdateCondition)(e,t)})).data.map(a=>new Zh.HelixEventSubConduitShard(a))}async _deleteSubscriptionsWithCondition(e){let t=this.getSubscriptionsPaginated();for await(let r of t)(!e||e(r))&&await r.unsubscribe()}};On.HelixEventSubApi=Xh;On.HelixEventSubApi=Xh=iA.__decorate([(0,R.rtfm)("api","HelixEventSubApi")],Xh)});var db=u($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.createExtensionTransactionQuery=$t.createExtensionProductBody=$t.createReleasedExtensionFilter=void 0;function oA(i,e){return{extension_id:i,extension_version:e}}n(oA,"createReleasedExtensionFilter");$t.createReleasedExtensionFilter=oA;function lA(i){return{sku:i.sku,cost:{amount:i.cost,type:"bits"},display_name:i.displayName,in_development:i.inDevelopment,expiration:i.expirationDate,is_broadcast:i.broadcast}}n(lA,"createExtensionProductBody");$t.createExtensionProductBody=lA;function uA(i,e){return{extension_id:i,id:e.transactionIds}}n(uA,"createExtensionTransactionQuery");$t.createExtensionTransactionQuery=uA});var ep=u(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.HelixChannelReference=void 0;var hb=(b(),x(g)),cA=C(),Te=m(),Il=class extends Te.DataObject{static{n(this,"HelixChannelReference")}constructor(e,t){super(e),this._client=t}get id(){return this[Te.rawDataSymbol].broadcaster_id}get displayName(){return this[Te.rawDataSymbol].broadcaster_name}async getChannel(){return(0,Te.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[Te.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,Te.checkRelationAssertion)(await this._client.users.getUserById(this[Te.rawDataSymbol].broadcaster_id))}get gameId(){return this[Te.rawDataSymbol].game_id}get gameName(){return this[Te.rawDataSymbol].game_name}async getGame(){return this[Te.rawDataSymbol].game_id?(0,Te.checkRelationAssertion)(await this._client.games.getGameById(this[Te.rawDataSymbol].game_id)):null}get title(){return this[Te.rawDataSymbol].title}};Bn.HelixChannelReference=Il;hb.__decorate([(0,cA.Enumerable)(!1)],Il.prototype,"_client",void 0);Bn.HelixChannelReference=Il=hb.__decorate([(0,Te.rtfm)("api","HelixChannelReference","id")],Il)});var rp=u(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.HelixExtensionBitsProduct=void 0;var dA=(b(),x(g)),hA=C(),zt=m(),tp=class extends zt.DataObject{static{n(this,"HelixExtensionBitsProduct")}get sku(){return this[zt.rawDataSymbol].sku}get cost(){return this[zt.rawDataSymbol].cost.amount}get displayName(){return this[zt.rawDataSymbol].display_name}get inDevelopment(){return this[zt.rawDataSymbol].in_development}get isBroadcast(){return this[zt.rawDataSymbol].is_broadcast}get expirationDate(){return(0,hA.mapNullable)(this[zt.rawDataSymbol].expiration,e=>new Date(e))}};jn.HelixExtensionBitsProduct=tp;jn.HelixExtensionBitsProduct=tp=dA.__decorate([(0,zt.rtfm)("api","HelixExtensionBitsProduct","sku")],tp)});var ip=u(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.HelixExtensionTransaction=void 0;var pb=(b(),x(g)),pA=C(),_e=m(),Tl=class extends _e.DataObject{static{n(this,"HelixExtensionTransaction")}constructor(e,t){super(e),this._client=t}get id(){return this[_e.rawDataSymbol].id}get transactionDate(){return new Date(this[_e.rawDataSymbol].timestamp)}get broadcasterId(){return this[_e.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[_e.rawDataSymbol].broadcaster_name}get broadcasterDisplayName(){return this[_e.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,_e.checkRelationAssertion)(await this._client.users.getUserById(this[_e.rawDataSymbol].broadcaster_id))}get userId(){return this[_e.rawDataSymbol].user_id}get userName(){return this[_e.rawDataSymbol].user_login}get userDisplayName(){return this[_e.rawDataSymbol].user_name}async getUser(){return(0,_e.checkRelationAssertion)(await this._client.users.getUserById(this[_e.rawDataSymbol].user_id))}get productType(){return this[_e.rawDataSymbol].product_type}get productSku(){return this[_e.rawDataSymbol].product_data.sku}get productCost(){return this[_e.rawDataSymbol].product_data.cost.amount}get productDisplayName(){return this[_e.rawDataSymbol].product_data.displayName}get productInDevelopment(){return this[_e.rawDataSymbol].product_data.inDevelopment}};kn.HelixExtensionTransaction=Tl;pb.__decorate([(0,pA.Enumerable)(!1)],Tl.prototype,"_client",void 0);kn.HelixExtensionTransaction=Tl=pb.__decorate([(0,_e.rtfm)("api","HelixExtensionTransaction","id")],Tl)});var sp=u(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.HelixExtensionsApi=void 0;var _A=(b(),x(g)),xb=m(),Rl=db(),np=je(),_b=oe(),mb=pe(),yb=le(),mA=G(),fb=ep(),gb=rp(),bb=ip(),ap=class extends mA.BaseApi{static{n(this,"HelixExtensionsApi")}async getReleasedExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/released",query:(0,Rl.createReleasedExtensionFilter)(e,t)});return new xb.HelixExtension(r.data[0])}async getLiveChannelsWithExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/live",query:{...(0,np.createSingleKeyQuery)("extension_id",e),...(0,yb.createPaginationQuery)(t)}});return(0,mb.createPaginatedResult)(r,fb.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new _b.HelixPaginatedRequest({url:"extensions/live",query:(0,np.createSingleKeyQuery)("extension_id",e)},this._client,t=>new fb.HelixChannelReference(t,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:(0,np.createSingleKeyQuery)("should_include_all",e?.toString())})).data.map(r=>new gb.HelixExtensionBitsProduct(r))}async putExtensionBitsProduct(e){let t=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:(0,Rl.createExtensionProductBody)(e)});return new gb.HelixExtensionBitsProduct(t.data[0])}async getExtensionTransactions(e,t={}){let r=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...(0,Rl.createExtensionTransactionQuery)(e,t),...(0,yb.createPaginationQuery)(t)}});return(0,mb.createPaginatedResult)(r,bb.HelixExtensionTransaction,this._client)}getExtensionTransactionsPaginated(e,t={}){return new _b.HelixPaginatedRequest({url:"extensions/transactions",forceType:"app",query:(0,Rl.createExtensionTransactionQuery)(e,t)},this._client,r=>new bb.HelixExtensionTransaction(r,this._client))}};Mn.HelixExtensionsApi=ap;Mn.HelixExtensionsApi=ap=_A.__decorate([(0,xb.rtfm)("api","HelixExtensionsApi")],ap)});var Ol=u(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.HelixGame=void 0;var wb=(b(),x(g)),yA=C(),qt=m(),Ul=class extends qt.DataObject{static{n(this,"HelixGame")}constructor(e,t){super(e),this._client=t}get id(){return this[qt.rawDataSymbol].id}get name(){return this[qt.rawDataSymbol].name}get boxArtUrl(){return this[qt.rawDataSymbol].box_art_url}get igdbId(){return this[qt.rawDataSymbol].igdb_id||null}getBoxArtUrl(e,t){return this[qt.rawDataSymbol].box_art_url.replace("{width}",e.toString()).replace("{height}",t.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[qt.rawDataSymbol].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[qt.rawDataSymbol].id})}};Ln.HelixGame=Ul;wb.__decorate([(0,yA.Enumerable)(!1)],Ul.prototype,"_client",void 0);Ln.HelixGame=Ul=wb.__decorate([(0,qt.rtfm)("api","HelixGame","id")],Ul)});var up=u(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.HelixGameApi=void 0;var Bl=(b(),x(g)),lp=C(),fA=m(),op=Ft(),gA=oe(),bA=pe(),xA=le(),wA=G(),Jr=Ol(),Zr=class extends wA.BaseApi{static{n(this,"HelixGameApi")}constructor(){super(...arguments),this._getGameByIdBatcher=new op.HelixRequestBatcher({url:"games"},"id","id",this._client,e=>new Jr.HelixGame(e,this._client)),this._getGameByNameBatcher=new op.HelixRequestBatcher({url:"games"},"name","name",this._client,e=>new Jr.HelixGame(e,this._client)),this._getGameByIgdbIdBatcher=new op.HelixRequestBatcher({url:"games"},"igdb_id","igdb_id",this._client,e=>new Jr.HelixGame(e,this._client))}async getGamesByIds(e){return await this._getGames("id",e)}async getGamesByNames(e){return await this._getGames("name",e)}async getGamesByIgdbIds(e){return await this._getGames("igdb_id",e)}async getGameById(e){var t;return(t=(await this._getGames("id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByName(e){var t;return(t=(await this._getGames("name",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIgdbId(e){var t;return(t=(await this._getGames("igdb_id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIdBatched(e){return await this._getGameByIdBatcher.request(e)}async getGameByNameBatched(e){return await this._getGameByNameBatcher.request(e)}async getGameByIgdbIdBatched(e){return await this._getGameByIgdbIdBatcher.request(e)}async getTopGames(e){let t=await this._client.callApi({type:"helix",url:"games/top",query:(0,xA.createPaginationQuery)(e)});return(0,bA.createPaginatedResult)(t,Jr.HelixGame,this._client)}getTopGamesPaginated(){return new gA.HelixPaginatedRequest({url:"games/top"},this._client,e=>new Jr.HelixGame(e,this._client))}async _getGames(e,t){return t.length?(await this._client.callApi({type:"helix",url:"games",query:{[e]:t}})).data.map(a=>new Jr.HelixGame(a,this._client)):[]}};Fn.HelixGameApi=Zr;Bl.__decorate([(0,lp.Enumerable)(!1)],Zr.prototype,"_getGameByIdBatcher",void 0);Bl.__decorate([(0,lp.Enumerable)(!1)],Zr.prototype,"_getGameByNameBatcher",void 0);Bl.__decorate([(0,lp.Enumerable)(!1)],Zr.prototype,"_getGameByIgdbIdBatcher",void 0);Fn.HelixGameApi=Zr=Bl.__decorate([(0,fA.rtfm)("api","HelixGameApi")],Zr)});var cp=u(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.HelixGoal=void 0;var vb=(b(),x(g)),vA=C(),Me=m(),jl=class extends Me.DataObject{static{n(this,"HelixGoal")}constructor(e,t){super(e),this._client=t}get id(){return this[Me.rawDataSymbol].id}get broadcasterId(){return this[Me.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[Me.rawDataSymbol].broadcaster_name}get broadcasterName(){return this[Me.rawDataSymbol].broadcaster_login}async getBroadcaster(){return(0,Me.checkRelationAssertion)(await this._client.users.getUserById(this[Me.rawDataSymbol].broadcaster_id))}get type(){return this[Me.rawDataSymbol].type}get description(){return this[Me.rawDataSymbol].description}get currentAmount(){return this[Me.rawDataSymbol].current_amount}get targetAmount(){return this[Me.rawDataSymbol].target_amount}get creationDate(){return this[Me.rawDataSymbol].created_at}};Nn.HelixGoal=jl;vb.__decorate([(0,vA.Enumerable)(!1)],jl.prototype,"_client",void 0);Nn.HelixGoal=jl=vb.__decorate([(0,Me.rtfm)("api","HelixGoal","id")],jl)});var hp=u(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.HelixGoalApi=void 0;var SA=(b(),x(g)),HA=Y(),Sb=m(),CA=G(),qA=cp(),dp=class extends CA.BaseApi{static{n(this,"HelixGoalApi")}async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:(0,Sb.extractUserId)(e),scopes:["channel:read:goals"],query:(0,HA.createBroadcasterQuery)(e)})).data.map(r=>new qA.HelixGoal(r,this._client))}};Qn.HelixGoalApi=dp;Qn.HelixGoalApi=dp=SA.__decorate([(0,Sb.rtfm)("api","HelixGoalApi")],dp)});var pp=u(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.HelixHypeTrainContribution=void 0;var Hb=(b(),x(g)),EA=C(),yr=m(),kl=class extends yr.DataObject{static{n(this,"HelixHypeTrainContribution")}constructor(e,t){super(e),this._client=t}get userId(){return this[yr.rawDataSymbol].user}async getUser(){return(0,yr.checkRelationAssertion)(await this._client.users.getUserById(this[yr.rawDataSymbol].user))}get type(){return this[yr.rawDataSymbol].type}get total(){return this[yr.rawDataSymbol].total}};Gn.HelixHypeTrainContribution=kl;Hb.__decorate([(0,EA.Enumerable)(!1)],kl.prototype,"_client",void 0);Gn.HelixHypeTrainContribution=kl=Hb.__decorate([(0,yr.rtfm)("api","HelixHypeTrainContribution","userId")],kl)});var _p=u(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.HelixHypeTrainEvent=void 0;var qb=(b(),x(g)),PA=C(),fe=m(),Cb=pp(),Ml=class extends fe.DataObject{static{n(this,"HelixHypeTrainEvent")}constructor(e,t){super(e),this._client=t}get eventId(){return this[fe.rawDataSymbol].id}get eventType(){return this[fe.rawDataSymbol].event_type}get eventDate(){return new Date(this[fe.rawDataSymbol].event_timestamp)}get eventVersion(){return this[fe.rawDataSymbol].version}get id(){return this[fe.rawDataSymbol].event_data.id}get broadcasterId(){return this[fe.rawDataSymbol].event_data.broadcaster_id}async getBroadcaster(){return(0,fe.checkRelationAssertion)(await this._client.users.getUserById(this[fe.rawDataSymbol].event_data.broadcaster_id))}get level(){return this[fe.rawDataSymbol].event_data.level}get startDate(){return new Date(this[fe.rawDataSymbol].event_data.started_at)}get expiryDate(){return new Date(this[fe.rawDataSymbol].event_data.expires_at)}get cooldownDate(){return new Date(this[fe.rawDataSymbol].event_data.cooldown_end_time)}get total(){return this[fe.rawDataSymbol].event_data.total}get goal(){return this[fe.rawDataSymbol].event_data.goal}get lastContribution(){return new Cb.HelixHypeTrainContribution(this[fe.rawDataSymbol].event_data.last_contribution,this._client)}get topContributions(){return this[fe.rawDataSymbol].event_data.top_contributions.map(e=>new Cb.HelixHypeTrainContribution(e,this._client))}};Wn.HelixHypeTrainEvent=Ml;qb.__decorate([(0,PA.Enumerable)(!1)],Ml.prototype,"_client",void 0);Wn.HelixHypeTrainEvent=Ml=qb.__decorate([(0,fe.rtfm)("api","HelixHypeTrainEvent","id")],Ml)});var yp=u(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.HelixHypeTrainApi=void 0;var Eb=Y(),Pb=m(),AA=oe(),DA=pe(),IA=le(),TA=G(),Ab=_p(),mp=class extends TA.BaseApi{static{n(this,"HelixHypeTrainApi")}async getHypeTrainEventsForBroadcaster(e,t){let r=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:(0,Pb.extractUserId)(e),scopes:["channel:read:hype_train"],query:{...(0,Eb.createBroadcasterQuery)(e),...(0,IA.createPaginationQuery)(t)}});return(0,DA.createPaginatedResult)(r,Ab.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new AA.HelixPaginatedRequest({url:"hypetrain/events",userId:(0,Pb.extractUserId)(e),scopes:["channel:read:hype_train"],query:(0,Eb.createBroadcasterQuery)(e)},this._client,t=>new Ab.HelixHypeTrainEvent(t,this._client))}};Ll.HelixHypeTrainApi=mp});var Db=u(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.createWarnUserBody=ce.createCheckAutoModStatusBody=ce.createUpdateShieldModeStatusBody=ce.createBanUserBody=ce.createAutoModSettingsBody=ce.createAutoModProcessBody=ce.createResolveUnbanRequestQuery=ce.createModeratorModifyQuery=ce.createModerationUserListQuery=void 0;var Kt=m();function RA(i,e){return{broadcaster_id:(0,Kt.extractUserId)(i),user_id:e?.userId}}n(RA,"createModerationUserListQuery");ce.createModerationUserListQuery=RA;function UA(i,e){return{broadcaster_id:(0,Kt.extractUserId)(i),user_id:(0,Kt.extractUserId)(e)}}n(UA,"createModeratorModifyQuery");ce.createModeratorModifyQuery=UA;function OA(i,e,t,r,a){return{unban_request_id:t,broadcaster_id:(0,Kt.extractUserId)(i),moderator_id:(0,Kt.extractUserId)(e),status:r?"approved":"denied",resolution_text:a}}n(OA,"createResolveUnbanRequestQuery");ce.createResolveUnbanRequestQuery=OA;function BA(i,e,t){return{user_id:(0,Kt.extractUserId)(i),msg_id:e,action:t?"ALLOW":"DENY"}}n(BA,"createAutoModProcessBody");ce.createAutoModProcessBody=BA;function jA(i){return{overall_level:i.overallLevel,aggression:i.aggression,bullying:i.bullying,disability:i.disability,misogyny:i.misogyny,race_ethnicity_or_religion:i.raceEthnicityOrReligion,sex_based_terms:i.sexBasedTerms,sexuality_sex_or_gender:i.sexualitySexOrGender,swearing:i.swearing}}n(jA,"createAutoModSettingsBody");ce.createAutoModSettingsBody=jA;function kA(i){return{data:{duration:i.duration,reason:i.reason,user_id:(0,Kt.extractUserId)(i.user)}}}n(kA,"createBanUserBody");ce.createBanUserBody=kA;function MA(i){return{is_active:i}}n(MA,"createUpdateShieldModeStatusBody");ce.createUpdateShieldModeStatusBody=MA;function LA(i){return{data:i.map(e=>({msg_id:e.messageId,msg_text:e.messageText}))}}n(LA,"createCheckAutoModStatusBody");ce.createCheckAutoModStatusBody=LA;function FA(i,e){return{data:{user_id:(0,Kt.extractUserId)(i),reason:e}}}n(FA,"createWarnUserBody");ce.createWarnUserBody=FA});var Ib=u(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.HelixAutoModSettings=void 0;var NA=(b(),x(g)),Re=m(),fp=class extends Re.DataObject{static{n(this,"HelixAutoModSettings")}get broadcasterId(){return this[Re.rawDataSymbol].broadcaster_id}get moderatorId(){return this[Re.rawDataSymbol].moderator_id}get overallLevel(){return this[Re.rawDataSymbol].overall_level?this[Re.rawDataSymbol].overall_level:null}get disability(){return this[Re.rawDataSymbol].disability}get aggression(){return this[Re.rawDataSymbol].aggression}get sexualitySexOrGender(){return this[Re.rawDataSymbol].sexuality_sex_or_gender}get misogyny(){return this[Re.rawDataSymbol].misogyny}get bullying(){return this[Re.rawDataSymbol].bullying}get swearing(){return this[Re.rawDataSymbol].swearing}get raceEthnicityOrReligion(){return this[Re.rawDataSymbol].race_ethnicity_or_religion}get sexBasedTerms(){return this[Re.rawDataSymbol].sex_based_terms}};Vn.HelixAutoModSettings=fp;Vn.HelixAutoModSettings=fp=NA.__decorate([(0,Re.rtfm)("api","HelixAutoModSettings","broadcasterId")],fp)});var Tb=u($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.HelixAutoModStatus=void 0;var QA=(b(),x(g)),Fl=m(),gp=class extends Fl.DataObject{static{n(this,"HelixAutoModStatus")}get messageId(){return this[Fl.rawDataSymbol].msg_id}get isPermitted(){return this[Fl.rawDataSymbol].is_permitted}};$n.HelixAutoModStatus=gp;$n.HelixAutoModStatus=gp=QA.__decorate([(0,Fl.rtfm)("api","HelixAutoModStatus","messageId")],gp)});var Nl=u(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.HelixBanUser=void 0;var bp=(b(),x(g)),xp=C(),Et=m(),zn=class extends Et.DataObject{static{n(this,"HelixBanUser")}constructor(e,t,r){super(e),this._expiryTimestamp=t,this._client=r}get creationDate(){return new Date(this[Et.rawDataSymbol].created_at)}get expiryDate(){return(0,xp.mapNullable)(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[Et.rawDataSymbol].moderator_id}async getModerator(){return(0,Et.checkRelationAssertion)(await this._client.users.getUserById(this[Et.rawDataSymbol].moderator_id))}get userId(){return this[Et.rawDataSymbol].user_id}async getUser(){return(0,Et.checkRelationAssertion)(await this._client.users.getUserById(this[Et.rawDataSymbol].user_id))}};Kn.HelixBanUser=zn;bp.__decorate([(0,xp.Enumerable)(!1)],zn.prototype,"_client",void 0);bp.__decorate([(0,xp.Enumerable)(!1)],zn.prototype,"_expiryTimestamp",void 0);Kn.HelixBanUser=zn=bp.__decorate([(0,Et.rtfm)("api","HelixBanUser","userId")],zn)});var vp=u(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.HelixBan=void 0;var GA=(b(),x(g)),Xr=m(),WA=Nl(),wp=class extends WA.HelixBanUser{static{n(this,"HelixBan")}constructor(e,t){super(e,e.expires_at||null,t)}get userName(){return this[Xr.rawDataSymbol].user_login}get userDisplayName(){return this[Xr.rawDataSymbol].user_name}get moderatorName(){return this[Xr.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[Xr.rawDataSymbol].moderator_name}get reason(){return this[Xr.rawDataSymbol].reason||null}};Jn.HelixBan=wp;Jn.HelixBan=wp=GA.__decorate([(0,Xr.rtfm)("api","HelixBan","userId")],wp)});var Hp=u(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.HelixBlockedTerm=void 0;var VA=(b(),x(g)),_t=m(),Sp=class extends _t.DataObject{static{n(this,"HelixBlockedTerm")}get broadcasterId(){return this[_t.rawDataSymbol].broadcaster_id}get creationDate(){return new Date(this[_t.rawDataSymbol].created_at)}get expirationDate(){return this[_t.rawDataSymbol].expires_at?new Date(this[_t.rawDataSymbol].expires_at):null}get id(){return this[_t.rawDataSymbol].id}get moderatorId(){return this[_t.rawDataSymbol].moderator_id}get text(){return this[_t.rawDataSymbol].text}get updatedDate(){return new Date(this[_t.rawDataSymbol].updated_at)}};Zn.HelixBlockedTerm=Sp;Zn.HelixBlockedTerm=Sp=VA.__decorate([(0,_t.rtfm)("api","HelixBlockedTerm","id")],Sp)});var Cp=u(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.HelixModeratedChannel=void 0;var Rb=(b(),x(g)),$A=C(),Pt=m(),Ql=class extends Pt.DataObject{static{n(this,"HelixModeratedChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[Pt.rawDataSymbol].broadcaster_id}get name(){return this[Pt.rawDataSymbol].broadcaster_login}get displayName(){return this[Pt.rawDataSymbol].broadcaster_name}async getChannel(){return(0,Pt.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[Pt.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,Pt.checkRelationAssertion)(await this._client.users.getUserById(this[Pt.rawDataSymbol].broadcaster_id))}};Xn.HelixModeratedChannel=Ql;Rb.__decorate([(0,$A.Enumerable)(!1)],Ql.prototype,"_client",void 0);Xn.HelixModeratedChannel=Ql=Rb.__decorate([(0,Pt.rtfm)("api","HelixModeratedChannel","id")],Ql)});var qp=u(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.HelixModerator=void 0;var Ub=(b(),x(g)),zA=C(),fr=m(),Gl=class extends fr.DataObject{static{n(this,"HelixModerator")}constructor(e,t){super(e),this._client=t}get userId(){return this[fr.rawDataSymbol].user_id}get userName(){return this[fr.rawDataSymbol].user_login}get userDisplayName(){return this[fr.rawDataSymbol].user_name}async getUser(){return(0,fr.checkRelationAssertion)(await this._client.users.getUserById(this[fr.rawDataSymbol].user_id))}};Yn.HelixModerator=Gl;Ub.__decorate([(0,zA.Enumerable)(!1)],Gl.prototype,"_client",void 0);Yn.HelixModerator=Gl=Ub.__decorate([(0,fr.rtfm)("api","HelixModerator","userId")],Gl)});var Ep=u(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.HelixShieldModeStatus=void 0;var Ob=(b(),x(g)),KA=C(),mt=m(),Wl=class extends mt.DataObject{static{n(this,"HelixShieldModeStatus")}constructor(e,t){super(e),this._client=t}get isActive(){return this[mt.rawDataSymbol].is_active}get moderatorId(){return this[mt.rawDataSymbol].moderator_id}get moderatorName(){return this[mt.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[mt.rawDataSymbol].moderator_name}async getModerator(){return(0,mt.checkRelationAssertion)(await this._client.users.getUserById(this[mt.rawDataSymbol].moderator_id))}get lastActivationDate(){return this[mt.rawDataSymbol].last_activated_at===""?null:new Date(this[mt.rawDataSymbol].last_activated_at)}};ea.HelixShieldModeStatus=Wl;Ob.__decorate([(0,KA.Enumerable)(!1)],Wl.prototype,"_client",void 0);ea.HelixShieldModeStatus=Wl=Ob.__decorate([(0,mt.rtfm)("api","HelixShieldModeStatus")],Wl)});var Pp=u(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.HelixUnbanRequest=void 0;var Bb=(b(),x(g)),jb=C(),te=m(),Vl=class extends te.DataObject{static{n(this,"HelixUnbanRequest")}constructor(e,t){super(e),this._client=t}get id(){return this[te.rawDataSymbol].id}get broadcasterId(){return this[te.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[te.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[te.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[te.rawDataSymbol].moderator_id}get moderatorName(){return this[te.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[te.rawDataSymbol].moderator_name}async getModerator(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].moderator_id))}get userId(){return this[te.rawDataSymbol].user_id}get userName(){return this[te.rawDataSymbol].user_login}get userDisplayName(){return this[te.rawDataSymbol].user_name}async getUser(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].user_id))}get message(){return this[te.rawDataSymbol].text}get creationDate(){return new Date(this[te.rawDataSymbol].created_at)}get resolutionMessage(){return this[te.rawDataSymbol].resolution_text||null}get resolutionDate(){return(0,jb.mapNullable)(this[te.rawDataSymbol].resolved_at,e=>new Date(e))}};ta.HelixUnbanRequest=Vl;Bb.__decorate([(0,jb.Enumerable)(!1)],Vl.prototype,"_client",void 0);ta.HelixUnbanRequest=Vl=Bb.__decorate([(0,te.rtfm)("api","HelixUnbanRequest","id")],Vl)});var Ap=u(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.HelixWarning=void 0;var kb=(b(),x(g)),JA=C(),Je=m(),$l=class extends Je.DataObject{static{n(this,"HelixWarning")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Je.rawDataSymbol].user_id}async getBroadcaster(){return(0,Je.checkRelationAssertion)(await this._client.users.getUserById(this[Je.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[Je.rawDataSymbol].moderator_id}async getModerator(){return(0,Je.checkRelationAssertion)(await this._client.users.getUserById(this[Je.rawDataSymbol].moderator_id))}get userId(){return this[Je.rawDataSymbol].user_id}async getUser(){return(0,Je.checkRelationAssertion)(await this._client.users.getUserById(this[Je.rawDataSymbol].user_id))}get reason(){return this[Je.rawDataSymbol].reason}};ra.HelixWarning=$l;kb.__decorate([(0,JA.Enumerable)(!1)],$l.prototype,"_client",void 0);ra.HelixWarning=$l=kb.__decorate([(0,Je.rtfm)("api","HelixWarning","userId")],$l)});var Rp=u(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.HelixModerationApi=void 0;var ZA=(b(),x(g)),Dp=Y(),F=m(),gr=je(),it=Db(),zl=oe(),ia=pe(),na=le(),XA=G(),Mb=Ib(),YA=Tb(),Lb=vp(),eD=Nl(),Fb=Hp(),Nb=Cp(),Qb=qp(),Gb=Ep(),Ip=Pp(),tD=Ap(),Tp=class extends XA.BaseApi{static{n(this,"HelixModerationApi")}async getBannedUsers(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/banned",userId:(0,F.extractUserId)(e),scopes:["moderation:read"],query:{...(0,it.createModerationUserListQuery)(e,t),...(0,na.createPaginationQuery)(t)}});return(0,ia.createPaginatedResult)(r,Lb.HelixBan,this._client)}getBannedUsersPaginated(e){return new zl.HelixPaginatedRequest({url:"moderation/banned",userId:(0,F.extractUserId)(e),scopes:["moderation:read"],query:(0,Dp.createBroadcasterQuery)(e)},this._client,t=>new Lb.HelixBan(t,this._client),50)}async checkUserBan(e,t){let r=(0,F.extractUserId)(t);return(await this.getBannedUsers(e,{userId:r})).data.some(s=>s.userId===r)}async getModerators(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/moderators",userId:(0,F.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:{...(0,it.createModerationUserListQuery)(e,t),...(0,na.createPaginationQuery)(t)}});return(0,ia.createPaginatedResult)(r,Qb.HelixModerator,this._client)}getModeratorsPaginated(e){return new zl.HelixPaginatedRequest({url:"moderation/moderators",userId:(0,F.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:(0,Dp.createBroadcasterQuery)(e)},this._client,t=>new Qb.HelixModerator(t,this._client))}async getModeratedChannels(e,t){let r=(0,F.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/channels",userId:r,scopes:["user:read:moderated_channels"],query:{...(0,gr.createSingleKeyQuery)("user_id",r),...(0,na.createPaginationQuery)(t)}});return(0,ia.createPaginatedResult)(a,Nb.HelixModeratedChannel,this._client)}getModeratedChannelsPaginated(e){let t=(0,F.extractUserId)(e);return new zl.HelixPaginatedRequest({url:"moderation/channels",userId:t,scopes:["user:read:moderated_channels"],query:(0,gr.createSingleKeyQuery)("user_id",t)},this._client,r=>new Nb.HelixModeratedChannel(r,this._client))}async checkUserMod(e,t){let r=(0,F.extractUserId)(t);return(await this.getModerators(e,{userId:r})).data.some(s=>s.userId===r)}async addModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"POST",userId:(0,F.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,it.createModeratorModifyQuery)(e,t)})}async removeModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"DELETE",userId:(0,F.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,it.createModeratorModifyQuery)(e,t)})}async checkAutoModStatus(e,t){return(await this._client.callApi({type:"helix",url:"moderation/enforcements/status",method:"POST",userId:(0,F.extractUserId)(e),scopes:["moderation:read"],query:(0,Dp.createBroadcasterQuery)(e),jsonBody:(0,it.createCheckAutoModStatusBody)(t)})).data.map(a=>new YA.HelixAutoModStatus(a))}async processHeldAutoModMessage(e,t,r){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:(0,F.extractUserId)(e),scopes:["moderator:manage:automod"],jsonBody:(0,it.createAutoModProcessBody)(e,t,r)})}async getAutoModSettings(e){let t=(0,F.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",userId:t,scopes:["moderator:read:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)})).data.map(a=>new Mb.HelixAutoModSettings(a))}async updateAutoModSettings(e,t){let r=(0,F.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",method:"PUT",userId:r,scopes:["moderator:manage:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,it.createAutoModSettingsBody)(t)})).data.map(s=>new Mb.HelixAutoModSettings(s))}async banUser(e,t){let r=(0,F.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/bans",method:"POST",userId:r,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,it.createBanUserBody)(t)})).data.map(s=>new eD.HelixBanUser(s,s.end_time,this._client))}async unbanUser(e,t){let r=(0,F.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/bans",method:"DELETE",userId:r,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,gr.createSingleKeyQuery)("user_id",(0,F.extractUserId)(t))}})}async getBlockedTerms(e,t){let r=(0,F.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/blocked_terms",userId:r,scopes:["moderator:read:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,na.createPaginationQuery)(t)}});return(0,ia.createPaginatedResult)(a,Fb.HelixBlockedTerm,this._client)}async addBlockedTerm(e,t){let r=(0,F.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"POST",userId:r,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:{text:t}})).data.map(s=>new Fb.HelixBlockedTerm(s))}async removeBlockedTerm(e,t,r){let a=(0,F.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"DELETE",userId:a,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(a),id:r}})}async deleteChatMessages(e,t){let r=(0,F.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/chat",method:"DELETE",userId:r,scopes:["moderator:manage:chat_messages"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,gr.createSingleKeyQuery)("message_id",t)}})}async getShieldModeStatus(e){let t=(0,F.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"GET",userId:t,scopes:["moderator:read:shield_mode","moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)});return new Gb.HelixShieldModeStatus(r.data[0],this._client)}async updateShieldModeStatus(e,t){let r=(0,F.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"PUT",userId:r,scopes:["moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,it.createUpdateShieldModeStatusBody)(t)});return new Gb.HelixShieldModeStatus(a.data[0],this._client)}async getUnbanRequests(e,t,r){let a=(0,F.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"moderation/unban_requests",method:"GET",userId:a,scopes:["moderator:read:unban_requests","moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(a),...(0,gr.createSingleKeyQuery)("status",t),...(0,na.createPaginationQuery)(r)}});return(0,ia.createPaginatedResult)(s,Ip.HelixUnbanRequest,this._client)}getUnbanRequestsPaginated(e,t){let r=(0,F.extractUserId)(e);return new zl.HelixPaginatedRequest({url:"moderation/unban_requests",method:"GET",userId:r,scopes:["moderator:read:unban_requests","moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,gr.createSingleKeyQuery)("status",t)}},this._client,a=>new Ip.HelixUnbanRequest(a,this._client))}async resolveUnbanRequest(e,t,r,a){let s=(0,F.extractUserId)(e),o=await this._client.callApi({type:"helix",url:"moderation/unban_requests",method:"PATCH",userId:s,scopes:["moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:(0,it.createResolveUnbanRequestQuery)(s,this._getUserContextIdWithDefault(s),t,r,a?.slice(0,500))});return new Ip.HelixUnbanRequest(o.data[0],this._client)}async warnUser(e,t,r){let a=(0,F.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"moderation/warnings",method:"POST",userId:a,scopes:["moderator:manage:warnings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(a),jsonBody:(0,it.createWarnUserBody)(t,r.slice(0,500))});return new tD.HelixWarning(s.data[0],this._client)}_createModeratorActionQuery(e){return(0,gr.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};aa.HelixModerationApi=Tp;aa.HelixModerationApi=Tp=ZA.__decorate([(0,F.rtfm)("api","HelixModerationApi")],Tp)});var Vb=u(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.createPollEndBody=Yr.createPollBody=void 0;var Wb=m();function rD(i,e){var t;return{broadcaster_id:(0,Wb.extractUserId)(i),title:e.title,choices:e.choices.map(r=>({title:r})),duration:e.duration,channel_points_voting_enabled:e.channelPointsPerVote!=null,channel_points_per_vote:(t=e.channelPointsPerVote)!==null&&t!==void 0?t:0}}n(rD,"createPollBody");Yr.createPollBody=rD;function iD(i,e,t){return{broadcaster_id:(0,Wb.extractUserId)(i),id:e,status:t?"TERMINATED":"ARCHIVED"}}n(iD,"createPollEndBody");Yr.createPollEndBody=iD});var Op=u(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.HelixPollChoice=void 0;var nD=(b(),x(g)),ei=m(),Up=class extends ei.DataObject{static{n(this,"HelixPollChoice")}get id(){return this[ei.rawDataSymbol].id}get title(){return this[ei.rawDataSymbol].title}get totalVotes(){return this[ei.rawDataSymbol].votes}get channelPointsVotes(){return this[ei.rawDataSymbol].channel_points_votes}};sa.HelixPollChoice=Up;sa.HelixPollChoice=Up=nD.__decorate([(0,ei.rtfm)("api","HelixPollChoice","id")],Up)});var Bp=u(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.HelixPoll=void 0;var $b=(b(),x(g)),aD=C(),He=m(),sD=Op(),Kl=class extends He.DataObject{static{n(this,"HelixPoll")}constructor(e,t){super(e),this._client=t}get id(){return this[He.rawDataSymbol].id}get broadcasterId(){return this[He.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[He.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[He.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,He.checkRelationAssertion)(await this._client.users.getUserById(this[He.rawDataSymbol].broadcaster_id))}get title(){return this[He.rawDataSymbol].title}get isChannelPointsVotingEnabled(){return this[He.rawDataSymbol].channel_points_voting_enabled}get channelPointsPerVote(){return this[He.rawDataSymbol].channel_points_per_vote}get status(){return this[He.rawDataSymbol].status}get durationInSeconds(){return this[He.rawDataSymbol].duration}get startDate(){return new Date(this[He.rawDataSymbol].started_at)}get endDate(){return new Date(this.startDate.getTime()+this[He.rawDataSymbol].duration*1e3)}get choices(){return this[He.rawDataSymbol].choices.map(e=>new sD.HelixPollChoice(e))}};oa.HelixPoll=Kl;$b.__decorate([(0,aD.Enumerable)(!1)],Kl.prototype,"_client",void 0);oa.HelixPoll=Kl=$b.__decorate([(0,He.rtfm)("api","HelixPoll","id")],Kl)});var kp=u(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.HelixPollApi=void 0;var oD=(b(),x(g)),zb=Y(),ti=m(),lD=je(),Kb=Vb(),uD=oe(),cD=pe(),dD=le(),hD=G(),la=Bp(),jp=class extends hD.BaseApi{static{n(this,"HelixPollApi")}async getPolls(e,t){let r=await this._client.callApi({type:"helix",url:"polls",userId:(0,ti.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:{...(0,zb.createBroadcasterQuery)(e),...(0,dD.createPaginationQuery)(t)}});return(0,cD.createPaginatedResult)(r,la.HelixPoll,this._client)}getPollsPaginated(e){return new uD.HelixPaginatedRequest({url:"polls",userId:(0,ti.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,zb.createBroadcasterQuery)(e)},this._client,t=>new la.HelixPoll(t,this._client),20)}async getPollsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"polls",userId:(0,ti.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,lD.createGetByIdsQuery)(e,t)})).data.map(a=>new la.HelixPoll(a,this._client)):[]}async getPollById(e,t){let r=await this.getPollsByIds(e,[t]);return r.length?r[0]:null}async createPoll(e,t){let r=await this._client.callApi({type:"helix",url:"polls",method:"POST",userId:(0,ti.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,Kb.createPollBody)(e,t)});return new la.HelixPoll(r.data[0],this._client)}async endPoll(e,t,r=!0){let a=await this._client.callApi({type:"helix",url:"polls",method:"PATCH",userId:(0,ti.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,Kb.createPollEndBody)(e,t,r)});return new la.HelixPoll(a.data[0],this._client)}};ua.HelixPollApi=jp;ua.HelixPollApi=jp=oD.__decorate([(0,ti.rtfm)("api","HelixPollApi")],jp)});var Zb=u(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.createEndPredictionBody=ri.createPredictionBody=void 0;var Jb=m();function pD(i,e){return{broadcaster_id:(0,Jb.extractUserId)(i),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}n(pD,"createPredictionBody");ri.createPredictionBody=pD;function _D(i,e,t,r){return{broadcaster_id:(0,Jb.extractUserId)(i),id:e,status:t,winning_outcome_id:r}}n(_D,"createEndPredictionBody");ri.createEndPredictionBody=_D});var Mp=u(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.HelixPredictor=void 0;var Xb=(b(),x(g)),mD=C(),Jt=m(),Jl=class extends Jt.DataObject{static{n(this,"HelixPredictor")}constructor(e,t){super(e),this._client=t}get userId(){return this[Jt.rawDataSymbol].user_id}get userName(){return this[Jt.rawDataSymbol].user_login}get userDisplayName(){return this[Jt.rawDataSymbol].user_name}async getUser(){return await this._client.users.getUserById(this[Jt.rawDataSymbol].user_id)}get channelPointsUsed(){return this[Jt.rawDataSymbol].channel_points_used}get channelPointsWon(){return this[Jt.rawDataSymbol].channel_points_won}};ca.HelixPredictor=Jl;Xb.__decorate([(0,mD.Enumerable)(!1)],Jl.prototype,"_client",void 0);ca.HelixPredictor=Jl=Xb.__decorate([(0,Jt.rtfm)("api","HelixPredictor","userId")],Jl)});var Lp=u(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.HelixPredictionOutcome=void 0;var Yb=(b(),x(g)),yD=C(),Zt=m(),fD=Mp(),Zl=class extends Zt.DataObject{static{n(this,"HelixPredictionOutcome")}constructor(e,t){super(e),this._client=t}get id(){return this[Zt.rawDataSymbol].id}get title(){return this[Zt.rawDataSymbol].title}get users(){return this[Zt.rawDataSymbol].users}get totalChannelPoints(){return this[Zt.rawDataSymbol].channel_points}get color(){return this[Zt.rawDataSymbol].color}get topPredictors(){var e,t;return(t=(e=this[Zt.rawDataSymbol].top_predictors)===null||e===void 0?void 0:e.map(r=>new fD.HelixPredictor(r,this._client)))!==null&&t!==void 0?t:[]}};da.HelixPredictionOutcome=Zl;Yb.__decorate([(0,yD.Enumerable)(!1)],Zl.prototype,"_client",void 0);da.HelixPredictionOutcome=Zl=Yb.__decorate([(0,Zt.rtfm)("api","HelixPredictionOutcome","id")],Zl)});var Fp=u(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.HelixPrediction=void 0;var tx=(b(),x(g)),gD=C(),re=m(),ex=Lp(),Xl=class extends re.DataObject{static{n(this,"HelixPrediction")}constructor(e,t){super(e),this._client=t}get id(){return this[re.rawDataSymbol].id}get broadcasterId(){return this[re.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[re.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[re.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,re.checkRelationAssertion)(await this._client.users.getUserById(this[re.rawDataSymbol].broadcaster_id))}get title(){return this[re.rawDataSymbol].title}get status(){return this[re.rawDataSymbol].status}get autoLockAfter(){return this[re.rawDataSymbol].prediction_window}get creationDate(){return new Date(this[re.rawDataSymbol].created_at)}get endDate(){return this[re.rawDataSymbol].ended_at?new Date(this[re.rawDataSymbol].ended_at):null}get lockDate(){return this[re.rawDataSymbol].locked_at?new Date(this[re.rawDataSymbol].locked_at):null}get outcomes(){return this[re.rawDataSymbol].outcomes.map(e=>new ex.HelixPredictionOutcome(e,this._client))}get winningOutcomeId(){return this[re.rawDataSymbol].winning_outcome_id||null}get winningOutcome(){if(!this[re.rawDataSymbol].winning_outcome_id)return null;let e=this[re.rawDataSymbol].outcomes.find(t=>t.id===this[re.rawDataSymbol].winning_outcome_id);if(!e)throw new re.HellFreezesOverError("Winning outcome not found in outcomes array");return new ex.HelixPredictionOutcome(e,this._client)}};ha.HelixPrediction=Xl;tx.__decorate([(0,gD.Enumerable)(!1)],Xl.prototype,"_client",void 0);ha.HelixPrediction=Xl=tx.__decorate([(0,re.rtfm)("api","HelixPrediction","id")],Xl)});var Qp=u(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.HelixPredictionApi=void 0;var bD=(b(),x(g)),rx=Y(),ii=m(),xD=je(),ix=Zb(),wD=oe(),vD=pe(),SD=le(),HD=G(),pa=Fp(),Np=class extends HD.BaseApi{static{n(this,"HelixPredictionApi")}async getPredictions(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",userId:(0,ii.extractUserId)(e),scopes:["channel:read:predictions"],query:{...(0,rx.createBroadcasterQuery)(e),...(0,SD.createPaginationQuery)(t)}});return(0,vD.createPaginatedResult)(r,pa.HelixPrediction,this._client)}getPredictionsPaginated(e){return new wD.HelixPaginatedRequest({url:"predictions",userId:(0,ii.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,rx.createBroadcasterQuery)(e)},this._client,t=>new pa.HelixPrediction(t,this._client),20)}async getPredictionsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"predictions",userId:(0,ii.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,xD.createGetByIdsQuery)(e,t)})).data.map(a=>new pa.HelixPrediction(a,this._client)):[]}async getPredictionById(e,t){let r=await this.getPredictionsByIds(e,[t]);return r.length?r[0]:null}async createPrediction(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",method:"POST",userId:(0,ii.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,ix.createPredictionBody)(e,t)});return new pa.HelixPrediction(r.data[0],this._client)}async lockPrediction(e,t){return await this._endPrediction(e,t,"LOCKED")}async resolvePrediction(e,t,r){return await this._endPrediction(e,t,"RESOLVED",r)}async cancelPrediction(e,t){return await this._endPrediction(e,t,"CANCELED")}async _endPrediction(e,t,r,a){let s=await this._client.callApi({type:"helix",url:"predictions",method:"PATCH",userId:(0,ii.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,ix.createEndPredictionBody)(e,t,r,a)});return new pa.HelixPrediction(s.data[0],this._client)}};_a.HelixPredictionApi=Np;_a.HelixPredictionApi=Np=bD.__decorate([(0,ii.rtfm)("api","HelixPredictionApi")],Np)});var ax=u(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});Yl.createRaidStartQuery=void 0;var nx=m();function CD(i,e){return{from_broadcaster_id:(0,nx.extractUserId)(i),to_broadcaster_id:(0,nx.extractUserId)(e)}}n(CD,"createRaidStartQuery");Yl.createRaidStartQuery=CD});var Wp=u(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.HelixRaid=void 0;var qD=(b(),x(g)),eu=m(),Gp=class extends eu.DataObject{static{n(this,"HelixRaid")}get creationDate(){return new Date(this[eu.rawDataSymbol].created_at)}get targetIsMature(){return this[eu.rawDataSymbol].is_mature}};ma.HelixRaid=Gp;ma.HelixRaid=Gp=qD.__decorate([(0,eu.rtfm)("api","HelixRaid")],Gp)});var zp=u(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.HelixRaidApi=void 0;var ED=(b(),x(g)),PD=Y(),Vp=m(),AD=ax(),DD=G(),ID=Wp(),$p=class extends DD.BaseApi{static{n(this,"HelixRaidApi")}async startRaid(e,t){let r=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:(0,Vp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,AD.createRaidStartQuery)(e,t)});return new ID.HelixRaid(r.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:(0,Vp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,PD.createBroadcasterQuery)(e)})}};ya.HelixRaidApi=$p;ya.HelixRaidApi=$p=ED.__decorate([(0,Vp.rtfm)("api","HelixRaidApi")],$p)});var Kp=u(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.createScheduleSegmentUpdateBody=Ze.createScheduleSegmentModifyQuery=Ze.createScheduleSegmentBody=Ze.createScheduleSettingsUpdateQuery=Ze.createScheduleQuery=void 0;var tu=m();function TD(i,e){var t;return{broadcaster_id:(0,tu.extractUserId)(i),start_time:e?.startDate,utc_offset:(t=e?.utcOffset)===null||t===void 0?void 0:t.toString()}}n(TD,"createScheduleQuery");Ze.createScheduleQuery=TD;function RD(i,e){return e.vacation?{broadcaster_id:(0,tu.extractUserId)(i),is_vacation_enabled:"true",vacation_start_time:e.vacation.startDate,vacation_end_time:e.vacation.endDate,timezone:e.vacation.timezone}:{broadcaster_id:(0,tu.extractUserId)(i),is_vacation_enabled:"false"}}n(RD,"createScheduleSettingsUpdateQuery");Ze.createScheduleSettingsUpdateQuery=RD;function UD(i){return{start_time:i.startDate,timezone:i.timezone,is_recurring:i.isRecurring,duration:i.duration,category_id:i.categoryId,title:i.title}}n(UD,"createScheduleSegmentBody");Ze.createScheduleSegmentBody=UD;function OD(i,e){return{broadcaster_id:(0,tu.extractUserId)(i),id:e}}n(OD,"createScheduleSegmentModifyQuery");Ze.createScheduleSegmentModifyQuery=OD;function BD(i){return{start_time:i.startDate,timezone:i.timezone,is_canceled:i.isCanceled,duration:i.duration,category_id:i.categoryId,title:i.title}}n(BD,"createScheduleSegmentUpdateBody");Ze.createScheduleSegmentUpdateBody=BD});var ga=u(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.HelixScheduleSegment=void 0;var sx=(b(),x(g)),ox=C(),nt=m(),ru=class extends nt.DataObject{static{n(this,"HelixScheduleSegment")}constructor(e,t){super(e),this._client=t}get id(){return this[nt.rawDataSymbol].id}get startDate(){return new Date(this[nt.rawDataSymbol].start_time)}get endDate(){return new Date(this[nt.rawDataSymbol].end_time)}get title(){return this[nt.rawDataSymbol].title}get cancelEndDate(){return(0,ox.mapNullable)(this[nt.rawDataSymbol].canceled_until,e=>new Date(e))}get categoryId(){var e,t;return(t=(e=this[nt.rawDataSymbol].category)===null||e===void 0?void 0:e.id)!==null&&t!==void 0?t:null}get categoryName(){var e,t;return(t=(e=this[nt.rawDataSymbol].category)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:null}async getCategory(){var e;let t=(e=this[nt.rawDataSymbol].category)===null||e===void 0?void 0:e.id;return t?await this._client.games.getGameById(t):null}get isRecurring(){return this[nt.rawDataSymbol].is_recurring}};fa.HelixScheduleSegment=ru;sx.__decorate([(0,ox.Enumerable)(!1)],ru.prototype,"_client",void 0);fa.HelixScheduleSegment=ru=sx.__decorate([(0,nt.rtfm)("api","HelixScheduleSegment","id")],ru)});var Zp=u(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.HelixPaginatedScheduleSegmentRequest=void 0;var jD=(b(),x(g)),kD=m(),MD=Kp(),LD=oe(),FD=ga(),Jp=class extends LD.HelixPaginatedRequest{static{n(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,r){super({url:"schedule",query:(0,MD.createScheduleQuery)(e,r)},t,a=>new FD.HelixScheduleSegment(a,t),25)}async _fetchData(e={}){var t;let r=await super._fetchData(e);return{data:(t=r.data.segments)!==null&&t!==void 0?t:[],pagination:r.pagination}}};ba.HelixPaginatedScheduleSegmentRequest=Jp;ba.HelixPaginatedScheduleSegmentRequest=Jp=jD.__decorate([(0,kD.rtfm)("api","HelixPaginatedScheduleSegmentRequest")],Jp)});var Xp=u(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.HelixSchedule=void 0;var lx=(b(),x(g)),ND=C(),yt=m(),QD=ga(),iu=class extends yt.DataObject{static{n(this,"HelixSchedule")}constructor(e,t){super(e),this._client=t}get segments(){var e,t;return(t=(e=this[yt.rawDataSymbol].segments)===null||e===void 0?void 0:e.map(r=>new QD.HelixScheduleSegment(r,this._client)))!==null&&t!==void 0?t:[]}get broadcasterId(){return this[yt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[yt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[yt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,yt.checkRelationAssertion)(await this._client.users.getUserById(this[yt.rawDataSymbol].broadcaster_id))}get vacationStartDate(){var e;let t=(e=this[yt.rawDataSymbol].vacation)===null||e===void 0?void 0:e.start_time;return t?new Date(t):null}get vacationEndDate(){var e;let t=(e=this[yt.rawDataSymbol].vacation)===null||e===void 0?void 0:e.end_time;return t?new Date(t):null}};xa.HelixSchedule=iu;lx.__decorate([(0,ND.Enumerable)(!1)],iu.prototype,"_client",void 0);xa.HelixSchedule=iu=lx.__decorate([(0,yt.rtfm)("api","HelixSchedule","broadcasterId")],iu)});var t_=u(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.HelixScheduleApi=void 0;var ux=Y(),ni=m(),GD=je(),ai=Kp(),WD=le(),VD=G(),$D=Zp(),zD=Xp(),Yp=ga(),e_=class extends VD.BaseApi{static{n(this,"HelixScheduleApi")}async getSchedule(e,t){let r=await this._client.callApi({type:"helix",url:"schedule",userId:(0,ni.extractUserId)(e),query:{...(0,ai.createScheduleQuery)(e,t),...(0,WD.createPaginationQuery)(t)}});return{data:new zD.HelixSchedule(r.data,this._client),cursor:r.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new $D.HelixPaginatedScheduleSegmentRequest(e,this._client,t)}async getScheduleSegmentsByIds(e,t){var r,a;return(a=(r=(await this._client.callApi({type:"helix",url:"schedule",userId:(0,ni.extractUserId)(e),query:(0,GD.createGetByIdsQuery)(e,t)})).data.segments)===null||r===void 0?void 0:r.map(o=>new Yp.HelixScheduleSegment(o,this._client)))!==null&&a!==void 0?a:[]}async getScheduleSegmentById(e,t){let r=await this.getScheduleSegmentsByIds(e,[t]);return r.length?r[0]:null}async getScheduleAsIcal(e){return await this._client.callApi({type:"helix",url:"schedule/icalendar",query:(0,ux.createBroadcasterQuery)(e)})}async updateScheduleSettings(e,t){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ai.createScheduleSettingsUpdateQuery)(e,t)})}async createScheduleSegment(e,t){let r=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ux.createBroadcasterQuery)(e),jsonBody:(0,ai.createScheduleSegmentBody)(t)});return new Yp.HelixScheduleSegment(r.data.segments[0],this._client)}async updateScheduleSegment(e,t,r){let a=await this._client.callApi({type:"helix",url:"schedule/segment",method:"PATCH",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ai.createScheduleSegmentModifyQuery)(e,t),jsonBody:(0,ai.createScheduleSegmentUpdateBody)(r)});return new Yp.HelixScheduleSegment(a.data.segments[0],this._client)}async deleteScheduleSegment(e,t){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ai.createScheduleSegmentModifyQuery)(e,t)})}};nu.HelixScheduleApi=e_});var cx=u(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.createSearchChannelsQuery=void 0;function KD(i,e){var t;return{query:i,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}n(KD,"createSearchChannelsQuery");au.createSearchChannelsQuery=KD});var r_=u(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.HelixChannelSearchResult=void 0;var dx=(b(),x(g)),JD=C(),ge=m(),su=class extends ge.DataObject{static{n(this,"HelixChannelSearchResult")}constructor(e,t){super(e),this._client=t}get language(){return this[ge.rawDataSymbol].broadcaster_language}get id(){return this[ge.rawDataSymbol].id}get name(){return this[ge.rawDataSymbol].broadcaster_login}get displayName(){return this[ge.rawDataSymbol].display_name}async getUser(){return(0,ge.checkRelationAssertion)(await this._client.users.getUserById(this[ge.rawDataSymbol].id))}get gameId(){return this[ge.rawDataSymbol].game_id}get gameName(){return this[ge.rawDataSymbol].game_name}async getGame(){return this[ge.rawDataSymbol].game_id?(0,ge.checkRelationAssertion)(await this._client.games.getGameById(this[ge.rawDataSymbol].game_id)):null}get isLive(){return this[ge.rawDataSymbol].is_live}get tags(){return this[ge.rawDataSymbol].tags}get thumbnailUrl(){return this[ge.rawDataSymbol].thumbnail_url}get startDate(){return this[ge.rawDataSymbol].is_live?new Date(this[ge.rawDataSymbol].started_at):null}};wa.HelixChannelSearchResult=su;dx.__decorate([(0,JD.Enumerable)(!1)],su.prototype,"_client",void 0);wa.HelixChannelSearchResult=su=dx.__decorate([(0,ge.rtfm)("api","HelixChannelSearchResult","id")],su)});var n_=u(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.HelixSearchApi=void 0;var ZD=(b(),x(g)),XD=m(),hx=cx(),px=oe(),_x=pe(),mx=le(),YD=G(),yx=Ol(),fx=r_(),i_=class extends YD.BaseApi{static{n(this,"HelixSearchApi")}async searchCategories(e,t){let r=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...(0,mx.createPaginationQuery)(t)}});return(0,_x.createPaginatedResult)(r,yx.HelixGame,this._client)}searchCategoriesPaginated(e){return new px.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new yx.HelixGame(t,this._client))}async searchChannels(e,t={}){let r=await this._client.callApi({type:"helix",url:"search/channels",query:{...(0,hx.createSearchChannelsQuery)(e,t),...(0,mx.createPaginationQuery)(t)}});return(0,_x.createPaginatedResult)(r,fx.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new px.HelixPaginatedRequest({url:"search/channels",query:(0,hx.createSearchChannelsQuery)(e,t)},this._client,r=>new fx.HelixChannelSearchResult(r,this._client))}};va.HelixSearchApi=i_;va.HelixSearchApi=i_=ZD.__decorate([(0,XD.rtfm)("api","HelixSearchApi")],i_)});var s_=u(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.StreamNotLiveError=void 0;var eI=m(),a_=class extends eI.CustomError{static{n(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};ou.StreamNotLiveError=a_});var gx=u(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.createVideoQuery=Xt.createStreamMarkerBody=Xt.createStreamQuery=void 0;var tI=m();function rI(i){return{game_id:i.game,language:i.language,type:i.type,user_id:i.userId,user_login:i.userName}}n(rI,"createStreamQuery");Xt.createStreamQuery=rI;function iI(i,e){return{user_id:(0,tI.extractUserId)(i),description:e}}n(iI,"createStreamMarkerBody");Xt.createStreamMarkerBody=iI;function nI(i){return{video_id:i}}n(nI,"createVideoQuery");Xt.createVideoQuery=nI});var o_=u(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.HelixStream=void 0;var bx=(b(),x(g)),aI=C(),ie=m(),lu=class extends ie.DataObject{static{n(this,"HelixStream")}constructor(e,t){super(e),this._client=t}get id(){return this[ie.rawDataSymbol].id}get userId(){return this[ie.rawDataSymbol].user_id}get userName(){return this[ie.rawDataSymbol].user_login}get userDisplayName(){return this[ie.rawDataSymbol].user_name}async getUser(){return(0,ie.checkRelationAssertion)(await this._client.users.getUserById(this[ie.rawDataSymbol].user_id))}get gameId(){return this[ie.rawDataSymbol].game_id}get gameName(){return this[ie.rawDataSymbol].game_name}async getGame(){return this[ie.rawDataSymbol].game_id?(0,ie.checkRelationAssertion)(await this._client.games.getGameById(this[ie.rawDataSymbol].game_id)):null}get type(){return this[ie.rawDataSymbol].type}get title(){return this[ie.rawDataSymbol].title}get viewers(){return this[ie.rawDataSymbol].viewer_count}get startDate(){return new Date(this[ie.rawDataSymbol].started_at)}get language(){return this[ie.rawDataSymbol].language}get thumbnailUrl(){return this[ie.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[ie.rawDataSymbol].thumbnail_url.replace("{width}",e.toString()).replace("{height}",t.toString())}get tags(){return this[ie.rawDataSymbol].tags}get isMature(){return this[ie.rawDataSymbol].is_mature}};Sa.HelixStream=lu;bx.__decorate([(0,aI.Enumerable)(!1)],lu.prototype,"_client",void 0);Sa.HelixStream=lu=bx.__decorate([(0,ie.rtfm)("api","HelixStream","id")],lu)});var cu=u(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.HelixStreamMarker=void 0;var xx=(b(),x(g)),sI=C(),si=m(),uu=class extends si.DataObject{static{n(this,"HelixStreamMarker")}constructor(e,t){super(e),this._client=t}get id(){return this[si.rawDataSymbol].id}get creationDate(){return new Date(this[si.rawDataSymbol].created_at)}get description(){return this[si.rawDataSymbol].description}get positionInSeconds(){return this[si.rawDataSymbol].position_seconds}};Ha.HelixStreamMarker=uu;xx.__decorate([(0,sI.Enumerable)(!1)],uu.prototype,"_client",void 0);Ha.HelixStreamMarker=uu=xx.__decorate([(0,si.rtfm)("api","HelixStreamMarker","id")],uu)});var c_=u(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.HelixStreamMarkerWithVideo=void 0;var oI=(b(),x(g)),l_=m(),lI=cu(),u_=class extends lI.HelixStreamMarker{static{n(this,"HelixStreamMarkerWithVideo")}constructor(e,t,r){super(e,r),this._videoId=t}get url(){return this[l_.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,l_.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};Ca.HelixStreamMarkerWithVideo=u_;Ca.HelixStreamMarkerWithVideo=u_=oI.__decorate([(0,l_.rtfm)("api","HelixStreamMarkerWithVideo","id")],u_)});var h_=u(Pa=>{"use strict";var li;Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HelixStreamApi=void 0;var d_=(b(),x(g)),qa=C(),wx=Y(),Ue=m(),uI=s_(),du=je(),oi=gx(),vx=Ft(),hu=oe(),Sx=pe(),pu=le(),cI=G(),br=o_(),dI=cu(),hI=c_(),Ea=li=class extends cI.BaseApi{static{n(this,"HelixStreamApi")}constructor(){super(...arguments),this._getStreamByUserIdBatcher=new vx.HelixRequestBatcher({url:"streams"},"user_id","user_id",this._client,e=>new br.HelixStream(e,this._client)),this._getStreamByUserNameBatcher=new vx.HelixRequestBatcher({url:"streams"},"user_login","user_login",this._client,e=>new br.HelixStream(e,this._client))}async getStreams(e={}){let t=await this._client.callApi({url:"streams",type:"helix",query:{...(0,oi.createStreamQuery)(e),...(0,pu.createPaginationQuery)(e)}});return(0,Sx.createPaginatedResult)(t,br.HelixStream,this._client)}getStreamsPaginated(e={}){return new hu.HelixPaginatedRequest({url:"streams",query:(0,oi.createStreamQuery)(e)},this._client,t=>new br.HelixStream(t,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(Ue.extractUserName)})).data}async getStreamByUserName(e){var t;return(t=(await this.getStreamsByUserNames([e]))[0])!==null&&t!==void 0?t:null}async getStreamByUserNameBatched(e){return await this._getStreamByUserNameBatcher.request((0,Ue.extractUserName)(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(Ue.extractUserId)})).data}async getStreamByUserId(e){let t=(0,Ue.extractUserId)(e),r=await this._client.callApi({url:"streams",type:"helix",userId:t,query:(0,oi.createStreamQuery)({userId:t})});return(0,qa.mapNullable)(r.data[0],a=>new br.HelixStream(a,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request((0,Ue.extractUserId)(e))}async getStreamMarkersForUser(e,t){var r;let a=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,du.createUserQuery)(e),...(0,pu.createPaginationQuery)(t)},userId:(0,Ue.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,qa.flatten)(a.data.map(s=>li._mapGetStreamMarkersResult(s,this._client))),cursor:(r=a.pagination)===null||r===void 0?void 0:r.cursor}}getStreamMarkersForUserPaginated(e){return new hu.HelixPaginatedRequest({url:"streams/markers",query:(0,du.createUserQuery)(e),userId:(0,Ue.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,t=>li._mapGetStreamMarkersResult(t,this._client))}async getStreamMarkersForVideo(e,t,r){var a;let s=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,oi.createVideoQuery)(t),...(0,pu.createPaginationQuery)(r)},userId:(0,Ue.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,qa.flatten)(s.data.map(o=>li._mapGetStreamMarkersResult(o,this._client))),cursor:(a=s.pagination)===null||a===void 0?void 0:a.cursor}}getStreamMarkersForVideoPaginated(e,t){return new hu.HelixPaginatedRequest({url:"streams/markers",query:(0,oi.createVideoQuery)(t),userId:(0,Ue.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,r=>li._mapGetStreamMarkersResult(r,this._client))}async createStreamMarker(e,t){try{let r=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:(0,Ue.extractUserId)(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:(0,oi.createStreamMarkerBody)(e,t)});return new dI.HelixStreamMarker(r.data[0],this._client)}catch(r){throw r instanceof wx.HttpStatusCodeError&&r.statusCode===404?new uI.StreamNotLiveError({cause:r}):r}}async getStreamKey(e){let t=(0,Ue.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:t,scopes:["channel:read:stream_key"],query:(0,wx.createBroadcasterQuery)(e)})).data[0].stream_key}async getFollowedStreams(e,t){let r=(0,Ue.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"streams/followed",userId:r,scopes:["user:read:follows"],query:{...(0,du.createSingleKeyQuery)("user_id",r),...(0,pu.createPaginationQuery)(t)}});return(0,Sx.createPaginatedResult)(a,br.HelixStream,this._client)}getFollowedStreamsPaginated(e){let t=(0,Ue.extractUserId)(e);return new hu.HelixPaginatedRequest({url:"streams/followed",userId:t,scopes:["user:read:follows"],query:(0,du.createSingleKeyQuery)("user_id",t)},this._client,r=>new br.HelixStream(r,this._client))}static _mapGetStreamMarkersResult(e,t){return e.videos.reduce((r,a)=>[...r,...a.markers.map(s=>new hI.HelixStreamMarkerWithVideo(s,a.video_id,t))],[])}};Pa.HelixStreamApi=Ea;d_.__decorate([(0,qa.Enumerable)(!1)],Ea.prototype,"_getStreamByUserIdBatcher",void 0);d_.__decorate([(0,qa.Enumerable)(!1)],Ea.prototype,"_getStreamByUserNameBatcher",void 0);Pa.HelixStreamApi=Ea=li=d_.__decorate([(0,Ue.rtfm)("api","HelixStreamApi")],Ea)});var Cx=u(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.createSubscriptionCheckQuery=void 0;var Hx=m();function pI(i,e){return{broadcaster_id:(0,Hx.extractUserId)(i),user_id:(0,Hx.extractUserId)(e)}}n(pI,"createSubscriptionCheckQuery");_u.createSubscriptionCheckQuery=pI});var yu=u(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.HelixUserSubscription=void 0;var qx=(b(),x(g)),_I=C(),Yt=m(),mu=class extends Yt.DataObject{static{n(this,"HelixUserSubscription")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Yt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Yt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Yt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[Yt.rawDataSymbol].broadcaster_id)}get isGift(){return this[Yt.rawDataSymbol].is_gift}get tier(){return this[Yt.rawDataSymbol].tier}};Aa.HelixUserSubscription=mu;qx.__decorate([(0,_I.Enumerable)(!1)],mu.prototype,"_client",void 0);Aa.HelixUserSubscription=mu=qx.__decorate([(0,Yt.rtfm)("api","HelixUserSubscription","broadcasterId")],mu)});var fu=u(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.HelixSubscription=void 0;var mI=(b(),x(g)),de=m(),yI=yu(),p_=class extends yI.HelixUserSubscription{static{n(this,"HelixSubscription")}get broadcasterId(){return this[de.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[de.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[de.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].broadcaster_id))}get gifterId(){return this[de.rawDataSymbol].is_gift?this[de.rawDataSymbol].gifter_id:null}get gifterName(){return this[de.rawDataSymbol].is_gift?this[de.rawDataSymbol].gifter_login:null}get gifterDisplayName(){return this[de.rawDataSymbol].is_gift?this[de.rawDataSymbol].gifter_name:null}async getGifter(){return this[de.rawDataSymbol].is_gift?(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].gifter_id)):null}get userId(){return this[de.rawDataSymbol].user_id}get userName(){return this[de.rawDataSymbol].user_login}get userDisplayName(){return this[de.rawDataSymbol].user_name}async getUser(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].user_id))}};Da.HelixSubscription=p_;Da.HelixSubscription=p_=mI.__decorate([(0,de.rtfm)("api","HelixSubscription","userId")],p_)});var m_=u(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.HelixPaginatedSubscriptionsRequest=void 0;var fI=(b(),x(g)),gI=Y(),Ex=m(),bI=Gr(),xI=fu(),__=class extends bI.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,Ex.extractUserId)(e),query:(0,gI.createBroadcasterQuery)(e)},t,r=>new xI.HelixSubscription(r,t))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};Ia.HelixPaginatedSubscriptionsRequest=__;Ia.HelixPaginatedSubscriptionsRequest=__=fI.__decorate([(0,Ex.rtfm)("api","HelixPaginatedSubscriptionsRequest")],__)});var f_=u(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.HelixSubscriptionApi=void 0;var wI=(b(),x(g)),Px=Y(),gu=m(),vI=je(),SI=Cx(),HI=pe(),CI=le(),qI=G(),EI=m_(),Ax=fu(),PI=yu(),y_=class extends qI.BaseApi{static{n(this,"HelixSubscriptionApi")}async getSubscriptions(e,t){let r=await this._client.callApi({url:"subscriptions",scopes:["channel:read:subscriptions"],type:"helix",userId:(0,gu.extractUserId)(e),query:{...(0,Px.createBroadcasterQuery)(e),...(0,CI.createPaginationQuery)(t)}});return{...(0,HI.createPaginatedResultWithTotal)(r,Ax.HelixSubscription,this._client),points:r.points}}getSubscriptionsPaginated(e){return new EI.HelixPaginatedSubscriptionsRequest(e,this._client)}async getSubscriptionsForUsers(e,t){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:(0,gu.extractUserId)(e),scopes:["channel:read:subscriptions"],query:(0,vI.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Ax.HelixSubscription(a,this._client))}async getSubscriptionForUser(e,t){let r=await this.getSubscriptionsForUsers(e,[t]);return r.length?r[0]:null}async checkUserSubscription(e,t){try{let r=await this._client.callApi({type:"helix",url:"subscriptions/user",userId:(0,gu.extractUserId)(e),scopes:["user:read:subscriptions"],query:(0,SI.createSubscriptionCheckQuery)(t,e)});return new PI.HelixUserSubscription(r.data[0],this._client)}catch(r){if(r instanceof Px.HttpStatusCodeError&&r.statusCode===404)return null;throw r}}};Ta.HelixSubscriptionApi=y_;Ta.HelixSubscriptionApi=y_=wI.__decorate([(0,gu.rtfm)("api","HelixSubscriptionApi")],y_)});var xu=u(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.HelixTeam=void 0;var Dx=(b(),x(g)),AI=C(),at=m(),bu=class extends at.DataObject{static{n(this,"HelixTeam")}constructor(e,t){super(e),this._client=t}get id(){return this[at.rawDataSymbol].id}get name(){return this[at.rawDataSymbol].team_name}get displayName(){return this[at.rawDataSymbol].team_display_name}get backgroundImageUrl(){return this[at.rawDataSymbol].background_image_url}get bannerUrl(){return this[at.rawDataSymbol].banner}get creationDate(){return new Date(this[at.rawDataSymbol].created_at)}get updateDate(){return new Date(this[at.rawDataSymbol].updated_at)}get info(){return this[at.rawDataSymbol].info}get logoThumbnailUrl(){return this[at.rawDataSymbol].thumbnail_url}async getUserRelations(){return(await this._client.teams.getTeamById(this.id)).userRelations}};Ra.HelixTeam=bu;Dx.__decorate([(0,AI.Enumerable)(!1)],bu.prototype,"_client",void 0);Ra.HelixTeam=bu=Dx.__decorate([(0,at.rtfm)("api","HelixTeam","id")],bu)});var b_=u(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.HelixTeamWithUsers=void 0;var DI=(b(),x(g)),Ix=m(),II=Go(),TI=xu(),g_=class extends TI.HelixTeam{static{n(this,"HelixTeamWithUsers")}get userRelations(){return this[Ix.rawDataSymbol].users.map(e=>new II.HelixUserRelation(e,this._client))}};Ua.HelixTeamWithUsers=g_;Ua.HelixTeamWithUsers=g_=DI.__decorate([(0,Ix.rtfm)("api","HelixTeamWithUsers","id")],g_)});var v_=u(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.HelixTeamApi=void 0;var RI=(b(),x(g)),x_=Y(),Rx=m(),UI=G(),OI=xu(),Tx=b_(),w_=class extends UI.BaseApi{static{n(this,"HelixTeamApi")}async getTeamsForBroadcaster(e){var t,r;return(r=(t=(await this._client.callApi({type:"helix",url:"teams/channel",userId:(0,Rx.extractUserId)(e),query:(0,x_.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(s=>new OI.HelixTeam(s,this._client)))!==null&&r!==void 0?r:[]}async getTeamById(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{id:e}});return new Tx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof x_.HttpStatusCodeError&&t.statusCode===500)return null;throw t}}async getTeamByName(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{name:e}});return new Tx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof x_.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};Oa.HelixTeamApi=w_;Oa.HelixTeamApi=w_=RI.__decorate([(0,Rx.rtfm)("api","HelixTeamApi")],w_)});var Ox=u(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.createUserBlockDeleteQuery=ui.createUserBlockCreateQuery=void 0;var Ux=m();function BI(i,e){return{target_user_id:(0,Ux.extractUserId)(i),source_context:e.sourceContext,reason:e.reason}}n(BI,"createUserBlockCreateQuery");ui.createUserBlockCreateQuery=BI;function jI(i){return{target_user_id:(0,Ux.extractUserId)(i)}}n(jI,"createUserBlockDeleteQuery");ui.createUserBlockDeleteQuery=jI});var Su=u(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.HelixBaseExtension=void 0;var wu=m(),S_=class extends wu.DataObject{static{n(this,"HelixBaseExtension")}get id(){return this[wu.rawDataSymbol].id}get version(){return this[wu.rawDataSymbol].version}get name(){return this[wu.rawDataSymbol].name}};vu.HelixBaseExtension=S_});var C_=u(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.HelixInstalledExtension=void 0;var kI=(b(),x(g)),MI=m(),LI=Su(),H_=class extends LI.HelixBaseExtension{static{n(this,"HelixInstalledExtension")}constructor(e,t,r){super(r),this._slotType=e,this._slotId=t}get slotType(){return this._slotType}get slotId(){return this._slotId}};Ba.HelixInstalledExtension=H_;Ba.HelixInstalledExtension=H_=kI.__decorate([(0,MI.rtfm)("api","HelixInstalledExtension","id")],H_)});var P_=u(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.HelixInstalledExtensionList=void 0;var FI=(b(),x(g)),ja=m(),q_=C_(),E_=class extends ja.DataObject{static{n(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let r=this[ja.rawDataSymbol][e][t];return r.active?new q_.HelixInstalledExtension(e,t,r):null}getExtensionsForSlotType(e){return[...Object.entries(this[ja.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,r])=>new q_.HelixInstalledExtension(e,t,r))}getAllExtensions(){return[...Object.entries(this[ja.rawDataSymbol])].flatMap(([e,t])=>[...Object.entries(t)].filter(r=>r[1].active).map(([r,a])=>new q_.HelixInstalledExtension(e,r,a)))}};ka.HelixInstalledExtensionList=E_;ka.HelixInstalledExtensionList=E_=FI.__decorate([(0,ja.rtfm)("api","HelixInstalledExtensionList")],E_)});var I_=u(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.HelixUserExtension=void 0;var NI=(b(),x(g)),A_=m(),QI=Su(),D_=class extends QI.HelixBaseExtension{static{n(this,"HelixUserExtension")}get canActivate(){return this[A_.rawDataSymbol].can_activate}get types(){return this[A_.rawDataSymbol].type}};Ma.HelixUserExtension=D_;Ma.HelixUserExtension=D_=NI.__decorate([(0,A_.rtfm)("api","HelixUserExtension","id")],D_)});var Cu=u(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.HelixUser=void 0;var Bx=(b(),x(g)),GI=C(),st=m(),Hu=class extends st.DataObject{static{n(this,"HelixUser")}constructor(e,t){super(e),this._client=t}get id(){return this[st.rawDataSymbol].id}get name(){return this[st.rawDataSymbol].login}get displayName(){return this[st.rawDataSymbol].display_name}get description(){return this[st.rawDataSymbol].description}get type(){return this[st.rawDataSymbol].type}get broadcasterType(){return this[st.rawDataSymbol].broadcaster_type}get profilePictureUrl(){return this[st.rawDataSymbol].profile_image_url}get offlinePlaceholderUrl(){return this[st.rawDataSymbol].offline_image_url}get creationDate(){return new Date(this[st.rawDataSymbol].created_at)}async getStream(){return await this._client.streams.getStreamByUserId(this)}async getFollowedChannels(){return await this._client.channels.getFollowedChannels(this)}async getFollowedChannel(e){var t;return(t=(await this._client.channels.getFollowedChannels(this,e)).data[0])!==null&&t!==void 0?t:null}async follows(e){return await this.getFollowedChannel(e)!==null}async getChannelFollowers(){return await this._client.channels.getChannelFollowers(this)}async getChannelFollower(e){var t;return(t=(await this._client.channels.getChannelFollowers(this,e)).data[0])!==null&&t!==void 0?t:null}async isFollowedBy(e){return await this.getChannelFollower(e)!==null}async getSubscriptionTo(e){return await this._client.subscriptions.checkUserSubscription(this,e)}async isSubscribedTo(e){return await this.getSubscriptionTo(e)!==null}async getSubscriber(e){return await this._client.subscriptions.getSubscriptionForUser(this,e)}async hasSubscriber(e){return await this.getSubscriber(e)!==null}};La.HelixUser=Hu;Bx.__decorate([(0,GI.Enumerable)(!1)],Hu.prototype,"_client",void 0);La.HelixUser=Hu=Bx.__decorate([(0,st.rtfm)("api","HelixUser","id")],Hu)});var R_=u(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.HelixPrivilegedUser=void 0;var WI=(b(),x(g)),jx=m(),VI=Cu(),T_=class extends VI.HelixUser{static{n(this,"HelixPrivilegedUser")}get email(){return this[jx.rawDataSymbol].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};Fa.HelixPrivilegedUser=T_;Fa.HelixPrivilegedUser=T_=WI.__decorate([(0,jx.rtfm)("api","HelixPrivilegedUser","id")],T_)});var U_=u(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.HelixUserBlock=void 0;var kx=(b(),x(g)),$I=C(),xr=m(),qu=class extends xr.DataObject{static{n(this,"HelixUserBlock")}constructor(e,t){super(e),this._client=t}get userId(){return this[xr.rawDataSymbol].user_id}get userName(){return this[xr.rawDataSymbol].user_login}get userDisplayName(){return this[xr.rawDataSymbol].display_name}async getUser(){return(0,xr.checkRelationAssertion)(await this._client.users.getUserById(this[xr.rawDataSymbol].user_id))}};Na.HelixUserBlock=qu;kx.__decorate([(0,$I.Enumerable)(!1)],qu.prototype,"_client",void 0);Na.HelixUserBlock=qu=kx.__decorate([(0,xr.rtfm)("api","HelixUserBlock","userId")],qu)});var j_=u(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.HelixUserApi=void 0;var O_=(b(),x(g)),B_=C(),Mx=Y(),we=m(),zI=je(),Lx=Ox(),Fx=Ft(),KI=oe(),JI=pe(),ZI=le(),XI=G(),Nx=P_(),YI=I_(),Qx=R_(),Eu=Cu(),Gx=U_(),Qa=class extends XI.BaseApi{static{n(this,"HelixUserApi")}constructor(){super(...arguments),this._getUserByIdBatcher=new Fx.HelixRequestBatcher({url:"users"},"id","id",this._client,e=>new Eu.HelixUser(e,this._client)),this._getUserByNameBatcher=new Fx.HelixRequestBatcher({url:"users"},"login","login",this._client,e=>new Eu.HelixUser(e,this._client))}async getUsersByIds(e){return await this._getUsers("id",e.map(we.extractUserId))}async getUsersByNames(e){return await this._getUsers("login",e.map(we.extractUserName))}async getUserById(e){let t=(0,we.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"users",userId:t,query:{id:t}});return(0,B_.mapNullable)(r.data[0],a=>new Eu.HelixUser(a,this._client))}async getUserByIdBatched(e){return await this._getUserByIdBatcher.request((0,we.extractUserId)(e))}async getUserByName(e){let t=await this._getUsers("login",[(0,we.extractUserName)(e)]);return t.length?t[0]:null}async getUserByNameBatched(e){return await this._getUserByNameBatcher.request((0,we.extractUserName)(e))}async getAuthenticatedUser(e,t=!1){var r;let a=await this._client.callApi({type:"helix",url:"users",forceType:"user",userId:(0,we.extractUserId)(e),scopes:t?["user:read:email"]:void 0});if(!(!((r=a.data)===null||r===void 0)&&r.length))throw new we.HellFreezesOverError("Could not get authenticated user");return new Qx.HelixPrivilegedUser(a.data[0],this._client)}async updateAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users",method:"PUT",userId:(0,we.extractUserId)(e),scopes:["user:edit"],query:{description:t.description}});return new Qx.HelixPrivilegedUser(r.data[0],this._client)}async getBlocks(e,t){let r=await this._client.callApi({type:"helix",url:"users/blocks",userId:(0,we.extractUserId)(e),scopes:["user:read:blocked_users"],query:{...(0,Mx.createBroadcasterQuery)(e),...(0,ZI.createPaginationQuery)(t)}});return(0,JI.createPaginatedResult)(r,Gx.HelixUserBlock,this._client)}getBlocksPaginated(e){return new KI.HelixPaginatedRequest({url:"users/blocks",userId:(0,we.extractUserId)(e),scopes:["user:read:blocked_users"],query:(0,Mx.createBroadcasterQuery)(e)},this._client,t=>new Gx.HelixUserBlock(t,this._client))}async createBlock(e,t,r={}){await this._client.callApi({type:"helix",url:"users/blocks",method:"PUT",userId:(0,we.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,Lx.createUserBlockCreateQuery)(t,r)})}async deleteBlock(e,t){await this._client.callApi({type:"helix",url:"users/blocks",method:"DELETE",userId:(0,we.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,Lx.createUserBlockDeleteQuery)(t)})}async getExtensionsForAuthenticatedUser(e,t=!1){return(await this._client.callApi({type:"helix",url:"users/extensions/list",userId:(0,we.extractUserId)(e),scopes:t?["channel:manage:extensions"]:["user:read:broadcast","channel:manage:extensions"]})).data.map(a=>new YI.HelixUserExtension(a))}async getActiveExtensions(e,t=!1){let r=(0,we.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"users/extensions",userId:r,scopes:t?["user:read:broadcast","channel:manage:extensions"]:void 0,query:(0,zI.createSingleKeyQuery)("user_id",r)});return new Nx.HelixInstalledExtensionList(a.data)}async updateActiveExtensionsForAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users/extensions",method:"PUT",userId:(0,we.extractUserId)(e),scopes:["channel:manage:extensions"],jsonBody:{data:t}});return new Nx.HelixInstalledExtensionList(r.data)}async _getUsers(e,t){if(t.length===0)return[];let r={[e]:t};return(await this._client.callApi({type:"helix",url:"users",query:r})).data.map(s=>new Eu.HelixUser(s,this._client))}};Ga.HelixUserApi=Qa;O_.__decorate([(0,B_.Enumerable)(!1)],Qa.prototype,"_getUserByIdBatcher",void 0);O_.__decorate([(0,B_.Enumerable)(!1)],Qa.prototype,"_getUserByNameBatcher",void 0);Ga.HelixUserApi=Qa=O_.__decorate([(0,we.rtfm)("api","HelixUserApi")],Qa)});var M_=u(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.HelixVideo=void 0;var k_=(b(),x(g)),Wx=Ci(),e1=C(),j=m(),Wa=class extends j.DataObject{static{n(this,"HelixVideo")}constructor(e,t){super(e),this._client=t}get id(){return this[j.rawDataSymbol].id}get userId(){return this[j.rawDataSymbol].user_id}get userName(){return this[j.rawDataSymbol].user_login}get userDisplayName(){return this[j.rawDataSymbol].user_name}async getUser(){return(0,j.checkRelationAssertion)(await this._client.users.getUserById(this[j.rawDataSymbol].user_id))}get title(){return this[j.rawDataSymbol].title}get description(){return this[j.rawDataSymbol].description}get creationDate(){return new Date(this[j.rawDataSymbol].created_at)}get publishDate(){return new Date(this[j.rawDataSymbol].published_at)}get url(){return this[j.rawDataSymbol].url}get thumbnailUrl(){return this[j.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[j.rawDataSymbol].thumbnail_url.replace("%{width}",e.toString()).replace("%{height}",t.toString())}get isPublic(){return this[j.rawDataSymbol].viewable==="public"}get views(){return this[j.rawDataSymbol].view_count}get language(){return this[j.rawDataSymbol].language}get type(){return this[j.rawDataSymbol].type}get duration(){return this[j.rawDataSymbol].duration}get durationInSeconds(){let e=this[j.rawDataSymbol].duration.match(/\d+[hms]/g);if(!e)throw new j.HellFreezesOverError(`Could not parse duration string: ${this[j.rawDataSymbol].duration}`);return e.map(t=>{let r=/(\d+)([hms])/.exec(t);if(!r)throw new j.HellFreezesOverError(`Could not parse partial duration string: ${t}`);let[,a,s]=r;return parseInt(a,10)*{h:3600,m:60,s:1}[s]}).reduce((t,r)=>t+r)}get streamId(){return this[j.rawDataSymbol].stream_id}get mutedSegmentData(){var e,t;return(t=(e=this[j.rawDataSymbol].muted_segments)===null||e===void 0?void 0:e.slice())!==null&&t!==void 0?t:[]}isMutedAt(e,t,r=!1){if(this[j.rawDataSymbol].muted_segments===null)return!1;if(t==null)return this[j.rawDataSymbol].muted_segments.some(s=>s.offset<=e&&e<=s.offset+s.duration);let a=e+t;return r?this[j.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return e<o&&s.offset<a}):this[j.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return s.offset<=e&&a<=o})}};Va.HelixVideo=Wa;k_.__decorate([(0,e1.Enumerable)(!1)],Wa.prototype,"_client",void 0);k_.__decorate([(0,Wx.CachedGetter)()],Wa.prototype,"durationInSeconds",null);Va.HelixVideo=Wa=k_.__decorate([Wx.Cacheable,(0,j.rtfm)("api","HelixVideo","id")],Wa)});var F_=u($a=>{"use strict";var Pu;Object.defineProperty($a,"__esModule",{value:!0});$a.HelixVideoApi=void 0;var Vx=(b(),x(g)),t1=C(),Au=m(),r1=Ft(),i1=oe(),n1=pe(),a1=le(),s1=G(),L_=M_(),Du=Pu=class extends s1.BaseApi{static{n(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new r1.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new L_.HelixVideo(e,this._client))}async getVideosByIds(e){return(await this._getVideos("id",e)).data}async getVideoById(e){let t=await this.getVideosByIds([e]);return t.length?t[0]:null}async getVideoByIdBatched(e){return await this._getVideoByIdBatcher.request(e)}async getVideosByUser(e,t={}){let r=(0,Au.extractUserId)(e);return await this._getVideos("user_id",[r],t)}getVideosByUserPaginated(e,t={}){let r=(0,Au.extractUserId)(e);return this._getVideosPaginated("user_id",[r],t)}async getVideosByGame(e,t={}){return await this._getVideos("game_id",[e],t)}getVideosByGamePaginated(e,t={}){return this._getVideosPaginated("game_id",[e],t)}async deleteVideosByIds(e,t){await this._client.callApi({type:"helix",url:"videos",method:"DELETE",scopes:["channel:manage:videos"],userId:(0,Au.extractUserId)(e),query:{id:t}})}async _getVideos(e,t,r={}){if(!t.length)return{data:[]};let a=await this._client.callApi({type:"helix",url:"videos",userId:e==="user_id"?t[0]:void 0,query:{...Pu._makeVideosQuery(e,t,r),...(0,a1.createPaginationQuery)(r)}});return(0,n1.createPaginatedResult)(a,L_.HelixVideo,this._client)}_getVideosPaginated(e,t,r={}){return new i1.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:Pu._makeVideosQuery(e,t,r)},this._client,a=>new L_.HelixVideo(a,this._client))}static _makeVideosQuery(e,t,r={}){let{language:a,period:s,orderBy:o,type:l}=r;return{[e]:t,language:a,period:s,sort:o,type:l}}};$a.HelixVideoApi=Du;Vx.__decorate([(0,t1.Enumerable)(!1)],Du.prototype,"_getVideoByIdBatcher",void 0);$a.HelixVideoApi=Du=Pu=Vx.__decorate([(0,Au.rtfm)("api","HelixVideoApi")],Du)});var zx=u(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.createWhisperQuery=void 0;var $x=m();function o1(i,e){return{from_user_id:(0,$x.extractUserId)(i),to_user_id:(0,$x.extractUserId)(e)}}n(o1,"createWhisperQuery");Iu.createWhisperQuery=o1});var Q_=u(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.HelixWhisperApi=void 0;var l1=(b(),x(g)),Kx=m(),u1=zx(),c1=G(),N_=class extends c1.BaseApi{static{n(this,"HelixWhisperApi")}async sendWhisper(e,t,r){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:(0,Kx.extractUserId)(e),scopes:["user:manage:whispers"],query:(0,u1.createWhisperQuery)(e,t),jsonBody:{message:r}})}};za.HelixWhisperApi=N_;za.HelixWhisperApi=N_=l1.__decorate([(0,Kx.rtfm)("api","HelixWhisperApi")],N_)});var W_=u(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.ApiReportedRequest=void 0;var G_=class{static{n(this,"ApiReportedRequest")}constructor(e,t,r){this._options=e,this._httpStatus=t,this._resolvedUserId=r}get options(){return this._options}get httpStatus(){return this._httpStatus}get resolvedUserId(){return this._resolvedUserId}};Tu.ApiReportedRequest=G_});var Uu=u(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.BaseApiClient=void 0;var W=(b(),x(g)),V=Ci(),d1=io(),h1=C(),p1=pd(),ci=Y(),Ru=Id(),Jx=m(),_1=cg(),m1=Md(),y1=Yd(),f1=ih(),g1=uh(),b1=Ih(),x1=Oh(),w1=Mh(),v1=Gh(),S1=Yh(),H1=sp(),C1=up(),q1=hp(),E1=yp(),P1=Rp(),A1=kp(),D1=Qp(),I1=zp(),T1=t_(),R1=n_(),U1=h_(),O1=f_(),B1=v_(),j1=j_(),k1=F_(),M1=Q_(),L1=W_(),N=class extends p1.EventEmitter{static{n(this,"BaseApiClient")}constructor(e,t,r){super(),this.onRequest=this.registerEvent(),this._config=e,this._logger=t,this._rateLimiter=r}async requestScopesForUser(e,t){await this._config.authProvider.getAccessTokenForUser(e,...t.map(r=>[r]))}async getTokenInfo(){try{let e=await this.callApi({type:"auth",url:"validate"});return new Ru.TokenInfo(e)}catch(e){throw e instanceof ci.HttpStatusCodeError&&e.statusCode===401?new Ru.InvalidTokenError({cause:e}):e}}async callApi(e){var t;let{authProvider:r}=this._config;if(!((t=e.auth)!==null&&t!==void 0?t:!0))return await(0,ci.callTwitchApi)(e,r.clientId,void 0,void 0,this._config.fetchOptions);let s=!1;if(e.forceType)switch(e.forceType){case"app":{if(!r.getAppAccessToken)throw new Error("Tried to make an API call that requires an app access token but your auth provider does not support that");let d=await r.getAppAccessToken();return await this._callApiUsingInitialToken(e,d)}case"user":{s=!0;break}default:throw new Jx.HellFreezesOverError(`Unknown forced token type: ${e.forceType}`)}if(e.scopes&&(s=!0),s){let d=e.canOverrideScopedUserContext?this._getUserIdFromRequestContext(e.userId):e.userId;if(!d)throw new Error("Tried to make an API call with a user context but no context user ID");let h=await r.getAccessTokenForUser(d,e.scopes);if(!h)throw new Error(`Tried to make an API call with a user context for user ID ${d} but no token was found`);if((0,Ru.accessTokenIsExpired)(h)&&r.refreshAccessTokenForUser){let p=await r.refreshAccessTokenForUser(d);return await this._callApiUsingInitialToken(e,p,!0)}return await this._callApiUsingInitialToken(e,h)}let o=this._getUserIdFromRequestContext(e.userId),l=o===null?await r.getAnyAccessToken():await r.getAnyAccessToken(o??e.userId);if((0,Ru.accessTokenIsExpired)(l)&&l.userId&&r.refreshAccessTokenForUser){let d=await r.refreshAccessTokenForUser(l.userId);return await this._callApiUsingInitialToken(e,d,!0)}return await this._callApiUsingInitialToken(e,l)}get bits(){return new m1.HelixBitsApi(this)}get channels(){return new y1.HelixChannelApi(this)}get channelPoints(){return new f1.HelixChannelPointsApi(this)}get charity(){return new g1.HelixCharityApi(this)}get chat(){return new b1.HelixChatApi(this)}get clips(){return new x1.HelixClipApi(this)}get contentClassificationLabels(){return new w1.HelixContentClassificationLabelApi(this)}get entitlements(){return new v1.HelixEntitlementApi(this)}get eventSub(){return new S1.HelixEventSubApi(this)}get extensions(){return new H1.HelixExtensionsApi(this)}get games(){return new C1.HelixGameApi(this)}get hypeTrain(){return new E1.HelixHypeTrainApi(this)}get goals(){return new q1.HelixGoalApi(this)}get moderation(){return new P1.HelixModerationApi(this)}get polls(){return new A1.HelixPollApi(this)}get predictions(){return new D1.HelixPredictionApi(this)}get raids(){return new I1.HelixRaidApi(this)}get schedule(){return new T1.HelixScheduleApi(this)}get search(){return new R1.HelixSearchApi(this)}get streams(){return new U1.HelixStreamApi(this)}get subscriptions(){return new O1.HelixSubscriptionApi(this)}get teams(){return new B1.HelixTeamApi(this)}get users(){return new j1.HelixUserApi(this)}get videos(){return new k1.HelixVideoApi(this)}get whispers(){return new M1.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof d1.ResponseBasedRateLimiter?this._rateLimiter.stats:null}get _authProvider(){return this._config.authProvider}get _mockServerPort(){return this._config.mockServerPort}get _batchDelay(){var e;return(e=this._config.batchDelay)!==null&&e!==void 0?e:0}_getUserIdFromRequestContext(e){return e}async _callApiUsingInitialToken(e,t,r=!1){var a;let{authProvider:s}=this._config,{authorizationType:o}=s,l=await this._callApiInternal(e,s.clientId,t.accessToken,o);if(l.status===401&&!r){if(t.userId){if(s.refreshAccessTokenForUser){let d=await s.refreshAccessTokenForUser(t.userId);l=await this._callApiInternal(e,s.clientId,d.accessToken,o)}}else if(s.getAppAccessToken){let d=await s.getAppAccessToken(!0);l=await this._callApiInternal(e,s.clientId,d.accessToken,o)}}return this.emit(this.onRequest,new L1.ApiReportedRequest(e,l.status,(a=t.userId)!==null&&a!==void 0?a:null)),await(0,ci.handleTwitchApiResponseError)(l,e),await(0,ci.transformTwitchApiResponse)(l)}async _callApiInternal(e,t,r,a){var s,o,l;let{fetchOptions:d,mockServerPort:h}=this._config,p=(s=e.type)!==null&&s!==void 0?s:"helix";this._logger.debug(`Calling ${p} API: ${(o=e.method)!==null&&o!==void 0?o:"GET"} ${e.url}`),this._logger.trace(`Query: ${JSON.stringify(e.query)}`),e.jsonBody&&this._logger.trace(`Request body: ${JSON.stringify(e.jsonBody)}`);let w=_1.operation({retries:3,minTimeout:500,factor:2}),{promise:E,resolve:P,reject:y}=(0,h1.promiseWithResolvers)();w.attempt(async()=>{try{let v=p==="helix"?await this._rateLimiter.request({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:d,mockServerPort:h}):await(0,ci.callTwitchApiRaw)(e,t,r,a,d,h);!v.ok&&v.status>=500&&v.status<600&&await(0,ci.handleTwitchApiResponseError)(v,e),P(v)}catch(v){if(w.retry(v))return;y(w.mainError())}});let q=await E;return this._logger.debug(`Called ${p} API: ${(l=e.method)!==null&&l!==void 0?l:"GET"} ${e.url} - result: ${q.status}`),q}};Ka.BaseApiClient=N;W.__decorate([(0,V.CachedGetter)()],N.prototype,"bits",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"channels",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"channelPoints",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"charity",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"chat",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"clips",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"contentClassificationLabels",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"entitlements",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"eventSub",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"extensions",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"games",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"hypeTrain",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"goals",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"moderation",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"polls",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"predictions",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"raids",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"schedule",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"search",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"streams",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"subscriptions",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"teams",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"users",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"videos",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"whispers",null);Ka.BaseApiClient=N=W.__decorate([V.Cacheable,(0,Jx.rtfm)("api","ApiClient")],N)});var Zx=u(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.NoContextApiClient=void 0;var F1=(b(),x(g)),N1=m(),Q1=Uu(),V_=class extends Q1.BaseApiClient{static{n(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};Ja.NoContextApiClient=V_;Ja.NoContextApiClient=V_=F1.__decorate([(0,N1.rtfm)("api","ApiClient")],V_)});var Xx=u(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.UserContextApiClient=void 0;var G1=(b(),x(g)),W1=m(),V1=Uu(),$_=class extends V1.BaseApiClient{static{n(this,"UserContextApiClient")}constructor(e,t,r,a){super(e,t,r),this._userId=a}_getUserIdFromRequestContext(){return this._userId}};Za.UserContextApiClient=$_;Za.UserContextApiClient=$_=G1.__decorate([(0,W1.rtfm)("api","ApiClient")],$_)});var rw=u(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.ApiClient=void 0;var $1=(b(),x(g)),z1=fi(),K1=bi(),Yx=io(),J1=Y(),tw=m(),Z1=ld(),X1=Ff(),Y1=Uu(),eT=Zx(),ew=Xx(),z_=class extends Y1.BaseApiClient{static{n(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new Z1.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,K1.createLogger)({name:"twurple:api:client",...e.logger}),z1.isNode?new Yx.PartitionedRateLimiter({getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey"),createChild:n(()=>new X1.HelixRateLimiter({logger:t}),"createChild")}):new Yx.PartitionedTimeBasedRateLimiter({logger:t,bucketSize:800,timeFrame:64e3,doRequest:n(async({options:r,clientId:a,accessToken:s,authorizationType:o,fetchOptions:l,mockServerPort:d})=>await(0,J1.callTwitchApiRaw)(r,a,s,o,l,d),"doRequest"),getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey")}))}async asUser(e,t){let r=new ew.UserContextApiClient(this._config,this._logger,this._rateLimiter,(0,tw.extractUserId)(e));return await t(r)}async asIntent(e,t){if(!this._authProvider.getAccessTokenForIntent)throw new Error("Trying to use intents with an auth provider that does not support them");for(let r of e){let a=await this._authProvider.getAccessTokenForIntent(r);if(a){let s=new ew.UserContextApiClient(this._config,this._logger,this._rateLimiter,a.userId);return await t(s)}}throw new Error(`Intents [${e.join(", ")}] not found in auth provider`)}async withoutUser(e){let t=new eT.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};Xa.ApiClient=z_;Xa.ApiClient=z_=$1.__decorate([(0,tw.rtfm)("api","ApiClient")],z_)});var nw=u(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});Ya.HelixFollow=void 0;var iw=(b(),x(g)),tT=C(),Le=m(),Ou=class extends Le.DataObject{static{n(this,"HelixFollow")}constructor(e,t){super(e),this._client=t}get userId(){return this[Le.rawDataSymbol].from_id}get userName(){return this[Le.rawDataSymbol].from_login}get userDisplayName(){return this[Le.rawDataSymbol].from_name}async getUser(){return(0,Le.checkRelationAssertion)(await this._client.users.getUserById(this[Le.rawDataSymbol].from_id))}get followedUserId(){return this[Le.rawDataSymbol].to_id}get followedUserName(){return this[Le.rawDataSymbol].to_login}get followedUserDisplayName(){return this[Le.rawDataSymbol].to_name}async getFollowedUser(){return(0,Le.checkRelationAssertion)(await this._client.users.getUserById(this[Le.rawDataSymbol].to_id))}get followDate(){return new Date(this[Le.rawDataSymbol].followed_at)}};Ya.HelixFollow=Ou;iw.__decorate([(0,tT.Enumerable)(!1)],Ou.prototype,"_client",void 0);Ya.HelixFollow=Ou=iw.__decorate([(0,Le.rtfm)("api","HelixFollow")],Ou)});var aw=u(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.HelixGoal=c.HelixGoalApi=c.HelixGame=c.HelixGameApi=c.HelixExtensionTransaction=c.HelixExtensionBitsProduct=c.HelixExtensionsApi=c.HelixPaginatedEventSubSubscriptionsRequest=c.HelixEventSubSubscription=c.HelixEventSubConduitShard=c.HelixEventSubConduit=c.HelixEventSubApi=c.HelixDropsEntitlement=c.HelixEntitlementApi=c.HelixContentClassificationLabel=c.HelixContentClassificationLabelApi=c.HelixClip=c.HelixClipApi=c.HelixSharedChatSession=c.HelixSharedChatSessionParticipant=c.HelixSentChatMessage=c.HelixPrivilegedChatSettings=c.HelixUserEmote=c.HelixEmoteFromSet=c.HelixChannelEmote=c.HelixEmote=c.HelixChatChatter=c.HelixChatSettings=c.HelixChatBadgeVersion=c.HelixChatBadgeSet=c.HelixChatApi=c.HelixCharityCampaignAmount=c.HelixCharityCampaignDonation=c.HelixCharityCampaign=c.HelixCharityApi=c.HelixCustomRewardRedemption=c.HelixCustomReward=c.HelixChannelPointsApi=c.HelixChannelReference=c.HelixFollowedChannel=c.HelixChannelFollower=c.HelixChannelEditor=c.HelixChannel=c.HelixAdSchedule=c.HelixChannelApi=c.HelixCheermoteList=c.HelixBitsLeaderboardEntry=c.HelixBitsLeaderboard=c.HelixBitsApi=c.ApiClient=void 0;c.HelixVideo=c.HelixVideoApi=c.HelixUserExtension=c.HelixInstalledExtensionList=c.HelixInstalledExtension=c.HelixBaseExtension=c.HelixUser=c.HelixPrivilegedUser=c.HelixFollow=c.HelixUserBlock=c.HelixUserApi=c.HelixTeamWithUsers=c.HelixTeam=c.HelixTeamApi=c.HelixUserSubscription=c.HelixSubscription=c.HelixSubscriptionApi=c.HelixPaginatedSubscriptionsRequest=c.HelixStreamMarkerWithVideo=c.HelixStreamMarker=c.HelixStream=c.HelixStreamApi=c.HelixChannelSearchResult=c.HelixSearchApi=c.HelixPaginatedScheduleSegmentRequest=c.HelixScheduleSegment=c.HelixSchedule=c.HelixScheduleApi=c.HelixUserRelation=c.HelixRaid=c.HelixRaidApi=c.HelixPredictor=c.HelixPredictionOutcome=c.HelixPrediction=c.HelixPredictionApi=c.HelixPollChoice=c.HelixPoll=c.HelixPollApi=c.HelixWarning=c.HelixUnbanRequest=c.HelixShieldModeStatus=c.HelixBlockedTerm=c.HelixBanUser=c.HelixModeratedChannel=c.HelixModerator=c.HelixBan=c.HelixModerationApi=c.HelixHypeTrainEvent=c.HelixHypeTrainContribution=c.HelixHypeTrainApi=void 0;c.HellFreezesOverError=c.HelixExtension=c.extractUserName=c.extractUserId=c.HelixPaginatedRequestWithTotal=c.HelixPaginatedRequest=c.ApiReportedRequest=c.StreamNotLiveError=c.ConfigError=c.HelixWhisperApi=void 0;var rT=rw();Object.defineProperty(c,"ApiClient",{enumerable:!0,get:n(function(){return rT.ApiClient},"get")});var iT=Md();Object.defineProperty(c,"HelixBitsApi",{enumerable:!0,get:n(function(){return iT.HelixBitsApi},"get")});var nT=Ud();Object.defineProperty(c,"HelixBitsLeaderboard",{enumerable:!0,get:n(function(){return nT.HelixBitsLeaderboard},"get")});var aT=Td();Object.defineProperty(c,"HelixBitsLeaderboardEntry",{enumerable:!0,get:n(function(){return aT.HelixBitsLeaderboardEntry},"get")});var sT=Bd();Object.defineProperty(c,"HelixCheermoteList",{enumerable:!0,get:n(function(){return sT.HelixCheermoteList},"get")});var oT=Yd();Object.defineProperty(c,"HelixChannelApi",{enumerable:!0,get:n(function(){return oT.HelixChannelApi},"get")});var lT=zd();Object.defineProperty(c,"HelixAdSchedule",{enumerable:!0,get:n(function(){return lT.HelixAdSchedule},"get")});var uT=Qd();Object.defineProperty(c,"HelixChannel",{enumerable:!0,get:n(function(){return uT.HelixChannel},"get")});var cT=Gd();Object.defineProperty(c,"HelixChannelEditor",{enumerable:!0,get:n(function(){return cT.HelixChannelEditor},"get")});var dT=Wd();Object.defineProperty(c,"HelixChannelFollower",{enumerable:!0,get:n(function(){return dT.HelixChannelFollower},"get")});var hT=Vd();Object.defineProperty(c,"HelixFollowedChannel",{enumerable:!0,get:n(function(){return hT.HelixFollowedChannel},"get")});var pT=ep();Object.defineProperty(c,"HelixChannelReference",{enumerable:!0,get:n(function(){return pT.HelixChannelReference},"get")});var _T=ih();Object.defineProperty(c,"HelixChannelPointsApi",{enumerable:!0,get:n(function(){return _T.HelixChannelPointsApi},"get")});var mT=eh();Object.defineProperty(c,"HelixCustomReward",{enumerable:!0,get:n(function(){return mT.HelixCustomReward},"get")});var yT=th();Object.defineProperty(c,"HelixCustomRewardRedemption",{enumerable:!0,get:n(function(){return yT.HelixCustomRewardRedemption},"get")});var fT=uh();Object.defineProperty(c,"HelixCharityApi",{enumerable:!0,get:n(function(){return fT.HelixCharityApi},"get")});var gT=ah();Object.defineProperty(c,"HelixCharityCampaign",{enumerable:!0,get:n(function(){return gT.HelixCharityCampaign},"get")});var bT=sh();Object.defineProperty(c,"HelixCharityCampaignDonation",{enumerable:!0,get:n(function(){return bT.HelixCharityCampaignDonation},"get")});var xT=sl();Object.defineProperty(c,"HelixCharityCampaignAmount",{enumerable:!0,get:n(function(){return xT.HelixCharityCampaignAmount},"get")});var wT=Ih();Object.defineProperty(c,"HelixChatApi",{enumerable:!0,get:n(function(){return wT.HelixChatApi},"get")});var vT=fh();Object.defineProperty(c,"HelixChatBadgeSet",{enumerable:!0,get:n(function(){return vT.HelixChatBadgeSet},"get")});var ST=yh();Object.defineProperty(c,"HelixChatBadgeVersion",{enumerable:!0,get:n(function(){return ST.HelixChatBadgeVersion},"get")});var HT=_l();Object.defineProperty(c,"HelixChatSettings",{enumerable:!0,get:n(function(){return HT.HelixChatSettings},"get")});var CT=gh();Object.defineProperty(c,"HelixChatChatter",{enumerable:!0,get:n(function(){return CT.HelixChatChatter},"get")});var qT=on();Object.defineProperty(c,"HelixEmote",{enumerable:!0,get:n(function(){return qT.HelixEmote},"get")});var ET=_h();Object.defineProperty(c,"HelixChannelEmote",{enumerable:!0,get:n(function(){return ET.HelixChannelEmote},"get")});var PT=xh();Object.defineProperty(c,"HelixEmoteFromSet",{enumerable:!0,get:n(function(){return PT.HelixEmoteFromSet},"get")});var AT=wh();Object.defineProperty(c,"HelixUserEmote",{enumerable:!0,get:n(function(){return AT.HelixUserEmote},"get")});var DT=Hh();Object.defineProperty(c,"HelixPrivilegedChatSettings",{enumerable:!0,get:n(function(){return DT.HelixPrivilegedChatSettings},"get")});var IT=qh();Object.defineProperty(c,"HelixSentChatMessage",{enumerable:!0,get:n(function(){return IT.HelixSentChatMessage},"get")});var TT=Eh();Object.defineProperty(c,"HelixSharedChatSessionParticipant",{enumerable:!0,get:n(function(){return TT.HelixSharedChatSessionParticipant},"get")});var RT=Ph();Object.defineProperty(c,"HelixSharedChatSession",{enumerable:!0,get:n(function(){return RT.HelixSharedChatSession},"get")});var UT=Oh();Object.defineProperty(c,"HelixClipApi",{enumerable:!0,get:n(function(){return UT.HelixClipApi},"get")});var OT=Th();Object.defineProperty(c,"HelixClip",{enumerable:!0,get:n(function(){return OT.HelixClip},"get")});var BT=Mh();Object.defineProperty(c,"HelixContentClassificationLabelApi",{enumerable:!0,get:n(function(){return BT.HelixContentClassificationLabelApi},"get")});var jT=jh();Object.defineProperty(c,"HelixContentClassificationLabel",{enumerable:!0,get:n(function(){return jT.HelixContentClassificationLabel},"get")});var kT=Gh();Object.defineProperty(c,"HelixEntitlementApi",{enumerable:!0,get:n(function(){return kT.HelixEntitlementApi},"get")});var MT=Lh();Object.defineProperty(c,"HelixDropsEntitlement",{enumerable:!0,get:n(function(){return MT.HelixDropsEntitlement},"get")});var LT=Yh();Object.defineProperty(c,"HelixEventSubApi",{enumerable:!0,get:n(function(){return LT.HelixEventSubApi},"get")});var FT=$h();Object.defineProperty(c,"HelixEventSubConduit",{enumerable:!0,get:n(function(){return FT.HelixEventSubConduit},"get")});var NT=Kh();Object.defineProperty(c,"HelixEventSubConduitShard",{enumerable:!0,get:n(function(){return NT.HelixEventSubConduitShard},"get")});var QT=Pl();Object.defineProperty(c,"HelixEventSubSubscription",{enumerable:!0,get:n(function(){return QT.HelixEventSubSubscription},"get")});var GT=Vh();Object.defineProperty(c,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:n(function(){return GT.HelixPaginatedEventSubSubscriptionsRequest},"get")});var WT=sp();Object.defineProperty(c,"HelixExtensionsApi",{enumerable:!0,get:n(function(){return WT.HelixExtensionsApi},"get")});var VT=rp();Object.defineProperty(c,"HelixExtensionBitsProduct",{enumerable:!0,get:n(function(){return VT.HelixExtensionBitsProduct},"get")});var $T=ip();Object.defineProperty(c,"HelixExtensionTransaction",{enumerable:!0,get:n(function(){return $T.HelixExtensionTransaction},"get")});var zT=up();Object.defineProperty(c,"HelixGameApi",{enumerable:!0,get:n(function(){return zT.HelixGameApi},"get")});var KT=Ol();Object.defineProperty(c,"HelixGame",{enumerable:!0,get:n(function(){return KT.HelixGame},"get")});var JT=hp();Object.defineProperty(c,"HelixGoalApi",{enumerable:!0,get:n(function(){return JT.HelixGoalApi},"get")});var ZT=cp();Object.defineProperty(c,"HelixGoal",{enumerable:!0,get:n(function(){return ZT.HelixGoal},"get")});var XT=yp();Object.defineProperty(c,"HelixHypeTrainApi",{enumerable:!0,get:n(function(){return XT.HelixHypeTrainApi},"get")});var YT=pp();Object.defineProperty(c,"HelixHypeTrainContribution",{enumerable:!0,get:n(function(){return YT.HelixHypeTrainContribution},"get")});var eR=_p();Object.defineProperty(c,"HelixHypeTrainEvent",{enumerable:!0,get:n(function(){return eR.HelixHypeTrainEvent},"get")});var tR=Rp();Object.defineProperty(c,"HelixModerationApi",{enumerable:!0,get:n(function(){return tR.HelixModerationApi},"get")});var rR=vp();Object.defineProperty(c,"HelixBan",{enumerable:!0,get:n(function(){return rR.HelixBan},"get")});var iR=qp();Object.defineProperty(c,"HelixModerator",{enumerable:!0,get:n(function(){return iR.HelixModerator},"get")});var nR=Cp();Object.defineProperty(c,"HelixModeratedChannel",{enumerable:!0,get:n(function(){return nR.HelixModeratedChannel},"get")});var aR=Nl();Object.defineProperty(c,"HelixBanUser",{enumerable:!0,get:n(function(){return aR.HelixBanUser},"get")});var sR=Hp();Object.defineProperty(c,"HelixBlockedTerm",{enumerable:!0,get:n(function(){return sR.HelixBlockedTerm},"get")});var oR=Ep();Object.defineProperty(c,"HelixShieldModeStatus",{enumerable:!0,get:n(function(){return oR.HelixShieldModeStatus},"get")});var lR=Pp();Object.defineProperty(c,"HelixUnbanRequest",{enumerable:!0,get:n(function(){return lR.HelixUnbanRequest},"get")});var uR=Ap();Object.defineProperty(c,"HelixWarning",{enumerable:!0,get:n(function(){return uR.HelixWarning},"get")});var cR=kp();Object.defineProperty(c,"HelixPollApi",{enumerable:!0,get:n(function(){return cR.HelixPollApi},"get")});var dR=Bp();Object.defineProperty(c,"HelixPoll",{enumerable:!0,get:n(function(){return dR.HelixPoll},"get")});var hR=Op();Object.defineProperty(c,"HelixPollChoice",{enumerable:!0,get:n(function(){return hR.HelixPollChoice},"get")});var pR=Qp();Object.defineProperty(c,"HelixPredictionApi",{enumerable:!0,get:n(function(){return pR.HelixPredictionApi},"get")});var _R=Fp();Object.defineProperty(c,"HelixPrediction",{enumerable:!0,get:n(function(){return _R.HelixPrediction},"get")});var mR=Lp();Object.defineProperty(c,"HelixPredictionOutcome",{enumerable:!0,get:n(function(){return mR.HelixPredictionOutcome},"get")});var yR=Mp();Object.defineProperty(c,"HelixPredictor",{enumerable:!0,get:n(function(){return yR.HelixPredictor},"get")});var fR=zp();Object.defineProperty(c,"HelixRaidApi",{enumerable:!0,get:n(function(){return fR.HelixRaidApi},"get")});var gR=Wp();Object.defineProperty(c,"HelixRaid",{enumerable:!0,get:n(function(){return gR.HelixRaid},"get")});var bR=Go();Object.defineProperty(c,"HelixUserRelation",{enumerable:!0,get:n(function(){return bR.HelixUserRelation},"get")});var xR=t_();Object.defineProperty(c,"HelixScheduleApi",{enumerable:!0,get:n(function(){return xR.HelixScheduleApi},"get")});var wR=Xp();Object.defineProperty(c,"HelixSchedule",{enumerable:!0,get:n(function(){return wR.HelixSchedule},"get")});var vR=ga();Object.defineProperty(c,"HelixScheduleSegment",{enumerable:!0,get:n(function(){return vR.HelixScheduleSegment},"get")});var SR=Zp();Object.defineProperty(c,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:n(function(){return SR.HelixPaginatedScheduleSegmentRequest},"get")});var HR=n_();Object.defineProperty(c,"HelixSearchApi",{enumerable:!0,get:n(function(){return HR.HelixSearchApi},"get")});var CR=r_();Object.defineProperty(c,"HelixChannelSearchResult",{enumerable:!0,get:n(function(){return CR.HelixChannelSearchResult},"get")});var qR=h_();Object.defineProperty(c,"HelixStreamApi",{enumerable:!0,get:n(function(){return qR.HelixStreamApi},"get")});var ER=o_();Object.defineProperty(c,"HelixStream",{enumerable:!0,get:n(function(){return ER.HelixStream},"get")});var PR=cu();Object.defineProperty(c,"HelixStreamMarker",{enumerable:!0,get:n(function(){return PR.HelixStreamMarker},"get")});var AR=c_();Object.defineProperty(c,"HelixStreamMarkerWithVideo",{enumerable:!0,get:n(function(){return AR.HelixStreamMarkerWithVideo},"get")});var DR=m_();Object.defineProperty(c,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:n(function(){return DR.HelixPaginatedSubscriptionsRequest},"get")});var IR=f_();Object.defineProperty(c,"HelixSubscriptionApi",{enumerable:!0,get:n(function(){return IR.HelixSubscriptionApi},"get")});var TR=fu();Object.defineProperty(c,"HelixSubscription",{enumerable:!0,get:n(function(){return TR.HelixSubscription},"get")});var RR=yu();Object.defineProperty(c,"HelixUserSubscription",{enumerable:!0,get:n(function(){return RR.HelixUserSubscription},"get")});var UR=v_();Object.defineProperty(c,"HelixTeamApi",{enumerable:!0,get:n(function(){return UR.HelixTeamApi},"get")});var OR=xu();Object.defineProperty(c,"HelixTeam",{enumerable:!0,get:n(function(){return OR.HelixTeam},"get")});var BR=b_();Object.defineProperty(c,"HelixTeamWithUsers",{enumerable:!0,get:n(function(){return BR.HelixTeamWithUsers},"get")});var jR=j_();Object.defineProperty(c,"HelixUserApi",{enumerable:!0,get:n(function(){return jR.HelixUserApi},"get")});var kR=U_();Object.defineProperty(c,"HelixUserBlock",{enumerable:!0,get:n(function(){return kR.HelixUserBlock},"get")});var MR=nw();Object.defineProperty(c,"HelixFollow",{enumerable:!0,get:n(function(){return MR.HelixFollow},"get")});var LR=R_();Object.defineProperty(c,"HelixPrivilegedUser",{enumerable:!0,get:n(function(){return LR.HelixPrivilegedUser},"get")});var FR=Cu();Object.defineProperty(c,"HelixUser",{enumerable:!0,get:n(function(){return FR.HelixUser},"get")});var NR=Su();Object.defineProperty(c,"HelixBaseExtension",{enumerable:!0,get:n(function(){return NR.HelixBaseExtension},"get")});var QR=C_();Object.defineProperty(c,"HelixInstalledExtension",{enumerable:!0,get:n(function(){return QR.HelixInstalledExtension},"get")});var GR=P_();Object.defineProperty(c,"HelixInstalledExtensionList",{enumerable:!0,get:n(function(){return GR.HelixInstalledExtensionList},"get")});var WR=I_();Object.defineProperty(c,"HelixUserExtension",{enumerable:!0,get:n(function(){return WR.HelixUserExtension},"get")});var VR=F_();Object.defineProperty(c,"HelixVideoApi",{enumerable:!0,get:n(function(){return VR.HelixVideoApi},"get")});var $R=M_();Object.defineProperty(c,"HelixVideo",{enumerable:!0,get:n(function(){return $R.HelixVideo},"get")});var zR=Q_();Object.defineProperty(c,"HelixWhisperApi",{enumerable:!0,get:n(function(){return zR.HelixWhisperApi},"get")});var KR=ld();Object.defineProperty(c,"ConfigError",{enumerable:!0,get:n(function(){return KR.ConfigError},"get")});var JR=s_();Object.defineProperty(c,"StreamNotLiveError",{enumerable:!0,get:n(function(){return JR.StreamNotLiveError},"get")});var ZR=W_();Object.defineProperty(c,"ApiReportedRequest",{enumerable:!0,get:n(function(){return ZR.ApiReportedRequest},"get")});var XR=oe();Object.defineProperty(c,"HelixPaginatedRequest",{enumerable:!0,get:n(function(){return XR.HelixPaginatedRequest},"get")});var YR=Gr();Object.defineProperty(c,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:n(function(){return YR.HelixPaginatedRequestWithTotal},"get")});var Bu=m();Object.defineProperty(c,"extractUserId",{enumerable:!0,get:n(function(){return Bu.extractUserId},"get")});Object.defineProperty(c,"extractUserName",{enumerable:!0,get:n(function(){return Bu.extractUserName},"get")});Object.defineProperty(c,"HelixExtension",{enumerable:!0,get:n(function(){return Bu.HelixExtension},"get")});Object.defineProperty(c,"HellFreezesOverError",{enumerable:!0,get:n(function(){return Bu.HellFreezesOverError},"get")})});var hw=u((XG,dw)=>{var sw=Fu(),eU=Gu(),ow=rs(),er=Tt(),lw=Vu(),uw=zu(),cw=Ju(),ju=Vm(),{ApiClient:tU}=aw(),{AppTokenAuthProvider:rU}=Id(),K_=class{static{n(this,"EmoteFetcher")}constructor(e,t,r){if(r&&r.apiClient)this.apiClient=r.apiClient;else if(e!==void 0&&t!==void 0){let a=new rU(e,t);this.apiClient=new tU({authProvider:a})}this.emotes=new ow,this.channels=new ow,this.ffzModifiersFetched=!1}get globalChannel(){return this.channels.get(null)}_setupChannel(e,t=null){let r=this.channels.get(e);return r||(r=new eU(this,e),this.channels.set(e,r)),t&&(r.format=t),r}_getRawTwitchEmotes(e){if(!this.apiClient)throw new Error("Client id or client secret not provided.");return e?this.apiClient.chat.getChannelEmotes(e):this.apiClient.chat.getGlobalEmotes()}_cacheTwitchEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new cw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawBTTVEmotes(e){let t=e?er.BTTV.Channel(e):er.BTTV.Global;return ju.get(t).then(r=>r.data instanceof Array?r.data:[...r.data.channelEmotes,...r.data.sharedEmotes])}_cacheBTTVEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new sw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawFFZEmoteSet(e){let t=er.FFZ.Set(e);return ju.get(t).then(r=>r.data.set.emoticons)}_getRawFFZEmotes(e){let t=er.FFZ.Channel(e);return ju.get(t).then(r=>{let a=[];for(let s of Object.keys(r.data.sets)){let o=r.data.sets[s];a.push(...o.emoticons)}return a})}_cacheFFZEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new lw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawSevenTVEmotes(e){let t=e?er.SevenTV.Channel(e):er.SevenTV.Global;return ju.get(t).then(r=>r.data)}_cacheSevenTVEmote(e,t,r,a=null){let s=this._setupChannel(e,r),o=a||new uw(s,t.id,t);return this.emotes.set(o.code,o),s.emotes.set(o.code,o),o}fetchTwitchEmotes(e=null){return this._getRawTwitchEmotes(e).then(t=>{for(let r of t)this._cacheTwitchEmote(e,{code:r.name,id:r.id,formats:r.formats});return this.channels.get(e).emotes.filter(r=>r.type==="twitch")})}fetchBTTVEmotes(e=null){return this._getRawBTTVEmotes(e).then(t=>{for(let r of t)this._cacheBTTVEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="bttv")})}async fetchFFZEmotes(e=null){return this.ffzModifiersFetched||(this.ffzModifiersFetched=!0,await this._getRawFFZEmoteSet(er.FFZ.sets.Modifiers).then(t=>{for(let r of t)this._cacheFFZEmote(null,r)})),e?this._getRawFFZEmotes(e).then(t=>{for(let r of t)this._cacheFFZEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="ffz")}):this._getRawFFZEmoteSet(er.FFZ.sets.Global).then(t=>{for(let r of t)this._cacheFFZEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="ffz")})}fetchSevenTVEmotes(e=null,t="webp"){return this._getRawSevenTVEmotes(e).then(r=>{if("emotes"in r)for(let a of r.emotes)this._cacheSevenTVEmote(e,a,t);else for(let a of r.emote_set.emotes)this._cacheSevenTVEmote(e,a,t);return this.channels.get(e).emotes.filter(a=>a.type==="7tv")})}fromObject(e){let t=[],r={bttv:{class:sw,cache:n((a,s,o)=>this._cacheBTTVEmote(s,null,o),"cache")},ffz:{class:lw,cache:n((a,s,o)=>this._cacheFFZEmote(s,null,o),"cache")},"7tv":{class:uw,cache:n((a,s,o)=>this._cacheSevenTVEmote(s,null,a.imageType,o),"cache")},twitch:{class:cw,cache:n((a,s,o)=>this._cacheTwitchEmote(s,null,o),"cache")}};for(let a of e){let{type:s}=a;if(!Object.keys(r).includes(s))throw new TypeError(`Unknown type: ${s}`);let o=r[s].class;this._setupChannel(a.channel_id,s==="7tv"?a.imageType:null);let l=o.fromObject(a,this.channels.get(a.channel_id));r[s].cache(a,a.channel_id,l),t.push(l)}return t}};dw.exports=K_});var _w=u((eW,pw)=>{var iU=Tt(),J_=class{static{n(this,"EmoteParser")}constructor(e,t={}){this.fetcher=e,this.options=Object.assign({template:"",type:"markdown",match:/:(.+?):/g},t),this._validateOptions(this.options)}_validateOptions(e){if(e.template&&typeof e.template!="string")throw new TypeError("Template must be a string");if(!["markdown","html","bbcode","plain"].includes(e.type))throw new TypeError("Parse type must be one of `markdown`, `html`, `bbcode`, or `plain`");if(!(e.match instanceof RegExp)||!e.match.global)throw new TypeError("Match must be a global RegExp.")}parse(e,t=0){return e.replace(this.options.match,(a,s)=>{let o=this.fetcher.emotes.get(s);if(!o)return a;if(o.modifier)return"";let l=this.options.template||iU.Templates[this.options.type],d=o.toLink(t);return l.replace(/{link}/g,d).replace(/{name}/g,o.code).replace(/{size}/g,t).replace(/{creator}/g,o.ownerName||"global")})}};pw.exports=J_});var nU=u((rW,mw)=>{mw.exports={BTTVEmote:Fu(),Channel:Gu(),Collection:rs(),Constants:Tt(),Emote:vr(),EmoteFetcher:hw(),EmoteParser:_w(),FFZEmote:Vu(),SevenTVEmote:zu(),TwitchEmote:Ju()}});export default nU();
20
20
  /*! Bundled license information:
21
21
 
22
22
  axios/dist/browser/axios.cjs:
23
- (*! Axios v1.13.5 Copyright (c) 2026 Matt Zabriskie and contributors *)
23
+ (*! Axios v1.13.6 Copyright (c) 2026 Matt Zabriskie and contributors *)
24
24
  */
25
25
  //# sourceMappingURL=TwitchEmoticons.min.js.map