From a70efa1f23bf9bc85ebe2a129dc01bde0027bc94 Mon Sep 17 00:00:00 2001 From: Zaytri <9072119+zaytri@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:01:22 -0800 Subject: [PATCH] Release v1.1.3 --- package-lock.json | 4 ++-- package.json | 2 +- release/slime2.js | 50 +++++++++++++++++++++++------------------------ 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index 077376d..d26a602 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "slime2", - "version": "1.1.2", + "version": "1.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "slime2", - "version": "1.1.2", + "version": "1.1.3", "dependencies": { "@tanstack/react-query": "^5.0.5", "@twurple/api": "^7.0.4", diff --git a/package.json b/package.json index b01e679..e2b4207 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "slime2", - "version": "1.1.2", + "version": "1.1.3", "private": true, "homepage": ".", "scripts": { diff --git a/release/slime2.js b/release/slime2.js index 632a500..41ec505 100644 --- a/release/slime2.js +++ b/release/slime2.js @@ -1,4 +1,4 @@ -var MA=Object.defineProperty;var NA=(t,e,r)=>e in t?MA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Mr=(t,e,r)=>(NA(t,typeof e!="symbol"?e+"":e,r),r),hh=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var T=(t,e,r)=>(hh(t,e,"read from private field"),r?r.call(t):e.get(t)),X=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},W=(t,e,r,n)=>(hh(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var pu=(t,e,r,n)=>({set _(i){W(t,e,i,r)},get _(){return T(t,e,n)}}),ae=(t,e,r)=>(hh(t,e,"access private method"),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var tf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function hS(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var pS={exports:{}},rf={},mS={exports:{}},ce={};/** +var NA=Object.defineProperty;var DA=(t,e,r)=>e in t?NA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Mr=(t,e,r)=>(DA(t,typeof e!="symbol"?e+"":e,r),r),hh=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var T=(t,e,r)=>(hh(t,e,"read from private field"),r?r.call(t):e.get(t)),X=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},G=(t,e,r,n)=>(hh(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var pu=(t,e,r,n)=>({set _(i){G(t,e,i,r)},get _(){return T(t,e,n)}}),ae=(t,e,r)=>(hh(t,e,"access private method"),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var tf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function hS(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var pS={exports:{}},rf={},mS={exports:{}},de={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var MA=Object.defineProperty;var NA=(t,e,r)=>e in t?MA(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ql=Symbol.for("react.element"),DA=Symbol.for("react.portal"),jA=Symbol.for("react.fragment"),LA=Symbol.for("react.strict_mode"),BA=Symbol.for("react.profiler"),$A=Symbol.for("react.provider"),UA=Symbol.for("react.context"),FA=Symbol.for("react.forward_ref"),qA=Symbol.for("react.suspense"),HA=Symbol.for("react.memo"),zA=Symbol.for("react.lazy"),c_=Symbol.iterator;function WA(t){return t===null||typeof t!="object"?null:(t=c_&&t[c_]||t["@@iterator"],typeof t=="function"?t:null)}var gS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},yS=Object.assign,vS={};function Fo(t,e,r){this.props=t,this.context=e,this.refs=vS,this.updater=r||gS}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Fo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function wS(){}wS.prototype=Fo.prototype;function T0(t,e,r){this.props=t,this.context=e,this.refs=vS,this.updater=r||gS}var k0=T0.prototype=new wS;k0.constructor=T0;yS(k0,Fo.prototype);k0.isPureReactComponent=!0;var d_=Array.isArray,_S=Object.prototype.hasOwnProperty,P0={current:null},bS={key:!0,ref:!0,__self:!0,__source:!0};function xS(t,e,r){var n,i={},s=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)_S.call(e,n)&&!bS.hasOwnProperty(n)&&(i[n]=e[n]);var a=arguments.length-2;if(a===1)i.children=r;else if(1e in t?MA(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var YA=I,XA=Symbol.for("react.element"),JA=Symbol.for("react.fragment"),ZA=Object.prototype.hasOwnProperty,eI=YA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,tI={key:!0,ref:!0,__self:!0,__source:!0};function SS(t,e,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)ZA.call(e,n)&&!tI.hasOwnProperty(n)&&(i[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:XA,type:t,key:s,ref:o,props:i,_owner:eI.current}}rf.Fragment=JA;rf.jsx=SS;rf.jsxs=SS;pS.exports=rf;var _=pS.exports,Kl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ko=typeof window>"u"||"Deno"in window;function Jt(){}function rI(t,e){return typeof t=="function"?t(e):t}function qm(t){return typeof t=="number"&&t>=0&&t!==1/0}function CS(t,e){return Math.max(t+(e||0)-Date.now(),0)}function h_(t,e){const{type:r="all",exact:n,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(n){if(e.queryHash!==I0(o,e.options))return!1}else if(!Fa(e.queryKey,o))return!1}if(r!=="all"){const l=e.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||typeof i<"u"&&i!==e.state.fetchStatus||s&&!s(e))}function p_(t,e){const{exact:r,status:n,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(r){if(Ua(e.options.mutationKey)!==Ua(s))return!1}else if(!Fa(e.options.mutationKey,s))return!1}return!(n&&e.state.status!==n||i&&!i(e))}function I0(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ua)(t)}function Ua(t){return JSON.stringify(t,(e,r)=>zm(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function Fa(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(r=>!Fa(t[r],e[r])):!1}function ES(t,e){if(t===e)return t;const r=m_(t)&&m_(e);if(r||zm(t)&&zm(e)){const n=r?t.length:Object.keys(t).length,i=r?e:Object.keys(e),s=i.length,o=r?[]:{};let a=0;for(let l=0;l"u")return!0;const r=e.prototype;return!(!g_(r)||!r.hasOwnProperty("isPrototypeOf"))}function g_(t){return Object.prototype.toString.call(t)==="[object Object]"}function TS(t){return new Promise(e=>{setTimeout(e,t)})}function y_(t){TS(0).then(t)}function Wm(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?ES(t,e):e}function nI(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function iI(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var qi,Wn,fo,iS,sI=(iS=class extends Kl{constructor(){super();X(this,qi,void 0);X(this,Wn,void 0);X(this,fo,void 0);W(this,fo,e=>{if(!ko&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){T(this,Wn)||this.setEventListener(T(this,fo))}onUnsubscribe(){var e;this.hasListeners()||((e=T(this,Wn))==null||e.call(this),W(this,Wn,void 0))}setEventListener(e){var r;W(this,fo,e),(r=T(this,Wn))==null||r.call(this),W(this,Wn,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){T(this,qi)!==e&&(W(this,qi,e),this.onFocus())}onFocus(){this.listeners.forEach(e=>{e()})}isFocused(){var e;return typeof T(this,qi)=="boolean"?T(this,qi):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qi=new WeakMap,Wn=new WeakMap,fo=new WeakMap,iS),Sc=new sI,ho,Gn,po,sS,oI=(sS=class extends Kl{constructor(){super();X(this,ho,!0);X(this,Gn,void 0);X(this,po,void 0);W(this,po,e=>{if(!ko&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){T(this,Gn)||this.setEventListener(T(this,po))}onUnsubscribe(){var e;this.hasListeners()||((e=T(this,Gn))==null||e.call(this),W(this,Gn,void 0))}setEventListener(e){var r;W(this,po,e),(r=T(this,Gn))==null||r.call(this),W(this,Gn,e(this.setOnline.bind(this)))}setOnline(e){T(this,ho)!==e&&(W(this,ho,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return T(this,ho)}},ho=new WeakMap,Gn=new WeakMap,po=new WeakMap,sS),Cc=new oI;function aI(t){return Math.min(1e3*2**t,3e4)}function nf(t){return(t??"online")==="online"?Cc.isOnline():!0}var kS=class{constructor(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function mh(t){return t instanceof kS}function PS(t){let e=!1,r=0,n=!1,i,s,o;const a=new Promise((w,p)=>{s=w,o=p}),l=w=>{var p;n||(y(new kS(w)),(p=t.abort)==null||p.call(t))},u=()=>{e=!0},c=()=>{e=!1},f=()=>!Sc.isFocused()||t.networkMode!=="always"&&!Cc.isOnline(),d=w=>{var p;n||(n=!0,(p=t.onSuccess)==null||p.call(t,w),i==null||i(),s(w))},y=w=>{var p;n||(n=!0,(p=t.onError)==null||p.call(t,w),i==null||i(),o(w))},v=()=>new Promise(w=>{var p;i=m=>{const g=n||!f();return g&&w(m),g},(p=t.onPause)==null||p.call(t)}).then(()=>{var w;i=void 0,n||(w=t.onContinue)==null||w.call(t)}),b=()=>{if(n)return;let w;try{w=t.fn()}catch(p){w=Promise.reject(p)}Promise.resolve(w).then(d).catch(p=>{var k;if(n)return;const m=t.retry??(ko?0:3),g=t.retryDelay??aI,x=typeof g=="function"?g(r,p):g,S=m===!0||typeof m=="number"&&r{if(f())return v()}).then(()=>{e?y(p):b()})})};return nf(t.networkMode)?b():v().then(b),{promise:a,cancel:l,continue:()=>(i==null?void 0:i())?a:Promise.resolve(),cancelRetry:u,continueRetry:c}}function lI(){let t=[],e=0,r=c=>{c()},n=c=>{c()};const i=c=>{let f;e++;try{f=c()}finally{e--,e||a()}return f},s=c=>{e?t.push(c):y_(()=>{r(c)})},o=c=>(...f)=>{s(()=>{c(...f)})},a=()=>{const c=t;t=[],c.length&&y_(()=>{n(()=>{c.forEach(f=>{r(f)})})})};return{batch:i,batchCalls:o,schedule:s,setNotifyFunction:c=>{r=c},setBatchNotifyFunction:c=>{n=c}}}var ot=lI(),Hi,oS,AS=(oS=class{constructor(){X(this,Hi,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qm(this.gcTime)&&W(this,Hi,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ko?1/0:5*60*1e3))}clearGcTimeout(){T(this,Hi)&&(clearTimeout(T(this,Hi)),W(this,Hi,void 0))}},Hi=new WeakMap,oS),mo,go,Kt,Vn,Yt,Ze,Ll,zi,yo,ec,_r,nn,aS,uI=(aS=class extends AS{constructor(e){super();X(this,yo);X(this,_r);X(this,mo,void 0);X(this,go,void 0);X(this,Kt,void 0);X(this,Vn,void 0);X(this,Yt,void 0);X(this,Ze,void 0);X(this,Ll,void 0);X(this,zi,void 0);W(this,zi,!1),W(this,Ll,e.defaultOptions),ae(this,yo,ec).call(this,e.options),W(this,Ze,[]),W(this,Kt,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,W(this,mo,e.state||cI(this.options)),this.state=T(this,mo),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!T(this,Ze).length&&this.state.fetchStatus==="idle"&&T(this,Kt).remove(this)}setData(e,r){const n=Wm(this.state.data,e,this.options);return ae(this,_r,nn).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){ae(this,_r,nn).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n;const r=T(this,Vn);return(n=T(this,Yt))==null||n.cancel(e),r?r.then(Jt).catch(Jt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(T(this,mo))}isActive(){return T(this,Ze).some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||T(this,Ze).some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!CS(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=T(this,Ze).find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=T(this,Yt))==null||r.continue()}onOnline(){var r;const e=T(this,Ze).find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=T(this,Yt))==null||r.continue()}addObserver(e){T(this,Ze).includes(e)||(T(this,Ze).push(e),this.clearGcTimeout(),T(this,Kt).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){T(this,Ze).includes(e)&&(W(this,Ze,T(this,Ze).filter(r=>r!==e)),T(this,Ze).length||(T(this,Yt)&&(T(this,zi)?T(this,Yt).cancel({revert:!0}):T(this,Yt).cancelRetry()),this.scheduleGc()),T(this,Kt).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return T(this,Ze).length}invalidate(){this.state.isInvalidated||ae(this,_r,nn).call(this,{type:"invalidate"})}fetch(e,r){var u,c,f,d;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(T(this,Vn))return(u=T(this,Yt))==null||u.continueRetry(),T(this,Vn)}if(e&&ae(this,yo,ec).call(this,e),!this.options.queryFn){const y=T(this,Ze).find(v=>v.options.queryFn);y&&ae(this,yo,ec).call(this,y.options)}const n=new AbortController,i={queryKey:this.queryKey,meta:this.meta},s=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(W(this,zi,!0),n.signal)})};s(i);const o=()=>this.options.queryFn?(W(this,zi,!1),this.options.persister?this.options.persister(this.options.queryFn,i,this):this.options.queryFn(i)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:r,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};s(a),(c=this.options.behavior)==null||c.onFetch(a,this),W(this,go,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&ae(this,_r,nn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta});const l=y=>{var v,b,w,p;mh(y)&&y.silent||ae(this,_r,nn).call(this,{type:"error",error:y}),mh(y)||((b=(v=T(this,Kt).config).onError)==null||b.call(v,y,this),(p=(w=T(this,Kt).config).onSettled)==null||p.call(w,this.state.data,y,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return W(this,Yt,PS({fn:a.fetchFn,abort:n.abort.bind(n),onSuccess:y=>{var v,b,w,p;if(typeof y>"u"){l(new Error(`${this.queryHash} data is undefined`));return}this.setData(y),(b=(v=T(this,Kt).config).onSuccess)==null||b.call(v,y,this),(p=(w=T(this,Kt).config).onSettled)==null||p.call(w,y,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(y,v)=>{ae(this,_r,nn).call(this,{type:"failed",failureCount:y,error:v})},onPause:()=>{ae(this,_r,nn).call(this,{type:"pause"})},onContinue:()=>{ae(this,_r,nn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),W(this,Vn,T(this,Yt).promise),T(this,Vn)}},mo=new WeakMap,go=new WeakMap,Kt=new WeakMap,Vn=new WeakMap,Yt=new WeakMap,Ze=new WeakMap,Ll=new WeakMap,zi=new WeakMap,yo=new WeakSet,ec=function(e){this.options={...T(this,Ll),...e},this.updateGcTime(this.options.gcTime)},_r=new WeakSet,nn=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:nf(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return mh(i)&&i.revert&&T(this,go)?{...T(this,go),fetchStatus:"idle"}:{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),ot.batch(()=>{T(this,Ze).forEach(n=>{n.onQueryUpdate()}),T(this,Kt).notify({query:this,type:"updated",action:e})})},aS);function cI(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=typeof e<"u",n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Fr,lS,dI=(lS=class extends Kl{constructor(e={}){super();X(this,Fr,void 0);this.config=e,W(this,Fr,new Map)}build(e,r,n){const i=r.queryKey,s=r.queryHash??I0(i,r);let o=this.get(s);return o||(o=new uI({cache:this,queryKey:i,queryHash:s,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){T(this,Fr).has(e.queryHash)||(T(this,Fr).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=T(this,Fr).get(e.queryHash);r&&(e.destroy(),r===e&&T(this,Fr).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ot.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return T(this,Fr).get(e)}getAll(){return[...T(this,Fr).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>h_(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>h_(e,n)):r}notify(e){ot.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){ot.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ot.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fr=new WeakMap,lS),qr,Bl,Bt,vo,Hr,jn,uS,fI=(uS=class extends AS{constructor(e){super();X(this,Hr);X(this,qr,void 0);X(this,Bl,void 0);X(this,Bt,void 0);X(this,vo,void 0);this.mutationId=e.mutationId,W(this,Bl,e.defaultOptions),W(this,Bt,e.mutationCache),W(this,qr,[]),this.state=e.state||hI(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...T(this,Bl),...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){T(this,qr).includes(e)||(T(this,qr).push(e),this.clearGcTimeout(),T(this,Bt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){W(this,qr,T(this,qr).filter(r=>r!==e)),this.scheduleGc(),T(this,Bt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){T(this,qr).length||(this.state.status==="pending"?this.scheduleGc():T(this,Bt).remove(this))}continue(){var e;return((e=T(this,vo))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,s,o,a,l,u,c,f,d,y,v,b,w,p,m,g,x,S,k,R;const r=()=>(W(this,vo,PS({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(O,$)=>{ae(this,Hr,jn).call(this,{type:"failed",failureCount:O,error:$})},onPause:()=>{ae(this,Hr,jn).call(this,{type:"pause"})},onContinue:()=>{ae(this,Hr,jn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),T(this,vo).promise),n=this.state.status==="pending";try{if(!n){ae(this,Hr,jn).call(this,{type:"pending",variables:e}),await((s=(i=T(this,Bt).config).onMutate)==null?void 0:s.call(i,e,this));const $=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e));$!==this.state.context&&ae(this,Hr,jn).call(this,{type:"pending",context:$,variables:e})}const O=await r();return await((u=(l=T(this,Bt).config).onSuccess)==null?void 0:u.call(l,O,e,this.state.context,this)),await((f=(c=this.options).onSuccess)==null?void 0:f.call(c,O,e,this.state.context)),await((y=(d=T(this,Bt).config).onSettled)==null?void 0:y.call(d,O,null,this.state.variables,this.state.context,this)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,O,null,e,this.state.context)),ae(this,Hr,jn).call(this,{type:"success",data:O}),O}catch(O){try{throw await((p=(w=T(this,Bt).config).onError)==null?void 0:p.call(w,O,e,this.state.context,this)),await((g=(m=this.options).onError)==null?void 0:g.call(m,O,e,this.state.context)),await((S=(x=T(this,Bt).config).onSettled)==null?void 0:S.call(x,void 0,O,this.state.variables,this.state.context,this)),await((R=(k=this.options).onSettled)==null?void 0:R.call(k,void 0,O,e,this.state.context)),O}finally{ae(this,Hr,jn).call(this,{type:"error",error:O})}}}},qr=new WeakMap,Bl=new WeakMap,Bt=new WeakMap,vo=new WeakMap,Hr=new WeakSet,jn=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!nf(this.options.networkMode),status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),ot.batch(()=>{T(this,qr).forEach(n=>{n.onMutationUpdate(e)}),T(this,Bt).notify({mutation:this,type:"updated",action:e})})},uS);function hI(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xt,$l,Wi,cS,pI=(cS=class extends Kl{constructor(e={}){super();X(this,Xt,void 0);X(this,$l,void 0);X(this,Wi,void 0);this.config=e,W(this,Xt,[]),W(this,$l,0)}build(e,r,n){const i=new fI({mutationCache:this,mutationId:++pu(this,$l)._,options:e.defaultMutationOptions(r),state:n});return this.add(i),i}add(e){T(this,Xt).push(e),this.notify({type:"added",mutation:e})}remove(e){W(this,Xt,T(this,Xt).filter(r=>r!==e)),this.notify({type:"removed",mutation:e})}clear(){ot.batch(()=>{T(this,Xt).forEach(e=>{this.remove(e)})})}getAll(){return T(this,Xt)}find(e){const r={exact:!0,...e};return T(this,Xt).find(n=>p_(r,n))}findAll(e={}){return T(this,Xt).filter(r=>p_(e,r))}notify(e){ot.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){return W(this,Wi,(T(this,Wi)??Promise.resolve()).then(()=>{const e=T(this,Xt).filter(r=>r.state.isPaused);return ot.batch(()=>e.reduce((r,n)=>r.then(()=>n.continue().catch(Jt)),Promise.resolve()))}).then(()=>{W(this,Wi,void 0)})),T(this,Wi)}},Xt=new WeakMap,$l=new WeakMap,Wi=new WeakMap,cS);function mI(t){return{onFetch:(e,r)=>{const n=async()=>{var v,b,w,p,m;const i=e.options,s=(w=(b=(v=e.fetchOptions)==null?void 0:v.meta)==null?void 0:b.fetchMore)==null?void 0:w.direction,o=((p=e.state.data)==null?void 0:p.pages)||[],a=((m=e.state.data)==null?void 0:m.pageParams)||[],l={pages:[],pageParams:[]};let u=!1;const c=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(e.signal.aborted?u=!0:e.signal.addEventListener("abort",()=>{u=!0}),e.signal)})},f=e.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${e.options.queryHash}'`))),d=async(g,x,S)=>{if(u)return Promise.reject();if(x==null&&g.pages.length)return Promise.resolve(g);const k={queryKey:e.queryKey,pageParam:x,direction:S?"backward":"forward",meta:e.options.meta};c(k);const R=await f(k),{maxPages:O}=e.options,$=S?iI:nI;return{pages:$(g.pages,R,O),pageParams:$(g.pageParams,x,O)}};let y;if(s&&o.length){const g=s==="backward",x=g?gI:v_,S={pages:o,pageParams:a},k=x(i,S);y=await d(S,k,g)}else{y=await d(l,a[0]??i.initialPageParam);const g=t??o.length;for(let x=1;x{var i,s;return(s=(i=e.options).persister)==null?void 0:s.call(i,n,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=n}}}function v_(t,{pages:e,pageParams:r}){const n=e.length-1;return t.getNextPageParam(e[n],e,r[n],r)}function gI(t,{pages:e,pageParams:r}){var n;return(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r)}var Ke,Qn,Kn,wo,_o,Yn,bo,xo,dS,yI=(dS=class{constructor(t={}){X(this,Ke,void 0);X(this,Qn,void 0);X(this,Kn,void 0);X(this,wo,void 0);X(this,_o,void 0);X(this,Yn,void 0);X(this,bo,void 0);X(this,xo,void 0);W(this,Ke,t.queryCache||new dI),W(this,Qn,t.mutationCache||new pI),W(this,Kn,t.defaultOptions||{}),W(this,wo,new Map),W(this,_o,new Map),W(this,Yn,0)}mount(){pu(this,Yn)._++,T(this,Yn)===1&&(W(this,bo,Sc.subscribe(()=>{Sc.isFocused()&&(this.resumePausedMutations(),T(this,Ke).onFocus())})),W(this,xo,Cc.subscribe(()=>{Cc.isOnline()&&(this.resumePausedMutations(),T(this,Ke).onOnline())})))}unmount(){var t,e;pu(this,Yn)._--,T(this,Yn)===0&&((t=T(this,bo))==null||t.call(this),W(this,bo,void 0),(e=T(this,xo))==null||e.call(this),W(this,xo,void 0))}isFetching(t){return T(this,Ke).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return T(this,Qn).findAll({...t,status:"pending"}).length}getQueryData(t){var e;return(e=T(this,Ke).find({queryKey:t}))==null?void 0:e.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);return e?Promise.resolve(e):this.fetchQuery(t)}getQueriesData(t){return this.getQueryCache().findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=T(this,Ke).find({queryKey:t}),i=n==null?void 0:n.state.data,s=rI(e,i);if(typeof s>"u")return;const o=this.defaultQueryOptions({queryKey:t});return T(this,Ke).build(this,o).setData(s,{...r,manual:!0})}setQueriesData(t,e,r){return ot.batch(()=>this.getQueryCache().findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var e;return(e=T(this,Ke).find({queryKey:t}))==null?void 0:e.state}removeQueries(t){const e=T(this,Ke);ot.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=T(this,Ke),n={type:"active",...t};return ot.batch(()=>(r.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(n,e)))}cancelQueries(t={},e={}){const r={revert:!0,...e},n=ot.batch(()=>T(this,Ke).findAll(t).map(i=>i.cancel(r)));return Promise.all(n).then(Jt).catch(Jt)}invalidateQueries(t={},e={}){return ot.batch(()=>{if(T(this,Ke).findAll(t).forEach(n=>{n.invalidate()}),t.refetchType==="none")return Promise.resolve();const r={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(r,e)})}refetchQueries(t={},e){const r={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},n=ot.batch(()=>T(this,Ke).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,r);return r.throwOnError||(s=s.catch(Jt)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(n).then(Jt)}fetchQuery(t){const e=this.defaultQueryOptions(t);typeof e.retry>"u"&&(e.retry=!1);const r=T(this,Ke).build(this,e);return r.isStaleByTime(e.staleTime)?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Jt).catch(Jt)}fetchInfiniteQuery(t){return t.behavior=mI(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Jt).catch(Jt)}resumePausedMutations(){return T(this,Qn).resumePausedMutations()}getQueryCache(){return T(this,Ke)}getMutationCache(){return T(this,Qn)}getDefaultOptions(){return T(this,Kn)}setDefaultOptions(t){W(this,Kn,t)}setQueryDefaults(t,e){T(this,wo).set(Ua(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...T(this,wo).values()];let r={};return e.forEach(n=>{Fa(t,n.queryKey)&&(r={...r,...n.defaultOptions})}),r}setMutationDefaults(t,e){T(this,_o).set(Ua(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...T(this,_o).values()];let r={};return e.forEach(n=>{Fa(t,n.mutationKey)&&(r={...r,...n.defaultOptions})}),r}defaultQueryOptions(t){if(t!=null&&t._defaulted)return t;const e={...T(this,Kn).queries,...(t==null?void 0:t.queryKey)&&this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=I0(e.queryKey,e)),typeof e.refetchOnReconnect>"u"&&(e.refetchOnReconnect=e.networkMode!=="always"),typeof e.throwOnError>"u"&&(e.throwOnError=!!e.suspense),typeof e.networkMode>"u"&&e.persister&&(e.networkMode="offlineFirst"),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...T(this,Kn).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){T(this,Ke).clear(),T(this,Qn).clear()}},Ke=new WeakMap,Qn=new WeakMap,Kn=new WeakMap,wo=new WeakMap,_o=new WeakMap,Yn=new WeakMap,bo=new WeakMap,xo=new WeakMap,dS),Et,ke,So,ht,Gi,Co,zr,Ul,Eo,To,Vi,Qi,Xn,Ki,Yi,fa,Fl,Gm,ql,Vm,Hl,Qm,zl,Km,Wl,Ym,Gl,Xm,Vl,Jm,ef,IS,fS,vI=(fS=class extends Kl{constructor(e,r){super();X(this,Yi);X(this,Fl);X(this,ql);X(this,Hl);X(this,zl);X(this,Wl);X(this,Gl);X(this,Vl);X(this,ef);X(this,Et,void 0);X(this,ke,void 0);X(this,So,void 0);X(this,ht,void 0);X(this,Gi,void 0);X(this,Co,void 0);X(this,zr,void 0);X(this,Ul,void 0);X(this,Eo,void 0);X(this,To,void 0);X(this,Vi,void 0);X(this,Qi,void 0);X(this,Xn,void 0);X(this,Ki,void 0);W(this,ke,void 0),W(this,So,void 0),W(this,ht,void 0),W(this,Ki,new Set),W(this,Et,e),this.options=r,W(this,zr,null),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,ke).addObserver(this),w_(T(this,ke),this.options)&&ae(this,Yi,fa).call(this),ae(this,zl,Km).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Zm(T(this,ke),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zm(T(this,ke),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ae(this,Wl,Ym).call(this),ae(this,Gl,Xm).call(this),T(this,ke).removeObserver(this)}setOptions(e,r){const n=this.options,i=T(this,ke);if(this.options=T(this,Et).defaultQueryOptions(e),Hm(n,this.options)||T(this,Et).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,ke),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=n.queryKey),ae(this,Vl,Jm).call(this);const s=this.hasListeners();s&&__(T(this,ke),i,this.options,n)&&ae(this,Yi,fa).call(this),this.updateResult(r),s&&(T(this,ke)!==i||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&ae(this,Fl,Gm).call(this);const o=ae(this,ql,Vm).call(this);s&&(T(this,ke)!==i||this.options.enabled!==n.enabled||o!==T(this,Xn))&&ae(this,Hl,Qm).call(this,o)}getOptimisticResult(e){const r=T(this,Et).getQueryCache().build(T(this,Et),e),n=this.createResult(r,e);return _I(this,n)&&(W(this,ht,n),W(this,Co,this.options),W(this,Gi,T(this,ke).state)),n}getCurrentResult(){return T(this,ht)}trackResult(e){const r={};return Object.keys(e).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(T(this,Ki).add(n),e[n])})}),r}getCurrentQuery(){return T(this,ke)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=T(this,Et).defaultQueryOptions(e),n=T(this,Et).getQueryCache().build(T(this,Et),r);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,r))}fetch(e){return ae(this,Yi,fa).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),T(this,ht)))}createResult(e,r){var k;const n=T(this,ke),i=this.options,s=T(this,ht),o=T(this,Gi),a=T(this,Co),u=e!==n?e.state:T(this,So),{state:c}=e;let{error:f,errorUpdatedAt:d,fetchStatus:y,status:v}=c,b=!1,w;if(r._optimisticResults){const R=this.hasListeners(),O=!R&&w_(e,r),$=R&&__(e,n,r,i);(O||$)&&(y=nf(e.options.networkMode)?"fetching":"paused",c.dataUpdatedAt||(v="pending")),r._optimisticResults==="isRestoring"&&(y="idle")}if(r.select&&typeof c.data<"u")if(s&&c.data===(o==null?void 0:o.data)&&r.select===T(this,Ul))w=T(this,Eo);else try{W(this,Ul,r.select),w=r.select(c.data),w=Wm(s==null?void 0:s.data,w,r),W(this,Eo,w),W(this,zr,null)}catch(R){W(this,zr,R)}else w=c.data;if(typeof r.placeholderData<"u"&&typeof w>"u"&&v==="pending"){let R;if(s!=null&&s.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData))R=s.data;else if(R=typeof r.placeholderData=="function"?r.placeholderData((k=T(this,To))==null?void 0:k.state.data,T(this,To)):r.placeholderData,r.select&&typeof R<"u")try{R=r.select(R),W(this,zr,null)}catch(O){W(this,zr,O)}typeof R<"u"&&(v="success",w=Wm(s==null?void 0:s.data,R,r),b=!0)}T(this,zr)&&(f=T(this,zr),w=T(this,Eo),d=Date.now(),v="error");const p=y==="fetching",m=v==="pending",g=v==="error",x=m&&p;return{status:v,fetchStatus:y,isPending:m,isSuccess:v==="success",isError:g,isInitialLoading:x,isLoading:x,data:w,dataUpdatedAt:c.dataUpdatedAt,error:f,errorUpdatedAt:d,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>u.dataUpdateCount||c.errorUpdateCount>u.errorUpdateCount,isFetching:p,isRefetching:p&&!m,isLoadingError:g&&c.dataUpdatedAt===0,isPaused:y==="paused",isPlaceholderData:b,isRefetchError:g&&c.dataUpdatedAt!==0,isStale:O0(e,r),refetch:this.refetch}}updateResult(e){const r=T(this,ht),n=this.createResult(T(this,ke),this.options);if(W(this,Gi,T(this,ke).state),W(this,Co,this.options),Hm(n,r))return;T(this,Gi).data!==void 0&&W(this,To,T(this,ke)),W(this,ht,n);const i={},s=()=>{if(!r)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!T(this,Ki).size)return!0;const l=new Set(a??T(this,Ki));return this.options.throwOnError&&l.add("error"),Object.keys(T(this,ht)).some(u=>{const c=u;return T(this,ht)[c]!==r[c]&&l.has(c)})};(e==null?void 0:e.listeners)!==!1&&s()&&(i.listeners=!0),ae(this,ef,IS).call(this,{...i,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ae(this,zl,Km).call(this)}},Et=new WeakMap,ke=new WeakMap,So=new WeakMap,ht=new WeakMap,Gi=new WeakMap,Co=new WeakMap,zr=new WeakMap,Ul=new WeakMap,Eo=new WeakMap,To=new WeakMap,Vi=new WeakMap,Qi=new WeakMap,Xn=new WeakMap,Ki=new WeakMap,Yi=new WeakSet,fa=function(e){ae(this,Vl,Jm).call(this);let r=T(this,ke).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(Jt)),r},Fl=new WeakSet,Gm=function(){if(ae(this,Wl,Ym).call(this),ko||T(this,ht).isStale||!qm(this.options.staleTime))return;const r=CS(T(this,ht).dataUpdatedAt,this.options.staleTime)+1;W(this,Vi,setTimeout(()=>{T(this,ht).isStale||this.updateResult()},r))},ql=new WeakSet,Vm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(this,ke)):this.options.refetchInterval)??!1},Hl=new WeakSet,Qm=function(e){ae(this,Gl,Xm).call(this),W(this,Xn,e),!(ko||this.options.enabled===!1||!qm(T(this,Xn))||T(this,Xn)===0)&&W(this,Qi,setInterval(()=>{(this.options.refetchIntervalInBackground||Sc.isFocused())&&ae(this,Yi,fa).call(this)},T(this,Xn)))},zl=new WeakSet,Km=function(){ae(this,Fl,Gm).call(this),ae(this,Hl,Qm).call(this,ae(this,ql,Vm).call(this))},Wl=new WeakSet,Ym=function(){T(this,Vi)&&(clearTimeout(T(this,Vi)),W(this,Vi,void 0))},Gl=new WeakSet,Xm=function(){T(this,Qi)&&(clearInterval(T(this,Qi)),W(this,Qi,void 0))},Vl=new WeakSet,Jm=function(){const e=T(this,Et).getQueryCache().build(T(this,Et),this.options);if(e===T(this,ke))return;const r=T(this,ke);W(this,ke,e),W(this,So,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},ef=new WeakSet,IS=function(e){ot.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(T(this,ht))}),T(this,Et).getQueryCache().notify({query:T(this,ke),type:"observerResultsUpdated"})})},fS);function wI(t,e){return e.enabled!==!1&&!t.state.dataUpdatedAt&&!(t.state.status==="error"&&e.retryOnMount===!1)}function w_(t,e){return wI(t,e)||t.state.dataUpdatedAt>0&&Zm(t,e,e.refetchOnMount)}function Zm(t,e,r){if(e.enabled!==!1){const n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&O0(t,e)}return!1}function __(t,e,r,n){return r.enabled!==!1&&(t!==e||n.enabled===!1)&&(!r.suspense||t.state.status!=="error")&&O0(t,r)}function O0(t,e){return t.isStaleByTime(e.staleTime)}function _I(t,e){return!Hm(t.getCurrentResult(),e)}var OS=I.createContext(void 0),sf=t=>{const e=I.useContext(OS);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},bI=({client:t,children:e})=>(I.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),I.createElement(OS.Provider,{value:t},e)),RS=I.createContext(!1),xI=()=>I.useContext(RS);RS.Provider;function SI(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var CI=I.createContext(SI()),EI=()=>I.useContext(CI);function TI(t,e){return typeof t=="function"?t(...e):!!t}var kI=(t,e)=>{(t.suspense||t.throwOnError)&&(e.isReset()||(t.retryOnMount=!1))},PI=t=>{I.useEffect(()=>{t.clearReset()},[t])},AI=({result:t,errorResetBoundary:e,throwOnError:r,query:n})=>t.isError&&!e.isReset()&&!t.isFetching&&TI(r,[t.error,n]),II=t=>{t.suspense&&typeof t.staleTime!="number"&&(t.staleTime=1e3)},OI=(t,e)=>t.isLoading&&t.isFetching&&!e,RI=(t,e,r)=>(t==null?void 0:t.suspense)&&OI(e,r),MI=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function NI(t,e,r){const n=sf(r),i=xI(),s=EI(),o=n.defaultQueryOptions(t);o._optimisticResults=i?"isRestoring":"optimistic",II(o),kI(o,s),PI(s);const[a]=I.useState(()=>new e(n,o)),l=a.getOptimisticResult(o);if(I.useSyncExternalStore(I.useCallback(u=>{const c=i?()=>{}:a.subscribe(ot.batchCalls(u));return a.updateResult(),c},[a,i]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),I.useEffect(()=>{a.setOptions(o,{listeners:!1})},[o,a]),RI(o,l,i))throw MI(o,a,s);if(AI({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getCurrentQuery()}))throw l.error;return o.notifyOnChangeProps?l:a.trackResult(l)}function xi(t,e){return NI(t,vI,e)}var eg={},MS={exports:{}},Gt={},NS={exports:{}},DS={};/** + */var XA=I,JA=Symbol.for("react.element"),ZA=Symbol.for("react.fragment"),eI=Object.prototype.hasOwnProperty,tI=XA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,rI={key:!0,ref:!0,__self:!0,__source:!0};function SS(t,e,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)eI.call(e,n)&&!rI.hasOwnProperty(n)&&(i[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:JA,type:t,key:s,ref:o,props:i,_owner:tI.current}}rf.Fragment=ZA;rf.jsx=SS;rf.jsxs=SS;pS.exports=rf;var _=pS.exports,Kl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ko=typeof window>"u"||"Deno"in window;function Jt(){}function nI(t,e){return typeof t=="function"?t(e):t}function qm(t){return typeof t=="number"&&t>=0&&t!==1/0}function CS(t,e){return Math.max(t+(e||0)-Date.now(),0)}function h_(t,e){const{type:r="all",exact:n,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(n){if(e.queryHash!==I0(o,e.options))return!1}else if(!Fa(e.queryKey,o))return!1}if(r!=="all"){const l=e.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||typeof i<"u"&&i!==e.state.fetchStatus||s&&!s(e))}function p_(t,e){const{exact:r,status:n,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(r){if(Ua(e.options.mutationKey)!==Ua(s))return!1}else if(!Fa(e.options.mutationKey,s))return!1}return!(n&&e.state.status!==n||i&&!i(e))}function I0(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ua)(t)}function Ua(t){return JSON.stringify(t,(e,r)=>zm(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function Fa(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(r=>!Fa(t[r],e[r])):!1}function ES(t,e){if(t===e)return t;const r=m_(t)&&m_(e);if(r||zm(t)&&zm(e)){const n=r?t.length:Object.keys(t).length,i=r?e:Object.keys(e),s=i.length,o=r?[]:{};let a=0;for(let l=0;l"u")return!0;const r=e.prototype;return!(!g_(r)||!r.hasOwnProperty("isPrototypeOf"))}function g_(t){return Object.prototype.toString.call(t)==="[object Object]"}function TS(t){return new Promise(e=>{setTimeout(e,t)})}function y_(t){TS(0).then(t)}function Wm(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?ES(t,e):e}function iI(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function sI(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var qi,Wn,fo,iS,oI=(iS=class extends Kl{constructor(){super();X(this,qi,void 0);X(this,Wn,void 0);X(this,fo,void 0);G(this,fo,e=>{if(!ko&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){T(this,Wn)||this.setEventListener(T(this,fo))}onUnsubscribe(){var e;this.hasListeners()||((e=T(this,Wn))==null||e.call(this),G(this,Wn,void 0))}setEventListener(e){var r;G(this,fo,e),(r=T(this,Wn))==null||r.call(this),G(this,Wn,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){T(this,qi)!==e&&(G(this,qi,e),this.onFocus())}onFocus(){this.listeners.forEach(e=>{e()})}isFocused(){var e;return typeof T(this,qi)=="boolean"?T(this,qi):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qi=new WeakMap,Wn=new WeakMap,fo=new WeakMap,iS),Sc=new oI,ho,Gn,po,sS,aI=(sS=class extends Kl{constructor(){super();X(this,ho,!0);X(this,Gn,void 0);X(this,po,void 0);G(this,po,e=>{if(!ko&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){T(this,Gn)||this.setEventListener(T(this,po))}onUnsubscribe(){var e;this.hasListeners()||((e=T(this,Gn))==null||e.call(this),G(this,Gn,void 0))}setEventListener(e){var r;G(this,po,e),(r=T(this,Gn))==null||r.call(this),G(this,Gn,e(this.setOnline.bind(this)))}setOnline(e){T(this,ho)!==e&&(G(this,ho,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return T(this,ho)}},ho=new WeakMap,Gn=new WeakMap,po=new WeakMap,sS),Cc=new aI;function lI(t){return Math.min(1e3*2**t,3e4)}function nf(t){return(t??"online")==="online"?Cc.isOnline():!0}var kS=class{constructor(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function mh(t){return t instanceof kS}function PS(t){let e=!1,r=0,n=!1,i,s,o;const a=new Promise((w,p)=>{s=w,o=p}),l=w=>{var p;n||(g(new kS(w)),(p=t.abort)==null||p.call(t))},u=()=>{e=!0},c=()=>{e=!1},f=()=>!Sc.isFocused()||t.networkMode!=="always"&&!Cc.isOnline(),d=w=>{var p;n||(n=!0,(p=t.onSuccess)==null||p.call(t,w),i==null||i(),s(w))},g=w=>{var p;n||(n=!0,(p=t.onError)==null||p.call(t,w),i==null||i(),o(w))},v=()=>new Promise(w=>{var p;i=m=>{const y=n||!f();return y&&w(m),y},(p=t.onPause)==null||p.call(t)}).then(()=>{var w;i=void 0,n||(w=t.onContinue)==null||w.call(t)}),b=()=>{if(n)return;let w;try{w=t.fn()}catch(p){w=Promise.reject(p)}Promise.resolve(w).then(d).catch(p=>{var k;if(n)return;const m=t.retry??(ko?0:3),y=t.retryDelay??lI,x=typeof y=="function"?y(r,p):y,S=m===!0||typeof m=="number"&&r{if(f())return v()}).then(()=>{e?g(p):b()})})};return nf(t.networkMode)?b():v().then(b),{promise:a,cancel:l,continue:()=>(i==null?void 0:i())?a:Promise.resolve(),cancelRetry:u,continueRetry:c}}function uI(){let t=[],e=0,r=c=>{c()},n=c=>{c()};const i=c=>{let f;e++;try{f=c()}finally{e--,e||a()}return f},s=c=>{e?t.push(c):y_(()=>{r(c)})},o=c=>(...f)=>{s(()=>{c(...f)})},a=()=>{const c=t;t=[],c.length&&y_(()=>{n(()=>{c.forEach(f=>{r(f)})})})};return{batch:i,batchCalls:o,schedule:s,setNotifyFunction:c=>{r=c},setBatchNotifyFunction:c=>{n=c}}}var ot=uI(),Hi,oS,AS=(oS=class{constructor(){X(this,Hi,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qm(this.gcTime)&&G(this,Hi,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ko?1/0:5*60*1e3))}clearGcTimeout(){T(this,Hi)&&(clearTimeout(T(this,Hi)),G(this,Hi,void 0))}},Hi=new WeakMap,oS),mo,go,Kt,Vn,Yt,Ze,Ll,zi,yo,ec,_r,nn,aS,cI=(aS=class extends AS{constructor(e){super();X(this,yo);X(this,_r);X(this,mo,void 0);X(this,go,void 0);X(this,Kt,void 0);X(this,Vn,void 0);X(this,Yt,void 0);X(this,Ze,void 0);X(this,Ll,void 0);X(this,zi,void 0);G(this,zi,!1),G(this,Ll,e.defaultOptions),ae(this,yo,ec).call(this,e.options),G(this,Ze,[]),G(this,Kt,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,G(this,mo,e.state||dI(this.options)),this.state=T(this,mo),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!T(this,Ze).length&&this.state.fetchStatus==="idle"&&T(this,Kt).remove(this)}setData(e,r){const n=Wm(this.state.data,e,this.options);return ae(this,_r,nn).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){ae(this,_r,nn).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n;const r=T(this,Vn);return(n=T(this,Yt))==null||n.cancel(e),r?r.then(Jt).catch(Jt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(T(this,mo))}isActive(){return T(this,Ze).some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||T(this,Ze).some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!CS(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=T(this,Ze).find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=T(this,Yt))==null||r.continue()}onOnline(){var r;const e=T(this,Ze).find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=T(this,Yt))==null||r.continue()}addObserver(e){T(this,Ze).includes(e)||(T(this,Ze).push(e),this.clearGcTimeout(),T(this,Kt).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){T(this,Ze).includes(e)&&(G(this,Ze,T(this,Ze).filter(r=>r!==e)),T(this,Ze).length||(T(this,Yt)&&(T(this,zi)?T(this,Yt).cancel({revert:!0}):T(this,Yt).cancelRetry()),this.scheduleGc()),T(this,Kt).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return T(this,Ze).length}invalidate(){this.state.isInvalidated||ae(this,_r,nn).call(this,{type:"invalidate"})}fetch(e,r){var u,c,f,d;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(T(this,Vn))return(u=T(this,Yt))==null||u.continueRetry(),T(this,Vn)}if(e&&ae(this,yo,ec).call(this,e),!this.options.queryFn){const g=T(this,Ze).find(v=>v.options.queryFn);g&&ae(this,yo,ec).call(this,g.options)}const n=new AbortController,i={queryKey:this.queryKey,meta:this.meta},s=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(G(this,zi,!0),n.signal)})};s(i);const o=()=>this.options.queryFn?(G(this,zi,!1),this.options.persister?this.options.persister(this.options.queryFn,i,this):this.options.queryFn(i)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:r,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};s(a),(c=this.options.behavior)==null||c.onFetch(a,this),G(this,go,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&ae(this,_r,nn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta});const l=g=>{var v,b,w,p;mh(g)&&g.silent||ae(this,_r,nn).call(this,{type:"error",error:g}),mh(g)||((b=(v=T(this,Kt).config).onError)==null||b.call(v,g,this),(p=(w=T(this,Kt).config).onSettled)==null||p.call(w,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return G(this,Yt,PS({fn:a.fetchFn,abort:n.abort.bind(n),onSuccess:g=>{var v,b,w,p;if(typeof g>"u"){l(new Error(`${this.queryHash} data is undefined`));return}this.setData(g),(b=(v=T(this,Kt).config).onSuccess)==null||b.call(v,g,this),(p=(w=T(this,Kt).config).onSettled)==null||p.call(w,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(g,v)=>{ae(this,_r,nn).call(this,{type:"failed",failureCount:g,error:v})},onPause:()=>{ae(this,_r,nn).call(this,{type:"pause"})},onContinue:()=>{ae(this,_r,nn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),G(this,Vn,T(this,Yt).promise),T(this,Vn)}},mo=new WeakMap,go=new WeakMap,Kt=new WeakMap,Vn=new WeakMap,Yt=new WeakMap,Ze=new WeakMap,Ll=new WeakMap,zi=new WeakMap,yo=new WeakSet,ec=function(e){this.options={...T(this,Ll),...e},this.updateGcTime(this.options.gcTime)},_r=new WeakSet,nn=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:nf(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return mh(i)&&i.revert&&T(this,go)?{...T(this,go),fetchStatus:"idle"}:{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),ot.batch(()=>{T(this,Ze).forEach(n=>{n.onQueryUpdate()}),T(this,Kt).notify({query:this,type:"updated",action:e})})},aS);function dI(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=typeof e<"u",n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Fr,lS,fI=(lS=class extends Kl{constructor(e={}){super();X(this,Fr,void 0);this.config=e,G(this,Fr,new Map)}build(e,r,n){const i=r.queryKey,s=r.queryHash??I0(i,r);let o=this.get(s);return o||(o=new cI({cache:this,queryKey:i,queryHash:s,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){T(this,Fr).has(e.queryHash)||(T(this,Fr).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=T(this,Fr).get(e.queryHash);r&&(e.destroy(),r===e&&T(this,Fr).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ot.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return T(this,Fr).get(e)}getAll(){return[...T(this,Fr).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>h_(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>h_(e,n)):r}notify(e){ot.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){ot.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ot.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fr=new WeakMap,lS),qr,Bl,Bt,vo,Hr,jn,uS,hI=(uS=class extends AS{constructor(e){super();X(this,Hr);X(this,qr,void 0);X(this,Bl,void 0);X(this,Bt,void 0);X(this,vo,void 0);this.mutationId=e.mutationId,G(this,Bl,e.defaultOptions),G(this,Bt,e.mutationCache),G(this,qr,[]),this.state=e.state||pI(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...T(this,Bl),...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){T(this,qr).includes(e)||(T(this,qr).push(e),this.clearGcTimeout(),T(this,Bt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){G(this,qr,T(this,qr).filter(r=>r!==e)),this.scheduleGc(),T(this,Bt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){T(this,qr).length||(this.state.status==="pending"?this.scheduleGc():T(this,Bt).remove(this))}continue(){var e;return((e=T(this,vo))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,s,o,a,l,u,c,f,d,g,v,b,w,p,m,y,x,S,k,O;const r=()=>(G(this,vo,PS({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(M,L)=>{ae(this,Hr,jn).call(this,{type:"failed",failureCount:M,error:L})},onPause:()=>{ae(this,Hr,jn).call(this,{type:"pause"})},onContinue:()=>{ae(this,Hr,jn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),T(this,vo).promise),n=this.state.status==="pending";try{if(!n){ae(this,Hr,jn).call(this,{type:"pending",variables:e}),await((s=(i=T(this,Bt).config).onMutate)==null?void 0:s.call(i,e,this));const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e));L!==this.state.context&&ae(this,Hr,jn).call(this,{type:"pending",context:L,variables:e})}const M=await r();return await((u=(l=T(this,Bt).config).onSuccess)==null?void 0:u.call(l,M,e,this.state.context,this)),await((f=(c=this.options).onSuccess)==null?void 0:f.call(c,M,e,this.state.context)),await((g=(d=T(this,Bt).config).onSettled)==null?void 0:g.call(d,M,null,this.state.variables,this.state.context,this)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,M,null,e,this.state.context)),ae(this,Hr,jn).call(this,{type:"success",data:M}),M}catch(M){try{throw await((p=(w=T(this,Bt).config).onError)==null?void 0:p.call(w,M,e,this.state.context,this)),await((y=(m=this.options).onError)==null?void 0:y.call(m,M,e,this.state.context)),await((S=(x=T(this,Bt).config).onSettled)==null?void 0:S.call(x,void 0,M,this.state.variables,this.state.context,this)),await((O=(k=this.options).onSettled)==null?void 0:O.call(k,void 0,M,e,this.state.context)),M}finally{ae(this,Hr,jn).call(this,{type:"error",error:M})}}}},qr=new WeakMap,Bl=new WeakMap,Bt=new WeakMap,vo=new WeakMap,Hr=new WeakSet,jn=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!nf(this.options.networkMode),status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),ot.batch(()=>{T(this,qr).forEach(n=>{n.onMutationUpdate(e)}),T(this,Bt).notify({mutation:this,type:"updated",action:e})})},uS);function pI(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xt,$l,Wi,cS,mI=(cS=class extends Kl{constructor(e={}){super();X(this,Xt,void 0);X(this,$l,void 0);X(this,Wi,void 0);this.config=e,G(this,Xt,[]),G(this,$l,0)}build(e,r,n){const i=new hI({mutationCache:this,mutationId:++pu(this,$l)._,options:e.defaultMutationOptions(r),state:n});return this.add(i),i}add(e){T(this,Xt).push(e),this.notify({type:"added",mutation:e})}remove(e){G(this,Xt,T(this,Xt).filter(r=>r!==e)),this.notify({type:"removed",mutation:e})}clear(){ot.batch(()=>{T(this,Xt).forEach(e=>{this.remove(e)})})}getAll(){return T(this,Xt)}find(e){const r={exact:!0,...e};return T(this,Xt).find(n=>p_(r,n))}findAll(e={}){return T(this,Xt).filter(r=>p_(e,r))}notify(e){ot.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){return G(this,Wi,(T(this,Wi)??Promise.resolve()).then(()=>{const e=T(this,Xt).filter(r=>r.state.isPaused);return ot.batch(()=>e.reduce((r,n)=>r.then(()=>n.continue().catch(Jt)),Promise.resolve()))}).then(()=>{G(this,Wi,void 0)})),T(this,Wi)}},Xt=new WeakMap,$l=new WeakMap,Wi=new WeakMap,cS);function gI(t){return{onFetch:(e,r)=>{const n=async()=>{var v,b,w,p,m;const i=e.options,s=(w=(b=(v=e.fetchOptions)==null?void 0:v.meta)==null?void 0:b.fetchMore)==null?void 0:w.direction,o=((p=e.state.data)==null?void 0:p.pages)||[],a=((m=e.state.data)==null?void 0:m.pageParams)||[],l={pages:[],pageParams:[]};let u=!1;const c=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(e.signal.aborted?u=!0:e.signal.addEventListener("abort",()=>{u=!0}),e.signal)})},f=e.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${e.options.queryHash}'`))),d=async(y,x,S)=>{if(u)return Promise.reject();if(x==null&&y.pages.length)return Promise.resolve(y);const k={queryKey:e.queryKey,pageParam:x,direction:S?"backward":"forward",meta:e.options.meta};c(k);const O=await f(k),{maxPages:M}=e.options,L=S?sI:iI;return{pages:L(y.pages,O,M),pageParams:L(y.pageParams,x,M)}};let g;if(s&&o.length){const y=s==="backward",x=y?yI:v_,S={pages:o,pageParams:a},k=x(i,S);g=await d(S,k,y)}else{g=await d(l,a[0]??i.initialPageParam);const y=t??o.length;for(let x=1;x{var i,s;return(s=(i=e.options).persister)==null?void 0:s.call(i,n,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=n}}}function v_(t,{pages:e,pageParams:r}){const n=e.length-1;return t.getNextPageParam(e[n],e,r[n],r)}function yI(t,{pages:e,pageParams:r}){var n;return(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r)}var Ke,Qn,Kn,wo,_o,Yn,bo,xo,dS,vI=(dS=class{constructor(t={}){X(this,Ke,void 0);X(this,Qn,void 0);X(this,Kn,void 0);X(this,wo,void 0);X(this,_o,void 0);X(this,Yn,void 0);X(this,bo,void 0);X(this,xo,void 0);G(this,Ke,t.queryCache||new fI),G(this,Qn,t.mutationCache||new mI),G(this,Kn,t.defaultOptions||{}),G(this,wo,new Map),G(this,_o,new Map),G(this,Yn,0)}mount(){pu(this,Yn)._++,T(this,Yn)===1&&(G(this,bo,Sc.subscribe(()=>{Sc.isFocused()&&(this.resumePausedMutations(),T(this,Ke).onFocus())})),G(this,xo,Cc.subscribe(()=>{Cc.isOnline()&&(this.resumePausedMutations(),T(this,Ke).onOnline())})))}unmount(){var t,e;pu(this,Yn)._--,T(this,Yn)===0&&((t=T(this,bo))==null||t.call(this),G(this,bo,void 0),(e=T(this,xo))==null||e.call(this),G(this,xo,void 0))}isFetching(t){return T(this,Ke).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return T(this,Qn).findAll({...t,status:"pending"}).length}getQueryData(t){var e;return(e=T(this,Ke).find({queryKey:t}))==null?void 0:e.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);return e?Promise.resolve(e):this.fetchQuery(t)}getQueriesData(t){return this.getQueryCache().findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=T(this,Ke).find({queryKey:t}),i=n==null?void 0:n.state.data,s=nI(e,i);if(typeof s>"u")return;const o=this.defaultQueryOptions({queryKey:t});return T(this,Ke).build(this,o).setData(s,{...r,manual:!0})}setQueriesData(t,e,r){return ot.batch(()=>this.getQueryCache().findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var e;return(e=T(this,Ke).find({queryKey:t}))==null?void 0:e.state}removeQueries(t){const e=T(this,Ke);ot.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=T(this,Ke),n={type:"active",...t};return ot.batch(()=>(r.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(n,e)))}cancelQueries(t={},e={}){const r={revert:!0,...e},n=ot.batch(()=>T(this,Ke).findAll(t).map(i=>i.cancel(r)));return Promise.all(n).then(Jt).catch(Jt)}invalidateQueries(t={},e={}){return ot.batch(()=>{if(T(this,Ke).findAll(t).forEach(n=>{n.invalidate()}),t.refetchType==="none")return Promise.resolve();const r={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(r,e)})}refetchQueries(t={},e){const r={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},n=ot.batch(()=>T(this,Ke).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,r);return r.throwOnError||(s=s.catch(Jt)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(n).then(Jt)}fetchQuery(t){const e=this.defaultQueryOptions(t);typeof e.retry>"u"&&(e.retry=!1);const r=T(this,Ke).build(this,e);return r.isStaleByTime(e.staleTime)?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Jt).catch(Jt)}fetchInfiniteQuery(t){return t.behavior=gI(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Jt).catch(Jt)}resumePausedMutations(){return T(this,Qn).resumePausedMutations()}getQueryCache(){return T(this,Ke)}getMutationCache(){return T(this,Qn)}getDefaultOptions(){return T(this,Kn)}setDefaultOptions(t){G(this,Kn,t)}setQueryDefaults(t,e){T(this,wo).set(Ua(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...T(this,wo).values()];let r={};return e.forEach(n=>{Fa(t,n.queryKey)&&(r={...r,...n.defaultOptions})}),r}setMutationDefaults(t,e){T(this,_o).set(Ua(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...T(this,_o).values()];let r={};return e.forEach(n=>{Fa(t,n.mutationKey)&&(r={...r,...n.defaultOptions})}),r}defaultQueryOptions(t){if(t!=null&&t._defaulted)return t;const e={...T(this,Kn).queries,...(t==null?void 0:t.queryKey)&&this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=I0(e.queryKey,e)),typeof e.refetchOnReconnect>"u"&&(e.refetchOnReconnect=e.networkMode!=="always"),typeof e.throwOnError>"u"&&(e.throwOnError=!!e.suspense),typeof e.networkMode>"u"&&e.persister&&(e.networkMode="offlineFirst"),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...T(this,Kn).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){T(this,Ke).clear(),T(this,Qn).clear()}},Ke=new WeakMap,Qn=new WeakMap,Kn=new WeakMap,wo=new WeakMap,_o=new WeakMap,Yn=new WeakMap,bo=new WeakMap,xo=new WeakMap,dS),Et,ke,So,ht,Gi,Co,zr,Ul,Eo,To,Vi,Qi,Xn,Ki,Yi,fa,Fl,Gm,ql,Vm,Hl,Qm,zl,Km,Wl,Ym,Gl,Xm,Vl,Jm,ef,IS,fS,wI=(fS=class extends Kl{constructor(e,r){super();X(this,Yi);X(this,Fl);X(this,ql);X(this,Hl);X(this,zl);X(this,Wl);X(this,Gl);X(this,Vl);X(this,ef);X(this,Et,void 0);X(this,ke,void 0);X(this,So,void 0);X(this,ht,void 0);X(this,Gi,void 0);X(this,Co,void 0);X(this,zr,void 0);X(this,Ul,void 0);X(this,Eo,void 0);X(this,To,void 0);X(this,Vi,void 0);X(this,Qi,void 0);X(this,Xn,void 0);X(this,Ki,void 0);G(this,ke,void 0),G(this,So,void 0),G(this,ht,void 0),G(this,Ki,new Set),G(this,Et,e),this.options=r,G(this,zr,null),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,ke).addObserver(this),w_(T(this,ke),this.options)&&ae(this,Yi,fa).call(this),ae(this,zl,Km).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Zm(T(this,ke),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zm(T(this,ke),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ae(this,Wl,Ym).call(this),ae(this,Gl,Xm).call(this),T(this,ke).removeObserver(this)}setOptions(e,r){const n=this.options,i=T(this,ke);if(this.options=T(this,Et).defaultQueryOptions(e),Hm(n,this.options)||T(this,Et).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,ke),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=n.queryKey),ae(this,Vl,Jm).call(this);const s=this.hasListeners();s&&__(T(this,ke),i,this.options,n)&&ae(this,Yi,fa).call(this),this.updateResult(r),s&&(T(this,ke)!==i||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&ae(this,Fl,Gm).call(this);const o=ae(this,ql,Vm).call(this);s&&(T(this,ke)!==i||this.options.enabled!==n.enabled||o!==T(this,Xn))&&ae(this,Hl,Qm).call(this,o)}getOptimisticResult(e){const r=T(this,Et).getQueryCache().build(T(this,Et),e),n=this.createResult(r,e);return bI(this,n)&&(G(this,ht,n),G(this,Co,this.options),G(this,Gi,T(this,ke).state)),n}getCurrentResult(){return T(this,ht)}trackResult(e){const r={};return Object.keys(e).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(T(this,Ki).add(n),e[n])})}),r}getCurrentQuery(){return T(this,ke)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=T(this,Et).defaultQueryOptions(e),n=T(this,Et).getQueryCache().build(T(this,Et),r);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,r))}fetch(e){return ae(this,Yi,fa).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),T(this,ht)))}createResult(e,r){var k;const n=T(this,ke),i=this.options,s=T(this,ht),o=T(this,Gi),a=T(this,Co),u=e!==n?e.state:T(this,So),{state:c}=e;let{error:f,errorUpdatedAt:d,fetchStatus:g,status:v}=c,b=!1,w;if(r._optimisticResults){const O=this.hasListeners(),M=!O&&w_(e,r),L=O&&__(e,n,r,i);(M||L)&&(g=nf(e.options.networkMode)?"fetching":"paused",c.dataUpdatedAt||(v="pending")),r._optimisticResults==="isRestoring"&&(g="idle")}if(r.select&&typeof c.data<"u")if(s&&c.data===(o==null?void 0:o.data)&&r.select===T(this,Ul))w=T(this,Eo);else try{G(this,Ul,r.select),w=r.select(c.data),w=Wm(s==null?void 0:s.data,w,r),G(this,Eo,w),G(this,zr,null)}catch(O){G(this,zr,O)}else w=c.data;if(typeof r.placeholderData<"u"&&typeof w>"u"&&v==="pending"){let O;if(s!=null&&s.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData))O=s.data;else if(O=typeof r.placeholderData=="function"?r.placeholderData((k=T(this,To))==null?void 0:k.state.data,T(this,To)):r.placeholderData,r.select&&typeof O<"u")try{O=r.select(O),G(this,zr,null)}catch(M){G(this,zr,M)}typeof O<"u"&&(v="success",w=Wm(s==null?void 0:s.data,O,r),b=!0)}T(this,zr)&&(f=T(this,zr),w=T(this,Eo),d=Date.now(),v="error");const p=g==="fetching",m=v==="pending",y=v==="error",x=m&&p;return{status:v,fetchStatus:g,isPending:m,isSuccess:v==="success",isError:y,isInitialLoading:x,isLoading:x,data:w,dataUpdatedAt:c.dataUpdatedAt,error:f,errorUpdatedAt:d,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>u.dataUpdateCount||c.errorUpdateCount>u.errorUpdateCount,isFetching:p,isRefetching:p&&!m,isLoadingError:y&&c.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:b,isRefetchError:y&&c.dataUpdatedAt!==0,isStale:O0(e,r),refetch:this.refetch}}updateResult(e){const r=T(this,ht),n=this.createResult(T(this,ke),this.options);if(G(this,Gi,T(this,ke).state),G(this,Co,this.options),Hm(n,r))return;T(this,Gi).data!==void 0&&G(this,To,T(this,ke)),G(this,ht,n);const i={},s=()=>{if(!r)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!T(this,Ki).size)return!0;const l=new Set(a??T(this,Ki));return this.options.throwOnError&&l.add("error"),Object.keys(T(this,ht)).some(u=>{const c=u;return T(this,ht)[c]!==r[c]&&l.has(c)})};(e==null?void 0:e.listeners)!==!1&&s()&&(i.listeners=!0),ae(this,ef,IS).call(this,{...i,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ae(this,zl,Km).call(this)}},Et=new WeakMap,ke=new WeakMap,So=new WeakMap,ht=new WeakMap,Gi=new WeakMap,Co=new WeakMap,zr=new WeakMap,Ul=new WeakMap,Eo=new WeakMap,To=new WeakMap,Vi=new WeakMap,Qi=new WeakMap,Xn=new WeakMap,Ki=new WeakMap,Yi=new WeakSet,fa=function(e){ae(this,Vl,Jm).call(this);let r=T(this,ke).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(Jt)),r},Fl=new WeakSet,Gm=function(){if(ae(this,Wl,Ym).call(this),ko||T(this,ht).isStale||!qm(this.options.staleTime))return;const r=CS(T(this,ht).dataUpdatedAt,this.options.staleTime)+1;G(this,Vi,setTimeout(()=>{T(this,ht).isStale||this.updateResult()},r))},ql=new WeakSet,Vm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(this,ke)):this.options.refetchInterval)??!1},Hl=new WeakSet,Qm=function(e){ae(this,Gl,Xm).call(this),G(this,Xn,e),!(ko||this.options.enabled===!1||!qm(T(this,Xn))||T(this,Xn)===0)&&G(this,Qi,setInterval(()=>{(this.options.refetchIntervalInBackground||Sc.isFocused())&&ae(this,Yi,fa).call(this)},T(this,Xn)))},zl=new WeakSet,Km=function(){ae(this,Fl,Gm).call(this),ae(this,Hl,Qm).call(this,ae(this,ql,Vm).call(this))},Wl=new WeakSet,Ym=function(){T(this,Vi)&&(clearTimeout(T(this,Vi)),G(this,Vi,void 0))},Gl=new WeakSet,Xm=function(){T(this,Qi)&&(clearInterval(T(this,Qi)),G(this,Qi,void 0))},Vl=new WeakSet,Jm=function(){const e=T(this,Et).getQueryCache().build(T(this,Et),this.options);if(e===T(this,ke))return;const r=T(this,ke);G(this,ke,e),G(this,So,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},ef=new WeakSet,IS=function(e){ot.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(T(this,ht))}),T(this,Et).getQueryCache().notify({query:T(this,ke),type:"observerResultsUpdated"})})},fS);function _I(t,e){return e.enabled!==!1&&!t.state.dataUpdatedAt&&!(t.state.status==="error"&&e.retryOnMount===!1)}function w_(t,e){return _I(t,e)||t.state.dataUpdatedAt>0&&Zm(t,e,e.refetchOnMount)}function Zm(t,e,r){if(e.enabled!==!1){const n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&O0(t,e)}return!1}function __(t,e,r,n){return r.enabled!==!1&&(t!==e||n.enabled===!1)&&(!r.suspense||t.state.status!=="error")&&O0(t,r)}function O0(t,e){return t.isStaleByTime(e.staleTime)}function bI(t,e){return!Hm(t.getCurrentResult(),e)}var OS=I.createContext(void 0),sf=t=>{const e=I.useContext(OS);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},xI=({client:t,children:e})=>(I.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),I.createElement(OS.Provider,{value:t},e)),RS=I.createContext(!1),SI=()=>I.useContext(RS);RS.Provider;function CI(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var EI=I.createContext(CI()),TI=()=>I.useContext(EI);function kI(t,e){return typeof t=="function"?t(...e):!!t}var PI=(t,e)=>{(t.suspense||t.throwOnError)&&(e.isReset()||(t.retryOnMount=!1))},AI=t=>{I.useEffect(()=>{t.clearReset()},[t])},II=({result:t,errorResetBoundary:e,throwOnError:r,query:n})=>t.isError&&!e.isReset()&&!t.isFetching&&kI(r,[t.error,n]),OI=t=>{t.suspense&&typeof t.staleTime!="number"&&(t.staleTime=1e3)},RI=(t,e)=>t.isLoading&&t.isFetching&&!e,MI=(t,e,r)=>(t==null?void 0:t.suspense)&&RI(e,r),NI=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function DI(t,e,r){const n=sf(r),i=SI(),s=TI(),o=n.defaultQueryOptions(t);o._optimisticResults=i?"isRestoring":"optimistic",OI(o),PI(o,s),AI(s);const[a]=I.useState(()=>new e(n,o)),l=a.getOptimisticResult(o);if(I.useSyncExternalStore(I.useCallback(u=>{const c=i?()=>{}:a.subscribe(ot.batchCalls(u));return a.updateResult(),c},[a,i]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),I.useEffect(()=>{a.setOptions(o,{listeners:!1})},[o,a]),MI(o,l,i))throw NI(o,a,s);if(II({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getCurrentQuery()}))throw l.error;return o.notifyOnChangeProps?l:a.trackResult(l)}function xi(t,e){return DI(t,wI,e)}var eg={},MS={exports:{}},Gt={},NS={exports:{}},DS={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var MA=Object.defineProperty;var NA=(t,e,r)=>e in t?MA(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(t){function e(B,H){var Y=B.length;B.push(H);e:for(;0>>1,ye=B[se];if(0>>1;sei(Or,Y))Rri(bs,Or)?(B[se]=bs,B[Rr]=Y,se=Rr):(B[se]=Or,B[Nt]=Y,se=Nt);else if(Rri(bs,Y))B[se]=bs,B[Rr]=Y,se=Rr;else break e}}return H}function i(B,H){var Y=B.sortIndex-H.sortIndex;return Y!==0?Y:B.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,f=null,d=3,y=!1,v=!1,b=!1,w=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(B){for(var H=r(u);H!==null;){if(H.callback===null)n(u);else if(H.startTime<=B)n(u),H.sortIndex=H.expirationTime,e(l,H);else break;H=r(u)}}function x(B){if(b=!1,g(B),!v)if(r(l)!==null)v=!0,Q(S);else{var H=r(u);H!==null&&le(x,H.startTime-B)}}function S(B,H){v=!1,b&&(b=!1,p(O),O=-1),y=!0;var Y=d;try{for(g(H),f=r(l);f!==null&&(!(f.expirationTime>H)||B&&!ee());){var se=f.callback;if(typeof se=="function"){f.callback=null,d=f.priorityLevel;var ye=se(f.expirationTime<=H);H=t.unstable_now(),typeof ye=="function"?f.callback=ye:f===r(l)&&n(l),g(H)}else n(l);f=r(l)}if(f!==null)var Mt=!0;else{var Nt=r(u);Nt!==null&&le(x,Nt.startTime-H),Mt=!1}return Mt}finally{f=null,d=Y,y=!1}}var k=!1,R=null,O=-1,$=5,G=-1;function ee(){return!(t.unstable_now()-G<$)}function fe(){if(R!==null){var B=t.unstable_now();G=B;var H=!0;try{H=R(!0,B)}finally{H?he():(k=!1,R=null)}}else k=!1}var he;if(typeof m=="function")he=function(){m(fe)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,j=P.port2;P.port1.onmessage=fe,he=function(){j.postMessage(null)}}else he=function(){w(fe,0)};function Q(B){R=B,k||(k=!0,he())}function le(B,H){O=w(function(){B(t.unstable_now())},H)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_continueExecution=function(){v||y||(v=!0,Q(S))},t.unstable_forceFrameRate=function(B){0>B||125se?(B.sortIndex=Y,e(u,B),r(l)===null&&B===r(u)&&(b?(p(O),O=-1):b=!0,le(x,Y-se))):(B.sortIndex=ye,e(l,B),v||y||(v=!0,Q(S))),B},t.unstable_shouldYield=ee,t.unstable_wrapCallback=function(B){var H=d;return function(){var Y=d;d=H;try{return B.apply(this,arguments)}finally{d=Y}}}})(DS);NS.exports=DS;var DI=NS.exports;/** + */(function(t){function e($,H){var Y=$.length;$.push(H);e:for(;0>>1,ye=$[se];if(0>>1;sei(Or,Y))Rri(bs,Or)?($[se]=bs,$[Rr]=Y,se=Rr):($[se]=Or,$[Nt]=Y,se=Nt);else if(Rri(bs,Y))$[se]=bs,$[Rr]=Y,se=Rr;else break e}}return H}function i($,H){var Y=$.sortIndex-H.sortIndex;return Y!==0?Y:$.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,f=null,d=3,g=!1,v=!1,b=!1,w=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y($){for(var H=r(u);H!==null;){if(H.callback===null)n(u);else if(H.startTime<=$)n(u),H.sortIndex=H.expirationTime,e(l,H);else break;H=r(u)}}function x($){if(b=!1,y($),!v)if(r(l)!==null)v=!0,Q(S);else{var H=r(u);H!==null&&ue(x,H.startTime-$)}}function S($,H){v=!1,b&&(b=!1,p(M),M=-1),g=!0;var Y=d;try{for(y(H),f=r(l);f!==null&&(!(f.expirationTime>H)||$&&!ee());){var se=f.callback;if(typeof se=="function"){f.callback=null,d=f.priorityLevel;var ye=se(f.expirationTime<=H);H=t.unstable_now(),typeof ye=="function"?f.callback=ye:f===r(l)&&n(l),y(H)}else n(l);f=r(l)}if(f!==null)var Mt=!0;else{var Nt=r(u);Nt!==null&&ue(x,Nt.startTime-H),Mt=!1}return Mt}finally{f=null,d=Y,g=!1}}var k=!1,O=null,M=-1,L=5,W=-1;function ee(){return!(t.unstable_now()-W$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return d},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function($){switch(d){case 1:case 2:case 3:var H=3;break;default:H=d}var Y=d;d=H;try{return $()}finally{d=Y}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function($,H){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var Y=d;d=$;try{return H()}finally{d=Y}},t.unstable_scheduleCallback=function($,H,Y){var se=t.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0se?($.sortIndex=Y,e(u,$),r(l)===null&&$===r(u)&&(b?(p(M),M=-1):b=!0,ue(x,Y-se))):($.sortIndex=ye,e(l,$),v||g||(v=!0,Q(S))),$},t.unstable_shouldYield=ee,t.unstable_wrapCallback=function($){var H=d;return function(){var Y=d;d=H;try{return $.apply(this,arguments)}finally{d=Y}}}})(DS);NS.exports=DS;var jI=NS.exports;/** * @license React * react-dom.production.min.js * @@ -30,47 +30,47 @@ var MA=Object.defineProperty;var NA=(t,e,r)=>e in t?MA(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var jS=I,Wt=DI;function U(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tg=Object.prototype.hasOwnProperty,jI=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,b_={},x_={};function LI(t){return tg.call(x_,t)?!0:tg.call(b_,t)?!1:jI.test(t)?x_[t]=!0:(b_[t]=!0,!1)}function BI(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function $I(t,e,r,n){if(e===null||typeof e>"u"||BI(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function xt(t,e,r,n,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){lt[t]=new xt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];lt[e]=new xt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){lt[t]=new xt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){lt[t]=new xt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){lt[t]=new xt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){lt[t]=new xt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){lt[t]=new xt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){lt[t]=new xt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){lt[t]=new xt(t,5,!1,t.toLowerCase(),null,!1,!1)});var R0=/[\-:]([a-z])/g;function M0(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(R0,M0);lt[e]=new xt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(R0,M0);lt[e]=new xt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(R0,M0);lt[e]=new xt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){lt[t]=new xt(t,1,!1,t.toLowerCase(),null,!1,!1)});lt.xlinkHref=new xt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){lt[t]=new xt(t,1,!1,t.toLowerCase(),null,!0,!0)});function N0(t,e,r,n){var i=lt.hasOwnProperty(e)?lt[e]:null;(i!==null?i.type!==0:n||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tg=Object.prototype.hasOwnProperty,LI=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,b_={},x_={};function BI(t){return tg.call(x_,t)?!0:tg.call(b_,t)?!1:LI.test(t)?x_[t]=!0:(b_[t]=!0,!1)}function $I(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function UI(t,e,r,n){if(e===null||typeof e>"u"||$I(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function xt(t,e,r,n,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){lt[t]=new xt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];lt[e]=new xt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){lt[t]=new xt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){lt[t]=new xt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){lt[t]=new xt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){lt[t]=new xt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){lt[t]=new xt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){lt[t]=new xt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){lt[t]=new xt(t,5,!1,t.toLowerCase(),null,!1,!1)});var R0=/[\-:]([a-z])/g;function M0(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(R0,M0);lt[e]=new xt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(R0,M0);lt[e]=new xt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(R0,M0);lt[e]=new xt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){lt[t]=new xt(t,1,!1,t.toLowerCase(),null,!1,!1)});lt.xlinkHref=new xt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){lt[t]=new xt(t,1,!1,t.toLowerCase(),null,!0,!0)});function N0(t,e,r,n){var i=lt.hasOwnProperty(e)?lt[e]:null;(i!==null?i.type!==0:n||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{yh=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?ha(t):""}function UI(t){switch(t.tag){case 5:return ha(t.type);case 16:return ha("Lazy");case 13:return ha("Suspense");case 19:return ha("SuspenseList");case 0:case 2:case 15:return t=vh(t.type,!1),t;case 11:return t=vh(t.type.render,!1),t;case 1:return t=vh(t.type,!0),t;default:return""}}function sg(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case js:return"Fragment";case Ds:return"Portal";case rg:return"Profiler";case D0:return"StrictMode";case ng:return"Suspense";case ig:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case $S:return(t.displayName||"Context")+".Consumer";case BS:return(t._context.displayName||"Context")+".Provider";case j0:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L0:return e=t.displayName||null,e!==null?e:sg(t.type)||"Memo";case Ln:e=t._payload,t=t._init;try{return sg(t(e))}catch{}}return null}function FI(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return sg(e);case 8:return e===D0?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function fi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function FS(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function qI(t){var e=FS(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function yu(t){t._valueTracker||(t._valueTracker=qI(t))}function qS(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=FS(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Ec(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function og(t,e){var r=e.checked;return Le({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function C_(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=fi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function HS(t,e){e=e.checked,e!=null&&N0(t,"checked",e,!1)}function ag(t,e){HS(t,e);var r=fi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?lg(t,e.type,r):e.hasOwnProperty("defaultValue")&&lg(t,e.type,fi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function E_(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function lg(t,e,r){(e!=="number"||Ec(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var pa=Array.isArray;function Zs(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=vu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ha(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var wa={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},HI=["Webkit","ms","Moz","O"];Object.keys(wa).forEach(function(t){HI.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),wa[e]=wa[t]})});function VS(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||wa.hasOwnProperty(t)&&wa[t]?(""+e).trim():e+"px"}function QS(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=VS(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var zI=Le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function dg(t,e){if(e){if(zI[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(U(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(U(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(U(61))}if(e.style!=null&&typeof e.style!="object")throw Error(U(62))}}function fg(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hg=null;function B0(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var pg=null,eo=null,to=null;function P_(t){if(t=Jl(t)){if(typeof pg!="function")throw Error(U(280));var e=t.stateNode;e&&(e=cf(e),pg(t.stateNode,t.type,e))}}function KS(t){eo?to?to.push(t):to=[t]:eo=t}function YS(){if(eo){var t=eo,e=to;if(to=eo=null,P_(t),e)for(t=0;t>>=0,t===0?32:31-(t3(t)/r3|0)|0}var wu=64,_u=4194304;function ma(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ac(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,o=r&268435455;if(o!==0){var a=o&~i;a!==0?n=ma(a):(s&=o,s!==0&&(n=ma(s)))}else o=r&~i,o!==0?n=ma(o):s!==0&&(n=ma(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function Yl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Er(e),t[e]=r}function o3(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=ba),L_=String.fromCharCode(32),B_=!1;function gC(t,e){switch(t){case"keyup":return N3.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ls=!1;function j3(t,e){switch(t){case"compositionend":return yC(e);case"keypress":return e.which!==32?null:(B_=!0,L_);case"textInput":return t=e.data,t===L_&&B_?null:t;default:return null}}function L3(t,e){if(Ls)return t==="compositionend"||!G0&&gC(t,e)?(t=pC(),rc=H0=Jn=null,Ls=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=q_(r)}}function bC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?bC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function xC(){for(var t=window,e=Ec();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Ec(t.document)}return e}function V0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function G3(t){var e=xC(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&bC(r.ownerDocument.documentElement,r)){if(n!==null&&V0(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=H_(r,s);var o=H_(r,n);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Bs=null,_g=null,Sa=null,bg=!1;function z_(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;bg||Bs==null||Bs!==Ec(n)||(n=Bs,"selectionStart"in n&&V0(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Sa&&Ka(Sa,n)||(Sa=n,n=Rc(_g,"onSelect"),0Fs||(t.current=kg[Fs],kg[Fs]=null,Fs--)}function Pe(t,e){Fs++,kg[Fs]=t.current,t.current=e}var hi={},mt=Ci(hi),Pt=Ci(!1),ss=hi;function Ao(t,e){var r=t.type.contextTypes;if(!r)return hi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function At(t){return t=t.childContextTypes,t!=null}function Nc(){Re(Pt),Re(mt)}function X_(t,e,r){if(mt.current!==hi)throw Error(U(168));Pe(mt,e),Pe(Pt,r)}function OC(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(U(108,FI(t)||"Unknown",i));return Le({},r,n)}function Dc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||hi,ss=mt.current,Pe(mt,t),Pe(Pt,Pt.current),!0}function J_(t,e,r){var n=t.stateNode;if(!n)throw Error(U(169));r?(t=OC(t,e,ss),n.__reactInternalMemoizedMergedChildContext=t,Re(Pt),Re(mt),Pe(mt,t)):Re(Pt),Pe(Pt,r)}var an=null,df=!1,Rh=!1;function RC(t){an===null?an=[t]:an.push(t)}function iO(t){df=!0,RC(t)}function Ei(){if(!Rh&&an!==null){Rh=!0;var t=0,e=Ee;try{var r=an;for(Ee=1;t>=o,i-=o,un=1<<32-Er(e)+i|r<O?($=R,R=null):$=R.sibling;var G=d(p,R,g[O],x);if(G===null){R===null&&(R=$);break}t&&R&&G.alternate===null&&e(p,R),m=s(G,m,O),k===null?S=G:k.sibling=G,k=G,R=$}if(O===g.length)return r(p,R),Ne&&Ii(p,O),S;if(R===null){for(;OO?($=R,R=null):$=R.sibling;var ee=d(p,R,G.value,x);if(ee===null){R===null&&(R=$);break}t&&R&&ee.alternate===null&&e(p,R),m=s(ee,m,O),k===null?S=ee:k.sibling=ee,k=ee,R=$}if(G.done)return r(p,R),Ne&&Ii(p,O),S;if(R===null){for(;!G.done;O++,G=g.next())G=f(p,G.value,x),G!==null&&(m=s(G,m,O),k===null?S=G:k.sibling=G,k=G);return Ne&&Ii(p,O),S}for(R=n(p,R);!G.done;O++,G=g.next())G=y(R,p,O,G.value,x),G!==null&&(t&&G.alternate!==null&&R.delete(G.key===null?O:G.key),m=s(G,m,O),k===null?S=G:k.sibling=G,k=G);return t&&R.forEach(function(fe){return e(p,fe)}),Ne&&Ii(p,O),S}function w(p,m,g,x){if(typeof g=="object"&&g!==null&&g.type===js&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case gu:e:{for(var S=g.key,k=m;k!==null;){if(k.key===S){if(S=g.type,S===js){if(k.tag===7){r(p,k.sibling),m=i(k,g.props.children),m.return=p,p=m;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ln&&s1(S)===k.type){r(p,k.sibling),m=i(k,g.props),m.ref=ia(p,k,g),m.return=p,p=m;break e}r(p,k);break}else e(p,k);k=k.sibling}g.type===js?(m=Ji(g.props.children,p.mode,x,g.key),m.return=p,p=m):(x=cc(g.type,g.key,g.props,null,p.mode,x),x.ref=ia(p,m,g),x.return=p,p=x)}return o(p);case Ds:e:{for(k=g.key;m!==null;){if(m.key===k)if(m.tag===4&&m.stateNode.containerInfo===g.containerInfo&&m.stateNode.implementation===g.implementation){r(p,m.sibling),m=i(m,g.children||[]),m.return=p,p=m;break e}else{r(p,m);break}else e(p,m);m=m.sibling}m=Uh(g,p.mode,x),m.return=p,p=m}return o(p);case Ln:return k=g._init,w(p,m,k(g._payload),x)}if(pa(g))return v(p,m,g,x);if(Zo(g))return b(p,m,g,x);ku(p,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,m!==null&&m.tag===6?(r(p,m.sibling),m=i(m,g),m.return=p,p=m):(r(p,m),m=$h(g,p.mode,x),m.return=p,p=m),o(p)):r(p,m)}return w}var Oo=UC(!0),FC=UC(!1),Zl={},Kr=Ci(Zl),Za=Ci(Zl),el=Ci(Zl);function Li(t){if(t===Zl)throw Error(U(174));return t}function rv(t,e){switch(Pe(el,e),Pe(Za,t),Pe(Kr,Zl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:cg(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=cg(e,t)}Re(Kr),Pe(Kr,e)}function Ro(){Re(Kr),Re(Za),Re(el)}function qC(t){Li(el.current);var e=Li(Kr.current),r=cg(e,t.type);e!==r&&(Pe(Za,t),Pe(Kr,r))}function nv(t){Za.current===t&&(Re(Kr),Re(Za))}var De=Ci(0);function Fc(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Mh=[];function iv(){for(var t=0;tr?r:4,t(!0);var n=Nh.transition;Nh.transition={};try{t(!1),e()}finally{Ee=r,Nh.transition=n}}function i5(){return fr().memoizedState}function lO(t,e,r){var n=li(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},s5(t))o5(e,r);else if(r=jC(t,e,r,n),r!==null){var i=_t();Tr(r,t,n,i),a5(r,e,n)}}function uO(t,e,r){var n=li(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(s5(t))o5(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,r);if(i.hasEagerState=!0,i.eagerState=a,Pr(a,o)){var l=e.interleaved;l===null?(i.next=i,ev(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}r=jC(t,e,i,n),r!==null&&(i=_t(),Tr(r,t,n,i),a5(r,e,n))}}function s5(t){var e=t.alternate;return t===je||e!==null&&e===je}function o5(t,e){Ca=qc=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function a5(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,U0(t,r)}}var Hc={readContext:dr,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},cO={readContext:dr,useCallback:function(t,e){return jr().memoizedState=[t,e===void 0?null:e],t},useContext:dr,useEffect:a1,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,oc(4194308,4,ZC.bind(null,e,t),r)},useLayoutEffect:function(t,e){return oc(4194308,4,t,e)},useInsertionEffect:function(t,e){return oc(4,2,t,e)},useMemo:function(t,e){var r=jr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=jr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=lO.bind(null,je,t),[n.memoizedState,t]},useRef:function(t){var e=jr();return t={current:t},e.memoizedState=t},useState:o1,useDebugValue:uv,useDeferredValue:function(t){return jr().memoizedState=t},useTransition:function(){var t=o1(!1),e=t[0];return t=aO.bind(null,t[1]),jr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=je,i=jr();if(Ne){if(r===void 0)throw Error(U(407));r=r()}else{if(r=e(),nt===null)throw Error(U(349));as&30||WC(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,a1(VC.bind(null,n,s,t),[t]),n.flags|=2048,nl(9,GC.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=jr(),e=nt.identifierPrefix;if(Ne){var r=cn,n=un;r=(n&~(1<<32-Er(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=tl++,0")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{yh=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?ha(t):""}function FI(t){switch(t.tag){case 5:return ha(t.type);case 16:return ha("Lazy");case 13:return ha("Suspense");case 19:return ha("SuspenseList");case 0:case 2:case 15:return t=vh(t.type,!1),t;case 11:return t=vh(t.type.render,!1),t;case 1:return t=vh(t.type,!0),t;default:return""}}function sg(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case js:return"Fragment";case Ds:return"Portal";case rg:return"Profiler";case D0:return"StrictMode";case ng:return"Suspense";case ig:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case $S:return(t.displayName||"Context")+".Consumer";case BS:return(t._context.displayName||"Context")+".Provider";case j0:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L0:return e=t.displayName||null,e!==null?e:sg(t.type)||"Memo";case Ln:e=t._payload,t=t._init;try{return sg(t(e))}catch{}}return null}function qI(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return sg(e);case 8:return e===D0?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function fi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function FS(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function HI(t){var e=FS(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function yu(t){t._valueTracker||(t._valueTracker=HI(t))}function qS(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=FS(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Ec(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function og(t,e){var r=e.checked;return Le({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function C_(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=fi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function HS(t,e){e=e.checked,e!=null&&N0(t,"checked",e,!1)}function ag(t,e){HS(t,e);var r=fi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?lg(t,e.type,r):e.hasOwnProperty("defaultValue")&&lg(t,e.type,fi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function E_(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function lg(t,e,r){(e!=="number"||Ec(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var pa=Array.isArray;function Zs(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=vu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ha(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var wa={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},zI=["Webkit","ms","Moz","O"];Object.keys(wa).forEach(function(t){zI.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),wa[e]=wa[t]})});function VS(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||wa.hasOwnProperty(t)&&wa[t]?(""+e).trim():e+"px"}function QS(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=VS(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var WI=Le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function dg(t,e){if(e){if(WI[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(U(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(U(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(U(61))}if(e.style!=null&&typeof e.style!="object")throw Error(U(62))}}function fg(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hg=null;function B0(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var pg=null,eo=null,to=null;function P_(t){if(t=Jl(t)){if(typeof pg!="function")throw Error(U(280));var e=t.stateNode;e&&(e=cf(e),pg(t.stateNode,t.type,e))}}function KS(t){eo?to?to.push(t):to=[t]:eo=t}function YS(){if(eo){var t=eo,e=to;if(to=eo=null,P_(t),e)for(t=0;t>>=0,t===0?32:31-(r3(t)/n3|0)|0}var wu=64,_u=4194304;function ma(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ac(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,o=r&268435455;if(o!==0){var a=o&~i;a!==0?n=ma(a):(s&=o,s!==0&&(n=ma(s)))}else o=r&~i,o!==0?n=ma(o):s!==0&&(n=ma(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function Yl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Er(e),t[e]=r}function a3(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=ba),L_=String.fromCharCode(32),B_=!1;function gC(t,e){switch(t){case"keyup":return D3.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ls=!1;function L3(t,e){switch(t){case"compositionend":return yC(e);case"keypress":return e.which!==32?null:(B_=!0,L_);case"textInput":return t=e.data,t===L_&&B_?null:t;default:return null}}function B3(t,e){if(Ls)return t==="compositionend"||!G0&&gC(t,e)?(t=pC(),rc=H0=Jn=null,Ls=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=q_(r)}}function bC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?bC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function xC(){for(var t=window,e=Ec();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Ec(t.document)}return e}function V0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function V3(t){var e=xC(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&bC(r.ownerDocument.documentElement,r)){if(n!==null&&V0(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=H_(r,s);var o=H_(r,n);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Bs=null,_g=null,Sa=null,bg=!1;function z_(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;bg||Bs==null||Bs!==Ec(n)||(n=Bs,"selectionStart"in n&&V0(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Sa&&Ka(Sa,n)||(Sa=n,n=Rc(_g,"onSelect"),0Fs||(t.current=kg[Fs],kg[Fs]=null,Fs--)}function Pe(t,e){Fs++,kg[Fs]=t.current,t.current=e}var hi={},mt=Ci(hi),Pt=Ci(!1),ss=hi;function Ao(t,e){var r=t.type.contextTypes;if(!r)return hi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function At(t){return t=t.childContextTypes,t!=null}function Nc(){Re(Pt),Re(mt)}function X_(t,e,r){if(mt.current!==hi)throw Error(U(168));Pe(mt,e),Pe(Pt,r)}function OC(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(U(108,qI(t)||"Unknown",i));return Le({},r,n)}function Dc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||hi,ss=mt.current,Pe(mt,t),Pe(Pt,Pt.current),!0}function J_(t,e,r){var n=t.stateNode;if(!n)throw Error(U(169));r?(t=OC(t,e,ss),n.__reactInternalMemoizedMergedChildContext=t,Re(Pt),Re(mt),Pe(mt,t)):Re(Pt),Pe(Pt,r)}var an=null,df=!1,Rh=!1;function RC(t){an===null?an=[t]:an.push(t)}function sO(t){df=!0,RC(t)}function Ei(){if(!Rh&&an!==null){Rh=!0;var t=0,e=Ee;try{var r=an;for(Ee=1;t>=o,i-=o,un=1<<32-Er(e)+i|r<M?(L=O,O=null):L=O.sibling;var W=d(p,O,y[M],x);if(W===null){O===null&&(O=L);break}t&&O&&W.alternate===null&&e(p,O),m=s(W,m,M),k===null?S=W:k.sibling=W,k=W,O=L}if(M===y.length)return r(p,O),Ne&&Ii(p,M),S;if(O===null){for(;MM?(L=O,O=null):L=O.sibling;var ee=d(p,O,W.value,x);if(ee===null){O===null&&(O=L);break}t&&O&&ee.alternate===null&&e(p,O),m=s(ee,m,M),k===null?S=ee:k.sibling=ee,k=ee,O=L}if(W.done)return r(p,O),Ne&&Ii(p,M),S;if(O===null){for(;!W.done;M++,W=y.next())W=f(p,W.value,x),W!==null&&(m=s(W,m,M),k===null?S=W:k.sibling=W,k=W);return Ne&&Ii(p,M),S}for(O=n(p,O);!W.done;M++,W=y.next())W=g(O,p,M,W.value,x),W!==null&&(t&&W.alternate!==null&&O.delete(W.key===null?M:W.key),m=s(W,m,M),k===null?S=W:k.sibling=W,k=W);return t&&O.forEach(function(le){return e(p,le)}),Ne&&Ii(p,M),S}function w(p,m,y,x){if(typeof y=="object"&&y!==null&&y.type===js&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case gu:e:{for(var S=y.key,k=m;k!==null;){if(k.key===S){if(S=y.type,S===js){if(k.tag===7){r(p,k.sibling),m=i(k,y.props.children),m.return=p,p=m;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ln&&s1(S)===k.type){r(p,k.sibling),m=i(k,y.props),m.ref=ia(p,k,y),m.return=p,p=m;break e}r(p,k);break}else e(p,k);k=k.sibling}y.type===js?(m=Ji(y.props.children,p.mode,x,y.key),m.return=p,p=m):(x=cc(y.type,y.key,y.props,null,p.mode,x),x.ref=ia(p,m,y),x.return=p,p=x)}return o(p);case Ds:e:{for(k=y.key;m!==null;){if(m.key===k)if(m.tag===4&&m.stateNode.containerInfo===y.containerInfo&&m.stateNode.implementation===y.implementation){r(p,m.sibling),m=i(m,y.children||[]),m.return=p,p=m;break e}else{r(p,m);break}else e(p,m);m=m.sibling}m=Uh(y,p.mode,x),m.return=p,p=m}return o(p);case Ln:return k=y._init,w(p,m,k(y._payload),x)}if(pa(y))return v(p,m,y,x);if(Zo(y))return b(p,m,y,x);ku(p,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,m!==null&&m.tag===6?(r(p,m.sibling),m=i(m,y),m.return=p,p=m):(r(p,m),m=$h(y,p.mode,x),m.return=p,p=m),o(p)):r(p,m)}return w}var Oo=UC(!0),FC=UC(!1),Zl={},Kr=Ci(Zl),Za=Ci(Zl),el=Ci(Zl);function Li(t){if(t===Zl)throw Error(U(174));return t}function rv(t,e){switch(Pe(el,e),Pe(Za,t),Pe(Kr,Zl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:cg(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=cg(e,t)}Re(Kr),Pe(Kr,e)}function Ro(){Re(Kr),Re(Za),Re(el)}function qC(t){Li(el.current);var e=Li(Kr.current),r=cg(e,t.type);e!==r&&(Pe(Za,t),Pe(Kr,r))}function nv(t){Za.current===t&&(Re(Kr),Re(Za))}var De=Ci(0);function Fc(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Mh=[];function iv(){for(var t=0;tr?r:4,t(!0);var n=Nh.transition;Nh.transition={};try{t(!1),e()}finally{Ee=r,Nh.transition=n}}function i5(){return fr().memoizedState}function uO(t,e,r){var n=li(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},s5(t))o5(e,r);else if(r=jC(t,e,r,n),r!==null){var i=_t();Tr(r,t,n,i),a5(r,e,n)}}function cO(t,e,r){var n=li(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(s5(t))o5(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,r);if(i.hasEagerState=!0,i.eagerState=a,Pr(a,o)){var l=e.interleaved;l===null?(i.next=i,ev(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}r=jC(t,e,i,n),r!==null&&(i=_t(),Tr(r,t,n,i),a5(r,e,n))}}function s5(t){var e=t.alternate;return t===je||e!==null&&e===je}function o5(t,e){Ca=qc=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function a5(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,U0(t,r)}}var Hc={readContext:dr,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},dO={readContext:dr,useCallback:function(t,e){return jr().memoizedState=[t,e===void 0?null:e],t},useContext:dr,useEffect:a1,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,oc(4194308,4,ZC.bind(null,e,t),r)},useLayoutEffect:function(t,e){return oc(4194308,4,t,e)},useInsertionEffect:function(t,e){return oc(4,2,t,e)},useMemo:function(t,e){var r=jr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=jr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=uO.bind(null,je,t),[n.memoizedState,t]},useRef:function(t){var e=jr();return t={current:t},e.memoizedState=t},useState:o1,useDebugValue:uv,useDeferredValue:function(t){return jr().memoizedState=t},useTransition:function(){var t=o1(!1),e=t[0];return t=lO.bind(null,t[1]),jr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=je,i=jr();if(Ne){if(r===void 0)throw Error(U(407));r=r()}else{if(r=e(),nt===null)throw Error(U(349));as&30||WC(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,a1(VC.bind(null,n,s,t),[t]),n.flags|=2048,nl(9,GC.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=jr(),e=nt.identifierPrefix;if(Ne){var r=cn,n=un;r=(n&~(1<<32-Er(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=tl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[Wr]=e,t[Ja]=n,g5(t,e,!1,!1),e.stateNode=t;e:{switch(o=fg(r,n),r){case"dialog":Oe("cancel",t),Oe("close",t),i=n;break;case"iframe":case"object":case"embed":Oe("load",t),i=n;break;case"video":case"audio":for(i=0;iNo&&(e.flags|=128,n=!0,sa(s,!1),e.lanes=4194304)}else{if(!n)if(t=Fc(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),sa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ne)return ct(e),null}else 2*Fe()-s.renderingStartTime>No&&r!==1073741824&&(e.flags|=128,n=!0,sa(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(r=s.last,r!==null?r.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Fe(),e.sibling=null,r=De.current,Pe(De,n?r&1|2:r&1),e):(ct(e),null);case 22:case 23:return mv(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?$t&1073741824&&(ct(e),e.subtreeFlags&6&&(e.flags|=8192)):ct(e),null;case 24:return null;case 25:return null}throw Error(U(156,e.tag))}function vO(t,e){switch(K0(e),e.tag){case 1:return At(e.type)&&Nc(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ro(),Re(Pt),Re(mt),iv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return nv(e),null;case 13:if(Re(De),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(U(340));Io()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Re(De),null;case 4:return Ro(),null;case 10:return Z0(e.type._context),null;case 22:case 23:return mv(),null;case 24:return null;default:return null}}var Au=!1,pt=!1,wO=typeof WeakSet=="function"?WeakSet:Set,V=null;function Ws(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Be(t,e,n)}else r.current=null}function $g(t,e,r){try{r()}catch(n){Be(t,e,n)}}var g1=!1;function _O(t,e){if(xg=Ic,t=xC(),V0(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,l=-1,u=0,c=0,f=t,d=null;t:for(;;){for(var y;f!==r||i!==0&&f.nodeType!==3||(a=o+i),f!==s||n!==0&&f.nodeType!==3||(l=o+n),f.nodeType===3&&(o+=f.nodeValue.length),(y=f.firstChild)!==null;)d=f,f=y;for(;;){if(f===t)break t;if(d===r&&++u===i&&(a=o),d===s&&++c===n&&(l=o),(y=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=y}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(Sg={focusedElem:t,selectionRange:r},Ic=!1,V=e;V!==null;)if(e=V,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,V=t;else for(;V!==null;){e=V;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var b=v.memoizedProps,w=v.memoizedState,p=e.stateNode,m=p.getSnapshotBeforeUpdate(e.elementType===e.type?b:wr(e.type,b),w);p.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var g=e.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(U(163))}}catch(x){Be(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,V=t;break}V=e.return}return v=g1,g1=!1,v}function Ea(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&$g(e,r,s)}i=i.next}while(i!==n)}}function pf(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Ug(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function w5(t){var e=t.alternate;e!==null&&(t.alternate=null,w5(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Wr],delete e[Ja],delete e[Tg],delete e[rO],delete e[nO])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function _5(t){return t.tag===5||t.tag===3||t.tag===4}function y1(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||_5(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Fg(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Mc));else if(n!==4&&(t=t.child,t!==null))for(Fg(t,e,r),t=t.sibling;t!==null;)Fg(t,e,r),t=t.sibling}function qg(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(qg(t,e,r),t=t.sibling;t!==null;)qg(t,e,r),t=t.sibling}var st=null,br=!1;function kn(t,e,r){for(r=r.child;r!==null;)b5(t,e,r),r=r.sibling}function b5(t,e,r){if(Qr&&typeof Qr.onCommitFiberUnmount=="function")try{Qr.onCommitFiberUnmount(of,r)}catch{}switch(r.tag){case 5:pt||Ws(r,e);case 6:var n=st,i=br;st=null,kn(t,e,r),st=n,br=i,st!==null&&(br?(t=st,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):st.removeChild(r.stateNode));break;case 18:st!==null&&(br?(t=st,r=r.stateNode,t.nodeType===8?Oh(t.parentNode,r):t.nodeType===1&&Oh(t,r),Va(t)):Oh(st,r.stateNode));break;case 4:n=st,i=br,st=r.stateNode.containerInfo,br=!0,kn(t,e,r),st=n,br=i;break;case 0:case 11:case 14:case 15:if(!pt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&$g(r,e,o),i=i.next}while(i!==n)}kn(t,e,r);break;case 1:if(!pt&&(Ws(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){Be(r,e,a)}kn(t,e,r);break;case 21:kn(t,e,r);break;case 22:r.mode&1?(pt=(n=pt)||r.memoizedState!==null,kn(t,e,r),pt=n):kn(t,e,r);break;default:kn(t,e,r)}}function v1(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new wO),e.forEach(function(n){var i=AO.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function yr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=Fe()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*xO(n/1960))-n,10t?16:t,Zn===null)var n=!1;else{if(t=Zn,Zn=null,Gc=0,ge&6)throw Error(U(331));var i=ge;for(ge|=4,V=t.current;V!==null;){var s=V,o=s.child;if(V.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lFe()-hv?Xi(t,0):fv|=r),It(t,e)}function A5(t,e){e===0&&(t.mode&1?(e=_u,_u<<=1,!(_u&130023424)&&(_u=4194304)):e=1);var r=_t();t=mn(t,e),t!==null&&(Yl(t,e,r),It(t,r))}function PO(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),A5(t,r)}function AO(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(U(314))}n!==null&&n.delete(e),A5(t,r)}var I5;I5=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Pt.current)kt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return kt=!1,gO(t,e,r);kt=!!(t.flags&131072)}else kt=!1,Ne&&e.flags&1048576&&MC(e,Lc,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;ac(t,e),t=e.pendingProps;var i=Ao(e,mt.current);no(e,r),i=ov(null,e,n,t,i,r);var s=av();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,At(n)?(s=!0,Dc(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,tv(e),i.updater=ff,e.stateNode=i,i._reactInternals=e,Rg(e,n,t,r),e=Dg(null,e,n,!0,s,r)):(e.tag=0,Ne&&s&&Q0(e),wt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(ac(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=OO(n),t=wr(n,t),i){case 0:e=Ng(null,e,n,t,r);break e;case 1:e=h1(null,e,n,t,r);break e;case 11:e=d1(null,e,n,t,r);break e;case 14:e=f1(null,e,n,wr(n.type,t),r);break e}throw Error(U(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:wr(n,i),Ng(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:wr(n,i),h1(t,e,n,i,r);case 3:e:{if(h5(e),t===null)throw Error(U(387));n=e.pendingProps,s=e.memoizedState,i=s.element,LC(t,e),Uc(e,n,null,r);var o=e.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Mo(Error(U(423)),e),e=p1(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(U(424)),e),e=p1(t,e,n,r,i);break e}else for(Ft=si(e.stateNode.containerInfo.firstChild),Ht=e,Ne=!0,xr=null,r=FC(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Io(),n===i){e=gn(t,e,r);break e}wt(t,e,n,r)}e=e.child}return e;case 5:return qC(e),t===null&&Ag(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Cg(n,i)?o=null:s!==null&&Cg(n,s)&&(e.flags|=32),f5(t,e),wt(t,e,o,r),e.child;case 6:return t===null&&Ag(e),null;case 13:return p5(t,e,r);case 4:return rv(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Oo(e,null,n,r):wt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:wr(n,i),d1(t,e,n,i,r);case 7:return wt(t,e,e.pendingProps,r),e.child;case 8:return wt(t,e,e.pendingProps.children,r),e.child;case 12:return wt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Pe(Bc,n._currentValue),n._currentValue=o,s!==null)if(Pr(s.value,o)){if(s.children===i.children&&!Pt.current){e=gn(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=dn(-1,r&-r),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ig(s.return,r,e),a.lanes|=r;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(U(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ig(o,r,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}wt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,no(e,r),i=dr(i),n=n(i),e.flags|=1,wt(t,e,n,r),e.child;case 14:return n=e.type,i=wr(n,e.pendingProps),i=wr(n.type,i),f1(t,e,n,i,r);case 15:return c5(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:wr(n,i),ac(t,e),e.tag=1,At(n)?(t=!0,Dc(e)):t=!1,no(e,r),$C(e,n,i),Rg(e,n,i,r),Dg(null,e,n,!0,t,r);case 19:return m5(t,e,r);case 22:return d5(t,e,r)}throw Error(U(156,e.tag))};function O5(t,e){return nC(t,e)}function IO(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rr(t,e,r,n){return new IO(t,e,r,n)}function yv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function OO(t){if(typeof t=="function")return yv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===j0)return 11;if(t===L0)return 14}return 2}function ui(t,e){var r=t.alternate;return r===null?(r=rr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function cc(t,e,r,n,i,s){var o=2;if(n=t,typeof t=="function")yv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case js:return Ji(r.children,i,s,e);case D0:o=8,i|=8;break;case rg:return t=rr(12,r,e,i|2),t.elementType=rg,t.lanes=s,t;case ng:return t=rr(13,r,e,i),t.elementType=ng,t.lanes=s,t;case ig:return t=rr(19,r,e,i),t.elementType=ig,t.lanes=s,t;case US:return gf(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case BS:o=10;break e;case $S:o=9;break e;case j0:o=11;break e;case L0:o=14;break e;case Ln:o=16,n=null;break e}throw Error(U(130,t==null?t:typeof t,""))}return e=rr(o,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function Ji(t,e,r,n){return t=rr(7,t,n,e),t.lanes=r,t}function gf(t,e,r,n){return t=rr(22,t,n,e),t.elementType=US,t.lanes=r,t.stateNode={isHidden:!1},t}function $h(t,e,r){return t=rr(6,t,null,e),t.lanes=r,t}function Uh(t,e,r){return e=rr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function RO(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_h(0),this.expirationTimes=_h(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_h(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function vv(t,e,r,n,i,s,o,a,l){return t=new RO(t,e,r,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=rr(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},tv(s),t}function MO(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(D5)}catch(t){console.error(t)}}D5(),MS.exports=Gt;var xv=MS.exports,T1=xv;eg.createRoot=T1.createRoot,eg.hydrateRoot=T1.hydrateRoot;function j5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e"u"||!window.document)return n;var i=document.createElement("style");document.head.appendChild(i);var s=i.sheet,o=` +`+s.stack}return{value:t,source:e,stack:i,digest:null}}function Lh(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Mg(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var pO=typeof WeakMap=="function"?WeakMap:Map;function l5(t,e,r){r=dn(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){Wc||(Wc=!0,Hg=n),Mg(t,e)},r}function u5(t,e,r){r=dn(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var i=e.value;r.payload=function(){return n(i)},r.callback=function(){Mg(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){Mg(t,e),typeof n!="function"&&(ai===null?ai=new Set([this]):ai.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),r}function l1(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new pO;var i=new Set;n.set(e,i)}else i=n.get(e),i===void 0&&(i=new Set,n.set(e,i));i.has(r)||(i.add(r),t=PO.bind(null,t,e,r),e.then(t,t))}function u1(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function c1(t,e,r,n,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=dn(-1,1),e.tag=2,oi(r,e,1))),r.lanes|=1),t)}var mO=vn.ReactCurrentOwner,kt=!1;function wt(t,e,r,n){e.child=t===null?FC(e,null,r,n):Oo(e,t.child,r,n)}function d1(t,e,r,n,i){r=r.render;var s=e.ref;return no(e,i),n=ov(t,e,r,n,s,i),r=av(),t!==null&&!kt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,gn(t,e,i)):(Ne&&r&&Q0(e),e.flags|=1,wt(t,e,n,i),e.child)}function f1(t,e,r,n,i){if(t===null){var s=r.type;return typeof s=="function"&&!yv(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=s,c5(t,e,s,n,i)):(t=cc(r.type,null,n,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:Ka,r(o,n)&&t.ref===e.ref)return gn(t,e,i)}return e.flags|=1,t=ui(s,n),t.ref=e.ref,t.return=e,e.child=t}function c5(t,e,r,n,i){if(t!==null){var s=t.memoizedProps;if(Ka(s,n)&&t.ref===e.ref)if(kt=!1,e.pendingProps=n=s,(t.lanes&i)!==0)t.flags&131072&&(kt=!0);else return e.lanes=t.lanes,gn(t,e,i)}return Ng(t,e,r,n,i)}function d5(t,e,r){var n=e.pendingProps,i=n.children,s=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pe(Gs,$t),$t|=r;else{if(!(r&1073741824))return t=s!==null?s.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Pe(Gs,$t),$t|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,Pe(Gs,$t),$t|=n}else s!==null?(n=s.baseLanes|r,e.memoizedState=null):n=r,Pe(Gs,$t),$t|=n;return wt(t,e,i,r),e.child}function f5(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function Ng(t,e,r,n,i){var s=At(r)?ss:mt.current;return s=Ao(e,s),no(e,i),r=ov(t,e,r,n,s,i),n=av(),t!==null&&!kt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,gn(t,e,i)):(Ne&&n&&Q0(e),e.flags|=1,wt(t,e,r,i),e.child)}function h1(t,e,r,n,i){if(At(r)){var s=!0;Dc(e)}else s=!1;if(no(e,i),e.stateNode===null)ac(t,e),$C(e,r,n),Rg(e,r,n,i),n=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=dr(u):(u=At(r)?ss:mt.current,u=Ao(e,u));var c=r.getDerivedStateFromProps,f=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==u)&&i1(e,o,n,u),Bn=!1;var d=e.memoizedState;o.state=d,Uc(e,n,o,i),l=e.memoizedState,a!==n||d!==l||Pt.current||Bn?(typeof c=="function"&&(Og(e,r,c,n),l=e.memoizedState),(a=Bn||n1(e,r,a,n,d,l,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=l),o.props=n,o.state=l,o.context=u,n=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{o=e.stateNode,LC(t,e),a=e.memoizedProps,u=e.type===e.elementType?a:wr(e.type,a),o.props=u,f=e.pendingProps,d=o.context,l=r.contextType,typeof l=="object"&&l!==null?l=dr(l):(l=At(r)?ss:mt.current,l=Ao(e,l));var g=r.getDerivedStateFromProps;(c=typeof g=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==f||d!==l)&&i1(e,o,n,l),Bn=!1,d=e.memoizedState,o.state=d,Uc(e,n,o,i);var v=e.memoizedState;a!==f||d!==v||Pt.current||Bn?(typeof g=="function"&&(Og(e,r,g,n),v=e.memoizedState),(u=Bn||n1(e,r,u,n,d,v,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,v,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,v,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=v),o.props=n,o.state=v,o.context=l,n=u):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),n=!1)}return Dg(t,e,r,n,s,i)}function Dg(t,e,r,n,i,s){f5(t,e);var o=(e.flags&128)!==0;if(!n&&!o)return i&&J_(e,r,!1),gn(t,e,s);n=e.stateNode,mO.current=e;var a=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&o?(e.child=Oo(e,t.child,null,s),e.child=Oo(e,null,a,s)):wt(t,e,a,s),e.memoizedState=n.state,i&&J_(e,r,!0),e.child}function h5(t){var e=t.stateNode;e.pendingContext?X_(t,e.pendingContext,e.pendingContext!==e.context):e.context&&X_(t,e.context,!1),rv(t,e.containerInfo)}function p1(t,e,r,n,i){return Io(),Y0(i),e.flags|=256,wt(t,e,r,n),e.child}var jg={dehydrated:null,treeContext:null,retryLane:0};function Lg(t){return{baseLanes:t,cachePool:null,transitions:null}}function p5(t,e,r){var n=e.pendingProps,i=De.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Pe(De,i&1),t===null)return Ag(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=n.children,t=n.fallback,s?(n=e.mode,s=e.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=gf(o,n,0,null),t=Ji(t,n,r,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Lg(r),e.memoizedState=jg,t):cv(e,o));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return gO(t,e,o,n,a,i,r);if(s){s=n.fallback,o=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:n.children};return!(o&1)&&e.child!==i?(n=e.child,n.childLanes=0,n.pendingProps=l,e.deletions=null):(n=ui(i,l),n.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=ui(a,s):(s=Ji(s,o,r,null),s.flags|=2),s.return=e,n.return=e,n.sibling=s,e.child=n,n=s,s=e.child,o=t.child.memoizedState,o=o===null?Lg(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~r,e.memoizedState=jg,n}return s=t.child,t=s.sibling,n=ui(s,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function cv(t,e){return e=gf({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Pu(t,e,r,n){return n!==null&&Y0(n),Oo(e,t.child,null,r),t=cv(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function gO(t,e,r,n,i,s,o){if(r)return e.flags&256?(e.flags&=-257,n=Lh(Error(U(422))),Pu(t,e,o,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=n.fallback,i=e.mode,n=gf({mode:"visible",children:n.children},i,0,null),s=Ji(s,i,o,null),s.flags|=2,n.return=e,s.return=e,n.sibling=s,e.child=n,e.mode&1&&Oo(e,t.child,null,o),e.child.memoizedState=Lg(o),e.memoizedState=jg,s);if(!(e.mode&1))return Pu(t,e,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var a=n.dgst;return n=a,s=Error(U(419)),n=Lh(s,n,void 0),Pu(t,e,o,n)}if(a=(o&t.childLanes)!==0,kt||a){if(n=nt,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,mn(t,i),Tr(n,t,i,-1))}return gv(),n=Lh(Error(U(421))),Pu(t,e,o,n)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=AO.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,Ft=si(i.nextSibling),Ht=e,Ne=!0,xr=null,t!==null&&(Zt[er++]=un,Zt[er++]=cn,Zt[er++]=os,un=t.id,cn=t.overflow,os=e),e=cv(e,n.children),e.flags|=4096,e)}function m1(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),Ig(t.return,e,r)}function Bh(t,e,r,n,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function m5(t,e,r){var n=e.pendingProps,i=n.revealOrder,s=n.tail;if(wt(t,e,n.children,r),n=De.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&m1(t,r,e);else if(t.tag===19)m1(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(Pe(De,n),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(r=e.child,i=null;r!==null;)t=r.alternate,t!==null&&Fc(t)===null&&(i=r),r=r.sibling;r=i,r===null?(i=e.child,e.child=null):(i=r.sibling,r.sibling=null),Bh(e,!1,i,r,s);break;case"backwards":for(r=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Fc(t)===null){e.child=i;break}t=i.sibling,i.sibling=r,r=i,i=t}Bh(e,!0,r,null,s);break;case"together":Bh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ac(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function gn(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),ls|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(U(153));if(e.child!==null){for(t=e.child,r=ui(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=ui(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function yO(t,e,r){switch(e.tag){case 3:h5(e),Io();break;case 5:qC(e);break;case 1:At(e.type)&&Dc(e);break;case 4:rv(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,i=e.memoizedProps.value;Pe(Bc,n._currentValue),n._currentValue=i;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Pe(De,De.current&1),e.flags|=128,null):r&e.child.childLanes?p5(t,e,r):(Pe(De,De.current&1),t=gn(t,e,r),t!==null?t.sibling:null);Pe(De,De.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return m5(t,e,r);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Pe(De,De.current),n)break;return null;case 22:case 23:return e.lanes=0,d5(t,e,r)}return gn(t,e,r)}var g5,Bg,y5,v5;g5=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Bg=function(){};y5=function(t,e,r,n){var i=t.memoizedProps;if(i!==n){t=e.stateNode,Li(Kr.current);var s=null;switch(r){case"input":i=og(t,i),n=og(t,n),s=[];break;case"select":i=Le({},i,{value:void 0}),n=Le({},n,{value:void 0}),s=[];break;case"textarea":i=ug(t,i),n=ug(t,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Mc)}dg(r,n);var o;r=null;for(u in i)if(!n.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(qa.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in n){var l=n[u];if(a=i!=null?i[u]:void 0,n.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(r||(r={}),r[o]=l[o])}else r||(s||(s=[]),s.push(u,r)),r=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(qa.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Oe("scroll",t),s||a===l||(s=[])):(s=s||[]).push(u,l))}r&&(s=s||[]).push("style",r);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};v5=function(t,e,r,n){r!==n&&(e.flags|=4)};function sa(t,e){if(!Ne)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function ct(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function vO(t,e,r){var n=e.pendingProps;switch(K0(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(e),null;case 1:return At(e.type)&&Nc(),ct(e),null;case 3:return n=e.stateNode,Ro(),Re(Pt),Re(mt),iv(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Tu(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,xr!==null&&(Gg(xr),xr=null))),Bg(t,e),ct(e),null;case 5:nv(e);var i=Li(el.current);if(r=e.type,t!==null&&e.stateNode!=null)y5(t,e,r,n,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(U(166));return ct(e),null}if(t=Li(Kr.current),Tu(e)){n=e.stateNode,r=e.type;var s=e.memoizedProps;switch(n[Wr]=e,n[Ja]=s,t=(e.mode&1)!==0,r){case"dialog":Oe("cancel",n),Oe("close",n);break;case"iframe":case"object":case"embed":Oe("load",n);break;case"video":case"audio":for(i=0;i<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[Wr]=e,t[Ja]=n,g5(t,e,!1,!1),e.stateNode=t;e:{switch(o=fg(r,n),r){case"dialog":Oe("cancel",t),Oe("close",t),i=n;break;case"iframe":case"object":case"embed":Oe("load",t),i=n;break;case"video":case"audio":for(i=0;iNo&&(e.flags|=128,n=!0,sa(s,!1),e.lanes=4194304)}else{if(!n)if(t=Fc(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),sa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ne)return ct(e),null}else 2*qe()-s.renderingStartTime>No&&r!==1073741824&&(e.flags|=128,n=!0,sa(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(r=s.last,r!==null?r.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=qe(),e.sibling=null,r=De.current,Pe(De,n?r&1|2:r&1),e):(ct(e),null);case 22:case 23:return mv(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?$t&1073741824&&(ct(e),e.subtreeFlags&6&&(e.flags|=8192)):ct(e),null;case 24:return null;case 25:return null}throw Error(U(156,e.tag))}function wO(t,e){switch(K0(e),e.tag){case 1:return At(e.type)&&Nc(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ro(),Re(Pt),Re(mt),iv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return nv(e),null;case 13:if(Re(De),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(U(340));Io()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Re(De),null;case 4:return Ro(),null;case 10:return Z0(e.type._context),null;case 22:case 23:return mv(),null;case 24:return null;default:return null}}var Au=!1,pt=!1,_O=typeof WeakSet=="function"?WeakSet:Set,V=null;function Ws(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){$e(t,e,n)}else r.current=null}function $g(t,e,r){try{r()}catch(n){$e(t,e,n)}}var g1=!1;function bO(t,e){if(xg=Ic,t=xC(),V0(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,l=-1,u=0,c=0,f=t,d=null;t:for(;;){for(var g;f!==r||i!==0&&f.nodeType!==3||(a=o+i),f!==s||n!==0&&f.nodeType!==3||(l=o+n),f.nodeType===3&&(o+=f.nodeValue.length),(g=f.firstChild)!==null;)d=f,f=g;for(;;){if(f===t)break t;if(d===r&&++u===i&&(a=o),d===s&&++c===n&&(l=o),(g=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=g}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(Sg={focusedElem:t,selectionRange:r},Ic=!1,V=e;V!==null;)if(e=V,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,V=t;else for(;V!==null;){e=V;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var b=v.memoizedProps,w=v.memoizedState,p=e.stateNode,m=p.getSnapshotBeforeUpdate(e.elementType===e.type?b:wr(e.type,b),w);p.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var y=e.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(U(163))}}catch(x){$e(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,V=t;break}V=e.return}return v=g1,g1=!1,v}function Ea(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&$g(e,r,s)}i=i.next}while(i!==n)}}function pf(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Ug(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function w5(t){var e=t.alternate;e!==null&&(t.alternate=null,w5(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Wr],delete e[Ja],delete e[Tg],delete e[nO],delete e[iO])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function _5(t){return t.tag===5||t.tag===3||t.tag===4}function y1(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||_5(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Fg(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Mc));else if(n!==4&&(t=t.child,t!==null))for(Fg(t,e,r),t=t.sibling;t!==null;)Fg(t,e,r),t=t.sibling}function qg(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(qg(t,e,r),t=t.sibling;t!==null;)qg(t,e,r),t=t.sibling}var st=null,br=!1;function kn(t,e,r){for(r=r.child;r!==null;)b5(t,e,r),r=r.sibling}function b5(t,e,r){if(Qr&&typeof Qr.onCommitFiberUnmount=="function")try{Qr.onCommitFiberUnmount(of,r)}catch{}switch(r.tag){case 5:pt||Ws(r,e);case 6:var n=st,i=br;st=null,kn(t,e,r),st=n,br=i,st!==null&&(br?(t=st,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):st.removeChild(r.stateNode));break;case 18:st!==null&&(br?(t=st,r=r.stateNode,t.nodeType===8?Oh(t.parentNode,r):t.nodeType===1&&Oh(t,r),Va(t)):Oh(st,r.stateNode));break;case 4:n=st,i=br,st=r.stateNode.containerInfo,br=!0,kn(t,e,r),st=n,br=i;break;case 0:case 11:case 14:case 15:if(!pt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&$g(r,e,o),i=i.next}while(i!==n)}kn(t,e,r);break;case 1:if(!pt&&(Ws(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){$e(r,e,a)}kn(t,e,r);break;case 21:kn(t,e,r);break;case 22:r.mode&1?(pt=(n=pt)||r.memoizedState!==null,kn(t,e,r),pt=n):kn(t,e,r);break;default:kn(t,e,r)}}function v1(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new _O),e.forEach(function(n){var i=IO.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function yr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=qe()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*SO(n/1960))-n,10t?16:t,Zn===null)var n=!1;else{if(t=Zn,Zn=null,Gc=0,ge&6)throw Error(U(331));var i=ge;for(ge|=4,V=t.current;V!==null;){var s=V,o=s.child;if(V.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lqe()-hv?Xi(t,0):fv|=r),It(t,e)}function A5(t,e){e===0&&(t.mode&1?(e=_u,_u<<=1,!(_u&130023424)&&(_u=4194304)):e=1);var r=_t();t=mn(t,e),t!==null&&(Yl(t,e,r),It(t,r))}function AO(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),A5(t,r)}function IO(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(U(314))}n!==null&&n.delete(e),A5(t,r)}var I5;I5=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Pt.current)kt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return kt=!1,yO(t,e,r);kt=!!(t.flags&131072)}else kt=!1,Ne&&e.flags&1048576&&MC(e,Lc,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;ac(t,e),t=e.pendingProps;var i=Ao(e,mt.current);no(e,r),i=ov(null,e,n,t,i,r);var s=av();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,At(n)?(s=!0,Dc(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,tv(e),i.updater=ff,e.stateNode=i,i._reactInternals=e,Rg(e,n,t,r),e=Dg(null,e,n,!0,s,r)):(e.tag=0,Ne&&s&&Q0(e),wt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(ac(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=RO(n),t=wr(n,t),i){case 0:e=Ng(null,e,n,t,r);break e;case 1:e=h1(null,e,n,t,r);break e;case 11:e=d1(null,e,n,t,r);break e;case 14:e=f1(null,e,n,wr(n.type,t),r);break e}throw Error(U(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:wr(n,i),Ng(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:wr(n,i),h1(t,e,n,i,r);case 3:e:{if(h5(e),t===null)throw Error(U(387));n=e.pendingProps,s=e.memoizedState,i=s.element,LC(t,e),Uc(e,n,null,r);var o=e.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Mo(Error(U(423)),e),e=p1(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(U(424)),e),e=p1(t,e,n,r,i);break e}else for(Ft=si(e.stateNode.containerInfo.firstChild),Ht=e,Ne=!0,xr=null,r=FC(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Io(),n===i){e=gn(t,e,r);break e}wt(t,e,n,r)}e=e.child}return e;case 5:return qC(e),t===null&&Ag(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Cg(n,i)?o=null:s!==null&&Cg(n,s)&&(e.flags|=32),f5(t,e),wt(t,e,o,r),e.child;case 6:return t===null&&Ag(e),null;case 13:return p5(t,e,r);case 4:return rv(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Oo(e,null,n,r):wt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:wr(n,i),d1(t,e,n,i,r);case 7:return wt(t,e,e.pendingProps,r),e.child;case 8:return wt(t,e,e.pendingProps.children,r),e.child;case 12:return wt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Pe(Bc,n._currentValue),n._currentValue=o,s!==null)if(Pr(s.value,o)){if(s.children===i.children&&!Pt.current){e=gn(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=dn(-1,r&-r),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ig(s.return,r,e),a.lanes|=r;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(U(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ig(o,r,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}wt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,no(e,r),i=dr(i),n=n(i),e.flags|=1,wt(t,e,n,r),e.child;case 14:return n=e.type,i=wr(n,e.pendingProps),i=wr(n.type,i),f1(t,e,n,i,r);case 15:return c5(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:wr(n,i),ac(t,e),e.tag=1,At(n)?(t=!0,Dc(e)):t=!1,no(e,r),$C(e,n,i),Rg(e,n,i,r),Dg(null,e,n,!0,t,r);case 19:return m5(t,e,r);case 22:return d5(t,e,r)}throw Error(U(156,e.tag))};function O5(t,e){return nC(t,e)}function OO(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rr(t,e,r,n){return new OO(t,e,r,n)}function yv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function RO(t){if(typeof t=="function")return yv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===j0)return 11;if(t===L0)return 14}return 2}function ui(t,e){var r=t.alternate;return r===null?(r=rr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function cc(t,e,r,n,i,s){var o=2;if(n=t,typeof t=="function")yv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case js:return Ji(r.children,i,s,e);case D0:o=8,i|=8;break;case rg:return t=rr(12,r,e,i|2),t.elementType=rg,t.lanes=s,t;case ng:return t=rr(13,r,e,i),t.elementType=ng,t.lanes=s,t;case ig:return t=rr(19,r,e,i),t.elementType=ig,t.lanes=s,t;case US:return gf(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case BS:o=10;break e;case $S:o=9;break e;case j0:o=11;break e;case L0:o=14;break e;case Ln:o=16,n=null;break e}throw Error(U(130,t==null?t:typeof t,""))}return e=rr(o,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function Ji(t,e,r,n){return t=rr(7,t,n,e),t.lanes=r,t}function gf(t,e,r,n){return t=rr(22,t,n,e),t.elementType=US,t.lanes=r,t.stateNode={isHidden:!1},t}function $h(t,e,r){return t=rr(6,t,null,e),t.lanes=r,t}function Uh(t,e,r){return e=rr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function MO(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_h(0),this.expirationTimes=_h(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_h(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function vv(t,e,r,n,i,s,o,a,l){return t=new MO(t,e,r,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=rr(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},tv(s),t}function NO(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(D5)}catch(t){console.error(t)}}D5(),MS.exports=Gt;var xv=MS.exports,T1=xv;eg.createRoot=T1.createRoot,eg.hydrateRoot=T1.hydrateRoot;function j5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e"u"||!window.document)return n;var i=document.createElement("style");document.head.appendChild(i);var s=i.sheet,o=` @keyframes `.concat(n,` { `).concat(e,` } - `);return s&&s.insertRule(o,0),n},Kc=globalThis&&globalThis.__assign||function(){return Kc=Object.assign||function(t){for(var e,r=1,n=arguments.length;rconsole.warn(l,"-",f)))}function o(l){return r.default.dim(l)}const a={info(l,u){s(r.default.bold(r.default.cyan("info")),...Array.isArray(l)?[l]:[u,l])},warn(l,u){s(r.default.bold(r.default.yellow("warn")),...Array.isArray(l)?[l]:[u,l])},risk(l,u){s(r.default.bold(r.default.magenta("risk")),...Array.isArray(l)?[l]:[u,l])}}})(B5);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});const e=r(B5);function r(s){return s&&s.__esModule?s:{default:s}}function n({version:s,from:o,to:a}){e.default.warn(`${o}-color-renamed`,[`As of Tailwind CSS ${s}, \`${o}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const i={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return n({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return n({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return n({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return n({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return n({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(L5);let Fh=L5;var WO=(Fh.__esModule?Fh:{default:Fh}).default;const GO=yn(WO);function U5({message:t,items:e,staticPosition:r}){return _.jsxs(Sv,{status:"loading",staticPosition:r,className:"flex-col",children:[_.jsxs("div",{className:"flex items-center justify-center gap-3",children:[Vg,t,Vg]}),e&&_.jsx("div",{className:"flex flex-col",children:e.map(n=>_.jsx(VO,{...n},n.message))})]})}function VO({message:t,status:e}){let r=Vg;switch(e){case"error":r=_.jsx("p",{children:"❌"});break;case"success":r=_.jsx("p",{children:"✅"});break}return _.jsxs("div",{className:"flex items-center justify-between gap-2",children:[_.jsx("p",{children:t}),r]})}const Vg=_.jsx(HO,{color:GO.lime[100],loading:!0,speedMultiplier:.5,height:16,width:3,radius:10}),ys={gcTime:1/0,staleTime:1/0,retry:1,retryOnMount:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1};function QO(t){const r=(t instanceof DocumentFragment?t:t[0]).cloneNode(!0),n=document.createElement("div");n.appendChild(r);const i=n.innerHTML;return n.remove(),i}function KO(t){const e=document.getElementById(t);if(!e)throw Error(`Template with id "${t}" not found.`);if(e.tagName!=="TEMPLATE")throw Error(`Element with id "${t}" is not a template.`);return e.content.cloneNode(!0)}async function P1(t,e){return new Promise(r=>{var s;(s=document.getElementById(t))==null||s.remove();const[n]=document.getElementsByTagName("head"),i=document.createElement("script");i.id=`slime2script.${t}`,i.src=`${e}?loadedAt=${Date.now()}`,i.async=!0,n.appendChild(i),i.onload=async()=>{r(!0)},i.onerror=async()=>{r(!1)}})}function vs(){}let YO=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");function bf(){return I.useContext(F5)}const F5=I.createContext({unsavedChanges:!1,setUnsavedChanges:vs}),q5={};function Ev(){return I.useContext(H5)}function xf(){const t=I.useContext(z5),{setUnsavedChanges:e}=bf();function r(u){t({type:"load-defaults",settings:u})}function n(u){t({type:"load-values",values:u})}function i(u,c,f){e(!0),t({type:"update-value",id:c,groupId:u,value:f})}function s(u,c,f){e(!0),t({type:"add-group-multiple",groupId:u,id:c,settingItems:f})}function o(u,c,f){e(!0),t({type:"copy-group-multiple",groupId:u,id:c,index:f})}function a(u,c,f){e(!0),t({type:"remove-group-multiple",groupId:u,id:c,index:f})}function l(u,c,f,d){e(!0),t({type:"move-group-multiple",groupId:u,id:c,currentIndex:f,newIndex:d})}return{loadDefaults:r,loadValues:n,update:i,addGroupMultiple:s,copyGroupMultiple:o,removeGroupMultiple:a,moveGroupMultiple:l}}const H5=I.createContext(q5),z5=I.createContext(vs);function XO(t,e){var r;switch(e.type){case"load-defaults":return Vs(e.settings,t);case"load-values":return e.values;case"update-value":{const{groupId:n,id:i}=e;let{value:s}=e;if(s!==null&&typeof s!="boolean"&&typeof s!="string"&&typeof s!="number"&&!Array.isArray(s))return t;Array.isArray(s)&&(s=s.filter(l=>typeof l=="string"||typeof l=="boolean"||typeof l=="number"));const o=(r=Ri(t,n))==null?void 0:r[i];if(!Array.isArray(s)&&s===o||Array.isArray(s)&&Array.isArray(o)&&JSON.stringify(s.toSorted())===JSON.stringify(o.toSorted()))return t;const a=JSON.parse(JSON.stringify(t));return ZO(a,n,i,s),a}case"add-group-multiple":{const{groupId:n,id:i,settingItems:s}=e,o=JSON.parse(JSON.stringify(t)),a=Ri(o,n);if(a){const l=a[i];Array.isArray(l)&&(a[i]=[...l,{...Vs(s),__id:Yc(i)}])}return o}case"copy-group-multiple":{const{groupId:n,id:i,index:s}=e,o=JSON.parse(JSON.stringify(t)),a=Ri(o,n);if(a){const l=a[i];if(Array.isArray(l)){const u=JSON.parse(JSON.stringify(l[s]));a[i]=l.toSpliced(s,0,{...u,__id:Yc(i)})}}return o}case"move-group-multiple":{const{groupId:n,id:i,currentIndex:s,newIndex:o}=e;if(o<0||s===o)return t;const a=JSON.parse(JSON.stringify(t)),l=Ri(a,n);if(l){const u=l[i];if(Array.isArray(u)){if(o>=u.length)return t;const[c]=u.splice(s,1);u.splice(o,0,c)}}return a}case"remove-group-multiple":{const{groupId:n,id:i,index:s}=e,o=JSON.parse(JSON.stringify(t)),a=Ri(o,n);if(a){const l=a[i];Array.isArray(l)&&(a[i]=l.filter((u,c)=>s!==c))}return o}}}function Vs(t,e={}){const r=!e||typeof e!="object"||Array.isArray(e)?{}:JSON.parse(JSON.stringify(e)),n=new Map;for(const i of t){if(i.id==="__id")throw Error("__id cannot be used as a setting ID!");if(!i.id)throw Error("A widget setting is missing an ID! All widget settings must have a unique ID.");if(n.get(i.id))throw Error(`Two widget settings have the same ID of '${i.id}'! All widget settings must have a unique ID.`);n.set(i.id,!0);const s=JO(i,r,r[i.id]);s!==void 0&&(r[i.id]=s)}return r}function JO(t,e,r){function n(a){return typeof a=="string"}function i(a){return typeof a=="string"||typeof a=="boolean"||typeof a=="number"}function s(a){return!!a&&typeof a=="object"}function o(a){return{...Vs(t.settings,a),__id:Yc(t.id)}}switch(t.type){case"boolean-input":return typeof r=="boolean"?r:typeof t.defaultValue=="boolean"?t.defaultValue:!1;case"number-input":return typeof r=="number"||r===null?r:typeof t.defaultValue=="number"?t.defaultValue:null;case"font-input":case"color-input":return typeof r=="string"?r:typeof t.defaultValue=="string"?t.defaultValue:"";case"text-input":return"multiple"in t&&t.multiple?Array.isArray(r)?r.filter(n):Array.isArray(t.defaultValue)?t.defaultValue.filter(n):[]:typeof r=="string"?r:typeof t.defaultValue=="string"?t.defaultValue:"";case"image-input":case"video-input":case"audio-input":return"multiple"in t&&t.multiple?Array.isArray(r)?r.filter(n):Array.isArray(t.defaultValue)?t.defaultValue.filter(n):[]:typeof r=="string"||r===null?r:typeof t.defaultValue=="string"?t.defaultValue:null;case"dropdown-input":return typeof r=="string"||typeof r=="boolean"||typeof r=="number"?r:typeof t.defaultValue=="string"||typeof t.defaultValue=="boolean"||typeof t.defaultValue=="number"?t.defaultValue:t.options.length?t.options[0].value:null;case"select-input":return"multiple"in t&&t.multiple?Array.isArray(r)?r.filter(i):Array.isArray(t.defaultValue)?t.defaultValue.filter(i):[]:typeof r=="string"||typeof r=="boolean"||typeof r=="number"?r:typeof t.defaultValue=="string"||typeof t.defaultValue=="boolean"||typeof t.defaultValue=="number"?t.defaultValue:t.options.length?t.options[0].value:null;case"group":return"multiple"in t&&t.multiple?Array.isArray(r)?r.filter(s).map(o):Array.isArray(t.defaultValues)?t.defaultValues.filter(s).map(o):[{...Vs(t.settings),__id:Yc(t.id)}]:r&&typeof r=="object"&&!Array.isArray(r)?Vs(t.settings,r):Vs(t.settings,e[t.id]);default:return}}function Yc(t){return`${t}_${YO()}`}function Ri(t,e){let r=t;for(let n=0;n{const y=d==="youtube"?"google":d;return P1(`${d}.key`,`SLIME2_${y.toUpperCase()}_KEY.js`)}))).reduce((d,y)=>y&&d,!0)}function i(u,c){t({type:"set-key",provider:u,key:c})}function s(u){t({type:"set-max-events",maxEvents:u})}function o(u){t({type:"set-event-delay",delay:u})}function a(u,c){t({type:"set-event-expiration",expiration:u,options:c})}function l(u,c){if(typeof u!="string"||!u.endsWith(".js"))throw Error('The first parameter of createWidgetSettings must be a string that ends in ".js"');if(!Array.isArray(c))throw Error("The second parameter of createWidgetSettings must be an array of objects");P1("widget.data",u).finally(()=>e(c)),t({type:"create-widget-settings",settings:c,dataFileName:u})}return{onEvent:r,setKey:i,setPlatform:n,setMaxEvents:s,setEventDelay:o,setEventExpiration:a,createWidgetSettings:l}}const W5={sendEvent:vs,maxEvents:100,platforms:[],widgetSettings:[],widgetDataFileName:"",keys:{twitch:"",google:""}},G5=I.createContext(W5),V5=I.createContext(vs);function tR(t,e){switch(e.type){case"set-platform":return{...t,platforms:Array.isArray(e.platform)?e.platform:[e.platform]};case"set-key":return{...t,keys:{...t.keys,[e.provider]:e.key}};case"set-on-event":return{...t,sendEvent:e.onEvent};case"set-max-events":return{...t,maxEvents:e.maxEvents};case"set-event-expiration":return{...t,eventExpiration:e.expiration,eventExpirationOptions:e.options};case"set-event-delay":return{...t,eventDelay:e.delay};case"create-widget-settings":return{...t,widgetSettings:e.settings,widgetDataFileName:e.dataFileName}}}function We(t,e){let r=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(e[0])||(e=e.map(o=>[o]));let n=e[0].length,i=e[0].map((o,a)=>e.map(l=>l[a])),s=t.map(o=>i.map(a=>{let l=0;if(!Array.isArray(o)){for(let u of a)l+=o*u;return l}for(let u=0;uo[0]):s}function eu(t){return ci(t)==="string"}function ci(t){return(Object.prototype.toString.call(t).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Xc(t,e){t=+t,e=+e;let r=(Math.floor(t)+"").length;if(e>r)return+t.toFixed(e-r);{let n=10**(r-e);return Math.round(t/n)*n}}function Q5(t){if(!t)return;t=t.trim();const e=/^([a-z]+)\((.+?)\)$/i,r=/^-?[\d.]+$/;let n=t.match(e);if(n){let i=[];return n[2].replace(/\/?\s*([-\w.]+(?:%|deg)?)/g,(s,o)=>{/%$/.test(o)?(o=new Number(o.slice(0,-1)/100),o.type=""):/deg$/.test(o)?(o=new Number(+o.slice(0,-3)),o.type="",o.unit="deg"):r.test(o)&&(o=new Number(o),o.type=""),s.startsWith("/")&&(o=o instanceof Number?o:new Number(o),o.alpha=!0),i.push(o)}),{name:n[1].toLowerCase(),rawName:n[1],rawArgs:n[2],args:i}}}function K5(t){return t[t.length-1]}function Jc(t,e,r){return isNaN(t)?e:isNaN(e)?t:t+(e-t)*r}function Y5(t,e,r){return(r-t)/(e-t)}function Tv(t,e,r){return Jc(e[0],e[1],Y5(t[0],t[1],r))}function X5(t){return t.map(e=>e.split("|").map(r=>{r=r.trim();let n=r.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(n){let i=new String(n[1]);return i.range=[+n[2],+n[3]],i}return r}))}var rR=Object.freeze({__proto__:null,interpolate:Jc,interpolateInv:Y5,isString:eu,last:K5,mapRange:Tv,multiplyMatrices:We,parseCoordGrammar:X5,parseFunction:Q5,toPrecision:Xc,type:ci});class nR{add(e,r,n){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(i){this[i]=this[i]||[],r&&this[i][n?"unshift":"push"](r)},this)}run(e,r){this[e]=this[e]||[],this[e].forEach(function(n){n.call(r&&r.context?r.context:r,r)})}}const pi=new nR;var Yr={gamut_mapping:"lch.c",precision:5,deltaE:"76"};const Cr={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function Qg(t){return Array.isArray(t)?t:Cr[t]}function Zc(t,e,r,n={}){if(t=Qg(t),e=Qg(e),!t||!e)throw new TypeError(`Missing white point to convert ${t?"":"from"}${!t&&!e?"/":""}${e?"":"to"}`);if(t===e)return r;let i={W1:t,W2:e,XYZ:r,options:n};if(pi.run("chromatic-adaptation-start",i),i.M||(i.W1===Cr.D65&&i.W2===Cr.D50?i.M=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]]:i.W1===Cr.D50&&i.W2===Cr.D65&&(i.M=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]])),pi.run("chromatic-adaptation-end",i),i.M)return We(i.M,i.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const iR=75e-6,Lt=class Lt{constructor(e){var i,s,o;this.id=e.id,this.name=e.name,this.base=e.base?Lt.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let r=e.coords??this.base.coords;for(let a in r)"name"in r[a]||(r[a].name=a);this.coords=r;let n=e.white??this.base.white??"D65";this.white=Qg(n),this.formats=e.formats??{};for(let a in this.formats){let l=this.formats[a];l.type||(l.type="function"),l.name||(l.name=a)}e.cssId&&!((i=this.formats.functions)!=null&&i.color)?(this.formats.color={id:e.cssId},Object.defineProperty(this,"cssId",{value:e.cssId})):(s=this.formats)!=null&&s.color&&!((o=this.formats)!=null&&o.color.id)&&(this.formats.color.id=this.id),this.referred=e.referred,Object.defineProperty(this,"path",{value:sR(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),pi.run("colorspace-init-end",this)}inGamut(e,{epsilon:r=iR}={}){if(this.isPolar)return e=this.toBase(e),this.base.inGamut(e,{epsilon:r});let n=Object.values(this.coords);return e.every((i,s)=>{let o=n[s];if(o.type!=="angle"&&o.range){if(Number.isNaN(i))return!0;let[a,l]=o.range;return(a===void 0||i>=a-r)&&(l===void 0||i<=l+r)}return!0})}get cssId(){var e,r;return((r=(e=this.formats.functions)==null?void 0:e.color)==null?void 0:r.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=A1(e,this),e;let r;return e==="default"?r=Object.values(this.formats)[0]:r=this.formats[e],r?(r=A1(r,this),r):null}equals(e){return e?this===e||this.id===e.id:!1}to(e,r){if(arguments.length===1&&([e,r]=[e.space,e.coords]),e=Lt.get(e),this.equals(e))return r;r=r.map(a=>Number.isNaN(a)?0:a);let n=this.path,i=e.path,s,o;for(let a=0;ao;a--)r=n[a].toBase(r);for(let a=o+1;a=0){let u=Object.entries(i.coords)[s];if(u)return{space:i,id:u[0],index:s,...u[1]}}i=Lt.get(i);let o=s.toLowerCase(),a=0;for(let u in i.coords){let c=i.coords[u];if(u.toLowerCase()===o||((l=c.name)==null?void 0:l.toLowerCase())===o)return{space:i,id:u,index:a,...c};a++}throw new TypeError(`No "${s}" coordinate found in ${i.name}. Its coordinates are: ${Object.keys(i.coords).join(", ")}`)}};Mr(Lt,"registry",{}),Mr(Lt,"DEFAULT_FORMAT",{type:"functions",name:"color"});let re=Lt;function sR(t){let e=[t];for(let r=t;r=r.base;)e.push(r);return e}function A1(t,{coords:e}={}){if(t.coords&&!t.coordGrammar){t.type||(t.type="function"),t.name||(t.name="color"),t.coordGrammar=X5(t.coords);let r=Object.entries(e).map(([n,i],s)=>{let o=t.coordGrammar[s][0],a=i.range||i.refRange,l=o.range,u="";return o==""?(l=[0,100],u="%"):o==""&&(u="deg"),{fromRange:a,toRange:l,suffix:u}});t.serializeCoords=(n,i)=>n.map((s,o)=>{let{fromRange:a,toRange:l,suffix:u}=r[o];return a&&l&&(s=Tv(a,l,s)),s=Xc(s,i),u&&(s+=u),s})}return t}var sr=new re({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class Rt extends re{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=sr),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=r=>{let n=We(e.toXYZ_M,r);return this.white!==this.base.white&&(n=Zc(this.white,this.base.white,n)),n}),e.fromBase??(e.fromBase=r=>(r=Zc(this.base.white,this.white,r),We(e.fromXYZ_M,r)))),e.referred??(e.referred="display"),super(e)}}function J5(t,{meta:e}={}){var n,i,s,o,a;let r={str:(n=String(t))==null?void 0:n.trim()};if(pi.run("parse-start",r),r.color)return r.color;if(r.parsed=Q5(r.str),r.parsed){let l=r.parsed.name;if(l==="color"){let u=r.parsed.args.shift(),c=r.parsed.rawArgs.indexOf("/")>0?r.parsed.args.pop():1;for(let d of re.all){let y=d.getFormat("color");if(y&&(u===y.id||(i=y.ids)!=null&&i.includes(u))){const v=Object.keys(d.coords).map((b,w)=>r.parsed.args[w]||0);return e&&(e.formatId="color"),{spaceId:d.id,coords:v,alpha:c}}}let f="";if(u in re.registry){let d=(a=(o=(s=re.registry[u].formats)==null?void 0:s.functions)==null?void 0:o.color)==null?void 0:a.id;d&&(f=`Did you mean color(${d})?`)}throw new TypeError(`Cannot parse color(${u}). `+(f||"Missing a plugin?"))}else for(let u of re.all){let c=u.getFormat(l);if(c&&c.type==="function"){let f=1;(c.lastAlpha||K5(r.parsed.args).alpha)&&(f=r.parsed.args.pop());let d=r.parsed.args,y;return c.coordGrammar&&(y=Object.entries(u.coords).map(([v,b],w)=>{var k;let p=c.coordGrammar[w],m=(k=d[w])==null?void 0:k.type,g=p.find(R=>R==m);if(!g){let R=b.name||v;throw new TypeError(`${m} not allowed for ${R} in ${l}()`)}let x=g.range;m===""&&(x||(x=[0,1]));let S=b.range||b.refRange;return x&&S&&(d[w]=Tv(x,S,d[w])),g})),e&&Object.assign(e,{formatId:c.name,types:y}),{spaceId:u.id,coords:d,alpha:f}}}}else for(let l of re.all)for(let u in l.formats){let c=l.formats[u];if(c.type!=="custom"||c.test&&!c.test(r.str))continue;let f=c.parse(r.str);if(f)return f.alpha??(f.alpha=1),e&&(e.formatId=u),f}throw new TypeError(`Could not parse ${t} as a color. Missing a plugin?`)}function be(t){if(!t)throw new TypeError("Empty color reference");eu(t)&&(t=J5(t));let e=t.space||t.spaceId;return e instanceof re||(t.space=re.get(e)),t.alpha===void 0&&(t.alpha=1),t}function tu(t,e){return e=re.get(e),e.from(t)}function or(t,e){let{space:r,index:n}=re.resolveCoord(e,t.space);return tu(t,r)[n]}function Z5(t,e,r){return e=re.get(e),t.coords=e.to(t.space,r),t}function mi(t,e,r){if(t=be(t),arguments.length===2&&ci(arguments[1])==="object"){let n=arguments[1];for(let i in n)mi(t,i,n[i])}else{typeof r=="function"&&(r=r(or(t,e)));let{space:n,index:i}=re.resolveCoord(e,t.space),s=tu(t,n);s[i]=r,Z5(t,n,s)}return t}var kv=new re({id:"xyz-d50",name:"XYZ D50",white:"D50",base:sr,fromBase:t=>Zc(sr.white,"D50",t),toBase:t=>Zc("D50",sr.white,t),formats:{color:{}}});const oR=216/24389,I1=24/116,Mu=24389/27;let qh=Cr.D50;var qt=new re({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"L"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:qh,base:kv,fromBase(t){let r=t.map((n,i)=>n/qh[i]).map(n=>n>oR?Math.cbrt(n):(Mu*n+16)/116);return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[2])]},toBase(t){let e=[];return e[1]=(t[0]+16)/116,e[0]=t[1]/500+e[1],e[2]=e[1]-t[2]/200,[e[0]>I1?Math.pow(e[0],3):(116*e[0]-16)/Mu,t[0]>8?Math.pow((t[0]+16)/116,3):t[0]/Mu,e[2]>I1?Math.pow(e[2],3):(116*e[2]-16)/Mu].map((n,i)=>n*qh[i])},formats:{lab:{coords:[" | "," | [-1,1]"," | [-1,1]"]}}});function Sf(t){return(t%360+360)%360}function aR(t,e){if(t==="raw")return e;let[r,n]=e.map(Sf),i=n-r;return t==="increasing"?i<0&&(n+=360):t==="decreasing"?i>0&&(r+=360):t==="longer"?-1800?r+=360:n+=360):t==="shorter"&&(i>180?r+=360:i<-180&&(n+=360)),[r,n]}var sl=new re({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:qt,fromBase(t){let[e,r,n]=t,i;const s=.02;return Math.abs(r) | "," | "," | "]}}});const O1=25**7,ed=Math.PI,R1=180/ed,Es=ed/180;function Kg(t,e,{kL:r=1,kC:n=1,kH:i=1}={}){let[s,o,a]=qt.from(t),l=sl.from(qt,[s,o,a])[1],[u,c,f]=qt.from(e),d=sl.from(qt,[u,c,f])[1];l<0&&(l=0),d<0&&(d=0);let v=((l+d)/2)**7,b=.5*(1-Math.sqrt(v/(v+O1))),w=(1+b)*o,p=(1+b)*c,m=Math.sqrt(w**2+a**2),g=Math.sqrt(p**2+f**2),x=w===0&&a===0?0:Math.atan2(a,w),S=p===0&&f===0?0:Math.atan2(f,p);x<0&&(x+=2*ed),S<0&&(S+=2*ed),x*=R1,S*=R1;let k=u-s,R=g-m,O=S-x,$=x+S,G=Math.abs(O),ee;m*g===0?ee=0:G<=180?ee=O:O>180?ee=O-360:O<-180?ee=O+360:console.log("the unthinkable has happened");let fe=2*Math.sqrt(g*m)*Math.sin(ee*Es/2),he=(s+u)/2,P=(m+g)/2,j=Math.pow(P,7),Q;m*g===0?Q=$:G<=180?Q=$/2:$<360?Q=($+360)/2:Q=($-360)/2;let le=(he-50)**2,B=1+.015*le/Math.sqrt(20+le),H=1+.045*P,Y=1;Y-=.17*Math.cos((Q-30)*Es),Y+=.24*Math.cos(2*Q*Es),Y+=.32*Math.cos((3*Q+6)*Es),Y-=.2*Math.cos((4*Q-63)*Es);let se=1+.015*P*Y,ye=30*Math.exp(-1*((Q-275)/25)**2),Mt=2*Math.sqrt(j/(j+O1)),Nt=-1*Math.sin(2*ye*Es)*Mt,Or=(k/(r*B))**2;return Or+=(R/(n*H))**2,Or+=(fe/(i*se))**2,Or+=Nt*(R/(n*H))*(fe/(i*se)),Math.sqrt(Or)}const lR=75e-6;function Pa(t,e=t.space,{epsilon:r=lR}={}){t=be(t),e=re.get(e);let n=t.coords;return e!==t.space&&(n=e.from(t)),e.inGamut(n,{epsilon:r})}function ol(t){return{space:t.space,coords:t.coords.slice(),alpha:t.alpha}}function gi(t,{method:e=Yr.gamut_mapping,space:r=t.space}={}){if(eu(arguments[1])&&(r=arguments[1]),r=re.get(r),Pa(t,r,{epsilon:0}))return be(t);let n=nr(t,r);if(e!=="clip"&&!Pa(t,r)){let i=gi(ol(n),{method:"clip",space:r});if(Kg(t,i)>2){let s=re.resolveCoord(e),o=s.space,a=s.id,l=nr(n,o),c=(s.range||s.refRange)[0],f=.01,d=c,y=or(l,a);for(;y-d>f;){let v=ol(l);v=gi(v,{space:r,method:"clip"}),Kg(l,v)-2s.range||[]);n.coords=n.coords.map((s,o)=>{let[a,l]=i[o];return a!==void 0&&(s=Math.max(a,s)),l!==void 0&&(s=Math.min(s,l)),s})}return r!==t.space&&(n=nr(n,t.space)),t.coords=n.coords,t}gi.returns="color";function nr(t,e,{inGamut:r}={}){t=be(t),e=re.get(e);let n=e.from(t),i={space:e,coords:n,alpha:t.alpha};return r&&(i=gi(i)),i}nr.returns="color";function td(t,{precision:e=Yr.precision,format:r="default",inGamut:n=!0,...i}={}){var l;let s;t=be(t);let o=r;r=t.space.getFormat(r)??t.space.getFormat("default")??re.DEFAULT_FORMAT,n||(n=r.toGamut);let a=t.coords;if(a=a.map(u=>u||0),n&&!Pa(t)&&(a=gi(ol(t),n===!0?void 0:n).coords),r.type==="custom")if(i.precision=e,r.serialize)s=r.serialize(a,t.alpha,i);else throw new TypeError(`format ${o} can only be used to parse colors, not for serialization`);else{let u=r.name||"color";r.serializeCoords?a=r.serializeCoords(a,e):e!==null&&(a=a.map(y=>Xc(y,e)));let c=[...a];if(u==="color"){let y=r.id||((l=r.ids)==null?void 0:l[0])||t.space.id;c.unshift(y)}let f=t.alpha;e!==null&&(f=Xc(f,e));let d=t.alpha<1&&!r.noAlpha?`${r.commas?",":" /"} ${f}`:"";s=`${u}(${c.join(r.commas?", ":" ")}${d})`}return s}const uR=[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],cR=[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]];var Cf=new Rt({id:"rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:uR,fromXYZ_M:cR,formats:{color:{}}});const Nu=1.09929682680944,M1=.018053968510807;var eE=new Rt({id:"rec2020",name:"REC.2020",base:Cf,toBase(t){return t.map(function(e){return e=M1?Nu*Math.pow(e,.45)-(Nu-1):4.5*e})},formats:{color:{}}});const dR=[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fR=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]];var tE=new Rt({id:"p3-linear",name:"Linear P3",white:"D65",toXYZ_M:dR,fromXYZ_M:fR});const hR=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],pR=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]];var rE=new Rt({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:hR,fromXYZ_M:pR,formats:{color:{}}}),N1={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let D1=Array(3).fill(" | [0, 255]"),j1=Array(3).fill("[0, 255]");var al=new Rt({id:"srgb",name:"sRGB",base:rE,fromBase:t=>t.map(e=>{let r=e<0?-1:1,n=e*r;return n>.0031308?r*(1.055*n**(1/2.4)-.055):12.92*e}),toBase:t=>t.map(e=>{let r=e<0?-1:1,n=e*r;return n<.04045?e/12.92:r*((n+.055)/1.055)**2.4}),formats:{rgb:{coords:D1},rgb_number:{name:"rgb",commas:!0,coords:j1,noAlpha:!0},color:{},rgba:{coords:D1,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:j1},hex:{type:"custom",toGamut:!0,test:t=>/^#([a-f0-9]{3,4}){1,2}$/i.test(t),parse(t){t.length<=5&&(t=t.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return t.replace(/[a-f0-9]{2}/gi,r=>{e.push(parseInt(r,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(t,e,{collapse:r=!0}={})=>{e<1&&t.push(e),t=t.map(s=>Math.round(s*255));let n=r&&t.every(s=>s%17===0);return"#"+t.map(s=>n?(s/17).toString(16):s.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:t=>/^[a-z]+$/i.test(t),parse(t){t=t.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(t==="transparent"?(e.coords=N1.black,e.alpha=0):e.coords=N1[t],e.coords)return e}}}}),nE=new Rt({id:"p3",name:"P3",base:tE,fromBase:al.fromBase,toBase:al.toBase,formats:{color:{id:"display-p3"}}});Yr.display_space=al;if(typeof CSS<"u"&&CSS.supports)for(let t of[qt,eE,nE]){let e=t.getMinCoords(),n=td({space:t,coords:e,alpha:1});if(CSS.supports("color",n)){Yr.display_space=t;break}}function mR(t,{space:e=Yr.display_space,...r}={}){let n=td(t,r);if(typeof CSS>"u"||CSS.supports("color",n)||!Yr.display_space)n=new String(n),n.color=t;else{let i=nr(t,e);n=new String(td(i,r)),n.color=i}return n}function iE(t,e,r="lab"){r=re.get(r);let n=r.from(t),i=r.from(e);return Math.sqrt(n.reduce((s,o,a)=>{let l=i[a];return isNaN(o)||isNaN(l)?s:s+(l-o)**2},0))}function gR(t,e){return t=be(t),e=be(e),t.space===e.space&&t.alpha===e.alpha&&t.coords.every((r,n)=>r===e.coords[n])}function yi(t){return or(t,[sr,"y"])}function sE(t,e){mi(t,[sr,"y"],e)}function yR(t){Object.defineProperty(t.prototype,"luminance",{get(){return yi(this)},set(e){sE(this,e)}})}var vR=Object.freeze({__proto__:null,getLuminance:yi,register:yR,setLuminance:sE});function wR(t,e){t=be(t),e=be(e);let r=Math.max(yi(t),0),n=Math.max(yi(e),0);return n>r&&([r,n]=[n,r]),(r+.05)/(n+.05)}const _R=.56,bR=.57,xR=.62,SR=.65,L1=.022,CR=1.414,ER=.1,TR=5e-4,kR=1.14,B1=.027,PR=1.14;function $1(t){return t>=L1?t:t+(L1-t)**CR}function Ts(t){let e=t<0?-1:1,r=Math.abs(t);return e*Math.pow(r,2.4)}function AR(t,e){e=be(e),t=be(t);let r,n,i,s,o,a;e=nr(e,"srgb"),[s,o,a]=e.coords;let l=Ts(s)*.2126729+Ts(o)*.7151522+Ts(a)*.072175;t=nr(t,"srgb"),[s,o,a]=t.coords;let u=Ts(s)*.2126729+Ts(o)*.7151522+Ts(a)*.072175,c=$1(l),f=$1(u),d=f>c;return Math.abs(f-c)0?i=n-B1:i=n+B1,i*100}function IR(t,e){t=be(t),e=be(e);let r=Math.max(yi(t),0),n=Math.max(yi(e),0);n>r&&([r,n]=[n,r]);let i=r+n;return i===0?0:(r-n)/i}const OR=5e4;function RR(t,e){t=be(t),e=be(e);let r=Math.max(yi(t),0),n=Math.max(yi(e),0);return n>r&&([r,n]=[n,r]),n===0?OR:(r-n)/n}function MR(t,e){t=be(t),e=be(e);let r=or(t,[qt,"l"]),n=or(e,[qt,"l"]);return Math.abs(r-n)}const NR=216/24389,U1=24/116,Du=24389/27;let Hh=Cr.D65;var Yg=new re({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"L"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Hh,base:sr,fromBase(t){let r=t.map((n,i)=>n/Hh[i]).map(n=>n>NR?Math.cbrt(n):(Du*n+16)/116);return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[2])]},toBase(t){let e=[];return e[1]=(t[0]+16)/116,e[0]=t[1]/500+e[1],e[2]=e[1]-t[2]/200,[e[0]>U1?Math.pow(e[0],3):(116*e[0]-16)/Du,t[0]>8?Math.pow((t[0]+16)/116,3):t[0]/Du,e[2]>U1?Math.pow(e[2],3):(116*e[2]-16)/Du].map((n,i)=>n*Hh[i])},formats:{"lab-d65":{coords:[" | "," | [-1,1]"," | [-1,1]"]}}});const zh=Math.pow(5,.5)*.5+.5;function DR(t,e){t=be(t),e=be(e);let r=or(t,[Yg,"l"]),n=or(e,[Yg,"l"]),i=Math.abs(Math.pow(r,zh)-Math.pow(n,zh)),s=Math.pow(i,1/zh)*Math.SQRT2-40;return s<7.5?0:s}var dc=Object.freeze({__proto__:null,contrastAPCA:AR,contrastDeltaPhi:DR,contrastLstar:MR,contrastMichelson:IR,contrastWCAG21:wR,contrastWeber:RR});function jR(t,e,r={}){eu(r)&&(r={algorithm:r});let{algorithm:n,...i}=r;if(!n){let s=Object.keys(dc).map(o=>o.replace(/^contrast/,"")).join(", ");throw new TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${s}`)}t=be(t),e=be(e);for(let s in dc)if("contrast"+n.toLowerCase()===s.toLowerCase())return dc[s](t,e,i);throw new TypeError(`Unknown contrast algorithm: ${n}`)}function oE(t){let[e,r,n]=tu(t,sr),i=e+15*r+3*n;return[4*e/i,9*r/i]}function aE(t){let[e,r,n]=tu(t,sr),i=e+r+n;return[e/i,r/i]}function LR(t){Object.defineProperty(t.prototype,"uv",{get(){return oE(this)}}),Object.defineProperty(t.prototype,"xy",{get(){return aE(this)}})}var BR=Object.freeze({__proto__:null,register:LR,uv:oE,xy:aE});function $R(t,e){return iE(t,e,"lab")}const UR=Math.PI,F1=UR/180;function FR(t,e,{l:r=2,c:n=1}={}){let[i,s,o]=qt.from(t),[,a,l]=sl.from(qt,[i,s,o]),[u,c,f]=qt.from(e),d=sl.from(qt,[u,c,f])[1];a<0&&(a=0),d<0&&(d=0);let y=i-u,v=a-d,b=s-c,w=o-f,p=b**2+w**2-v**2,m=.511;i>=16&&(m=.040975*i/(1+.01765*i));let g=.0638*a/(1+.0131*a)+.638,x;Number.isNaN(l)&&(l=0),l>=164&&l<=345?x=.56+Math.abs(.2*Math.cos((l+168)*F1)):x=.36+Math.abs(.4*Math.cos((l+35)*F1));let S=Math.pow(a,4),k=Math.sqrt(S/(S+1900)),R=g*(k*x+1-k),O=(y/(r*m))**2;return O+=(v/(n*g))**2,O+=p/R**2,Math.sqrt(O)}const q1=203;var Pv=new re({id:"xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:sr,fromBase(t){return t.map(e=>Math.max(e*q1,0))},toBase(t){return t.map(e=>Math.max(e/q1,0))}});const ju=1.15,Lu=.66,H1=2610/2**14,qR=2**14/2610,z1=3424/2**12,W1=2413/2**7,G1=2392/2**7,HR=1.7*2523/2**5,V1=2**5/(1.7*2523),Bu=-.56,Wh=16295499532821565e-27,zR=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],WR=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],GR=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],VR=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var lE=new re({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Pv,fromBase(t){let[e,r,n]=t,i=ju*e-(ju-1)*n,s=Lu*r-(Lu-1)*e,a=We(zR,[i,s,n]).map(function(d){let y=z1+W1*(d/1e4)**H1,v=1+G1*(d/1e4)**H1;return(y/v)**HR}),[l,u,c]=We(GR,a);return[(1+Bu)*l/(1+Bu*l)-Wh,u,c]},toBase(t){let[e,r,n]=t,i=(e+Wh)/(1+Bu-Bu*(e+Wh)),o=We(VR,[i,r,n]).map(function(d){let y=z1-d**V1,v=G1*d**V1-W1;return 1e4*(y/v)**qR}),[a,l,u]=We(WR,o),c=(a+(ju-1)*u)/ju,f=(l+(Lu-1)*c)/Lu;return[c,f,u]},formats:{color:{}}}),Xg=new re({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:lE,fromBase(t){let[e,r,n]=t,i;const s=2e-4;return Math.abs(r)Math.cbrt(n));return We(o4,r)},toBase(t){let r=We(a4,t).map(n=>n**3);return We(s4,r)},formats:{oklab:{coords:[" | "," | [-1,1]"," | [-1,1]"]}}});function l4(t,e){let[r,n,i]=rd.from(t),[s,o,a]=rd.from(e),l=r-s,u=n-o,c=i-a;return Math.sqrt(l**2+u**2+c**2)}var nd={deltaE76:$R,deltaECMC:FR,deltaE2000:Kg,deltaEJz:QR,deltaEITP:n4,deltaEOK:l4};function ya(t,e,r={}){eu(r)&&(r={method:r});let{method:n=Yr.deltaE,...i}=r;t=be(t),e=be(e);for(let s in nd)if("deltae"+n.toLowerCase()===s.toLowerCase())return nd[s](t,e,i);throw new TypeError(`Unknown deltaE method: ${n}`)}function u4(t,e=.25){let n=[re.get("oklch","lch"),"l"];return mi(t,n,i=>i*(1+e))}function c4(t,e=.25){let n=[re.get("oklch","lch"),"l"];return mi(t,n,i=>i*(1-e))}var d4=Object.freeze({__proto__:null,darken:c4,lighten:u4});function fE(t,e,r=.5,n={}){[t,e]=[be(t),be(e)],ci(r)==="object"&&([r,n]=[.5,r]);let{space:i,outputSpace:s,premultiplied:o}=n;return ru(t,e,{space:i,outputSpace:s,premultiplied:o})(r)}function hE(t,e,r={}){let n;Av(t)&&([n,r]=[t,e],[t,e]=n.rangeArgs.colors);let{maxDeltaE:i,deltaEMethod:s,steps:o=2,maxSteps:a=1e3,...l}=r;n||([t,e]=[be(t),be(e)],n=ru(t,e,l));let u=ya(t,e),c=i>0?Math.max(o,Math.ceil(u/i)+1):o,f=[];if(a!==void 0&&(c=Math.min(c,a)),c===1)f=[{p:.5,color:n(.5)}];else{let d=1/(c-1);f=Array.from({length:c},(y,v)=>{let b=v*d;return{p:b,color:n(b)}})}if(i>0){let d=f.reduce((y,v,b)=>{if(b===0)return 0;let w=ya(v.color,f[b-1].color,s);return Math.max(y,w)},0);for(;d>i;){d=0;for(let y=1;yd.color),f}function ru(t,e,r={}){if(Av(t)){let[l,u]=[t,e];return ru(...l.rangeArgs.colors,{...l.rangeArgs.options,...u})}let{space:n,outputSpace:i,progression:s,premultiplied:o}=r;t=be(t),e=be(e),t=ol(t),e=ol(e);let a={colors:[t,e],options:r};if(n?n=re.get(n):n=re.registry[Yr.interpolationSpace]||t.space,i=i?re.get(i):n,t=nr(t,n),e=nr(e,n),t=gi(t),e=gi(e),n.coords.h&&n.coords.h.type==="angle"){let l=r.hue=r.hue||"shorter",u=[n,"h"],[c,f]=[or(t,u),or(e,u)];[c,f]=aR(l,[c,f]),mi(t,u,c),mi(e,u,f)}return o&&(t.coords=t.coords.map(l=>l*t.alpha),e.coords=e.coords.map(l=>l*e.alpha)),Object.assign(l=>{l=s?s(l):l;let u=t.coords.map((d,y)=>{let v=e.coords[y];return Jc(d,v,l)}),c=Jc(t.alpha,e.alpha,l),f={space:n,coords:u,alpha:c};return o&&(f.coords=f.coords.map(d=>d/c)),i!==n&&(f=nr(f,i)),f},{rangeArgs:a})}function Av(t){return ci(t)==="function"&&!!t.rangeArgs}Yr.interpolationSpace="lab";function f4(t){t.defineFunction("mix",fE,{returns:"color"}),t.defineFunction("range",ru,{returns:"function"}),t.defineFunction("steps",hE,{returns:"array"})}var h4=Object.freeze({__proto__:null,isRange:Av,mix:fE,range:ru,register:f4,steps:hE}),pE=new re({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:al,fromBase:t=>{let e=Math.max(...t),r=Math.min(...t),[n,i,s]=t,[o,a,l]=[NaN,0,(r+e)/2],u=e-r;if(u!==0){switch(a=l===0||l===1?0:(e-l)/Math.min(l,1-l),e){case n:o=(i-s)/u+(i{let[e,r,n]=t;e=e%360,e<0&&(e+=360),r/=100,n/=100;function i(s){let o=(s+e/30)%12,a=r*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(o-3,9-o,1))}return[i(0),i(8),i(4)]},formats:{hsl:{toGamut:!0,coords:[" | ","",""]},hsla:{coords:[" | ","",""],commas:!0,lastAlpha:!0}}}),mE=new re({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:pE,fromBase(t){let[e,r,n]=t;r/=100,n/=100;let i=n+r*Math.min(n,1-n);return[e,i===0?0:200*(1-n/i),100*i]},toBase(t){let[e,r,n]=t;r/=100,n/=100;let i=n*(1-r/2);return[e,i===0||i===1?0:(n-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{toGamut:!0}}}),p4=new re({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:mE,fromBase(t){let[e,r,n]=t;return[e,n*(100-r)/100,100-n]},toBase(t){let[e,r,n]=t;r/=100,n/=100;let i=r+n;if(i>=1){let a=r/i;return[e,0,a*100]}let s=1-n,o=s===0?0:1-r/s;return[e,o*100,s*100]},formats:{hwb:{toGamut:!0,coords:[" | ","",""]}}});const m4=[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],g4=[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]];var gE=new Rt({id:"a98rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:m4,fromXYZ_M:g4}),y4=new Rt({id:"a98rgb",name:"Adobe® 98 RGB compatible",base:gE,toBase:t=>t.map(e=>Math.pow(Math.abs(e),563/256)*Math.sign(e)),fromBase:t=>t.map(e=>Math.pow(Math.abs(e),256/563)*Math.sign(e)),formats:{color:{id:"a98-rgb"}}});const v4=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],w4=[[1.3457989731028281,-.25558010007997534,-.05110628506753401],[-.5446224939028347,1.5082327413132781,.02053603239147973],[0,0,1.2119675456389454]];var yE=new Rt({id:"prophoto-linear",name:"Linear ProPhoto",white:"D50",base:kv,toXYZ_M:v4,fromXYZ_M:w4});const _4=1/512,b4=16/512;var x4=new Rt({id:"prophoto",name:"ProPhoto",base:yE,toBase(t){return t.map(e=>ee>=_4?e**(1/1.8):16*e)},formats:{color:{id:"prophoto-rgb"}}}),S4=new re({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:rd,fromBase(t){let[e,r,n]=t,i;const s=2e-4;return Math.abs(r) | "," | [0,1]"," | "]}}});const Y1=203,X1=2610/2**14,C4=2**14/2610,E4=2523/2**5,J1=2**5/2523,Z1=3424/2**12,eb=2413/2**7,tb=2392/2**7;var T4=new Rt({id:"rec2100pq",name:"REC.2100-PQ",base:Cf,toBase(t){return t.map(function(e){return(Math.max(e**J1-Z1,0)/(eb-tb*e**J1))**C4*1e4/Y1})},fromBase(t){return t.map(function(e){let r=Math.max(e*Y1/1e4,0),n=Z1+eb*r**X1,i=1+tb*r**X1;return(n/i)**E4})},formats:{color:{id:"rec2100-pq"}}});const rb=.17883277,nb=.28466892,ib=.55991073,Gh=3.7743;var k4=new Rt({id:"rec2100hlg",cssid:"rec2100-hlg",name:"REC.2100-HLG",referred:"scene",base:Cf,toBase(t){return t.map(function(e){return e<=.5?e**2/3*Gh:(Math.exp((e-ib)/rb)+nb)/12*Gh})},fromBase(t){return t.map(function(e){return e/=Gh,e<=1/12?Math.sqrt(3*e):rb*Math.log(12*e-nb)+ib})},formats:{color:{id:"rec2100-hlg"}}});const vE={};pi.add("chromatic-adaptation-start",t=>{t.options.method&&(t.M=wE(t.W1,t.W2,t.options.method))});pi.add("chromatic-adaptation-end",t=>{t.M||(t.M=wE(t.W1,t.W2,t.options.method))});function Ef({id:t,toCone_M:e,fromCone_M:r}){vE[t]=arguments[0]}function wE(t,e,r="Bradford"){let n=vE[r],[i,s,o]=We(n.toCone_M,t),[a,l,u]=We(n.toCone_M,e),c=[[a/i,0,0],[0,l/s,0],[0,0,u/o]],f=We(c,n.toCone_M);return We(n.fromCone_M,f)}Ef({id:"von Kries",toCone_M:[[.40024,.7076,-.08081],[-.2263,1.16532,.0457],[0,0,.91822]],fromCone_M:[[1.8599364,-1.1293816,.2198974],[.3611914,.6388125,-64e-7],[0,0,1.0890636]]});Ef({id:"Bradford",toCone_M:[[.8951,.2664,-.1614],[-.7502,1.7135,.0367],[.0389,-.0685,1.0296]],fromCone_M:[[.9869929,-.1470543,.1599627],[.4323053,.5183603,.0492912],[-.0085287,.0400428,.9684867]]});Ef({id:"CAT02",toCone_M:[[.7328,.4296,-.1624],[-.7036,1.6975,.0061],[.003,.0136,.9834]],fromCone_M:[[1.0961238,-.278869,.1827452],[.454369,.4735332,.0720978],[-.0096276,-.005698,1.0153256]]});Ef({id:"CAT16",toCone_M:[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],fromCone_M:[[1.862067855087233,-1.011254630531685,.1491867754444518],[.3875265432361372,.6214474419314753,-.008973985167612518],[-.01584149884933386,-.03412293802851557,1.04996443687785]]});Object.assign(Cr,{A:[1.0985,1,.35585],C:[.98074,1,1.18232],D55:[.95682,1,.92149],D75:[.94972,1,1.22638],E:[1,1,1],F2:[.99186,1,.67393],F7:[.95041,1,1.08747],F11:[1.00962,1,.6435]});Cr.ACES=[.32168/.33767,1,(1-.32168-.33767)/.33767];const P4=[[.6624541811085053,.13400420645643313,.1561876870049078],[.27222871678091454,.6740817658111484,.05368951740793705],[-.005574649490394108,.004060733528982826,1.0103391003129971]],A4=[[1.6410233796943257,-.32480329418479,-.23642469523761225],[-.6636628587229829,1.6153315916573379,.016756347685530137],[.011721894328375376,-.008284441996237409,.9883948585390215]];var _E=new Rt({id:"acescg",name:"ACEScg",coords:{r:{range:[0,65504],name:"Red"},g:{range:[0,65504],name:"Green"},b:{range:[0,65504],name:"Blue"}},referred:"scene",white:Cr.ACES,toXYZ_M:P4,fromXYZ_M:A4,formats:{color:{}}});const $u=2**-16,Vh=-.35828683,Uu=(Math.log2(65504)+9.72)/17.52;var I4=new Rt({id:"acescc",name:"ACEScc",coords:{r:{range:[Vh,Uu],name:"Red"},g:{range:[Vh,Uu],name:"Green"},b:{range:[Vh,Uu],name:"Blue"}},referred:"scene",base:_E,toBase(t){const e=-.3013698630136986;return t.map(function(r){return r<=e?(2**(r*17.52-9.72)-$u)*2:rthis.get(o),set:a=>this.set(o,a)})}get spaceId(){return this.space.id}clone(){return new Ce(this.space,this.coords,this.alpha)}toJSON(){return{spaceId:this.spaceId,coords:this.coords,alpha:this.alpha}}display(...e){let r=mR(this,...e);return r.color=new Ce(r.color),r}static get(e,...r){return e instanceof Ce?e:new Ce(e,...r)}static defineFunction(e,r,n=r){let{instance:i=!0,returns:s}=n,o=function(...a){let l=r(...a);if(s==="color")l=Ce.get(l);else if(s==="function"){let u=l;l=function(...c){let f=u(...c);return Ce.get(f)},Object.assign(l,u)}else s==="array"&&(l=l.map(u=>Ce.get(u)));return l};e in Ce||(Ce[e]=o),i&&(Ce.prototype[e]=function(...a){return o(this,...a)})}static defineFunctions(e){for(let r in e)Ce.defineFunction(r,e[r],e[r])}static extend(e){if(e.register)e.register(Ce);else for(let r in e)Ce.defineFunction(r,e[r])}}Ce.defineFunctions({get:or,getAll:tu,set:mi,setAll:Z5,to:nr,equals:gR,inGamut:Pa,toGamut:gi,distance:iE,toString:td});Object.assign(Ce,{util:rR,hooks:pi,WHITES:Cr,Space:re,spaces:re.registry,parse:J5,defaults:Yr});for(let t of Object.keys(sb))re.register(sb[t]);for(let t in re.registry)Zg(t,re.registry[t]);pi.add("colorspace-init-end",t=>{var e;Zg(t.id,t),(e=t.aliases)==null||e.forEach(r=>{Zg(r,t)})});function Zg(t,e){Object.keys(e.coords),Object.values(e.coords).map(n=>n.name);let r=t.replace(/-/g,"_");Object.defineProperty(Ce.prototype,r,{get(){let n=this.getAll(t);return typeof Proxy>"u"?n:new Proxy(n,{has:(i,s)=>{try{return re.resolveCoord([e,s]),!0}catch{}return Reflect.has(i,s)},get:(i,s,o)=>{if(s&&typeof s!="symbol"&&!(s in i)){let{index:a}=re.resolveCoord([e,s]);if(a>=0)return i[a]}return Reflect.get(i,s,o)},set:(i,s,o,a)=>{if(s&&typeof s!="symbol"&&!(s in i)||s>=0){let{index:l}=re.resolveCoord([e,s]);if(l>=0)return i[l]=o,this.setAll(t,i),!0}return Reflect.set(i,s,o,a)}})},set(n){this.setAll(t,n)},configurable:!0,enumerable:!0})}Ce.extend(nd);Ce.extend({deltaE:ya});Object.assign(Ce,{deltaEMethods:nd});Ce.extend(d4);Ce.extend({contrast:jR});Ce.extend(BR);Ce.extend(vR);Ce.extend(h4);Ce.extend(dc);class ll extends Ce{static light(e){return new Ce(this._generateAccessibleColor(e,"black")).toString({format:"hex"})}static dark(e){return new Ce(this._generateAccessibleColor(e,"white")).toString({format:"hex"})}static accessibleBackground(e){const r=this._contrast("black",e),n=this._contrast("white",e);return r>n?"black":"white"}static accessibleForeground(e){const r=this._contrast(e,"black"),n=this._contrast(e,"white");return r>n?"black":"white"}static _generateAccessibleColor(e,r){let n=e;const i=this.steps(e,r==="black"?"white":"black",{space:"hsv",outputSpace:"srgb",steps:9});for(const s of i)if(this._contrast(r,s)>75){n=s;break}return n}static _contrast(e,r){return Math.abs(this.contrastAPCA(e,r))}}const ob=60,Fu=20;function O4({broadcaster:t,staticPosition:e,platform:r}){const[n,i]=I.useState(!1);return I.useEffect(()=>{setTimeout(()=>{i(!0)},3.5*1e3)},[]),n?null:_.jsx(Sv,{status:"success",staticPosition:e,className:"slime2-banner-fade",children:_.jsxs("div",{className:"flex items-center justify-center",children:["Connected to",_.jsx("a",{href:t.url,target:"_blank",children:_.jsx(R4,{image:t.image,platform:r})}),t.displayName]})})}function R4({image:t,platform:e}){const[r,n]=I.useState(!1);function i(){n(!0)}return r?_.jsx("img",{src:`https://slime2.stream/assets/${e}-logo.svg`,height:Fu,width:Fu,alt:"Stream Platform Logo",className:"mx-3 inline-block"}):_.jsxs("div",{className:"relative mx-3 inline-block",children:[_.jsx("img",{src:t,alt:"Your Profile Picture",width:ob,height:ob,className:"inline rounded-full",onError:i}),_.jsx("img",{src:`https://slime2.stream/assets/${e}-logo.svg`,height:Fu,width:Fu,alt:"Stream Platform Logo",className:"absolute -bottom-px -right-1"})]})}function Tf(){const t=I.useContext(xE);function e(r){return!!t[r]}return{isPlatformReady:e}}function M4(){const t=I.useContext(SE);function e(r){t({type:r})}return{setPlatformReady:e}}const bE={},xE=I.createContext(bE),SE=I.createContext(vs);function N4(t,e){switch(e.type){case"twitch":return{...t,twitch:!0};case"youtube":return{...t,youtube:!0}}}function CE(){return I.useContext(TE)}function Iv(){const t=I.useContext(kE),e=CE(),r=wn(),{maxEvents:n,eventDelay:i}=r;function s(u,c){t({type:"remove",eventType:u,eventId:c})}function o(u){const c=[...e],f=e.length+1-(n||100);for(let y=0;ys(u.type,u.id)}})}i?setTimeout(d,i):d()}function a(u){t({type:"remove-user",userId:u})}function l(){t({type:"clear-messages"})}return{removeEvent:s,addEvent:o,removeUser:a,removeMessages:l}}const EE=[],TE=I.createContext(EE),kE=I.createContext(vs);function D4(t,e){switch(e.type){case"add":return[...t,e.event];case"remove":return t.filter(r=>r.type!==e.eventType||r.id!==e.eventId);case"remove-user":return t.filter(r=>r.userId!==e.userId);case"clear-messages":return t.filter(r=>r.type!=="message")}}var ey=function(t,e){return ey=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},ey(t,e)};function zo(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ey(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var cs=function(){return cs=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function kr(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})}function ar(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _n(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function vi(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n>=1,e&&(r+=r);while(e);return n+t}function Zi(t,e,r){var n=t.split(e);return n.length<=r?n:vi(vi([],_n(n.slice(0,r-1)),!1),[n.slice(r-1).join(e)],!1)}function RE(t){return vi([],_n(t),!1).length}function ny(t,e,r){return vi([],_n(t),!1).slice(e,r).join("")}var Qh,Kh,id=typeof process>"u"?[]:(Kh=(Qh={}.LOGGING)===null||Qh===void 0?void 0:Qh.split(";").map(function(t){var e=t.split("=",2),r=e[0],n=e[1];return n?[r==="default"?void 0:r.split(":"),Ov(n)]:null}).filter(function(t){return!!t}).sort(function(t,e){var r,n,i=t[0],s=e[0];return((r=s==null?void 0:s.length)!==null&&r!==void 0?r:0)-((n=i==null?void 0:i.length)!==null&&n!==void 0?n:0)}))!==null&&Kh!==void 0?Kh:[],Yh=id.findIndex(function(t){var e=t[0];return!e}),ME=void 0;Yh!==-1&&(ME=id[Yh][1],id.splice(Yh));function U4(t,e){return e.length<=t.length&&e.every(function(r,n){return r===t[n]})}function NE(t){for(var e=t.split(":"),r=0,n=id;rthis._minLevel)){var i=PE[r],s="[".concat(this._name,"] ").concat(n);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(n)),i(s)}},e}(DE),q4=function(){function t(e){var r=e.name,n=e.minLevel,i=e.custom,s;this._minLevel=(s=Xr(n,function(o){return Ov(o)}))!==null&&s!==void 0?s:NE(r),this._override=typeof i=="function"?{log:i}:i}return t.prototype.log=function(e,r){this._shouldLog(e)&&this._override.log(e,r)},t.prototype.crit=function(e){this._override.crit?this._shouldLog(te.CRITICAL)&&this._override.crit(e):this.log(te.CRITICAL,e)},t.prototype.error=function(e){this._override.error?this._shouldLog(te.ERROR)&&this._override.error(e):this.log(te.ERROR,e)},t.prototype.warn=function(e){this._override.warn?this._shouldLog(te.WARNING)&&this._override.warn(e):this.log(te.WARNING,e)},t.prototype.info=function(e){this._override.info?this._shouldLog(te.INFO)&&this._override.info(e):this.log(te.INFO,e)},t.prototype.debug=function(e){this._override.debug?this._shouldLog(te.DEBUG)&&this._override.debug(e):this.log(te.DEBUG,e)},t.prototype.trace=function(e){this._override.trace?this._shouldLog(te.TRACE)&&this._override.trace(e):this.log(te.TRACE,e)},t.prototype._shouldLog=function(e){return this._minLevel===void 0||this._minLevel>=e},t}(),An,In,On,H4=(An={},An[te.CRITICAL]="🛑",An[te.ERROR]="❌",An[te.WARNING]="⚠️ ",An[te.INFO]="ℹ️ ",An[te.DEBUG]="🐞",An[te.TRACE]="🐾",An),z4={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},W4={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 Pf(t,e,r){return function(n){return"\x1B[".concat(t,"m").concat(r?r(n):n,"\x1B[").concat(e,"m")}}function Gr(t){return Pf(z4[t],39)}function aa(t,e){return Pf(W4[t],49,e)}var G4=(In={},In[te.CRITICAL]=Gr("red"),In[te.ERROR]=Gr("redBright"),In[te.WARNING]=Gr("yellow"),In[te.INFO]=Gr("blue"),In[te.DEBUG]=Gr("magenta"),In[te.TRACE]=Pf(0,0),In),lb=(On={},On[te.CRITICAL]=aa("bgRed",Gr("white")),On[te.ERROR]=aa("bgRedBright",Gr("white")),On[te.WARNING]=aa("bgYellow",Gr("black")),On[te.INFO]=aa("bgBlue",Gr("white")),On[te.DEBUG]=aa("bgMagenta",Gr("black")),On[te.TRACE]=Pf(7,27),On),V4=function(t){zo(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.log=function(r,n){var i,s,o;if(!(r>this._minLevel)){var a=PE[r],l="";if(this._timestamps&&(l+="[".concat(new Date().toISOString(),"] ")),this._emoji){var u=H4[r];l+="".concat(u," ")}var c=(o=(i=this._colors)!==null&&i!==void 0?i:(s=process.stdout)===null||s===void 0?void 0:s.isTTY)!==null&&o!==void 0?o:!0;c?l+="".concat(lb[r](this._name)," ").concat(lb[r](te[r])," ").concat(G4[r](n)):l+="[".concat(this._name,":").concat(te[r].toLowerCase(),"] ").concat(n),a(l)}},e}(DE);function Wo(t){return t.custom?new q4(t):kf?new V4(t):new F4(t)}var jE=function(t){zo(e,t);function e(){for(var r=[],n=0;n"u"||!et?ue:et(Uint8Array),ts={"%AggregateError%":typeof AggregateError>"u"?ue:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ue:ArrayBuffer,"%ArrayIteratorPrototype%":ks&&et?et([][Symbol.iterator]()):ue,"%AsyncFromSyncIteratorPrototype%":ue,"%AsyncFunction%":Is,"%AsyncGenerator%":Is,"%AsyncGeneratorFunction%":Is,"%AsyncIteratorPrototype%":Is,"%Atomics%":typeof Atomics>"u"?ue:Atomics,"%BigInt%":typeof BigInt>"u"?ue:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ue:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ue:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ue:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?ue:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ue:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ue:FinalizationRegistry,"%Function%":UE,"%GeneratorFunction%":Is,"%Int8Array%":typeof Int8Array>"u"?ue:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ue:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ue:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ks&&et?et(et([][Symbol.iterator]())):ue,"%JSON%":typeof JSON=="object"?JSON:ue,"%Map%":typeof Map>"u"?ue:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ks||!et?ue:et(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ue:Promise,"%Proxy%":typeof Proxy>"u"?ue:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?ue:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ue:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ks||!et?ue:et(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ue:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ks&&et?et(""[Symbol.iterator]()):ue,"%Symbol%":ks?Symbol:ue,"%SyntaxError%":Do,"%ThrowTypeError%":aM,"%TypedArray%":uM,"%TypeError%":so,"%Uint8Array%":typeof Uint8Array>"u"?ue:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ue:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ue:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ue:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?ue:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ue:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ue:WeakSet};if(et)try{null.error}catch(t){var cM=et(et(t));ts["%Error.prototype%"]=cM}var dM=function t(e){var r;if(e==="%AsyncFunction%")r=Xh("async function () {}");else if(e==="%GeneratorFunction%")r=Xh("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Xh("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&et&&(r=et(i.prototype))}return ts[e]=r,r},hb={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},nu=Mv,sd=Ti,fM=nu.call(Function.call,Array.prototype.concat),hM=nu.call(Function.apply,Array.prototype.splice),pb=nu.call(Function.call,String.prototype.replace),od=nu.call(Function.call,String.prototype.slice),pM=nu.call(Function.call,RegExp.prototype.exec),mM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,gM=/\\(\\)?/g,yM=function(e){var r=od(e,0,1),n=od(e,-1);if(r==="%"&&n!=="%")throw new Do("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Do("invalid intrinsic syntax, expected opening `%`");var i=[];return pb(e,mM,function(s,o,a,l){i[i.length]=a?pb(l,gM,"$1"):o||s}),i},vM=function(e,r){var n=e,i;if(sd(hb,n)&&(i=hb[n],n="%"+i[0]+"%"),sd(ts,n)){var s=ts[n];if(s===Is&&(s=dM(n)),typeof s>"u"&&!r)throw new so("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Do("intrinsic "+e+" does not exist!")},de=function(e,r){if(typeof e!="string"||e.length===0)throw new so("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new so('"allowMissing" argument must be a boolean');if(pM(/^%?[^%]*%?$/,e)===null)throw new Do("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=yM(e),i=n.length>0?n[0]:"",s=vM("%"+i+"%",r),o=s.name,a=s.value,l=!1,u=s.alias;u&&(i=u[0],hM(n,fM([0,1],u)));for(var c=1,f=!0;c=n.length){var b=es(a,d);f=!!b,f&&"get"in b&&!("originalValue"in b.get)?a=b.get:a=a[d]}else f=sd(a,d),a=a[d];f&&!l&&(ts[o]=a)}}return a},wM=de,iy=wM("%Object.defineProperty%",!0),sy=function(){if(iy)try{return iy({},"a",{value:1}),!0}catch{return!1}return!1};sy.hasArrayLengthDefineBug=function(){if(!sy())return null;try{return iy([],"length",{value:1}).length!==1}catch{return!0}};var Af=sy,_M=de,hc=_M("%Object.getOwnPropertyDescriptor%",!0);if(hc)try{hc([],"length")}catch{hc=null}var jv=hc,bM=Af(),Lv=de,Aa=bM&&Lv("%Object.defineProperty%",!0);if(Aa)try{Aa({},"a",{value:1})}catch{Aa=!1}var xM=Lv("%SyntaxError%"),Ps=Lv("%TypeError%"),mb=jv,FE=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Ps("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ps("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ps("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ps("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ps("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ps("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!mb&&mb(e,r);if(Aa)Aa(e,r,{configurable:o===null&&l?l.configurable:!o,enumerable:i===null&&l?l.enumerable:!i,value:n,writable:s===null&&l?l.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new xM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},qE=de,gb=FE,SM=Af(),yb=jv,vb=qE("%TypeError%"),CM=qE("%Math.floor%"),EM=function(e,r){if(typeof e!="function")throw new vb("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||CM(r)!==r)throw new vb("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&yb){var o=yb(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(SM?gb(e,"length",r,!0,!0):gb(e,"length",r)),e};(function(t){var e=Mv,r=de,n=EM,i=r("%TypeError%"),s=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(o,s),l=r("%Object.defineProperty%",!0),u=r("%Math.max%");if(l)try{l({},"a",{value:1})}catch{l=null}t.exports=function(d){if(typeof d!="function")throw new i("a function is required");var y=a(e,o,arguments);return n(y,1+u(0,d.length-(arguments.length-1)),!0)};var c=function(){return a(e,s,arguments)};l?l(t.exports,"apply",{value:c}):t.exports.apply=c})(BE);var iu=BE.exports,wb=Object.prototype.toString,HE=function(e){var r=wb.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&wb.call(e.callee)==="[object Function]"),n},Zh,_b;function TM(){if(_b)return Zh;_b=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=HE,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(d){var y=d.constructor;return y&&y.prototype===d},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var d in window)try{if(!u["$"+d]&&e.call(window,d)&&window[d]!==null&&typeof window[d]=="object")try{l(window[d])}catch{return!0}}catch{return!0}return!1}(),f=function(d){if(typeof window>"u"||!c)return l(d);try{return l(d)}catch{return!1}};t=function(y){var v=y!==null&&typeof y=="object",b=r.call(y)==="[object Function]",w=n(y),p=v&&r.call(y)==="[object String]",m=[];if(!v&&!b&&!w)throw new TypeError("Object.keys called on a non-object");var g=o&&b;if(p&&y.length>0&&!e.call(y,0))for(var x=0;x0)for(var S=0;S2?arguments[2]:{},n=IM(e);OM&&(n=MM.call(n,Object.getOwnPropertySymbols(e)));for(var i=0;i"u")return"Undefined";if(typeof e=="function"||typeof e=="object")return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"}),tp}var rp,Tb;function LM(){if(Tb)return rp;Tb=1;var t=GE();return rp=function(r){return typeof r=="symbol"?"Symbol":typeof r=="bigint"?"BigInt":t(r)},rp}var la={exports:{}},np,kb;function Of(){if(kb)return np;kb=1;var t=Nv;return np=function(){return t()&&!!Symbol.toStringTag},np}var ip,Pb;function mr(){if(Pb)return ip;Pb=1;var t=de,e=iu,r=e(t("String.prototype.indexOf"));return ip=function(i,s){var o=t(i,!!s);return typeof o=="function"&&r(i,".prototype.")>-1?e(o):o},ip}var sp,Ab;function BM(){if(Ab)return sp;Ab=1;var t=Of()(),e=mr(),r=e("Object.prototype.toString"),n=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:r(a)==="[object Arguments]"},i=function(a){return n(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&r(a)!=="[object Array]"&&r(a.callee)==="[object Function]"},s=function(){return n(arguments)}();return n.isLegacyArguments=i,sp=s?n:i,sp}const $M={},UM=Object.freeze(Object.defineProperty({__proto__:null,default:$M},Symbol.toStringTag,{value:"Module"})),FM=hS(UM);var op,Ib;function VE(){if(Ib)return op;Ib=1;var t=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,r=t&&e&&typeof e.get=="function"?e.get:null,n=t&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,s=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,o=i&&s&&typeof s.get=="function"?s.get:null,a=i&&Set.prototype.forEach,l=typeof WeakMap=="function"&&WeakMap.prototype,u=l?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,f=c?WeakSet.prototype.has:null,d=typeof WeakRef=="function"&&WeakRef.prototype,y=d?WeakRef.prototype.deref:null,v=Boolean.prototype.valueOf,b=Object.prototype.toString,w=Function.prototype.toString,p=String.prototype.match,m=String.prototype.slice,g=String.prototype.replace,x=String.prototype.toUpperCase,S=String.prototype.toLowerCase,k=RegExp.prototype.test,R=Array.prototype.concat,O=Array.prototype.join,$=Array.prototype.slice,G=Math.floor,ee=typeof BigInt=="function"?BigInt.prototype.valueOf:null,fe=Object.getOwnPropertySymbols,he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,P=typeof Symbol=="function"&&typeof Symbol.iterator=="object",j=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===P||"symbol")?Symbol.toStringTag:null,Q=Object.prototype.propertyIsEnumerable,le=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(A){return A.__proto__}:null);function B(A,M){if(A===1/0||A===-1/0||A!==A||A&&A>-1e3&&A<1e3||k.call(/e/,M))return M;var we=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof A=="number"){var Te=A<0?-G(-A):G(A);if(Te!==A){var Ue=String(Te),oe=m.call(M,Ue.length+1);return g.call(Ue,we,"$&_")+"."+g.call(g.call(oe,/([0-9]{3})/g,"$&_"),/_$/,"")}}return g.call(M,we,"$&_")}var H=FM,Y=H.custom,se=Jw(Y)?Y:null;op=function A(M,we,Te,Ue){var oe=we||{};if(Sn(oe,"quoteStyle")&&oe.quoteStyle!=="single"&&oe.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Sn(oe,"maxStringLength")&&(typeof oe.maxStringLength=="number"?oe.maxStringLength<0&&oe.maxStringLength!==1/0:oe.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var En=Sn(oe,"customInspect")?oe.customInspect:!0;if(typeof En!="boolean"&&En!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Sn(oe,"indent")&&oe.indent!==null&&oe.indent!==" "&&!(parseInt(oe.indent,10)===oe.indent&&oe.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Sn(oe,"numericSeparator")&&typeof oe.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Pi=oe.numericSeparator;if(typeof M>"u")return"undefined";if(M===null)return"null";if(typeof M=="boolean")return M?"true":"false";if(typeof M=="string")return e_(M,oe);if(typeof M=="number"){if(M===0)return 1/0/M>0?"0":"-0";var Dt=String(M);return Pi?B(M,Dt):Dt}if(typeof M=="bigint"){var Tn=String(M)+"n";return Pi?B(M,Tn):Tn}var oh=typeof oe.depth>"u"?5:oe.depth;if(typeof Te>"u"&&(Te=0),Te>=oh&&oh>0&&typeof M=="object")return Nt(M)?"[Array]":"[Object]";var xs=IA(oe,Te);if(typeof Ue>"u")Ue=[];else if(Zw(Ue,M)>=0)return"[Circular]";function gr(Ss,hu,RA){if(hu&&(Ue=$.call(Ue),Ue.push(hu)),RA){var u_={depth:oe.depth};return Sn(oe,"quoteStyle")&&(u_.quoteStyle=oe.quoteStyle),A(Ss,u_,Te+1,Ue)}return A(Ss,oe,Te+1,Ue)}if(typeof M=="function"&&!Rr(M)){var r_=bA(M),n_=du(M,gr);return"[Function"+(r_?": "+r_:" (anonymous)")+"]"+(n_.length>0?" { "+O.call(n_,", ")+" }":"")}if(Jw(M)){var i_=P?g.call(String(M),/^(Symbol\(.*\))_[^)]*$/,"$1"):he.call(M);return typeof M=="object"&&!P?Xo(i_):i_}if(kA(M)){for(var Jo="<"+S.call(String(M.nodeName)),ah=M.attributes||[],fu=0;fu",Jo}if(Nt(M)){if(M.length===0)return"[]";var lh=du(M,gr);return xs&&!AA(lh)?"["+sh(lh,xs)+"]":"[ "+O.call(lh,", ")+" ]"}if(bs(M)){var uh=du(M,gr);return!("cause"in Error.prototype)&&"cause"in M&&!Q.call(M,"cause")?"{ ["+String(M)+"] "+O.call(R.call("[cause]: "+gr(M.cause),uh),", ")+" }":uh.length===0?"["+String(M)+"]":"{ ["+String(M)+"] "+O.call(uh,", ")+" }"}if(typeof M=="object"&&En){if(se&&typeof M[se]=="function"&&H)return H(M,{depth:oh-Te});if(En!=="symbol"&&typeof M.inspect=="function")return M.inspect()}if(xA(M)){var s_=[];return n&&n.call(M,function(Ss,hu){s_.push(gr(hu,M,!0)+" => "+gr(Ss,M))}),t_("Map",r.call(M),s_,xs)}if(EA(M)){var o_=[];return a&&a.call(M,function(Ss){o_.push(gr(Ss,M))}),t_("Set",o.call(M),o_,xs)}if(SA(M))return ih("WeakMap");if(TA(M))return ih("WeakSet");if(CA(M))return ih("WeakRef");if(yA(M))return Xo(gr(Number(M)));if(wA(M))return Xo(gr(ee.call(M)));if(vA(M))return Xo(v.call(M));if(gA(M))return Xo(gr(String(M)));if(typeof window<"u"&&M===window)return"{ [object Window] }";if(M===tf)return"{ [object globalThis] }";if(!Or(M)&&!Rr(M)){var ch=du(M,gr),a_=le?le(M)===Object.prototype:M instanceof Object||M.constructor===Object,dh=M instanceof Object?"":"null prototype",l_=!a_&&j&&Object(M)===M&&j in M?m.call(Cn(M),8,-1):dh?"Object":"",OA=a_||typeof M.constructor!="function"?"":M.constructor.name?M.constructor.name+" ":"",fh=OA+(l_||dh?"["+O.call(R.call([],l_||[],dh||[]),": ")+"] ":"");return ch.length===0?fh+"{}":xs?fh+"{"+sh(ch,xs)+"}":fh+"{ "+O.call(ch,", ")+" }"}return String(M)};function ye(A,M,we){var Te=(we.quoteStyle||M)==="double"?'"':"'";return Te+A+Te}function Mt(A){return g.call(String(A),/"/g,""")}function Nt(A){return Cn(A)==="[object Array]"&&(!j||!(typeof A=="object"&&j in A))}function Or(A){return Cn(A)==="[object Date]"&&(!j||!(typeof A=="object"&&j in A))}function Rr(A){return Cn(A)==="[object RegExp]"&&(!j||!(typeof A=="object"&&j in A))}function bs(A){return Cn(A)==="[object Error]"&&(!j||!(typeof A=="object"&&j in A))}function gA(A){return Cn(A)==="[object String]"&&(!j||!(typeof A=="object"&&j in A))}function yA(A){return Cn(A)==="[object Number]"&&(!j||!(typeof A=="object"&&j in A))}function vA(A){return Cn(A)==="[object Boolean]"&&(!j||!(typeof A=="object"&&j in A))}function Jw(A){if(P)return A&&typeof A=="object"&&A instanceof Symbol;if(typeof A=="symbol")return!0;if(!A||typeof A!="object"||!he)return!1;try{return he.call(A),!0}catch{}return!1}function wA(A){if(!A||typeof A!="object"||!ee)return!1;try{return ee.call(A),!0}catch{}return!1}var _A=Object.prototype.hasOwnProperty||function(A){return A in this};function Sn(A,M){return _A.call(A,M)}function Cn(A){return b.call(A)}function bA(A){if(A.name)return A.name;var M=p.call(w.call(A),/^function\s*([\w$]+)/);return M?M[1]:null}function Zw(A,M){if(A.indexOf)return A.indexOf(M);for(var we=0,Te=A.length;weM.maxStringLength){var we=A.length-M.maxStringLength,Te="... "+we+" more character"+(we>1?"s":"");return e_(m.call(A,0,M.maxStringLength),M)+Te}var Ue=g.call(g.call(A,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,PA);return ye(Ue,"single",M)}function PA(A){var M=A.charCodeAt(0),we={8:"b",9:"t",10:"n",12:"f",13:"r"}[M];return we?"\\"+we:"\\x"+(M<16?"0":"")+x.call(M.toString(16))}function Xo(A){return"Object("+A+")"}function ih(A){return A+" { ? }"}function t_(A,M,we,Te){var Ue=Te?sh(we,Te):O.call(we,", ");return A+" ("+M+") {"+Ue+"}"}function AA(A){for(var M=0;M=0)return!1;return!0}function IA(A,M){var we;if(A.indent===" ")we=" ";else if(typeof A.indent=="number"&&A.indent>0)we=O.call(Array(A.indent+1)," ");else return null;return{base:we,prev:O.call(Array(M+1),we)}}function sh(A,M){if(A.length===0)return"";var we=` -`+M.prev+M.base;return we+O.call(A,","+we)+` -`+M.prev}function du(A,M){var we=Nt(A),Te=[];if(we){Te.length=A.length;for(var Ue=0;Ue=ee)return G+1;var fe=c($,G);if(fe<55296||fe>56319)return G+1;var he=c($,G+1);return he<56320||he>57343?G+1:G+2},y=function($){var G=0;return{next:function(){var fe=G>=$.length,he;return fe||(he=$[G],G+=1),{done:fe,value:he}}}},v=function($,G){if(n($)||t($))return y($);if(i($)){var ee=0;return{next:function(){var he=d($,ee),P=f($,ee,he);return ee=he,{done:he>$.length,value:P}}}}if(G&&typeof $["_es6-shim iterator_"]<"u")return $["_es6-shim iterator_"]()};if(!o&&!a)la.exports=function($){if($!=null)return v($,!0)};else{var b=GM(),w=VM(),p=l("Map.prototype.forEach",!0),m=l("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var g=l("Map.prototype.iterator",!0),x=l("Set.prototype.iterator",!0);var S=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),k=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0),R=function($){if(b($)){if(g)return e(g($));if(S)return S($);if(p){var G=[];return p($,function(fe,he){u(G,[he,fe])}),y(G)}}if(w($)){if(x)return e(x($));if(k)return k($);if(m){var ee=[];return m($,function(fe){u(ee,fe)}),y(ee)}}};la.exports=function($){return R($)||v($)}}}return la.exports}var pp,$b;function KM(){if($b)return pp;$b=1;var t=TypeError;return pp=function(r){if(!r||typeof r.next!="function")throw new t("iterator must be an object with a `next` method");if(arguments.length>1){var n=arguments[1];if(typeof n!="function")throw new t("`callback`, if provided, must be a function")}for(var i=n||[],s;(s=r.next())&&!s.done;)n?n(s.value):i.push(s.value);if(!n)return i},pp}var mp,Ub;function YM(){if(Ub)return mp;Ub=1;var t=QM(),e=TypeError,r=KM();return mp=function(i){var s=t(i);if(!s)throw new e("non-iterable value provided");return arguments.length>1?r(s,arguments[1]):r(s)},mp}var gp,Fb;function XM(){if(Fb)return gp;Fb=1;var t=de,e=t("%TypeError%");return gp=function(n,i){if(n==null)throw new e(i||"Cannot call method on "+n);return n},gp}var yp,qb;function Rf(){return qb||(qb=1,yp=XM()),yp}var vp,Hb;function Bv(){return Hb||(Hb=1,vp=Number.isNaN||function(e){return e!==e}),vp}var wp,zb;function KE(){if(zb)return wp;zb=1;var t=Bv();return wp=function(e){return(typeof e=="number"||typeof e=="bigint")&&!t(e)&&e!==1/0&&e!==-1/0},wp}var _p,Wb;function $v(){if(Wb)return _p;Wb=1;var t=de,e=t("%Math.abs%"),r=t("%Math.floor%"),n=Bv(),i=KE();return _p=function(o){if(typeof o!="number"||n(o)||!i(o))return!1;var a=e(o);return r(a)===a},_p}var bp,Gb;function JM(){if(Gb)return bp;Gb=1;var t=de,e=t("%Array.prototype%"),r=t("%RangeError%"),n=t("%SyntaxError%"),i=t("%TypeError%"),s=$v(),o=Math.pow(2,32)-1,a=$E(),l=t("%Object.setPrototypeOf%",!0)||(a?function(u,c){return u.__proto__=c,u}:null);return bp=function(c){if(!s(c)||c<0)throw new i("Assertion failed: `length` must be an integer Number >= 0");if(c>o)throw new r("length is greater than (2**32 - 1)");var f=arguments.length>1?arguments[1]:e,d=[];if(f!==e){if(!l)throw new n("ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]");l(d,f)}return c!==0&&(d.length=c),d},bp}var xp,Vb;function ws(){return Vb||(Vb=1,xp=function(e){return typeof e=="string"||typeof e=="symbol"}),xp}var Sp,Qb;function St(){if(Qb)return Sp;Qb=1;var t=GE();return Sp=function(r){return typeof r=="symbol"?"Symbol":typeof r=="bigint"?"BigInt":t(r)},Sp}var Cp,Kb;function YE(){if(Kb)return Cp;Kb=1;var t=de,e=t("%TypeError%"),r=VE(),n=ws(),i=St();return Cp=function(o,a){if(i(o)!=="Object")throw new e("Assertion failed: Type(O) is not Object");if(!n(a))throw new e("Assertion failed: IsPropertyKey(P) is not true, got "+r(a));return o[a]},Cp}var Ep,Yb;function XE(){if(Yb)return Ep;Yb=1;var t=de,e=t("%Array%"),r=!e.isArray&&mr()("Object.prototype.toString");return Ep=e.isArray||function(i){return r(i)==="[object Array]"},Ep}var Tp,Xb;function JE(){return Xb||(Xb=1,Tp=XE()),Tp}var qu={exports:{}},kp,Jb;function ZM(){return Jb||(Jb=1,kp=de),kp}var Pp,Zb;function Uv(){if(Zb)return Pp;Zb=1;var t=de,e=Ti,r=t("%TypeError%");return Pp=function(i,s){if(i.Type(s)!=="Object")return!1;var o={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var a in s)if(e(s,a)&&!o[a])return!1;if(i.IsDataDescriptor(s)&&i.IsAccessorDescriptor(s))throw new r("Property Descriptors may not be both accessor and data descriptors");return!0},Pp}var Ap,e2;function ZE(){if(e2)return Ap;e2=1;var t=Af,e=de,r=t()&&e("%Object.defineProperty%",!0),n=t.hasArrayLengthDefineBug(),i=n&&XE(),s=mr(),o=s("Object.prototype.propertyIsEnumerable");return Ap=function(l,u,c,f,d,y){if(!r){if(!l(y)||!y["[[Configurable]]"]||!y["[[Writable]]"]||d in f&&o(f,d)!==!!y["[[Enumerable]]"])return!1;var v=y["[[Value]]"];return f[d]=v,u(f[d],v)}return n&&d==="length"&&"[[Value]]"in y&&i(f)&&f.length!==y["[[Value]]"]?(f.length=y["[[Value]]"],f.length===y["[[Value]]"]):(r(f,d,c(y)),!0)},Ap}var Ip,t2;function eN(){if(t2)return Ip;t2=1;var t=Ti;return Ip=function(r){return t(r,"[[StartIndex]]")&&t(r,"[[EndIndex]]")&&r["[[StartIndex]]"]>=0&&r["[[EndIndex]]"]>=r["[[StartIndex]]"]&&String(parseInt(r["[[StartIndex]]"],10))===String(r["[[StartIndex]]"])&&String(parseInt(r["[[EndIndex]]"],10))===String(r["[[EndIndex]]"])},Ip}var Op,r2;function Mf(){if(r2)return Op;r2=1;var t=de,e=t("%TypeError%"),r=t("%SyntaxError%"),n=Ti,i=$v(),s=eN(),o={"Property Descriptor":function(l){var u={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};if(!l)return!1;for(var c in l)if(n(l,c)&&!u[c])return!1;var f=n(l,"[[Value]]"),d=n(l,"[[Get]]")||n(l,"[[Set]]");if(f&&d)throw new e("Property Descriptors may not be both accessor and data descriptors");return!0},"Match Record":s,"Iterator Record":function(l){return n(l,"[[Iterator]]")&&n(l,"[[NextMethod]]")&&n(l,"[[Done]]")},"PromiseCapability Record":function(l){return!!l&&n(l,"[[Resolve]]")&&typeof l["[[Resolve]]"]=="function"&&n(l,"[[Reject]]")&&typeof l["[[Reject]]"]=="function"&&n(l,"[[Promise]]")&&l["[[Promise]]"]&&typeof l["[[Promise]]"].then=="function"},"AsyncGeneratorRequest Record":function(l){return!!l&&n(l,"[[Completion]]")&&n(l,"[[Capability]]")&&o["PromiseCapability Record"](l["[[Capability]]"])},"RegExp Record":function(l){return l&&n(l,"[[IgnoreCase]]")&&typeof l["[[IgnoreCase]]"]=="boolean"&&n(l,"[[Multiline]]")&&typeof l["[[Multiline]]"]=="boolean"&&n(l,"[[DotAll]]")&&typeof l["[[DotAll]]"]=="boolean"&&n(l,"[[Unicode]]")&&typeof l["[[Unicode]]"]=="boolean"&&n(l,"[[CapturingGroupsCount]]")&&typeof l["[[CapturingGroupsCount]]"]=="number"&&i(l["[[CapturingGroupsCount]]"])&&l["[[CapturingGroupsCount]]"]>=0}};return Op=function(l,u,c,f){var d=o[u];if(typeof d!="function")throw new r("unknown record type: "+u);if(l(f)!=="Object"||!d(f))throw new e(c+" must be a "+u)},Op}var Rp,n2;function tN(){return n2||(n2=1,Rp=function(e){if(typeof e>"u")return e;var r={};return"[[Value]]"in e&&(r.value=e["[[Value]]"]),"[[Writable]]"in e&&(r.writable=!!e["[[Writable]]"]),"[[Get]]"in e&&(r.get=e["[[Get]]"]),"[[Set]]"in e&&(r.set=e["[[Set]]"]),"[[Enumerable]]"in e&&(r.enumerable=!!e["[[Enumerable]]"]),"[[Configurable]]"in e&&(r.configurable=!!e["[[Configurable]]"]),r}),Rp}var Mp,i2;function eT(){if(i2)return Mp;i2=1;var t=Mf(),e=tN(),r=St();return Mp=function(i){return typeof i<"u"&&t(r,"Property Descriptor","Desc",i),e(i)},Mp}var Np,s2;function Nf(){if(s2)return Np;s2=1;var t=Ti,e=St(),r=Mf();return Np=function(i){return!(typeof i>"u"||(r(e,"Property Descriptor","Desc",i),!t(i,"[[Get]]")&&!t(i,"[[Set]]")))},Np}var Dp,o2;function Df(){if(o2)return Dp;o2=1;var t=Ti,e=St(),r=Mf();return Dp=function(i){return!(typeof i>"u"||(r(e,"Property Descriptor","Desc",i),!t(i,"[[Value]]")&&!t(i,"[[Writable]]")))},Dp}var jp,a2;function Fv(){if(a2)return jp;a2=1;var t=Bv();return jp=function(r,n){return r===n?r===0?1/r===1/n:!0:t(r)&&t(n)},jp}var Lp,l2;function rN(){return l2||(l2=1,Lp=function(e){return!!e}),Lp}var Bp,u2;function tT(){if(u2)return Bp;u2=1;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,n;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},e(function(){throw 42},null,r)}catch(m){m!==n&&(e=null)}else e=null;var i=/^\s*class\b/,s=function(g){try{var x=t.call(g);return i.test(x)}catch{return!1}},o=function(g){try{return s(g)?!1:(t.call(g),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",u="[object Function]",c="[object GeneratorFunction]",f="[object HTMLAllCollection]",d="[object HTML document.all class]",y="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,b=!(0 in[,]),w=function(){return!1};if(typeof document=="object"){var p=document.all;a.call(p)===a.call(document.all)&&(w=function(g){if((b||!g)&&(typeof g>"u"||typeof g=="object"))try{var x=a.call(g);return(x===f||x===d||x===y||x===l)&&g("")==null}catch{}return!1})}return Bp=e?function(g){if(w(g))return!0;if(!g||typeof g!="function"&&typeof g!="object")return!1;try{e(g,null,r)}catch(x){if(x!==n)return!1}return!s(g)&&o(g)}:function(g){if(w(g))return!0;if(!g||typeof g!="function"&&typeof g!="object")return!1;if(v)return o(g);if(s(g))return!1;var x=a.call(g);return x!==u&&x!==c&&!/^\[object HTML/.test(x)?!1:o(g)},Bp}var $p,c2;function rT(){return c2||(c2=1,$p=tT()),$p}var Up,d2;function nT(){if(d2)return Up;d2=1;var t=Ti,e=de,r=e("%TypeError%"),n=St(),i=rN(),s=rT();return Up=function(a){if(n(a)!=="Object")throw new r("ToPropertyDescriptor requires an object");var l={};if(t(a,"enumerable")&&(l["[[Enumerable]]"]=i(a.enumerable)),t(a,"configurable")&&(l["[[Configurable]]"]=i(a.configurable)),t(a,"value")&&(l["[[Value]]"]=a.value),t(a,"writable")&&(l["[[Writable]]"]=i(a.writable)),t(a,"get")){var u=a.get;if(typeof u<"u"&&!s(u))throw new r("getter must be a function");l["[[Get]]"]=u}if(t(a,"set")){var c=a.set;if(typeof c<"u"&&!s(c))throw new r("setter must be a function");l["[[Set]]"]=c}if((t(l,"[[Get]]")||t(l,"[[Set]]"))&&(t(l,"[[Value]]")||t(l,"[[Writable]]")))throw new r("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return l},Up}var Fp,f2;function nN(){if(f2)return Fp;f2=1;var t=de,e=t("%TypeError%"),r=Uv(),n=ZE(),i=eT(),s=Nf(),o=Df(),a=ws(),l=Fv(),u=nT(),c=St();return Fp=function(d,y,v){if(c(d)!=="Object")throw new e("Assertion failed: Type(O) is not Object");if(!a(y))throw new e("Assertion failed: IsPropertyKey(P) is not true");var b=r({Type:c,IsDataDescriptor:o,IsAccessorDescriptor:s},v)?v:u(v);if(!r({Type:c,IsDataDescriptor:o,IsAccessorDescriptor:s},b))throw new e("Assertion failed: Desc is not a valid Property Descriptor");return n(o,l,i,d,y,b)},Fp}var h2;function iN(){if(h2)return qu.exports;h2=1;var t=ZM(),e=t("%Reflect.construct%",!0),r=nN();try{r({},"",{"[[Get]]":function(){}})}catch{r=null}if(r&&e){var n={},i={};r(i,"length",{"[[Get]]":function(){throw n},"[[Enumerable]]":!0}),qu.exports=function(o){try{e(o,i)}catch(a){return a===n}}}else qu.exports=function(o){return typeof o=="function"&&!!o.prototype};return qu.exports}var qp,p2;function sN(){if(p2)return qp;p2=1;var t=de,e=t("%Symbol.species%",!0),r=t("%TypeError%"),n=JM(),i=YE(),s=JE(),o=iN(),a=St(),l=$v();return qp=function(c,f){if(!l(f)||f<0)throw new r("Assertion failed: length must be an integer >= 0");var d=s(c);if(!d)return n(f);var y=i(c,"constructor");if(e&&a(y)==="Object"&&(y=i(y,e),y===null&&(y=void 0)),typeof y>"u")return n(f);if(!o(y))throw new r("C must be a constructor");return new y(f)},qp}var Hp,m2;function oN(){if(m2)return Hp;m2=1;var t=de,e=mr(),r=t("%TypeError%"),n=JE(),i=t("%Reflect.apply%",!0)||e("Function.prototype.apply");return Hp=function(o,a){var l=arguments.length>2?arguments[2]:[];if(!n(l))throw new r("Assertion failed: optional `argumentsList`, if provided, must be a List");return i(o,a,l)},Hp}var zp,g2;function iT(){return g2||(g2=1,zp=function(e){return e===null||typeof e!="function"&&typeof e!="object"}),zp}var Wp,y2;function aN(){if(y2)return Wp;y2=1;var t=de,e=t("%Object.preventExtensions%",!0),r=t("%Object.isExtensible%",!0),n=iT();return Wp=e?function(s){return!n(s)&&r(s)}:function(s){return!n(s)},Wp}var Gp,v2;function lN(){return v2||(v2=1,Gp=function(e,r){return!!r&&typeof r=="object"&&"[[Enumerable]]"in r&&"[[Configurable]]"in r&&(e.IsAccessorDescriptor(r)||e.IsDataDescriptor(r))}),Gp}var Vp,w2;function uN(){if(w2)return Vp;w2=1;var t=Mf(),e=Nf(),r=Df(),n=St();return Vp=function(s){return typeof s>"u"?!1:(t(n,"Property Descriptor","Desc",s),!e(s)&&!r(s))},Vp}var Qp,_2;function cN(){if(_2)return Qp;_2=1;var t=de,e=t("%TypeError%"),r=ZE(),n=lN(),i=Uv(),s=eT(),o=Nf(),a=Df(),l=uN(),u=ws(),c=Fv(),f=St();return Qp=function(y,v,b,w,p){var m=f(y);if(m!=="Undefined"&&m!=="Object")throw new e("Assertion failed: O must be undefined or an Object");if(!u(v))throw new e("Assertion failed: P must be a Property Key");if(f(b)!=="Boolean")throw new e("Assertion failed: extensible must be a Boolean");if(!i({Type:f,IsDataDescriptor:a,IsAccessorDescriptor:o},w))throw new e("Assertion failed: Desc must be a Property Descriptor");if(f(p)!=="Undefined"&&!i({Type:f,IsDataDescriptor:a,IsAccessorDescriptor:o},p))throw new e("Assertion failed: current must be a Property Descriptor, or undefined");if(f(p)==="Undefined")return b?m==="Undefined"?!0:o(w)?r(a,c,s,y,v,w):r(a,c,s,y,v,{"[[Configurable]]":!!w["[[Configurable]]"],"[[Enumerable]]":!!w["[[Enumerable]]"],"[[Value]]":w["[[Value]]"],"[[Writable]]":!!w["[[Writable]]"]}):!1;if(!n({IsAccessorDescriptor:o,IsDataDescriptor:a},p))throw new e("`current`, when present, must be a fully populated and valid Property Descriptor");if(!p["[[Configurable]]"]){if("[[Configurable]]"in w&&w["[[Configurable]]"]||"[[Enumerable]]"in w&&!c(w["[[Enumerable]]"],p["[[Enumerable]]"])||!l(w)&&!c(o(w),o(p)))return!1;if(o(p)){if("[[Get]]"in w&&!c(w["[[Get]]"],p["[[Get]]"])||"[[Set]]"in w&&!c(w["[[Set]]"],p["[[Set]]"]))return!1}else if(!p["[[Writable]]"]&&("[[Writable]]"in w&&w["[[Writable]]"]||"[[Value]]"in w&&!c(w["[[Value]]"],p["[[Value]]"])))return!1}if(m!=="Undefined"){var g,x;return a(p)&&o(w)?(g=("[[Configurable]]"in w?w:p)["[[Configurable]]"],x=("[[Enumerable]]"in w?w:p)["[[Enumerable]]"],r(a,c,s,y,v,{"[[Configurable]]":!!g,"[[Enumerable]]":!!x,"[[Get]]":("[[Get]]"in w?w:p)["[[Get]]"],"[[Set]]":("[[Set]]"in w?w:p)["[[Set]]"]})):o(p)&&a(w)?(g=("[[Configurable]]"in w?w:p)["[[Configurable]]"],x=("[[Enumerable]]"in w?w:p)["[[Enumerable]]"],r(a,c,s,y,v,{"[[Configurable]]":!!g,"[[Enumerable]]":!!x,"[[Value]]":("[[Value]]"in w?w:p)["[[Value]]"],"[[Writable]]":!!("[[Writable]]"in w?w:p)["[[Writable]]"]})):r(a,c,s,y,v,w)}return!0},Qp}var Kp,b2;function dN(){if(b2)return Kp;b2=1;var t=de,e=jv,r=t("%SyntaxError%"),n=t("%TypeError%"),i=Uv(),s=Nf(),o=Df(),a=aN(),l=ws(),u=nT(),c=Fv(),f=St(),d=cN();return Kp=function(v,b,w){if(f(v)!=="Object")throw new n("Assertion failed: O must be an Object");if(!l(b))throw new n("Assertion failed: P must be a Property Key");if(!i({Type:f,IsDataDescriptor:o,IsAccessorDescriptor:s},w))throw new n("Assertion failed: Desc must be a Property Descriptor");if(!e){if(s(w))throw new r("This environment does not support accessor property descriptors.");var p=!(b in v)&&w["[[Writable]]"]&&w["[[Enumerable]]"]&&w["[[Configurable]]"]&&"[[Value]]"in w,m=b in v&&(!("[[Configurable]]"in w)||w["[[Configurable]]"])&&(!("[[Enumerable]]"in w)||w["[[Enumerable]]"])&&(!("[[Writable]]"in w)||w["[[Writable]]"])&&"[[Value]]"in w;if(p||m)return v[b]=w["[[Value]]"],c(v[b],w["[[Value]]"]);throw new r("This environment does not support defining non-writable, non-enumerable, or non-configurable properties")}var g=e(v,b),x=g&&u(g),S=a(v);return d(v,b,S,w,x)},Kp}var Yp,x2;function fN(){if(x2)return Yp;x2=1;var t=de,e=t("%TypeError%"),r=ws(),n=dN(),i=St();return Yp=function(o,a,l){if(i(o)!=="Object")throw new e("Assertion failed: Type(O) is not Object");if(!r(a))throw new e("Assertion failed: IsPropertyKey(P) is not true");var u={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Value]]":l,"[[Writable]]":!0};return n(o,a,u)},Yp}var Xp,S2;function hN(){if(S2)return Xp;S2=1;var t=de,e=t("%TypeError%"),r=fN(),n=ws(),i=St();return Xp=function(o,a,l){if(i(o)!=="Object")throw new e("Assertion failed: Type(O) is not Object");if(!n(a))throw new e("Assertion failed: IsPropertyKey(P) is not true");var u=r(o,a,l);if(!u)throw new e("unable to create data property")},Xp}var Jp,C2;function pN(){if(C2)return Jp;C2=1;var t=de,e=t("%TypeError%"),r=ws(),n=St();return Jp=function(s,o){if(n(s)!=="Object")throw new e("Assertion failed: `O` must be an Object");if(!r(o))throw new e("Assertion failed: `P` must be a Property Key");return o in s},Jp}var Zp,E2;function mN(){if(E2)return Zp;E2=1;var t=Math.floor;return Zp=function(r,n){var i=r%n;return t(i>=0?i:i+n)},Zp}var em,T2;function gN(){if(T2)return em;T2=1;var t=mN();return em=function(r,n){return t(r,n)},em}var tm,k2;function yN(){return k2||(k2=1,tm=function(e){return e===null||typeof e!="function"&&typeof e!="object"}),tm}var rm,P2;function vN(){if(P2)return rm;P2=1;var t=Date.prototype.getDay,e=function(o){try{return t.call(o),!0}catch{return!1}},r=Object.prototype.toString,n="[object Date]",i=Of()();return rm=function(o){return typeof o!="object"||o===null?!1:i?e(o):r.call(o)===n},rm}var Hu={exports:{}},A2;function wN(){if(A2)return Hu.exports;A2=1;var t=Object.prototype.toString,e=Dv();if(e){var r=Symbol.prototype.toString,n=/^Symbol\(.*\)$/,i=function(o){return typeof o.valueOf()!="symbol"?!1:n.test(r.call(o))};Hu.exports=function(o){if(typeof o=="symbol")return!0;if(t.call(o)!=="[object Symbol]")return!1;try{return i(o)}catch{return!1}}}else Hu.exports=function(o){return!1};return Hu.exports}var nm,I2;function _N(){if(I2)return nm;I2=1;var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol",e=yN(),r=tT(),n=vN(),i=wN(),s=function(l,u){if(typeof l>"u"||l===null)throw new TypeError("Cannot call method on "+l);if(typeof u!="string"||u!=="number"&&u!=="string")throw new TypeError('hint must be "string" or "number"');var c=u==="string"?["toString","valueOf"]:["valueOf","toString"],f,d,y;for(y=0;y1&&(arguments[1]===String?u="string":arguments[1]===Number&&(u="number"));var c;if(t&&(Symbol.toPrimitive?c=o(l,Symbol.toPrimitive):i(l)&&(c=Symbol.prototype.valueOf)),typeof c<"u"){var f=c.call(l,u);if(e(f))return f;throw new TypeError("unable to convert exotic object to primitive")}return u==="default"&&(n(l)||i(l))&&(u="string"),s(l,u==="default"?"number":u)},nm}var im,O2;function bN(){if(O2)return im;O2=1;var t=_N();return im=function(r){return arguments.length>1?t(r,arguments[1]):t(r)},im}var sm,R2;function xN(){if(R2)return sm;R2=1;var t=mr(),e=Of()(),r,n,i,s;if(e){r=t("Object.prototype.hasOwnProperty"),n=t("RegExp.prototype.exec"),i={};var o=function(){throw i};s={toString:o,valueOf:o},typeof Symbol.toPrimitive=="symbol"&&(s[Symbol.toPrimitive]=o)}var a=t("Object.prototype.toString"),l=Object.getOwnPropertyDescriptor,u="[object RegExp]";return sm=e?function(f){if(!f||typeof f!="object")return!1;var d=l(f,"lastIndex"),y=d&&r(d,"value");if(!y)return!1;try{n(f,s)}catch(v){return v===i}}:function(f){return!f||typeof f!="object"&&typeof f!="function"?!1:a(f)===u},sm}var om,M2;function SN(){if(M2)return om;M2=1;var t=mr(),e=de,r=xN(),n=t("RegExp.prototype.exec"),i=e("%TypeError%");return om=function(o){if(!r(o))throw new i("`regex` must be a RegExp");return function(l){return n(o,l)!==null}},om}var am,N2;function sT(){if(N2)return am;N2=1;var t=de,e=t("%String%"),r=t("%TypeError%");return am=function(i){if(typeof i=="symbol")throw new r("Cannot convert a Symbol value to a string");return e(i)},am}var lm,D2;function oT(){if(D2)return lm;D2=1;var t=Rf(),e=sT(),r=mr(),n=r("String.prototype.replace"),i=/^\s$/.test("᠎"),s=i?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,o=i?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;return lm=function(){var l=e(t(this));return n(n(l,s,""),o,"")},lm}var um,j2;function aT(){if(j2)return um;j2=1;var t=oT(),e="​",r="᠎";return um=function(){return String.prototype.trim&&e.trim()===e&&r.trim()===r&&("_"+r).trim()==="_"+r&&(r+"_").trim()===r+"_"?String.prototype.trim:t},um}var cm,L2;function CN(){if(L2)return cm;L2=1;var t=Go,e=aT();return cm=function(){var n=e();return t(String.prototype,{trim:n},{trim:function(){return String.prototype.trim!==n}}),n},cm}var dm,B2;function EN(){if(B2)return dm;B2=1;var t=iu,e=Go,r=Rf(),n=oT(),i=aT(),s=CN(),o=t(i()),a=function(u){return r(u),o(u)};return e(a,{getPolyfill:i,implementation:n,shim:s}),dm=a,dm}var fm,$2;function TN(){if($2)return fm;$2=1;var t=de,e=t("%Number%"),r=t("%RegExp%"),n=t("%TypeError%"),i=t("%parseInt%"),s=mr(),o=SN(),a=s("String.prototype.slice"),l=o(/^0b[01]+$/i),u=o(/^0o[0-7]+$/i),c=o(/^[-+]0x[0-9a-f]+$/i),f=["…","​","￾"].join(""),d=new r("["+f+"]","g"),y=o(d),v=EN(),b=St();return fm=function w(p){if(b(p)!=="String")throw new n("Assertion failed: `argument` is not a String");if(l(p))return e(i(a(p,2),2));if(u(p))return e(i(a(p,2),8));if(y(p)||c(p))return NaN;var m=v(p);return m!==p?w(m):e(p)},fm}var hm,U2;function kN(){if(U2)return hm;U2=1;var t=de,e=t("%TypeError%"),r=t("%Number%"),n=iT(),i=bN(),s=TN();return hm=function(a){var l=n(a)?a:i(a,r);if(typeof l=="symbol")throw new e("Cannot convert a Symbol value to a number");if(typeof l=="bigint")throw new e("Conversion from 'BigInt' to 'number' is not allowed.");return typeof l=="string"?s(l):r(l)},hm}var pm,F2;function PN(){if(F2)return pm;F2=1;var t=St(),e=Math.floor;return pm=function(n){return t(n)==="BigInt"?n:e(n)},pm}var mm,q2;function AN(){if(q2)return mm;q2=1;var t=de,e=PN(),r=t("%TypeError%");return mm=function(i){if(typeof i!="number"&&typeof i!="bigint")throw new r("argument must be a Number or a BigInt");var s=i<0?-e(-i):e(i);return s===0?0:s},mm}var gm,H2;function IN(){if(H2)return gm;H2=1;var t=gN(),e=kN(),r=AN(),n=KE(),i=4294967296;return gm=function(o){var a=e(o);if(!n(a)||a===0)return 0;var l=r(a),u=t(l,i);return u===0?0:u},gm}var ym,z2;function ON(){if(z2)return ym;z2=1;var t=de,e=t("%Object%"),r=Rf();return ym=function(i){return r(i),e(i)},ym}var vm,W2;function lT(){if(W2)return vm;W2=1;var t=sN(),e=oN(),r=hN(),n=YE(),i=pN(),s=rT(),o=IN(),a=ON(),l=sT(),u=mr(),c=QE(),f=Object("a"),d=f[0]!=="a"||!(0 in f),y=u("String.prototype.split");return vm=function(b){var w=a(this),p=d&&c(w)?y(w,""):w,m=o(p.length);if(!s(b))throw new TypeError("Array.prototype.map callback must be a function");var g;arguments.length>1&&(g=arguments[1]);for(var x=t(w,m),S=0;S"u"?Promise:this,c)};r(l,{getPolyfill:s,implementation:i,shim:o}),t.exports=l,t.exports.default=l})(LE);var QN=LE.exports;const KN=yn(QN);var qv=function(){function t(e){var r=e.logger;this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=Wo(cs({name:"rate-limiter",emoji:!0},r))}return t.prototype.request=function(e,r){return kr(this,void 0,Promise,function(){var n=this;return ar(this,function(i){switch(i.label){case 0:return this._logger.trace("request start"),[4,new Promise(function(s,o){var a,l={req:e,resolve:s,reject:o,limitReachedBehavior:(a=r==null?void 0:r.limitReachedBehavior)!==null&&a!==void 0?a:"enqueue"};n._batchRunning||n._nextBatchTimer||n._paused?(n._logger.trace("request queued batchRunning:".concat(n._batchRunning.toString()," hasNextBatchTimer:").concat((!!n._nextBatchTimer).toString()," paused:").concat(n._paused.toString())),n._queue.push(l)):n._runRequestBatch([l])})];case 1:return[2,i.sent()]}})})},t.prototype.clear=function(){this._queue=[]},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1,this._runNextBatch()},Object.defineProperty(t.prototype,"stats",{get:function(){var e,r,n,i,s;return{lastKnownLimit:(r=(e=this._parameters)===null||e===void 0?void 0:e.limit)!==null&&r!==void 0?r:null,lastKnownRemainingRequests:(i=(n=this._parameters)===null||n===void 0?void 0:n.remaining)!==null&&i!==void 0?i:null,lastKnownResetDate:hr((s=this._parameters)===null||s===void 0?void 0:s.resetsAt,function(o){return new Date(o)})}},enumerable:!1,configurable:!0}),t.prototype._runRequestBatch=function(e){return kr(this,void 0,void 0,function(){var r,n,i,s,o,a,l,u,c=this;return ar(this,function(f){switch(f.label){case 0:return this._logger.trace("runRequestBatch start specs:".concat(e.length)),this._batchRunning=!0,this._parameters&&this._logger.debug("Remaining requests: ".concat(this._parameters.remaining)),this._logger.debug("Doing ".concat(e.length," requests, new queue length is ").concat(this._queue.length)),r=e.map(function(d){return kr(c,void 0,Promise,function(){var y,v,b,w,p,m,g;return ar(this,function(x){switch(x.label){case 0:y=d.req,v=d.resolve,b=d.reject,x.label=1;case 1:return x.trys.push([1,3,,4]),[4,this.doRequest(y)];case 2:if(w=x.sent(),p=this.needsToRetryAfter(w),p!==null)throw this._queue.unshift(d),this._logger.info("Retrying after ".concat(p," ms")),new ub(p);return m=this.getParametersFromResponse(w),v(w),[2,m];case 3:if(g=x.sent(),g instanceof ub)throw g;return b(g),[2,void 0];case 4:return[2]}})})}),[4,KN.call(Promise,r)];case 1:return n=f.sent(),i=n.filter(function(d){return d.status==="rejected"}),s=Date.now(),i.length?(this._logger.trace("runRequestBatch some rejected"),o=Math.max.apply(Math,vi([s],_n(i.map(function(d){return d.reason.retryAt})),!1)),a=o-s,this._logger.warn("Waiting for ".concat(a," ms because the rate limit was exceeded")),this._nextBatchTimer=setTimeout(function(){c._parameters=void 0,c._runNextBatch()},a)):(this._logger.trace("runRequestBatch none rejected"),l=n.filter(function(d){return d.status==="fulfilled"&&d.value!==void 0}).map(function(d){return d.value}).reduce(function(d,y){return d?y.remaining0?(this._logger.trace("runRequestBatch canRunMore"),this._runNextBatch()):(u=l.resetsAt-s,this._logger.trace("runRequestBatch delay:".concat(u)),this._logger.warn("Waiting for ".concat(u," ms because the rate limit was reached")),this._queue=this._queue.filter(function(d){switch(d.limitReachedBehavior){case"enqueue":return!0;case"null":return d.resolve(null),!1;case"throw":return d.reject(new Rv("Request removed from queue because the rate limit was reached")),!1;default:throw new Error("this should never happen")}}),this._nextBatchTimer=setTimeout(function(){c._parameters=void 0,c._runNextBatch()},u)))),this._logger.trace("runRequestBatch end"),[2]}})})},t.prototype._runNextBatch=function(){if(!this._paused){this._logger.trace("runNextBatch start"),this._nextBatchTimer&&(clearTimeout(this._nextBatchTimer),this._nextBatchTimer=void 0);var e=this._parameters?Math.min(this._parameters.remaining,this._parameters.limit/10):1,r=this._queue.splice(0,e);r.length&&this._runRequestBatch(r),this._logger.trace("runNextBatch end")}},t}(),YN=function(){function t(e){this._children=new Map,this._paused=!1,this._partitionKeyCallback=e.getPartitionKey,this._createChildCallback=e.createChild}return t.prototype.request=function(e,r){return kr(this,void 0,Promise,function(){var n,i;return ar(this,function(s){switch(s.label){case 0:return n=this._partitionKeyCallback(e),i=this._getChild(n),[4,i.request(e,r)];case 1:return[2,s.sent()]}})})},t.prototype.clear=function(){var e,r;try{for(var n=fc(this._children.values()),i=n.next();!i.done;i=n.next()){var s=i.value;s.clear()}}catch(o){e={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.pause=function(){var e,r;this._paused=!0;try{for(var n=fc(this._children.values()),i=n.next();!i.done;i=n.next()){var s=i.value;s.pause()}}catch(o){e={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.resume=function(){var e,r;this._paused=!1;try{for(var n=fc(this._children.values()),i=n.next();!i.done;i=n.next()){var s=i.value;s.resume()}}catch(o){e={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.getChildStats=function(e){if(!this._children.has(e))return null;var r=this._children.get(e);return r instanceof qv?r.stats:null},t.prototype._getChild=function(e){if(this._children.has(e))return this._children.get(e);var r=this._createChildCallback(e);return this._paused&&r.pause(),this._children.set(e,r),r},t}(),pT=function(){function t(e){var r=e.logger,n=e.bucketSize,i=e.timeFrame,s=e.doRequest,o=e.getPartitionKey;this._partitionedQueue=new Map,this._usedFromBucket=new Map,this._paused=!1,this._logger=Wo(cs({name:"rate-limiter",emoji:!0},r)),this._bucketSize=n,this._timeFrame=i,this._callback=s,this._partitionKeyCallback=o}return t.prototype.request=function(e,r){return kr(this,void 0,Promise,function(){var n=this;return ar(this,function(i){switch(i.label){case 0:return[4,new Promise(function(s,o){var a,l,u={req:e,resolve:s,reject:o,limitReachedBehavior:(a=r==null?void 0:r.limitReachedBehavior)!==null&&a!==void 0?a:"enqueue"},c=n._partitionKeyCallback(e),f=(l=n._usedFromBucket.get(c))!==null&&l!==void 0?l:0;if(f>=n._bucketSize||n._paused)switch(u.limitReachedBehavior){case"enqueue":{var d=n._getPartitionedQueue(c);d.push(u),f+d.length>=n._bucketSize?n._logger.warn("Rate limit of ".concat(n._bucketSize," for ").concat(c?"partition ".concat(c):"default partition"," was reached, waiting for ").concat(n._paused?"the limiter to be unpaused":"a free bucket entry","; queue size is ").concat(d.length)):n._logger.info("Enqueueing request for ".concat(c?"partition ".concat(c):"default partition"," because the rate limiter is paused; queue size is ").concat(d.length));break}case"null":{u.resolve(null),n._paused?n._logger.info("Returning null for request for ".concat(c?"partition ".concat(c):"default partition"," because the rate limiter is paused")):n._logger.warn("Rate limit of ".concat(n._bucketSize," for ").concat(c?"partition ".concat(c):"default partition"," was reached, dropping request and returning null"));break}case"throw":{u.reject(new Rv("Request dropped because ".concat(n._paused?"the rate limiter is paused":"the rate limit for ".concat(c?"partition ".concat(c):"default partition"," was reached"))));break}default:throw new Error("this should never happen")}else n._runRequest(u,c)})];case 1:return[2,i.sent()]}})})},t.prototype.clear=function(){this._partitionedQueue.clear()},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){var e,r;this._paused=!1;try{for(var n=fc(this._partitionedQueue.keys()),i=n.next();!i.done;i=n.next()){var s=i.value;this._runNextRequest(s)}}catch(o){e={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype._getPartitionedQueue=function(e){if(this._partitionedQueue.has(e))return this._partitionedQueue.get(e);var r=[];return this._partitionedQueue.set(e,r),r},t.prototype._runRequest=function(e,r){var n;return kr(this,void 0,void 0,function(){var i,s,o,a,l,u,c=this;return ar(this,function(f){switch(f.label){case 0:i=this._getPartitionedQueue(r),this._logger.debug("doing a request for ".concat(r?"partition ".concat(r):"default partition",", new queue length is ").concat(i.length)),this._usedFromBucket.set(r,((n=this._usedFromBucket.get(r))!==null&&n!==void 0?n:0)+1),s=e.req,o=e.resolve,a=e.reject,f.label=1;case 1:return f.trys.push([1,3,4,5]),l=o,[4,this._callback(s)];case 2:return l.apply(void 0,[f.sent()]),[3,5];case 3:return u=f.sent(),a(u),[3,5];case 4:return setTimeout(function(){var d=c._usedFromBucket.get(r)-1;c._usedFromBucket.set(r,d),i.length&&d=n._bucketSize||n._paused)switch(l.limitReachedBehavior){case"enqueue":{n._queue.push(l),n._usedFromBucket+n._queue.length>=n._bucketSize?n._logger.warn("Rate limit of ".concat(n._bucketSize," was reached, waiting for ").concat(n._paused?"the limiter to be unpaused":"a free bucket entry","; queue size is ").concat(n._queue.length)):n._logger.info("Enqueueing request because the rate limiter is paused; queue size is ".concat(n._queue.length));break}case"null":{l.resolve(null),n._logger.warn("Rate limit of ".concat(n._bucketSize," was reached, dropping request and returning null")),n._paused?n._logger.info("Returning null for request because the rate limiter is paused"):n._logger.warn("Rate limit of ".concat(n._bucketSize," was reached, dropping request and returning null"));break}case"throw":{l.reject(new Rv("Request dropped because ".concat(n._paused?"the rate limiter is paused":"the rate limit was reached")));break}default:throw new Error("this should never happen")}else n._runRequest(l)})];case 1:return[2,i.sent()]}})})},t.prototype.clear=function(){this._queue=[]},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1,this._runNextRequest()},t.prototype._runRequest=function(e){return kr(this,void 0,void 0,function(){var r,n,i,s,o,a=this;return ar(this,function(l){switch(l.label){case 0:this._logger.debug("doing a request, new queue length is ".concat(this._queue.length)),this._usedFromBucket+=1,r=e.req,n=e.resolve,i=e.reject,l.label=1;case 1:return l.trys.push([1,3,4,5]),s=n,[4,this._callback(r)];case 2:return s.apply(void 0,[l.sent()]),[3,5];case 3:return o=l.sent(),i(o),[3,5];case 4:return setTimeout(function(){a._usedFromBucket-=1,a._queue.length&&a._usedFromBucketthis.addListener(e,r);return e}emit(e,...r){if(this._eventListeners.has(e))for(const n of this._eventListeners.get(e))n(...r);if(this._internalEventListeners.has(e))for(const n of this._internalEventListeners.get(e))n(...r)}registerInternalEvent(){const e=r=>this.addInternalListener(e,r);return e}addInternalListener(e,r){return this._addListener(!0,e,r)}removeInternalListener(e,r){this._removeListener(!0,e,r)}_addListener(e,r,n){const i=e?this._eventListeners:this._internalEventListeners;return i.has(r)?i.get(r).push(n):i.set(r,[n]),new JN(this,r,n,e)}_removeListener(e,r,n){const i=e?this._eventListeners:this._internalEventListeners;if(!r)i.clear();else if(typeof r=="object"){const s=r;this._removeListener(s._internal,s.event,s.listener)}else{const s=r;if(i.has(s))if(n){const o=i.get(s);let a=0;for(;(a=o.indexOf(n))!==-1;)o.splice(a,1)}else i.delete(s)}}}const ZN=6e4;function e6(t){return hr(t.expiresIn,e=>t.obtainmentTimestamp+e*1e3-ZN)}function oo(t){var e;return(e=hr(e6(t),r=>Date.now()>r))!==null&&e!==void 0?e:!1}var ay={exports:{}};(function(t,e){var r=typeof self<"u"?self:tf,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function l(P){return P&&DataView.prototype.isPrototypeOf(P)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(P){return P&&u.indexOf(Object.prototype.toString.call(P))>-1};function f(P){if(typeof P!="string"&&(P=String(P)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(P))throw new TypeError("Invalid character in header field name");return P.toLowerCase()}function d(P){return typeof P!="string"&&(P=String(P)),P}function y(P){var j={next:function(){var Q=P.shift();return{done:Q===void 0,value:Q}}};return a.iterable&&(j[Symbol.iterator]=function(){return j}),j}function v(P){this.map={},P instanceof v?P.forEach(function(j,Q){this.append(Q,j)},this):Array.isArray(P)?P.forEach(function(j){this.append(j[0],j[1])},this):P&&Object.getOwnPropertyNames(P).forEach(function(j){this.append(j,P[j])},this)}v.prototype.append=function(P,j){P=f(P),j=d(j);var Q=this.map[P];this.map[P]=Q?Q+", "+j:j},v.prototype.delete=function(P){delete this.map[f(P)]},v.prototype.get=function(P){return P=f(P),this.has(P)?this.map[P]:null},v.prototype.has=function(P){return this.map.hasOwnProperty(f(P))},v.prototype.set=function(P,j){this.map[f(P)]=d(j)},v.prototype.forEach=function(P,j){for(var Q in this.map)this.map.hasOwnProperty(Q)&&P.call(j,this.map[Q],Q,this)},v.prototype.keys=function(){var P=[];return this.forEach(function(j,Q){P.push(Q)}),y(P)},v.prototype.values=function(){var P=[];return this.forEach(function(j){P.push(j)}),y(P)},v.prototype.entries=function(){var P=[];return this.forEach(function(j,Q){P.push([Q,j])}),y(P)},a.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function b(P){if(P.bodyUsed)return Promise.reject(new TypeError("Already read"));P.bodyUsed=!0}function w(P){return new Promise(function(j,Q){P.onload=function(){j(P.result)},P.onerror=function(){Q(P.error)}})}function p(P){var j=new FileReader,Q=w(j);return j.readAsArrayBuffer(P),Q}function m(P){var j=new FileReader,Q=w(j);return j.readAsText(P),Q}function g(P){for(var j=new Uint8Array(P),Q=new Array(j.length),le=0;le-1?j:P}function O(P,j){j=j||{};var Q=j.body;if(P instanceof O){if(P.bodyUsed)throw new TypeError("Already read");this.url=P.url,this.credentials=P.credentials,j.headers||(this.headers=new v(P.headers)),this.method=P.method,this.mode=P.mode,this.signal=P.signal,!Q&&P._bodyInit!=null&&(Q=P._bodyInit,P.bodyUsed=!0)}else this.url=String(P);if(this.credentials=j.credentials||this.credentials||"same-origin",(j.headers||!this.headers)&&(this.headers=new v(j.headers)),this.method=R(j.method||this.method||"GET"),this.mode=j.mode||this.mode||null,this.signal=j.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&Q)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(Q)}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function $(P){var j=new FormData;return P.trim().split("&").forEach(function(Q){if(Q){var le=Q.split("="),B=le.shift().replace(/\+/g," "),H=le.join("=").replace(/\+/g," ");j.append(decodeURIComponent(B),decodeURIComponent(H))}}),j}function G(P){var j=new v,Q=P.replace(/\r?\n[\t ]+/g," ");return Q.split(/\r?\n/).forEach(function(le){var B=le.split(":"),H=B.shift().trim();if(H){var Y=B.join(":").trim();j.append(H,Y)}}),j}S.call(O.prototype);function ee(P,j){j||(j={}),this.type="default",this.status=j.status===void 0?200:j.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in j?j.statusText:"OK",this.headers=new v(j.headers),this.url=j.url||"",this._initBody(P)}S.call(ee.prototype),ee.prototype.clone=function(){return new ee(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},ee.error=function(){var P=new ee(null,{status:0,statusText:""});return P.type="error",P};var fe=[301,302,303,307,308];ee.redirect=function(P,j){if(fe.indexOf(j)===-1)throw new RangeError("Invalid status code");return new ee(null,{status:j,headers:{location:P}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(j,Q){this.message=j,this.name=Q;var le=Error(j);this.stack=le.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function he(P,j){return new Promise(function(Q,le){var B=new O(P,j);if(B.signal&&B.signal.aborted)return le(new o.DOMException("Aborted","AbortError"));var H=new XMLHttpRequest;function Y(){H.abort()}H.onload=function(){var se={status:H.status,statusText:H.statusText,headers:G(H.getAllResponseHeaders()||"")};se.url="responseURL"in H?H.responseURL:se.headers.get("X-Request-URL");var ye="response"in H?H.response:H.responseText;Q(new ee(ye,se))},H.onerror=function(){le(new TypeError("Network request failed"))},H.ontimeout=function(){le(new TypeError("Network request failed"))},H.onabort=function(){le(new o.DOMException("Aborted","AbortError"))},H.open(B.method,B.url,!0),B.credentials==="include"?H.withCredentials=!0:B.credentials==="omit"&&(H.withCredentials=!1),"responseType"in H&&a.blob&&(H.responseType="blob"),B.headers.forEach(function(se,ye){H.setRequestHeader(ye,se)}),B.signal&&(B.signal.addEventListener("abort",Y),H.onreadystatechange=function(){H.readyState===4&&B.signal.removeEventListener("abort",Y)}),H.send(typeof B._bodyInit>"u"?null:B._bodyInit)})}return he.polyfill=!0,s.fetch||(s.fetch=he,s.Headers=v,s.Request=O,s.Response=ee),o.Headers=v,o.Request=O,o.Response=ee,o.fetch=he,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(ay,ay.exports);var mT=ay.exports;const t6=yn(mT);var Sm=Object.prototype.hasOwnProperty,Os=Array.isArray,Dr=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),r6=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Os(n)){for(var i=[],s=0;s=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122){s+=i.charAt(o);continue}if(a<128){s=s+Dr[a];continue}if(a<2048){s=s+(Dr[192|a>>6]+Dr[128|a&63]);continue}if(a<55296||a>=57344){s=s+(Dr[224|a>>12]+Dr[128|a>>6&63]+Dr[128|a&63]);continue}o+=1,a=65536+((a&1023)<<10|i.charCodeAt(o)&1023),s+=Dr[240|a>>18]+Dr[128|a>>12&63]+Dr[128|a>>6&63]+Dr[128|a&63]}return s},a6=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i"u")return w;var p;if(ao(a))p=a;else{var m=Object.keys(v);p=l?m.sort(l):m}for(var g=0;g"u"?ft.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ft.charsetSentinel,delimiter:typeof e.delimiter>"u"?ft.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:ft.encode,encoder:typeof e.encoder=="function"?e.encoder:ft.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:ft.encodeValuesOnly,filter:s,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:ft.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:ft.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ft.strictNullHandling}},b6=function(t,e){var r=t,n=_6(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):ao(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in X2?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var l=X2[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var u=0;u0?d+f:""};const vT=yn(b6);var x6=Hv;x6.decode;const h=Symbol("twurpleRawData");class Z{constructor(e){this[h]=e}}class Zr extends Error{constructor(e,r){var n;super(e,r),Object.setPrototypeOf(this,new.target.prototype),(n=Error.captureStackTrace)===null||n===void 0||n.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}}class S6 extends Zr{constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}}function ne(t){if(t==null)throw new S6;return t}function L(t,e,r){return n=>{const i=r?function(){return`[${e}#${this[r]} - please check https://twurple.js.org/reference/${t}/classes/${e}.html for available properties]`}:function(){return`[${e} - please check https://twurple.js.org/reference/${t}/classes/${e}.html for available properties]`};Object.defineProperty(n.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:i,enumerable:!1})}}let uy=class extends Z{get authorName(){return this[h].author_name}get bitsEnabled(){return this[h].bits_enabled}get installable(){return this[h].can_install}get configurationLocation(){return this[h].configuration_location}get description(){return this[h].description}get tosUrl(){return this[h].eula_tos_url}get hasChatSupport(){return this[h].has_chat_support}get iconUrl(){return this[h].icon_url}getIconUrl(e){return this[h].icon_urls[e]}get id(){return this[h].id}get name(){return this[h].name}get privacyPolicyUrl(){return this[h].privacy_policy_url}get requestsIdentityLink(){return this[h].request_identity_link}get screenshotUrls(){return this[h].screenshot_urls}get state(){return this[h].state}get subscriptionsSupportLevel(){return this[h].subscriptions_support_level}get summary(){return this[h].summary}get supportEmail(){return this[h].support_email}get version(){return this[h].version}get viewerSummery(){return this[h].viewer_summary}get allowedConfigUrls(){return this[h].allowlisted_config_urls}get allowedPanelUrls(){return this[h].allowlisted_panel_urls}get mobileViewerUrl(){var e,r;return(r=(e=this[h].views.mobile)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get panelViewerUrl(){var e,r;return(r=(e=this[h].views.panel)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get panelHeight(){var e,r;return(r=(e=this[h].views.panel)===null||e===void 0?void 0:e.height)!==null&&r!==void 0?r:null}get panelCanLinkExternalContent(){var e,r;return(r=(e=this[h].views.panel)===null||e===void 0?void 0:e.can_link_external_content)!==null&&r!==void 0?r:null}get overlayViewerUrl(){var e,r;return(r=(e=this[h].views.video_overlay)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get overlayCanLinkExternalContent(){var e,r;return(r=(e=this[h].views.video_overlay)===null||e===void 0?void 0:e.can_link_external_content)!==null&&r!==void 0?r:null}get componentViewerUrl(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get componentAspectWidth(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.aspect_width)!==null&&r!==void 0?r:null}get componentAspectHeight(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.aspect_height)!==null&&r!==void 0?r:null}get componentAspectRatioX(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.aspect_ratio_x)!==null&&r!==void 0?r:null}get componentAspectRatioY(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.aspect_ratio_y)!==null&&r!==void 0?r:null}get componentAutoScales(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.autoscale)!==null&&r!==void 0?r:null}get componentScalePixels(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.scale_pixels)!==null&&r!==void 0?r:null}get componentTargetHeight(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.target_height)!==null&&r!==void 0?r:null}get componentSize(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.size)!==null&&r!==void 0?r:null}get componentZoom(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.zoom)!==null&&r!==void 0?r:null}get componentZoomPixels(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.zoom_pixels)!==null&&r!==void 0?r:null}get componentCanLinkExternalContent(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.can_link_external_content)!==null&&r!==void 0?r:null}get configViewerUrl(){var e,r;return(r=(e=this[h].views.config)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get configCanLinkExternalContent(){var e,r;return(r=(e=this[h].views.config)===null||e===void 0?void 0:e.can_link_external_content)!==null&&r!==void 0?r:null}};uy=C([L("api","HelixExtension","id")],uy);class wi extends Zr{constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}}function E(t){return typeof t=="string"?t:typeof t=="number"?t.toString(10):t.id}function Oa(t){return typeof t=="string"?t:t.name}class ds extends Zr{constructor(e,r,n,i,s,o){super(`Encountered HTTP status code ${e}: ${r} + `);return s&&s.insertRule(o,0),n},Kc=globalThis&&globalThis.__assign||function(){return Kc=Object.assign||function(t){for(var e,r=1,n=arguments.length;rconsole.warn(l,"-",f)))}function o(l){return r.default.dim(l)}const a={info(l,u){s(r.default.bold(r.default.cyan("info")),...Array.isArray(l)?[l]:[u,l])},warn(l,u){s(r.default.bold(r.default.yellow("warn")),...Array.isArray(l)?[l]:[u,l])},risk(l,u){s(r.default.bold(r.default.magenta("risk")),...Array.isArray(l)?[l]:[u,l])}}})(B5);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});const e=r(B5);function r(s){return s&&s.__esModule?s:{default:s}}function n({version:s,from:o,to:a}){e.default.warn(`${o}-color-renamed`,[`As of Tailwind CSS ${s}, \`${o}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const i={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return n({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return n({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return n({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return n({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return n({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(L5);let Fh=L5;var GO=(Fh.__esModule?Fh:{default:Fh}).default;const VO=yn(GO);function U5({message:t,items:e,staticPosition:r}){return _.jsxs(Sv,{status:"loading",staticPosition:r,className:"flex-col",children:[_.jsxs("div",{className:"flex items-center justify-center gap-3",children:[Vg,t,Vg]}),e&&_.jsx("div",{className:"flex flex-col",children:e.map(n=>_.jsx(QO,{...n},n.message))})]})}function QO({message:t,status:e}){let r=Vg;switch(e){case"error":r=_.jsx("p",{children:"❌"});break;case"success":r=_.jsx("p",{children:"✅"});break}return _.jsxs("div",{className:"flex items-center justify-between gap-2",children:[_.jsx("p",{children:t}),r]})}const Vg=_.jsx(zO,{color:VO.lime[100],loading:!0,speedMultiplier:.5,height:16,width:3,radius:10}),ys={gcTime:1/0,staleTime:1/0,retry:1,retryOnMount:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1};function KO(t){const r=(t instanceof DocumentFragment?t:t[0]).cloneNode(!0),n=document.createElement("div");n.appendChild(r);const i=n.innerHTML;return n.remove(),i}function YO(t){const e=document.getElementById(t);if(!e)throw Error(`Template with id "${t}" not found.`);if(e.tagName!=="TEMPLATE")throw Error(`Element with id "${t}" is not a template.`);return e.content.cloneNode(!0)}async function P1(t,e){return new Promise(r=>{var s;(s=document.getElementById(t))==null||s.remove();const[n]=document.getElementsByTagName("head"),i=document.createElement("script");i.id=`slime2script.${t}`,i.src=`${e}?loadedAt=${Date.now()}`,i.async=!0,n.appendChild(i),i.onload=async()=>{r(!0)},i.onerror=async()=>{r(!1)}})}function vs(){}let XO=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");function bf(){return I.useContext(F5)}const F5=I.createContext({unsavedChanges:!1,setUnsavedChanges:vs}),q5={};function Ev(){return I.useContext(H5)}function xf(){const t=I.useContext(z5),{setUnsavedChanges:e}=bf();function r(u){t({type:"load-defaults",settings:u})}function n(u){t({type:"load-values",values:u})}function i(u,c,f){e(!0),t({type:"update-value",id:c,groupId:u,value:f})}function s(u,c,f){e(!0),t({type:"add-group-multiple",groupId:u,id:c,settingItems:f})}function o(u,c,f){e(!0),t({type:"copy-group-multiple",groupId:u,id:c,index:f})}function a(u,c,f){e(!0),t({type:"remove-group-multiple",groupId:u,id:c,index:f})}function l(u,c,f,d){e(!0),t({type:"move-group-multiple",groupId:u,id:c,currentIndex:f,newIndex:d})}return{loadDefaults:r,loadValues:n,update:i,addGroupMultiple:s,copyGroupMultiple:o,removeGroupMultiple:a,moveGroupMultiple:l}}const H5=I.createContext(q5),z5=I.createContext(vs);function JO(t,e){var r;switch(e.type){case"load-defaults":return Vs(e.settings,t);case"load-values":return e.values;case"update-value":{const{groupId:n,id:i}=e;let{value:s}=e;if(s!==null&&typeof s!="boolean"&&typeof s!="string"&&typeof s!="number"&&!Array.isArray(s))return t;Array.isArray(s)&&(s=s.filter(l=>typeof l=="string"||typeof l=="boolean"||typeof l=="number"));const o=(r=Ri(t,n))==null?void 0:r[i];if(!Array.isArray(s)&&s===o||Array.isArray(s)&&Array.isArray(o)&&JSON.stringify(s.toSorted())===JSON.stringify(o.toSorted()))return t;const a=JSON.parse(JSON.stringify(t));return eR(a,n,i,s),a}case"add-group-multiple":{const{groupId:n,id:i,settingItems:s}=e,o=JSON.parse(JSON.stringify(t)),a=Ri(o,n);if(a){const l=a[i];Array.isArray(l)&&(a[i]=[...l,{...Vs(s),__id:Yc(i)}])}return o}case"copy-group-multiple":{const{groupId:n,id:i,index:s}=e,o=JSON.parse(JSON.stringify(t)),a=Ri(o,n);if(a){const l=a[i];if(Array.isArray(l)){const u=JSON.parse(JSON.stringify(l[s]));a[i]=l.toSpliced(s,0,{...u,__id:Yc(i)})}}return o}case"move-group-multiple":{const{groupId:n,id:i,currentIndex:s,newIndex:o}=e;if(o<0||s===o)return t;const a=JSON.parse(JSON.stringify(t)),l=Ri(a,n);if(l){const u=l[i];if(Array.isArray(u)){if(o>=u.length)return t;const[c]=u.splice(s,1);u.splice(o,0,c)}}return a}case"remove-group-multiple":{const{groupId:n,id:i,index:s}=e,o=JSON.parse(JSON.stringify(t)),a=Ri(o,n);if(a){const l=a[i];Array.isArray(l)&&(a[i]=l.filter((u,c)=>s!==c))}return o}}}function Vs(t,e={}){const r=!e||typeof e!="object"||Array.isArray(e)?{}:JSON.parse(JSON.stringify(e)),n=new Map;for(const i of t){if(i.id==="__id")throw Error("__id cannot be used as a setting ID!");if(!i.id)throw Error("A widget setting is missing an ID! All widget settings must have a unique ID.");if(n.get(i.id))throw Error(`Two widget settings have the same ID of '${i.id}'! All widget settings must have a unique ID.`);n.set(i.id,!0);const s=ZO(i,r,r[i.id]);s!==void 0&&(r[i.id]=s)}return r}function ZO(t,e,r){function n(a){return typeof a=="string"}function i(a){return typeof a=="string"||typeof a=="boolean"||typeof a=="number"}function s(a){return!!a&&typeof a=="object"}function o(a){return{...Vs(t.settings,a),__id:Yc(t.id)}}switch(t.type){case"boolean-input":return typeof r=="boolean"?r:typeof t.defaultValue=="boolean"?t.defaultValue:!1;case"number-input":return typeof r=="number"||r===null?r:typeof t.defaultValue=="number"?t.defaultValue:null;case"font-input":case"color-input":return typeof r=="string"?r:typeof t.defaultValue=="string"?t.defaultValue:"";case"text-input":return"multiple"in t&&t.multiple?Array.isArray(r)?r.filter(n):Array.isArray(t.defaultValue)?t.defaultValue.filter(n):[]:typeof r=="string"?r:typeof t.defaultValue=="string"?t.defaultValue:"";case"image-input":case"video-input":case"audio-input":return"multiple"in t&&t.multiple?Array.isArray(r)?r.filter(n):Array.isArray(t.defaultValue)?t.defaultValue.filter(n):[]:typeof r=="string"||r===null?r:typeof t.defaultValue=="string"?t.defaultValue:null;case"dropdown-input":return typeof r=="string"||typeof r=="boolean"||typeof r=="number"?r:typeof t.defaultValue=="string"||typeof t.defaultValue=="boolean"||typeof t.defaultValue=="number"?t.defaultValue:t.options.length?t.options[0].value:null;case"select-input":return"multiple"in t&&t.multiple?Array.isArray(r)?r.filter(i):Array.isArray(t.defaultValue)?t.defaultValue.filter(i):[]:typeof r=="string"||typeof r=="boolean"||typeof r=="number"?r:typeof t.defaultValue=="string"||typeof t.defaultValue=="boolean"||typeof t.defaultValue=="number"?t.defaultValue:t.options.length?t.options[0].value:null;case"group":return"multiple"in t&&t.multiple?Array.isArray(r)?r.filter(s).map(o):Array.isArray(t.defaultValues)?t.defaultValues.filter(s).map(o):[{...Vs(t.settings),__id:Yc(t.id)}]:r&&typeof r=="object"&&!Array.isArray(r)?Vs(t.settings,r):Vs(t.settings,e[t.id]);default:return}}function Yc(t){return`${t}_${XO()}`}function Ri(t,e){let r=t;for(let n=0;n{const g=d==="youtube"?"google":d;return P1(`${d}.key`,`SLIME2_${g.toUpperCase()}_KEY.js`)}))).reduce((d,g)=>g&&d,!0)}function i(u,c){t({type:"set-key",provider:u,key:c})}function s(u){t({type:"set-max-events",maxEvents:u})}function o(u){t({type:"set-event-delay",delay:u})}function a(u,c){t({type:"set-event-expiration",expiration:u,options:c})}function l(u,c){if(typeof u!="string"||!u.endsWith(".js"))throw Error('The first parameter of createWidgetSettings must be a string that ends in ".js"');if(!Array.isArray(c))throw Error("The second parameter of createWidgetSettings must be an array of objects");P1("widget.data",u).finally(()=>e(c)),t({type:"create-widget-settings",settings:c,dataFileName:u})}return{onEvent:r,setKey:i,setPlatform:n,setMaxEvents:s,setEventDelay:o,setEventExpiration:a,createWidgetSettings:l}}const W5={sendEvent:vs,maxEvents:100,platforms:[],widgetSettings:[],widgetDataFileName:"",keys:{twitch:"",google:""}},G5=I.createContext(W5),V5=I.createContext(vs);function rR(t,e){switch(e.type){case"set-platform":return{...t,platforms:Array.isArray(e.platform)?e.platform:[e.platform]};case"set-key":return{...t,keys:{...t.keys,[e.provider]:e.key}};case"set-on-event":return{...t,sendEvent:e.onEvent};case"set-max-events":return{...t,maxEvents:e.maxEvents};case"set-event-expiration":return{...t,eventExpiration:e.expiration,eventExpirationOptions:e.options};case"set-event-delay":return{...t,eventDelay:e.delay};case"create-widget-settings":return{...t,widgetSettings:e.settings,widgetDataFileName:e.dataFileName}}}function We(t,e){let r=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(e[0])||(e=e.map(o=>[o]));let n=e[0].length,i=e[0].map((o,a)=>e.map(l=>l[a])),s=t.map(o=>i.map(a=>{let l=0;if(!Array.isArray(o)){for(let u of a)l+=o*u;return l}for(let u=0;uo[0]):s}function eu(t){return ci(t)==="string"}function ci(t){return(Object.prototype.toString.call(t).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Xc(t,e){t=+t,e=+e;let r=(Math.floor(t)+"").length;if(e>r)return+t.toFixed(e-r);{let n=10**(r-e);return Math.round(t/n)*n}}function Q5(t){if(!t)return;t=t.trim();const e=/^([a-z]+)\((.+?)\)$/i,r=/^-?[\d.]+$/;let n=t.match(e);if(n){let i=[];return n[2].replace(/\/?\s*([-\w.]+(?:%|deg)?)/g,(s,o)=>{/%$/.test(o)?(o=new Number(o.slice(0,-1)/100),o.type=""):/deg$/.test(o)?(o=new Number(+o.slice(0,-3)),o.type="",o.unit="deg"):r.test(o)&&(o=new Number(o),o.type=""),s.startsWith("/")&&(o=o instanceof Number?o:new Number(o),o.alpha=!0),i.push(o)}),{name:n[1].toLowerCase(),rawName:n[1],rawArgs:n[2],args:i}}}function K5(t){return t[t.length-1]}function Jc(t,e,r){return isNaN(t)?e:isNaN(e)?t:t+(e-t)*r}function Y5(t,e,r){return(r-t)/(e-t)}function Tv(t,e,r){return Jc(e[0],e[1],Y5(t[0],t[1],r))}function X5(t){return t.map(e=>e.split("|").map(r=>{r=r.trim();let n=r.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(n){let i=new String(n[1]);return i.range=[+n[2],+n[3]],i}return r}))}var nR=Object.freeze({__proto__:null,interpolate:Jc,interpolateInv:Y5,isString:eu,last:K5,mapRange:Tv,multiplyMatrices:We,parseCoordGrammar:X5,parseFunction:Q5,toPrecision:Xc,type:ci});class iR{add(e,r,n){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(i){this[i]=this[i]||[],r&&this[i][n?"unshift":"push"](r)},this)}run(e,r){this[e]=this[e]||[],this[e].forEach(function(n){n.call(r&&r.context?r.context:r,r)})}}const pi=new iR;var Yr={gamut_mapping:"lch.c",precision:5,deltaE:"76"};const Cr={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function Qg(t){return Array.isArray(t)?t:Cr[t]}function Zc(t,e,r,n={}){if(t=Qg(t),e=Qg(e),!t||!e)throw new TypeError(`Missing white point to convert ${t?"":"from"}${!t&&!e?"/":""}${e?"":"to"}`);if(t===e)return r;let i={W1:t,W2:e,XYZ:r,options:n};if(pi.run("chromatic-adaptation-start",i),i.M||(i.W1===Cr.D65&&i.W2===Cr.D50?i.M=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]]:i.W1===Cr.D50&&i.W2===Cr.D65&&(i.M=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]])),pi.run("chromatic-adaptation-end",i),i.M)return We(i.M,i.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const sR=75e-6,Lt=class Lt{constructor(e){var i,s,o;this.id=e.id,this.name=e.name,this.base=e.base?Lt.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let r=e.coords??this.base.coords;for(let a in r)"name"in r[a]||(r[a].name=a);this.coords=r;let n=e.white??this.base.white??"D65";this.white=Qg(n),this.formats=e.formats??{};for(let a in this.formats){let l=this.formats[a];l.type||(l.type="function"),l.name||(l.name=a)}e.cssId&&!((i=this.formats.functions)!=null&&i.color)?(this.formats.color={id:e.cssId},Object.defineProperty(this,"cssId",{value:e.cssId})):(s=this.formats)!=null&&s.color&&!((o=this.formats)!=null&&o.color.id)&&(this.formats.color.id=this.id),this.referred=e.referred,Object.defineProperty(this,"path",{value:oR(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),pi.run("colorspace-init-end",this)}inGamut(e,{epsilon:r=sR}={}){if(this.isPolar)return e=this.toBase(e),this.base.inGamut(e,{epsilon:r});let n=Object.values(this.coords);return e.every((i,s)=>{let o=n[s];if(o.type!=="angle"&&o.range){if(Number.isNaN(i))return!0;let[a,l]=o.range;return(a===void 0||i>=a-r)&&(l===void 0||i<=l+r)}return!0})}get cssId(){var e,r;return((r=(e=this.formats.functions)==null?void 0:e.color)==null?void 0:r.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=A1(e,this),e;let r;return e==="default"?r=Object.values(this.formats)[0]:r=this.formats[e],r?(r=A1(r,this),r):null}equals(e){return e?this===e||this.id===e.id:!1}to(e,r){if(arguments.length===1&&([e,r]=[e.space,e.coords]),e=Lt.get(e),this.equals(e))return r;r=r.map(a=>Number.isNaN(a)?0:a);let n=this.path,i=e.path,s,o;for(let a=0;ao;a--)r=n[a].toBase(r);for(let a=o+1;a=0){let u=Object.entries(i.coords)[s];if(u)return{space:i,id:u[0],index:s,...u[1]}}i=Lt.get(i);let o=s.toLowerCase(),a=0;for(let u in i.coords){let c=i.coords[u];if(u.toLowerCase()===o||((l=c.name)==null?void 0:l.toLowerCase())===o)return{space:i,id:u,index:a,...c};a++}throw new TypeError(`No "${s}" coordinate found in ${i.name}. Its coordinates are: ${Object.keys(i.coords).join(", ")}`)}};Mr(Lt,"registry",{}),Mr(Lt,"DEFAULT_FORMAT",{type:"functions",name:"color"});let re=Lt;function oR(t){let e=[t];for(let r=t;r=r.base;)e.push(r);return e}function A1(t,{coords:e}={}){if(t.coords&&!t.coordGrammar){t.type||(t.type="function"),t.name||(t.name="color"),t.coordGrammar=X5(t.coords);let r=Object.entries(e).map(([n,i],s)=>{let o=t.coordGrammar[s][0],a=i.range||i.refRange,l=o.range,u="";return o==""?(l=[0,100],u="%"):o==""&&(u="deg"),{fromRange:a,toRange:l,suffix:u}});t.serializeCoords=(n,i)=>n.map((s,o)=>{let{fromRange:a,toRange:l,suffix:u}=r[o];return a&&l&&(s=Tv(a,l,s)),s=Xc(s,i),u&&(s+=u),s})}return t}var sr=new re({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class Rt extends re{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=sr),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=r=>{let n=We(e.toXYZ_M,r);return this.white!==this.base.white&&(n=Zc(this.white,this.base.white,n)),n}),e.fromBase??(e.fromBase=r=>(r=Zc(this.base.white,this.white,r),We(e.fromXYZ_M,r)))),e.referred??(e.referred="display"),super(e)}}function J5(t,{meta:e}={}){var n,i,s,o,a;let r={str:(n=String(t))==null?void 0:n.trim()};if(pi.run("parse-start",r),r.color)return r.color;if(r.parsed=Q5(r.str),r.parsed){let l=r.parsed.name;if(l==="color"){let u=r.parsed.args.shift(),c=r.parsed.rawArgs.indexOf("/")>0?r.parsed.args.pop():1;for(let d of re.all){let g=d.getFormat("color");if(g&&(u===g.id||(i=g.ids)!=null&&i.includes(u))){const v=Object.keys(d.coords).map((b,w)=>r.parsed.args[w]||0);return e&&(e.formatId="color"),{spaceId:d.id,coords:v,alpha:c}}}let f="";if(u in re.registry){let d=(a=(o=(s=re.registry[u].formats)==null?void 0:s.functions)==null?void 0:o.color)==null?void 0:a.id;d&&(f=`Did you mean color(${d})?`)}throw new TypeError(`Cannot parse color(${u}). `+(f||"Missing a plugin?"))}else for(let u of re.all){let c=u.getFormat(l);if(c&&c.type==="function"){let f=1;(c.lastAlpha||K5(r.parsed.args).alpha)&&(f=r.parsed.args.pop());let d=r.parsed.args,g;return c.coordGrammar&&(g=Object.entries(u.coords).map(([v,b],w)=>{var k;let p=c.coordGrammar[w],m=(k=d[w])==null?void 0:k.type,y=p.find(O=>O==m);if(!y){let O=b.name||v;throw new TypeError(`${m} not allowed for ${O} in ${l}()`)}let x=y.range;m===""&&(x||(x=[0,1]));let S=b.range||b.refRange;return x&&S&&(d[w]=Tv(x,S,d[w])),y})),e&&Object.assign(e,{formatId:c.name,types:g}),{spaceId:u.id,coords:d,alpha:f}}}}else for(let l of re.all)for(let u in l.formats){let c=l.formats[u];if(c.type!=="custom"||c.test&&!c.test(r.str))continue;let f=c.parse(r.str);if(f)return f.alpha??(f.alpha=1),e&&(e.formatId=u),f}throw new TypeError(`Could not parse ${t} as a color. Missing a plugin?`)}function be(t){if(!t)throw new TypeError("Empty color reference");eu(t)&&(t=J5(t));let e=t.space||t.spaceId;return e instanceof re||(t.space=re.get(e)),t.alpha===void 0&&(t.alpha=1),t}function tu(t,e){return e=re.get(e),e.from(t)}function or(t,e){let{space:r,index:n}=re.resolveCoord(e,t.space);return tu(t,r)[n]}function Z5(t,e,r){return e=re.get(e),t.coords=e.to(t.space,r),t}function mi(t,e,r){if(t=be(t),arguments.length===2&&ci(arguments[1])==="object"){let n=arguments[1];for(let i in n)mi(t,i,n[i])}else{typeof r=="function"&&(r=r(or(t,e)));let{space:n,index:i}=re.resolveCoord(e,t.space),s=tu(t,n);s[i]=r,Z5(t,n,s)}return t}var kv=new re({id:"xyz-d50",name:"XYZ D50",white:"D50",base:sr,fromBase:t=>Zc(sr.white,"D50",t),toBase:t=>Zc("D50",sr.white,t),formats:{color:{}}});const aR=216/24389,I1=24/116,Mu=24389/27;let qh=Cr.D50;var qt=new re({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"L"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:qh,base:kv,fromBase(t){let r=t.map((n,i)=>n/qh[i]).map(n=>n>aR?Math.cbrt(n):(Mu*n+16)/116);return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[2])]},toBase(t){let e=[];return e[1]=(t[0]+16)/116,e[0]=t[1]/500+e[1],e[2]=e[1]-t[2]/200,[e[0]>I1?Math.pow(e[0],3):(116*e[0]-16)/Mu,t[0]>8?Math.pow((t[0]+16)/116,3):t[0]/Mu,e[2]>I1?Math.pow(e[2],3):(116*e[2]-16)/Mu].map((n,i)=>n*qh[i])},formats:{lab:{coords:[" | "," | [-1,1]"," | [-1,1]"]}}});function Sf(t){return(t%360+360)%360}function lR(t,e){if(t==="raw")return e;let[r,n]=e.map(Sf),i=n-r;return t==="increasing"?i<0&&(n+=360):t==="decreasing"?i>0&&(r+=360):t==="longer"?-1800?r+=360:n+=360):t==="shorter"&&(i>180?r+=360:i<-180&&(n+=360)),[r,n]}var sl=new re({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:qt,fromBase(t){let[e,r,n]=t,i;const s=.02;return Math.abs(r) | "," | "," | "]}}});const O1=25**7,ed=Math.PI,R1=180/ed,Es=ed/180;function Kg(t,e,{kL:r=1,kC:n=1,kH:i=1}={}){let[s,o,a]=qt.from(t),l=sl.from(qt,[s,o,a])[1],[u,c,f]=qt.from(e),d=sl.from(qt,[u,c,f])[1];l<0&&(l=0),d<0&&(d=0);let v=((l+d)/2)**7,b=.5*(1-Math.sqrt(v/(v+O1))),w=(1+b)*o,p=(1+b)*c,m=Math.sqrt(w**2+a**2),y=Math.sqrt(p**2+f**2),x=w===0&&a===0?0:Math.atan2(a,w),S=p===0&&f===0?0:Math.atan2(f,p);x<0&&(x+=2*ed),S<0&&(S+=2*ed),x*=R1,S*=R1;let k=u-s,O=y-m,M=S-x,L=x+S,W=Math.abs(M),ee;m*y===0?ee=0:W<=180?ee=M:M>180?ee=M-360:M<-180?ee=M+360:console.log("the unthinkable has happened");let le=2*Math.sqrt(y*m)*Math.sin(ee*Es/2),he=(s+u)/2,P=(m+y)/2,j=Math.pow(P,7),Q;m*y===0?Q=L:W<=180?Q=L/2:L<360?Q=(L+360)/2:Q=(L-360)/2;let ue=(he-50)**2,$=1+.015*ue/Math.sqrt(20+ue),H=1+.045*P,Y=1;Y-=.17*Math.cos((Q-30)*Es),Y+=.24*Math.cos(2*Q*Es),Y+=.32*Math.cos((3*Q+6)*Es),Y-=.2*Math.cos((4*Q-63)*Es);let se=1+.015*P*Y,ye=30*Math.exp(-1*((Q-275)/25)**2),Mt=2*Math.sqrt(j/(j+O1)),Nt=-1*Math.sin(2*ye*Es)*Mt,Or=(k/(r*$))**2;return Or+=(O/(n*H))**2,Or+=(le/(i*se))**2,Or+=Nt*(O/(n*H))*(le/(i*se)),Math.sqrt(Or)}const uR=75e-6;function Pa(t,e=t.space,{epsilon:r=uR}={}){t=be(t),e=re.get(e);let n=t.coords;return e!==t.space&&(n=e.from(t)),e.inGamut(n,{epsilon:r})}function ol(t){return{space:t.space,coords:t.coords.slice(),alpha:t.alpha}}function gi(t,{method:e=Yr.gamut_mapping,space:r=t.space}={}){if(eu(arguments[1])&&(r=arguments[1]),r=re.get(r),Pa(t,r,{epsilon:0}))return be(t);let n=nr(t,r);if(e!=="clip"&&!Pa(t,r)){let i=gi(ol(n),{method:"clip",space:r});if(Kg(t,i)>2){let s=re.resolveCoord(e),o=s.space,a=s.id,l=nr(n,o),c=(s.range||s.refRange)[0],f=.01,d=c,g=or(l,a);for(;g-d>f;){let v=ol(l);v=gi(v,{space:r,method:"clip"}),Kg(l,v)-2s.range||[]);n.coords=n.coords.map((s,o)=>{let[a,l]=i[o];return a!==void 0&&(s=Math.max(a,s)),l!==void 0&&(s=Math.min(s,l)),s})}return r!==t.space&&(n=nr(n,t.space)),t.coords=n.coords,t}gi.returns="color";function nr(t,e,{inGamut:r}={}){t=be(t),e=re.get(e);let n=e.from(t),i={space:e,coords:n,alpha:t.alpha};return r&&(i=gi(i)),i}nr.returns="color";function td(t,{precision:e=Yr.precision,format:r="default",inGamut:n=!0,...i}={}){var l;let s;t=be(t);let o=r;r=t.space.getFormat(r)??t.space.getFormat("default")??re.DEFAULT_FORMAT,n||(n=r.toGamut);let a=t.coords;if(a=a.map(u=>u||0),n&&!Pa(t)&&(a=gi(ol(t),n===!0?void 0:n).coords),r.type==="custom")if(i.precision=e,r.serialize)s=r.serialize(a,t.alpha,i);else throw new TypeError(`format ${o} can only be used to parse colors, not for serialization`);else{let u=r.name||"color";r.serializeCoords?a=r.serializeCoords(a,e):e!==null&&(a=a.map(g=>Xc(g,e)));let c=[...a];if(u==="color"){let g=r.id||((l=r.ids)==null?void 0:l[0])||t.space.id;c.unshift(g)}let f=t.alpha;e!==null&&(f=Xc(f,e));let d=t.alpha<1&&!r.noAlpha?`${r.commas?",":" /"} ${f}`:"";s=`${u}(${c.join(r.commas?", ":" ")}${d})`}return s}const cR=[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],dR=[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]];var Cf=new Rt({id:"rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:cR,fromXYZ_M:dR,formats:{color:{}}});const Nu=1.09929682680944,M1=.018053968510807;var eE=new Rt({id:"rec2020",name:"REC.2020",base:Cf,toBase(t){return t.map(function(e){return e=M1?Nu*Math.pow(e,.45)-(Nu-1):4.5*e})},formats:{color:{}}});const fR=[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],hR=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]];var tE=new Rt({id:"p3-linear",name:"Linear P3",white:"D65",toXYZ_M:fR,fromXYZ_M:hR});const pR=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],mR=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]];var rE=new Rt({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:pR,fromXYZ_M:mR,formats:{color:{}}}),N1={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let D1=Array(3).fill(" | [0, 255]"),j1=Array(3).fill("[0, 255]");var al=new Rt({id:"srgb",name:"sRGB",base:rE,fromBase:t=>t.map(e=>{let r=e<0?-1:1,n=e*r;return n>.0031308?r*(1.055*n**(1/2.4)-.055):12.92*e}),toBase:t=>t.map(e=>{let r=e<0?-1:1,n=e*r;return n<.04045?e/12.92:r*((n+.055)/1.055)**2.4}),formats:{rgb:{coords:D1},rgb_number:{name:"rgb",commas:!0,coords:j1,noAlpha:!0},color:{},rgba:{coords:D1,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:j1},hex:{type:"custom",toGamut:!0,test:t=>/^#([a-f0-9]{3,4}){1,2}$/i.test(t),parse(t){t.length<=5&&(t=t.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return t.replace(/[a-f0-9]{2}/gi,r=>{e.push(parseInt(r,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(t,e,{collapse:r=!0}={})=>{e<1&&t.push(e),t=t.map(s=>Math.round(s*255));let n=r&&t.every(s=>s%17===0);return"#"+t.map(s=>n?(s/17).toString(16):s.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:t=>/^[a-z]+$/i.test(t),parse(t){t=t.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(t==="transparent"?(e.coords=N1.black,e.alpha=0):e.coords=N1[t],e.coords)return e}}}}),nE=new Rt({id:"p3",name:"P3",base:tE,fromBase:al.fromBase,toBase:al.toBase,formats:{color:{id:"display-p3"}}});Yr.display_space=al;if(typeof CSS<"u"&&CSS.supports)for(let t of[qt,eE,nE]){let e=t.getMinCoords(),n=td({space:t,coords:e,alpha:1});if(CSS.supports("color",n)){Yr.display_space=t;break}}function gR(t,{space:e=Yr.display_space,...r}={}){let n=td(t,r);if(typeof CSS>"u"||CSS.supports("color",n)||!Yr.display_space)n=new String(n),n.color=t;else{let i=nr(t,e);n=new String(td(i,r)),n.color=i}return n}function iE(t,e,r="lab"){r=re.get(r);let n=r.from(t),i=r.from(e);return Math.sqrt(n.reduce((s,o,a)=>{let l=i[a];return isNaN(o)||isNaN(l)?s:s+(l-o)**2},0))}function yR(t,e){return t=be(t),e=be(e),t.space===e.space&&t.alpha===e.alpha&&t.coords.every((r,n)=>r===e.coords[n])}function yi(t){return or(t,[sr,"y"])}function sE(t,e){mi(t,[sr,"y"],e)}function vR(t){Object.defineProperty(t.prototype,"luminance",{get(){return yi(this)},set(e){sE(this,e)}})}var wR=Object.freeze({__proto__:null,getLuminance:yi,register:vR,setLuminance:sE});function _R(t,e){t=be(t),e=be(e);let r=Math.max(yi(t),0),n=Math.max(yi(e),0);return n>r&&([r,n]=[n,r]),(r+.05)/(n+.05)}const bR=.56,xR=.57,SR=.62,CR=.65,L1=.022,ER=1.414,TR=.1,kR=5e-4,PR=1.14,B1=.027,AR=1.14;function $1(t){return t>=L1?t:t+(L1-t)**ER}function Ts(t){let e=t<0?-1:1,r=Math.abs(t);return e*Math.pow(r,2.4)}function IR(t,e){e=be(e),t=be(t);let r,n,i,s,o,a;e=nr(e,"srgb"),[s,o,a]=e.coords;let l=Ts(s)*.2126729+Ts(o)*.7151522+Ts(a)*.072175;t=nr(t,"srgb"),[s,o,a]=t.coords;let u=Ts(s)*.2126729+Ts(o)*.7151522+Ts(a)*.072175,c=$1(l),f=$1(u),d=f>c;return Math.abs(f-c)0?i=n-B1:i=n+B1,i*100}function OR(t,e){t=be(t),e=be(e);let r=Math.max(yi(t),0),n=Math.max(yi(e),0);n>r&&([r,n]=[n,r]);let i=r+n;return i===0?0:(r-n)/i}const RR=5e4;function MR(t,e){t=be(t),e=be(e);let r=Math.max(yi(t),0),n=Math.max(yi(e),0);return n>r&&([r,n]=[n,r]),n===0?RR:(r-n)/n}function NR(t,e){t=be(t),e=be(e);let r=or(t,[qt,"l"]),n=or(e,[qt,"l"]);return Math.abs(r-n)}const DR=216/24389,U1=24/116,Du=24389/27;let Hh=Cr.D65;var Yg=new re({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"L"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Hh,base:sr,fromBase(t){let r=t.map((n,i)=>n/Hh[i]).map(n=>n>DR?Math.cbrt(n):(Du*n+16)/116);return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[2])]},toBase(t){let e=[];return e[1]=(t[0]+16)/116,e[0]=t[1]/500+e[1],e[2]=e[1]-t[2]/200,[e[0]>U1?Math.pow(e[0],3):(116*e[0]-16)/Du,t[0]>8?Math.pow((t[0]+16)/116,3):t[0]/Du,e[2]>U1?Math.pow(e[2],3):(116*e[2]-16)/Du].map((n,i)=>n*Hh[i])},formats:{"lab-d65":{coords:[" | "," | [-1,1]"," | [-1,1]"]}}});const zh=Math.pow(5,.5)*.5+.5;function jR(t,e){t=be(t),e=be(e);let r=or(t,[Yg,"l"]),n=or(e,[Yg,"l"]),i=Math.abs(Math.pow(r,zh)-Math.pow(n,zh)),s=Math.pow(i,1/zh)*Math.SQRT2-40;return s<7.5?0:s}var dc=Object.freeze({__proto__:null,contrastAPCA:IR,contrastDeltaPhi:jR,contrastLstar:NR,contrastMichelson:OR,contrastWCAG21:_R,contrastWeber:MR});function LR(t,e,r={}){eu(r)&&(r={algorithm:r});let{algorithm:n,...i}=r;if(!n){let s=Object.keys(dc).map(o=>o.replace(/^contrast/,"")).join(", ");throw new TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${s}`)}t=be(t),e=be(e);for(let s in dc)if("contrast"+n.toLowerCase()===s.toLowerCase())return dc[s](t,e,i);throw new TypeError(`Unknown contrast algorithm: ${n}`)}function oE(t){let[e,r,n]=tu(t,sr),i=e+15*r+3*n;return[4*e/i,9*r/i]}function aE(t){let[e,r,n]=tu(t,sr),i=e+r+n;return[e/i,r/i]}function BR(t){Object.defineProperty(t.prototype,"uv",{get(){return oE(this)}}),Object.defineProperty(t.prototype,"xy",{get(){return aE(this)}})}var $R=Object.freeze({__proto__:null,register:BR,uv:oE,xy:aE});function UR(t,e){return iE(t,e,"lab")}const FR=Math.PI,F1=FR/180;function qR(t,e,{l:r=2,c:n=1}={}){let[i,s,o]=qt.from(t),[,a,l]=sl.from(qt,[i,s,o]),[u,c,f]=qt.from(e),d=sl.from(qt,[u,c,f])[1];a<0&&(a=0),d<0&&(d=0);let g=i-u,v=a-d,b=s-c,w=o-f,p=b**2+w**2-v**2,m=.511;i>=16&&(m=.040975*i/(1+.01765*i));let y=.0638*a/(1+.0131*a)+.638,x;Number.isNaN(l)&&(l=0),l>=164&&l<=345?x=.56+Math.abs(.2*Math.cos((l+168)*F1)):x=.36+Math.abs(.4*Math.cos((l+35)*F1));let S=Math.pow(a,4),k=Math.sqrt(S/(S+1900)),O=y*(k*x+1-k),M=(g/(r*m))**2;return M+=(v/(n*y))**2,M+=p/O**2,Math.sqrt(M)}const q1=203;var Pv=new re({id:"xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:sr,fromBase(t){return t.map(e=>Math.max(e*q1,0))},toBase(t){return t.map(e=>Math.max(e/q1,0))}});const ju=1.15,Lu=.66,H1=2610/2**14,HR=2**14/2610,z1=3424/2**12,W1=2413/2**7,G1=2392/2**7,zR=1.7*2523/2**5,V1=2**5/(1.7*2523),Bu=-.56,Wh=16295499532821565e-27,WR=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],GR=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],VR=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],QR=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var lE=new re({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Pv,fromBase(t){let[e,r,n]=t,i=ju*e-(ju-1)*n,s=Lu*r-(Lu-1)*e,a=We(WR,[i,s,n]).map(function(d){let g=z1+W1*(d/1e4)**H1,v=1+G1*(d/1e4)**H1;return(g/v)**zR}),[l,u,c]=We(VR,a);return[(1+Bu)*l/(1+Bu*l)-Wh,u,c]},toBase(t){let[e,r,n]=t,i=(e+Wh)/(1+Bu-Bu*(e+Wh)),o=We(QR,[i,r,n]).map(function(d){let g=z1-d**V1,v=G1*d**V1-W1;return 1e4*(g/v)**HR}),[a,l,u]=We(GR,o),c=(a+(ju-1)*u)/ju,f=(l+(Lu-1)*c)/Lu;return[c,f,u]},formats:{color:{}}}),Xg=new re({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:lE,fromBase(t){let[e,r,n]=t,i;const s=2e-4;return Math.abs(r)Math.cbrt(n));return We(a4,r)},toBase(t){let r=We(l4,t).map(n=>n**3);return We(o4,r)},formats:{oklab:{coords:[" | "," | [-1,1]"," | [-1,1]"]}}});function u4(t,e){let[r,n,i]=rd.from(t),[s,o,a]=rd.from(e),l=r-s,u=n-o,c=i-a;return Math.sqrt(l**2+u**2+c**2)}var nd={deltaE76:UR,deltaECMC:qR,deltaE2000:Kg,deltaEJz:KR,deltaEITP:i4,deltaEOK:u4};function ya(t,e,r={}){eu(r)&&(r={method:r});let{method:n=Yr.deltaE,...i}=r;t=be(t),e=be(e);for(let s in nd)if("deltae"+n.toLowerCase()===s.toLowerCase())return nd[s](t,e,i);throw new TypeError(`Unknown deltaE method: ${n}`)}function c4(t,e=.25){let n=[re.get("oklch","lch"),"l"];return mi(t,n,i=>i*(1+e))}function d4(t,e=.25){let n=[re.get("oklch","lch"),"l"];return mi(t,n,i=>i*(1-e))}var f4=Object.freeze({__proto__:null,darken:d4,lighten:c4});function fE(t,e,r=.5,n={}){[t,e]=[be(t),be(e)],ci(r)==="object"&&([r,n]=[.5,r]);let{space:i,outputSpace:s,premultiplied:o}=n;return ru(t,e,{space:i,outputSpace:s,premultiplied:o})(r)}function hE(t,e,r={}){let n;Av(t)&&([n,r]=[t,e],[t,e]=n.rangeArgs.colors);let{maxDeltaE:i,deltaEMethod:s,steps:o=2,maxSteps:a=1e3,...l}=r;n||([t,e]=[be(t),be(e)],n=ru(t,e,l));let u=ya(t,e),c=i>0?Math.max(o,Math.ceil(u/i)+1):o,f=[];if(a!==void 0&&(c=Math.min(c,a)),c===1)f=[{p:.5,color:n(.5)}];else{let d=1/(c-1);f=Array.from({length:c},(g,v)=>{let b=v*d;return{p:b,color:n(b)}})}if(i>0){let d=f.reduce((g,v,b)=>{if(b===0)return 0;let w=ya(v.color,f[b-1].color,s);return Math.max(g,w)},0);for(;d>i;){d=0;for(let g=1;gd.color),f}function ru(t,e,r={}){if(Av(t)){let[l,u]=[t,e];return ru(...l.rangeArgs.colors,{...l.rangeArgs.options,...u})}let{space:n,outputSpace:i,progression:s,premultiplied:o}=r;t=be(t),e=be(e),t=ol(t),e=ol(e);let a={colors:[t,e],options:r};if(n?n=re.get(n):n=re.registry[Yr.interpolationSpace]||t.space,i=i?re.get(i):n,t=nr(t,n),e=nr(e,n),t=gi(t),e=gi(e),n.coords.h&&n.coords.h.type==="angle"){let l=r.hue=r.hue||"shorter",u=[n,"h"],[c,f]=[or(t,u),or(e,u)];[c,f]=lR(l,[c,f]),mi(t,u,c),mi(e,u,f)}return o&&(t.coords=t.coords.map(l=>l*t.alpha),e.coords=e.coords.map(l=>l*e.alpha)),Object.assign(l=>{l=s?s(l):l;let u=t.coords.map((d,g)=>{let v=e.coords[g];return Jc(d,v,l)}),c=Jc(t.alpha,e.alpha,l),f={space:n,coords:u,alpha:c};return o&&(f.coords=f.coords.map(d=>d/c)),i!==n&&(f=nr(f,i)),f},{rangeArgs:a})}function Av(t){return ci(t)==="function"&&!!t.rangeArgs}Yr.interpolationSpace="lab";function h4(t){t.defineFunction("mix",fE,{returns:"color"}),t.defineFunction("range",ru,{returns:"function"}),t.defineFunction("steps",hE,{returns:"array"})}var p4=Object.freeze({__proto__:null,isRange:Av,mix:fE,range:ru,register:h4,steps:hE}),pE=new re({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:al,fromBase:t=>{let e=Math.max(...t),r=Math.min(...t),[n,i,s]=t,[o,a,l]=[NaN,0,(r+e)/2],u=e-r;if(u!==0){switch(a=l===0||l===1?0:(e-l)/Math.min(l,1-l),e){case n:o=(i-s)/u+(i{let[e,r,n]=t;e=e%360,e<0&&(e+=360),r/=100,n/=100;function i(s){let o=(s+e/30)%12,a=r*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(o-3,9-o,1))}return[i(0),i(8),i(4)]},formats:{hsl:{toGamut:!0,coords:[" | ","",""]},hsla:{coords:[" | ","",""],commas:!0,lastAlpha:!0}}}),mE=new re({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:pE,fromBase(t){let[e,r,n]=t;r/=100,n/=100;let i=n+r*Math.min(n,1-n);return[e,i===0?0:200*(1-n/i),100*i]},toBase(t){let[e,r,n]=t;r/=100,n/=100;let i=n*(1-r/2);return[e,i===0||i===1?0:(n-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{toGamut:!0}}}),m4=new re({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:mE,fromBase(t){let[e,r,n]=t;return[e,n*(100-r)/100,100-n]},toBase(t){let[e,r,n]=t;r/=100,n/=100;let i=r+n;if(i>=1){let a=r/i;return[e,0,a*100]}let s=1-n,o=s===0?0:1-r/s;return[e,o*100,s*100]},formats:{hwb:{toGamut:!0,coords:[" | ","",""]}}});const g4=[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],y4=[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]];var gE=new Rt({id:"a98rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:g4,fromXYZ_M:y4}),v4=new Rt({id:"a98rgb",name:"Adobe® 98 RGB compatible",base:gE,toBase:t=>t.map(e=>Math.pow(Math.abs(e),563/256)*Math.sign(e)),fromBase:t=>t.map(e=>Math.pow(Math.abs(e),256/563)*Math.sign(e)),formats:{color:{id:"a98-rgb"}}});const w4=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],_4=[[1.3457989731028281,-.25558010007997534,-.05110628506753401],[-.5446224939028347,1.5082327413132781,.02053603239147973],[0,0,1.2119675456389454]];var yE=new Rt({id:"prophoto-linear",name:"Linear ProPhoto",white:"D50",base:kv,toXYZ_M:w4,fromXYZ_M:_4});const b4=1/512,x4=16/512;var S4=new Rt({id:"prophoto",name:"ProPhoto",base:yE,toBase(t){return t.map(e=>ee>=b4?e**(1/1.8):16*e)},formats:{color:{id:"prophoto-rgb"}}}),C4=new re({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:rd,fromBase(t){let[e,r,n]=t,i;const s=2e-4;return Math.abs(r) | "," | [0,1]"," | "]}}});const Y1=203,X1=2610/2**14,E4=2**14/2610,T4=2523/2**5,J1=2**5/2523,Z1=3424/2**12,eb=2413/2**7,tb=2392/2**7;var k4=new Rt({id:"rec2100pq",name:"REC.2100-PQ",base:Cf,toBase(t){return t.map(function(e){return(Math.max(e**J1-Z1,0)/(eb-tb*e**J1))**E4*1e4/Y1})},fromBase(t){return t.map(function(e){let r=Math.max(e*Y1/1e4,0),n=Z1+eb*r**X1,i=1+tb*r**X1;return(n/i)**T4})},formats:{color:{id:"rec2100-pq"}}});const rb=.17883277,nb=.28466892,ib=.55991073,Gh=3.7743;var P4=new Rt({id:"rec2100hlg",cssid:"rec2100-hlg",name:"REC.2100-HLG",referred:"scene",base:Cf,toBase(t){return t.map(function(e){return e<=.5?e**2/3*Gh:(Math.exp((e-ib)/rb)+nb)/12*Gh})},fromBase(t){return t.map(function(e){return e/=Gh,e<=1/12?Math.sqrt(3*e):rb*Math.log(12*e-nb)+ib})},formats:{color:{id:"rec2100-hlg"}}});const vE={};pi.add("chromatic-adaptation-start",t=>{t.options.method&&(t.M=wE(t.W1,t.W2,t.options.method))});pi.add("chromatic-adaptation-end",t=>{t.M||(t.M=wE(t.W1,t.W2,t.options.method))});function Ef({id:t,toCone_M:e,fromCone_M:r}){vE[t]=arguments[0]}function wE(t,e,r="Bradford"){let n=vE[r],[i,s,o]=We(n.toCone_M,t),[a,l,u]=We(n.toCone_M,e),c=[[a/i,0,0],[0,l/s,0],[0,0,u/o]],f=We(c,n.toCone_M);return We(n.fromCone_M,f)}Ef({id:"von Kries",toCone_M:[[.40024,.7076,-.08081],[-.2263,1.16532,.0457],[0,0,.91822]],fromCone_M:[[1.8599364,-1.1293816,.2198974],[.3611914,.6388125,-64e-7],[0,0,1.0890636]]});Ef({id:"Bradford",toCone_M:[[.8951,.2664,-.1614],[-.7502,1.7135,.0367],[.0389,-.0685,1.0296]],fromCone_M:[[.9869929,-.1470543,.1599627],[.4323053,.5183603,.0492912],[-.0085287,.0400428,.9684867]]});Ef({id:"CAT02",toCone_M:[[.7328,.4296,-.1624],[-.7036,1.6975,.0061],[.003,.0136,.9834]],fromCone_M:[[1.0961238,-.278869,.1827452],[.454369,.4735332,.0720978],[-.0096276,-.005698,1.0153256]]});Ef({id:"CAT16",toCone_M:[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],fromCone_M:[[1.862067855087233,-1.011254630531685,.1491867754444518],[.3875265432361372,.6214474419314753,-.008973985167612518],[-.01584149884933386,-.03412293802851557,1.04996443687785]]});Object.assign(Cr,{A:[1.0985,1,.35585],C:[.98074,1,1.18232],D55:[.95682,1,.92149],D75:[.94972,1,1.22638],E:[1,1,1],F2:[.99186,1,.67393],F7:[.95041,1,1.08747],F11:[1.00962,1,.6435]});Cr.ACES=[.32168/.33767,1,(1-.32168-.33767)/.33767];const A4=[[.6624541811085053,.13400420645643313,.1561876870049078],[.27222871678091454,.6740817658111484,.05368951740793705],[-.005574649490394108,.004060733528982826,1.0103391003129971]],I4=[[1.6410233796943257,-.32480329418479,-.23642469523761225],[-.6636628587229829,1.6153315916573379,.016756347685530137],[.011721894328375376,-.008284441996237409,.9883948585390215]];var _E=new Rt({id:"acescg",name:"ACEScg",coords:{r:{range:[0,65504],name:"Red"},g:{range:[0,65504],name:"Green"},b:{range:[0,65504],name:"Blue"}},referred:"scene",white:Cr.ACES,toXYZ_M:A4,fromXYZ_M:I4,formats:{color:{}}});const $u=2**-16,Vh=-.35828683,Uu=(Math.log2(65504)+9.72)/17.52;var O4=new Rt({id:"acescc",name:"ACEScc",coords:{r:{range:[Vh,Uu],name:"Red"},g:{range:[Vh,Uu],name:"Green"},b:{range:[Vh,Uu],name:"Blue"}},referred:"scene",base:_E,toBase(t){const e=-.3013698630136986;return t.map(function(r){return r<=e?(2**(r*17.52-9.72)-$u)*2:rthis.get(o),set:a=>this.set(o,a)})}get spaceId(){return this.space.id}clone(){return new Ce(this.space,this.coords,this.alpha)}toJSON(){return{spaceId:this.spaceId,coords:this.coords,alpha:this.alpha}}display(...e){let r=gR(this,...e);return r.color=new Ce(r.color),r}static get(e,...r){return e instanceof Ce?e:new Ce(e,...r)}static defineFunction(e,r,n=r){let{instance:i=!0,returns:s}=n,o=function(...a){let l=r(...a);if(s==="color")l=Ce.get(l);else if(s==="function"){let u=l;l=function(...c){let f=u(...c);return Ce.get(f)},Object.assign(l,u)}else s==="array"&&(l=l.map(u=>Ce.get(u)));return l};e in Ce||(Ce[e]=o),i&&(Ce.prototype[e]=function(...a){return o(this,...a)})}static defineFunctions(e){for(let r in e)Ce.defineFunction(r,e[r],e[r])}static extend(e){if(e.register)e.register(Ce);else for(let r in e)Ce.defineFunction(r,e[r])}}Ce.defineFunctions({get:or,getAll:tu,set:mi,setAll:Z5,to:nr,equals:yR,inGamut:Pa,toGamut:gi,distance:iE,toString:td});Object.assign(Ce,{util:nR,hooks:pi,WHITES:Cr,Space:re,spaces:re.registry,parse:J5,defaults:Yr});for(let t of Object.keys(sb))re.register(sb[t]);for(let t in re.registry)Zg(t,re.registry[t]);pi.add("colorspace-init-end",t=>{var e;Zg(t.id,t),(e=t.aliases)==null||e.forEach(r=>{Zg(r,t)})});function Zg(t,e){Object.keys(e.coords),Object.values(e.coords).map(n=>n.name);let r=t.replace(/-/g,"_");Object.defineProperty(Ce.prototype,r,{get(){let n=this.getAll(t);return typeof Proxy>"u"?n:new Proxy(n,{has:(i,s)=>{try{return re.resolveCoord([e,s]),!0}catch{}return Reflect.has(i,s)},get:(i,s,o)=>{if(s&&typeof s!="symbol"&&!(s in i)){let{index:a}=re.resolveCoord([e,s]);if(a>=0)return i[a]}return Reflect.get(i,s,o)},set:(i,s,o,a)=>{if(s&&typeof s!="symbol"&&!(s in i)||s>=0){let{index:l}=re.resolveCoord([e,s]);if(l>=0)return i[l]=o,this.setAll(t,i),!0}return Reflect.set(i,s,o,a)}})},set(n){this.setAll(t,n)},configurable:!0,enumerable:!0})}Ce.extend(nd);Ce.extend({deltaE:ya});Object.assign(Ce,{deltaEMethods:nd});Ce.extend(f4);Ce.extend({contrast:LR});Ce.extend($R);Ce.extend(wR);Ce.extend(p4);Ce.extend(dc);class ll extends Ce{static light(e){return new Ce(this._generateAccessibleColor(e,"black")).toString({format:"hex"})}static dark(e){return new Ce(this._generateAccessibleColor(e,"white")).toString({format:"hex"})}static accessibleBackground(e){const r=this._contrast("black",e),n=this._contrast("white",e);return r>n?"black":"white"}static accessibleForeground(e){const r=this._contrast(e,"black"),n=this._contrast(e,"white");return r>n?"black":"white"}static _generateAccessibleColor(e,r){let n=e;const i=this.steps(e,r==="black"?"white":"black",{space:"hsv",outputSpace:"srgb",steps:9});for(const s of i)if(this._contrast(r,s)>75){n=s;break}return n}static _contrast(e,r){return Math.abs(this.contrastAPCA(e,r))}}const ob=60,Fu=20;function R4({broadcaster:t,staticPosition:e,platform:r}){const[n,i]=I.useState(!1);return I.useEffect(()=>{setTimeout(()=>{i(!0)},3.5*1e3)},[]),n?null:_.jsx(Sv,{status:"success",staticPosition:e,className:"slime2-banner-fade",children:_.jsxs("div",{className:"flex items-center justify-center",children:["Connected to",_.jsx("a",{href:t.url,target:"_blank",children:_.jsx(M4,{image:t.image,platform:r})}),t.displayName]})})}function M4({image:t,platform:e}){const[r,n]=I.useState(!1);function i(){n(!0)}return r?_.jsx("img",{src:`https://slime2.stream/assets/${e}-logo.svg`,height:Fu,width:Fu,alt:"Stream Platform Logo",className:"mx-3 inline-block"}):_.jsxs("div",{className:"relative mx-3 inline-block",children:[_.jsx("img",{src:t,alt:"Your Profile Picture",width:ob,height:ob,className:"inline rounded-full",onError:i}),_.jsx("img",{src:`https://slime2.stream/assets/${e}-logo.svg`,height:Fu,width:Fu,alt:"Stream Platform Logo",className:"absolute -bottom-px -right-1"})]})}function Tf(){const t=I.useContext(xE);function e(r){return!!t[r]}return{isPlatformReady:e}}function N4(){const t=I.useContext(SE);function e(r){t({type:r})}return{setPlatformReady:e}}const bE={},xE=I.createContext(bE),SE=I.createContext(vs);function D4(t,e){switch(e.type){case"twitch":return{...t,twitch:!0};case"youtube":return{...t,youtube:!0}}}function CE(){return I.useContext(TE)}function Iv(){const t=I.useContext(kE),e=CE(),r=wn(),{maxEvents:n,eventDelay:i}=r;function s(u,c){t({type:"remove",eventType:u,eventId:c})}function o(u){const c=[...e],f=e.length+1-(n||100);for(let g=0;gs(u.type,u.id)}})}i?setTimeout(d,i):d()}function a(u){t({type:"remove-user",userId:u})}function l(){t({type:"clear-messages"})}return{removeEvent:s,addEvent:o,removeUser:a,removeMessages:l}}const EE=[],TE=I.createContext(EE),kE=I.createContext(vs);function j4(t,e){switch(e.type){case"add":return[...t,e.event];case"remove":return t.filter(r=>r.type!==e.eventType||r.id!==e.eventId);case"remove-user":return t.filter(r=>r.userId!==e.userId);case"clear-messages":return t.filter(r=>r.type!=="message")}}var ey=function(t,e){return ey=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},ey(t,e)};function zo(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ey(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var cs=function(){return cs=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function kr(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})}function ar(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _n(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function vi(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n>=1,e&&(r+=r);while(e);return n+t}function Zi(t,e,r){var n=t.split(e);return n.length<=r?n:vi(vi([],_n(n.slice(0,r-1)),!1),[n.slice(r-1).join(e)],!1)}function RE(t){return vi([],_n(t),!1).length}function ny(t,e,r){return vi([],_n(t),!1).slice(e,r).join("")}var Qh,Kh,id=typeof process>"u"?[]:(Kh=(Qh={}.LOGGING)===null||Qh===void 0?void 0:Qh.split(";").map(function(t){var e=t.split("=",2),r=e[0],n=e[1];return n?[r==="default"?void 0:r.split(":"),Ov(n)]:null}).filter(function(t){return!!t}).sort(function(t,e){var r,n,i=t[0],s=e[0];return((r=s==null?void 0:s.length)!==null&&r!==void 0?r:0)-((n=i==null?void 0:i.length)!==null&&n!==void 0?n:0)}))!==null&&Kh!==void 0?Kh:[],Yh=id.findIndex(function(t){var e=t[0];return!e}),ME=void 0;Yh!==-1&&(ME=id[Yh][1],id.splice(Yh));function F4(t,e){return e.length<=t.length&&e.every(function(r,n){return r===t[n]})}function NE(t){for(var e=t.split(":"),r=0,n=id;rthis._minLevel)){var i=PE[r],s="[".concat(this._name,"] ").concat(n);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(n)),i(s)}},e}(DE),H4=function(){function t(e){var r=e.name,n=e.minLevel,i=e.custom,s;this._minLevel=(s=Xr(n,function(o){return Ov(o)}))!==null&&s!==void 0?s:NE(r),this._override=typeof i=="function"?{log:i}:i}return t.prototype.log=function(e,r){this._shouldLog(e)&&this._override.log(e,r)},t.prototype.crit=function(e){this._override.crit?this._shouldLog(te.CRITICAL)&&this._override.crit(e):this.log(te.CRITICAL,e)},t.prototype.error=function(e){this._override.error?this._shouldLog(te.ERROR)&&this._override.error(e):this.log(te.ERROR,e)},t.prototype.warn=function(e){this._override.warn?this._shouldLog(te.WARNING)&&this._override.warn(e):this.log(te.WARNING,e)},t.prototype.info=function(e){this._override.info?this._shouldLog(te.INFO)&&this._override.info(e):this.log(te.INFO,e)},t.prototype.debug=function(e){this._override.debug?this._shouldLog(te.DEBUG)&&this._override.debug(e):this.log(te.DEBUG,e)},t.prototype.trace=function(e){this._override.trace?this._shouldLog(te.TRACE)&&this._override.trace(e):this.log(te.TRACE,e)},t.prototype._shouldLog=function(e){return this._minLevel===void 0||this._minLevel>=e},t}(),An,In,On,z4=(An={},An[te.CRITICAL]="🛑",An[te.ERROR]="❌",An[te.WARNING]="⚠️ ",An[te.INFO]="ℹ️ ",An[te.DEBUG]="🐞",An[te.TRACE]="🐾",An),W4={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},G4={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 Pf(t,e,r){return function(n){return"\x1B[".concat(t,"m").concat(r?r(n):n,"\x1B[").concat(e,"m")}}function Gr(t){return Pf(W4[t],39)}function aa(t,e){return Pf(G4[t],49,e)}var V4=(In={},In[te.CRITICAL]=Gr("red"),In[te.ERROR]=Gr("redBright"),In[te.WARNING]=Gr("yellow"),In[te.INFO]=Gr("blue"),In[te.DEBUG]=Gr("magenta"),In[te.TRACE]=Pf(0,0),In),lb=(On={},On[te.CRITICAL]=aa("bgRed",Gr("white")),On[te.ERROR]=aa("bgRedBright",Gr("white")),On[te.WARNING]=aa("bgYellow",Gr("black")),On[te.INFO]=aa("bgBlue",Gr("white")),On[te.DEBUG]=aa("bgMagenta",Gr("black")),On[te.TRACE]=Pf(7,27),On),Q4=function(t){zo(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.log=function(r,n){var i,s,o;if(!(r>this._minLevel)){var a=PE[r],l="";if(this._timestamps&&(l+="[".concat(new Date().toISOString(),"] ")),this._emoji){var u=z4[r];l+="".concat(u," ")}var c=(o=(i=this._colors)!==null&&i!==void 0?i:(s=process.stdout)===null||s===void 0?void 0:s.isTTY)!==null&&o!==void 0?o:!0;c?l+="".concat(lb[r](this._name)," ").concat(lb[r](te[r])," ").concat(V4[r](n)):l+="[".concat(this._name,":").concat(te[r].toLowerCase(),"] ").concat(n),a(l)}},e}(DE);function Wo(t){return t.custom?new H4(t):kf?new Q4(t):new q4(t)}var jE=function(t){zo(e,t);function e(){for(var r=[],n=0;n"u"||!et?ce:et(Uint8Array),ts={"%AggregateError%":typeof AggregateError>"u"?ce:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ce:ArrayBuffer,"%ArrayIteratorPrototype%":ks&&et?et([][Symbol.iterator]()):ce,"%AsyncFromSyncIteratorPrototype%":ce,"%AsyncFunction%":Is,"%AsyncGenerator%":Is,"%AsyncGeneratorFunction%":Is,"%AsyncIteratorPrototype%":Is,"%Atomics%":typeof Atomics>"u"?ce:Atomics,"%BigInt%":typeof BigInt>"u"?ce:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ce:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ce:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ce:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?ce:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ce:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ce:FinalizationRegistry,"%Function%":UE,"%GeneratorFunction%":Is,"%Int8Array%":typeof Int8Array>"u"?ce:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ce:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ce:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ks&&et?et(et([][Symbol.iterator]())):ce,"%JSON%":typeof JSON=="object"?JSON:ce,"%Map%":typeof Map>"u"?ce:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ks||!et?ce:et(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ce:Promise,"%Proxy%":typeof Proxy>"u"?ce:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?ce:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ce:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ks||!et?ce:et(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ce:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ks&&et?et(""[Symbol.iterator]()):ce,"%Symbol%":ks?Symbol:ce,"%SyntaxError%":Do,"%ThrowTypeError%":lM,"%TypedArray%":cM,"%TypeError%":so,"%Uint8Array%":typeof Uint8Array>"u"?ce:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ce:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ce:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ce:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?ce:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ce:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ce:WeakSet};if(et)try{null.error}catch(t){var dM=et(et(t));ts["%Error.prototype%"]=dM}var fM=function t(e){var r;if(e==="%AsyncFunction%")r=Xh("async function () {}");else if(e==="%GeneratorFunction%")r=Xh("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Xh("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&et&&(r=et(i.prototype))}return ts[e]=r,r},hb={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},nu=Mv,sd=Ti,hM=nu.call(Function.call,Array.prototype.concat),pM=nu.call(Function.apply,Array.prototype.splice),pb=nu.call(Function.call,String.prototype.replace),od=nu.call(Function.call,String.prototype.slice),mM=nu.call(Function.call,RegExp.prototype.exec),gM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yM=/\\(\\)?/g,vM=function(e){var r=od(e,0,1),n=od(e,-1);if(r==="%"&&n!=="%")throw new Do("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Do("invalid intrinsic syntax, expected opening `%`");var i=[];return pb(e,gM,function(s,o,a,l){i[i.length]=a?pb(l,yM,"$1"):o||s}),i},wM=function(e,r){var n=e,i;if(sd(hb,n)&&(i=hb[n],n="%"+i[0]+"%"),sd(ts,n)){var s=ts[n];if(s===Is&&(s=fM(n)),typeof s>"u"&&!r)throw new so("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Do("intrinsic "+e+" does not exist!")},fe=function(e,r){if(typeof e!="string"||e.length===0)throw new so("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new so('"allowMissing" argument must be a boolean');if(mM(/^%?[^%]*%?$/,e)===null)throw new Do("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=vM(e),i=n.length>0?n[0]:"",s=wM("%"+i+"%",r),o=s.name,a=s.value,l=!1,u=s.alias;u&&(i=u[0],pM(n,hM([0,1],u)));for(var c=1,f=!0;c=n.length){var b=es(a,d);f=!!b,f&&"get"in b&&!("originalValue"in b.get)?a=b.get:a=a[d]}else f=sd(a,d),a=a[d];f&&!l&&(ts[o]=a)}}return a},_M=fe,iy=_M("%Object.defineProperty%",!0),sy=function(){if(iy)try{return iy({},"a",{value:1}),!0}catch{return!1}return!1};sy.hasArrayLengthDefineBug=function(){if(!sy())return null;try{return iy([],"length",{value:1}).length!==1}catch{return!0}};var Af=sy,bM=fe,hc=bM("%Object.getOwnPropertyDescriptor%",!0);if(hc)try{hc([],"length")}catch{hc=null}var jv=hc,xM=Af(),Lv=fe,Aa=xM&&Lv("%Object.defineProperty%",!0);if(Aa)try{Aa({},"a",{value:1})}catch{Aa=!1}var SM=Lv("%SyntaxError%"),Ps=Lv("%TypeError%"),mb=jv,FE=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Ps("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ps("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ps("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ps("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ps("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ps("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!mb&&mb(e,r);if(Aa)Aa(e,r,{configurable:o===null&&l?l.configurable:!o,enumerable:i===null&&l?l.enumerable:!i,value:n,writable:s===null&&l?l.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new SM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},qE=fe,gb=FE,CM=Af(),yb=jv,vb=qE("%TypeError%"),EM=qE("%Math.floor%"),TM=function(e,r){if(typeof e!="function")throw new vb("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||EM(r)!==r)throw new vb("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&yb){var o=yb(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(CM?gb(e,"length",r,!0,!0):gb(e,"length",r)),e};(function(t){var e=Mv,r=fe,n=TM,i=r("%TypeError%"),s=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(o,s),l=r("%Object.defineProperty%",!0),u=r("%Math.max%");if(l)try{l({},"a",{value:1})}catch{l=null}t.exports=function(d){if(typeof d!="function")throw new i("a function is required");var g=a(e,o,arguments);return n(g,1+u(0,d.length-(arguments.length-1)),!0)};var c=function(){return a(e,s,arguments)};l?l(t.exports,"apply",{value:c}):t.exports.apply=c})(BE);var iu=BE.exports,wb=Object.prototype.toString,HE=function(e){var r=wb.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&wb.call(e.callee)==="[object Function]"),n},Zh,_b;function kM(){if(_b)return Zh;_b=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=HE,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(d){var g=d.constructor;return g&&g.prototype===d},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var d in window)try{if(!u["$"+d]&&e.call(window,d)&&window[d]!==null&&typeof window[d]=="object")try{l(window[d])}catch{return!0}}catch{return!0}return!1}(),f=function(d){if(typeof window>"u"||!c)return l(d);try{return l(d)}catch{return!1}};t=function(g){var v=g!==null&&typeof g=="object",b=r.call(g)==="[object Function]",w=n(g),p=v&&r.call(g)==="[object String]",m=[];if(!v&&!b&&!w)throw new TypeError("Object.keys called on a non-object");var y=o&&b;if(p&&g.length>0&&!e.call(g,0))for(var x=0;x0)for(var S=0;S2?arguments[2]:{},n=OM(e);RM&&(n=NM.call(n,Object.getOwnPropertySymbols(e)));for(var i=0;i"u")return"Undefined";if(typeof e=="function"||typeof e=="object")return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"}),tp}var rp,Tb;function BM(){if(Tb)return rp;Tb=1;var t=GE();return rp=function(r){return typeof r=="symbol"?"Symbol":typeof r=="bigint"?"BigInt":t(r)},rp}var la={exports:{}},np,kb;function Of(){if(kb)return np;kb=1;var t=Nv;return np=function(){return t()&&!!Symbol.toStringTag},np}var ip,Pb;function mr(){if(Pb)return ip;Pb=1;var t=fe,e=iu,r=e(t("String.prototype.indexOf"));return ip=function(i,s){var o=t(i,!!s);return typeof o=="function"&&r(i,".prototype.")>-1?e(o):o},ip}var sp,Ab;function $M(){if(Ab)return sp;Ab=1;var t=Of()(),e=mr(),r=e("Object.prototype.toString"),n=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:r(a)==="[object Arguments]"},i=function(a){return n(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&r(a)!=="[object Array]"&&r(a.callee)==="[object Function]"},s=function(){return n(arguments)}();return n.isLegacyArguments=i,sp=s?n:i,sp}const UM={},FM=Object.freeze(Object.defineProperty({__proto__:null,default:UM},Symbol.toStringTag,{value:"Module"})),qM=hS(FM);var op,Ib;function VE(){if(Ib)return op;Ib=1;var t=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,r=t&&e&&typeof e.get=="function"?e.get:null,n=t&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,s=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,o=i&&s&&typeof s.get=="function"?s.get:null,a=i&&Set.prototype.forEach,l=typeof WeakMap=="function"&&WeakMap.prototype,u=l?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,f=c?WeakSet.prototype.has:null,d=typeof WeakRef=="function"&&WeakRef.prototype,g=d?WeakRef.prototype.deref:null,v=Boolean.prototype.valueOf,b=Object.prototype.toString,w=Function.prototype.toString,p=String.prototype.match,m=String.prototype.slice,y=String.prototype.replace,x=String.prototype.toUpperCase,S=String.prototype.toLowerCase,k=RegExp.prototype.test,O=Array.prototype.concat,M=Array.prototype.join,L=Array.prototype.slice,W=Math.floor,ee=typeof BigInt=="function"?BigInt.prototype.valueOf:null,le=Object.getOwnPropertySymbols,he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,P=typeof Symbol=="function"&&typeof Symbol.iterator=="object",j=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===P||"symbol")?Symbol.toStringTag:null,Q=Object.prototype.propertyIsEnumerable,ue=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(A){return A.__proto__}:null);function $(A,R){if(A===1/0||A===-1/0||A!==A||A&&A>-1e3&&A<1e3||k.call(/e/,R))return R;var we=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof A=="number"){var Te=A<0?-W(-A):W(A);if(Te!==A){var Fe=String(Te),oe=m.call(R,Fe.length+1);return y.call(Fe,we,"$&_")+"."+y.call(y.call(oe,/([0-9]{3})/g,"$&_"),/_$/,"")}}return y.call(R,we,"$&_")}var H=qM,Y=H.custom,se=Jw(Y)?Y:null;op=function A(R,we,Te,Fe){var oe=we||{};if(Sn(oe,"quoteStyle")&&oe.quoteStyle!=="single"&&oe.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Sn(oe,"maxStringLength")&&(typeof oe.maxStringLength=="number"?oe.maxStringLength<0&&oe.maxStringLength!==1/0:oe.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var En=Sn(oe,"customInspect")?oe.customInspect:!0;if(typeof En!="boolean"&&En!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Sn(oe,"indent")&&oe.indent!==null&&oe.indent!==" "&&!(parseInt(oe.indent,10)===oe.indent&&oe.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Sn(oe,"numericSeparator")&&typeof oe.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Pi=oe.numericSeparator;if(typeof R>"u")return"undefined";if(R===null)return"null";if(typeof R=="boolean")return R?"true":"false";if(typeof R=="string")return e_(R,oe);if(typeof R=="number"){if(R===0)return 1/0/R>0?"0":"-0";var Dt=String(R);return Pi?$(R,Dt):Dt}if(typeof R=="bigint"){var Tn=String(R)+"n";return Pi?$(R,Tn):Tn}var oh=typeof oe.depth>"u"?5:oe.depth;if(typeof Te>"u"&&(Te=0),Te>=oh&&oh>0&&typeof R=="object")return Nt(R)?"[Array]":"[Object]";var xs=OA(oe,Te);if(typeof Fe>"u")Fe=[];else if(Zw(Fe,R)>=0)return"[Circular]";function gr(Ss,hu,MA){if(hu&&(Fe=L.call(Fe),Fe.push(hu)),MA){var u_={depth:oe.depth};return Sn(oe,"quoteStyle")&&(u_.quoteStyle=oe.quoteStyle),A(Ss,u_,Te+1,Fe)}return A(Ss,oe,Te+1,Fe)}if(typeof R=="function"&&!Rr(R)){var r_=xA(R),n_=du(R,gr);return"[Function"+(r_?": "+r_:" (anonymous)")+"]"+(n_.length>0?" { "+M.call(n_,", ")+" }":"")}if(Jw(R)){var i_=P?y.call(String(R),/^(Symbol\(.*\))_[^)]*$/,"$1"):he.call(R);return typeof R=="object"&&!P?Xo(i_):i_}if(PA(R)){for(var Jo="<"+S.call(String(R.nodeName)),ah=R.attributes||[],fu=0;fu",Jo}if(Nt(R)){if(R.length===0)return"[]";var lh=du(R,gr);return xs&&!IA(lh)?"["+sh(lh,xs)+"]":"[ "+M.call(lh,", ")+" ]"}if(bs(R)){var uh=du(R,gr);return!("cause"in Error.prototype)&&"cause"in R&&!Q.call(R,"cause")?"{ ["+String(R)+"] "+M.call(O.call("[cause]: "+gr(R.cause),uh),", ")+" }":uh.length===0?"["+String(R)+"]":"{ ["+String(R)+"] "+M.call(uh,", ")+" }"}if(typeof R=="object"&&En){if(se&&typeof R[se]=="function"&&H)return H(R,{depth:oh-Te});if(En!=="symbol"&&typeof R.inspect=="function")return R.inspect()}if(SA(R)){var s_=[];return n&&n.call(R,function(Ss,hu){s_.push(gr(hu,R,!0)+" => "+gr(Ss,R))}),t_("Map",r.call(R),s_,xs)}if(TA(R)){var o_=[];return a&&a.call(R,function(Ss){o_.push(gr(Ss,R))}),t_("Set",o.call(R),o_,xs)}if(CA(R))return ih("WeakMap");if(kA(R))return ih("WeakSet");if(EA(R))return ih("WeakRef");if(vA(R))return Xo(gr(Number(R)));if(_A(R))return Xo(gr(ee.call(R)));if(wA(R))return Xo(v.call(R));if(yA(R))return Xo(gr(String(R)));if(typeof window<"u"&&R===window)return"{ [object Window] }";if(R===tf)return"{ [object globalThis] }";if(!Or(R)&&!Rr(R)){var ch=du(R,gr),a_=ue?ue(R)===Object.prototype:R instanceof Object||R.constructor===Object,dh=R instanceof Object?"":"null prototype",l_=!a_&&j&&Object(R)===R&&j in R?m.call(Cn(R),8,-1):dh?"Object":"",RA=a_||typeof R.constructor!="function"?"":R.constructor.name?R.constructor.name+" ":"",fh=RA+(l_||dh?"["+M.call(O.call([],l_||[],dh||[]),": ")+"] ":"");return ch.length===0?fh+"{}":xs?fh+"{"+sh(ch,xs)+"}":fh+"{ "+M.call(ch,", ")+" }"}return String(R)};function ye(A,R,we){var Te=(we.quoteStyle||R)==="double"?'"':"'";return Te+A+Te}function Mt(A){return y.call(String(A),/"/g,""")}function Nt(A){return Cn(A)==="[object Array]"&&(!j||!(typeof A=="object"&&j in A))}function Or(A){return Cn(A)==="[object Date]"&&(!j||!(typeof A=="object"&&j in A))}function Rr(A){return Cn(A)==="[object RegExp]"&&(!j||!(typeof A=="object"&&j in A))}function bs(A){return Cn(A)==="[object Error]"&&(!j||!(typeof A=="object"&&j in A))}function yA(A){return Cn(A)==="[object String]"&&(!j||!(typeof A=="object"&&j in A))}function vA(A){return Cn(A)==="[object Number]"&&(!j||!(typeof A=="object"&&j in A))}function wA(A){return Cn(A)==="[object Boolean]"&&(!j||!(typeof A=="object"&&j in A))}function Jw(A){if(P)return A&&typeof A=="object"&&A instanceof Symbol;if(typeof A=="symbol")return!0;if(!A||typeof A!="object"||!he)return!1;try{return he.call(A),!0}catch{}return!1}function _A(A){if(!A||typeof A!="object"||!ee)return!1;try{return ee.call(A),!0}catch{}return!1}var bA=Object.prototype.hasOwnProperty||function(A){return A in this};function Sn(A,R){return bA.call(A,R)}function Cn(A){return b.call(A)}function xA(A){if(A.name)return A.name;var R=p.call(w.call(A),/^function\s*([\w$]+)/);return R?R[1]:null}function Zw(A,R){if(A.indexOf)return A.indexOf(R);for(var we=0,Te=A.length;weR.maxStringLength){var we=A.length-R.maxStringLength,Te="... "+we+" more character"+(we>1?"s":"");return e_(m.call(A,0,R.maxStringLength),R)+Te}var Fe=y.call(y.call(A,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,AA);return ye(Fe,"single",R)}function AA(A){var R=A.charCodeAt(0),we={8:"b",9:"t",10:"n",12:"f",13:"r"}[R];return we?"\\"+we:"\\x"+(R<16?"0":"")+x.call(R.toString(16))}function Xo(A){return"Object("+A+")"}function ih(A){return A+" { ? }"}function t_(A,R,we,Te){var Fe=Te?sh(we,Te):M.call(we,", ");return A+" ("+R+") {"+Fe+"}"}function IA(A){for(var R=0;R=0)return!1;return!0}function OA(A,R){var we;if(A.indent===" ")we=" ";else if(typeof A.indent=="number"&&A.indent>0)we=M.call(Array(A.indent+1)," ");else return null;return{base:we,prev:M.call(Array(R+1),we)}}function sh(A,R){if(A.length===0)return"";var we=` +`+R.prev+R.base;return we+M.call(A,","+we)+` +`+R.prev}function du(A,R){var we=Nt(A),Te=[];if(we){Te.length=A.length;for(var Fe=0;Fe=ee)return W+1;var le=c(L,W);if(le<55296||le>56319)return W+1;var he=c(L,W+1);return he<56320||he>57343?W+1:W+2},g=function(L){var W=0;return{next:function(){var le=W>=L.length,he;return le||(he=L[W],W+=1),{done:le,value:he}}}},v=function(L,W){if(n(L)||t(L))return g(L);if(i(L)){var ee=0;return{next:function(){var he=d(L,ee),P=f(L,ee,he);return ee=he,{done:he>L.length,value:P}}}}if(W&&typeof L["_es6-shim iterator_"]<"u")return L["_es6-shim iterator_"]()};if(!o&&!a)la.exports=function(L){if(L!=null)return v(L,!0)};else{var b=VM(),w=QM(),p=l("Map.prototype.forEach",!0),m=l("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var y=l("Map.prototype.iterator",!0),x=l("Set.prototype.iterator",!0);var S=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),k=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0),O=function(L){if(b(L)){if(y)return e(y(L));if(S)return S(L);if(p){var W=[];return p(L,function(le,he){u(W,[he,le])}),g(W)}}if(w(L)){if(x)return e(x(L));if(k)return k(L);if(m){var ee=[];return m(L,function(le){u(ee,le)}),g(ee)}}};la.exports=function(L){return O(L)||v(L)}}}return la.exports}var pp,$b;function YM(){if($b)return pp;$b=1;var t=TypeError;return pp=function(r){if(!r||typeof r.next!="function")throw new t("iterator must be an object with a `next` method");if(arguments.length>1){var n=arguments[1];if(typeof n!="function")throw new t("`callback`, if provided, must be a function")}for(var i=n||[],s;(s=r.next())&&!s.done;)n?n(s.value):i.push(s.value);if(!n)return i},pp}var mp,Ub;function XM(){if(Ub)return mp;Ub=1;var t=KM(),e=TypeError,r=YM();return mp=function(i){var s=t(i);if(!s)throw new e("non-iterable value provided");return arguments.length>1?r(s,arguments[1]):r(s)},mp}var gp,Fb;function JM(){if(Fb)return gp;Fb=1;var t=fe,e=t("%TypeError%");return gp=function(n,i){if(n==null)throw new e(i||"Cannot call method on "+n);return n},gp}var yp,qb;function Rf(){return qb||(qb=1,yp=JM()),yp}var vp,Hb;function Bv(){return Hb||(Hb=1,vp=Number.isNaN||function(e){return e!==e}),vp}var wp,zb;function KE(){if(zb)return wp;zb=1;var t=Bv();return wp=function(e){return(typeof e=="number"||typeof e=="bigint")&&!t(e)&&e!==1/0&&e!==-1/0},wp}var _p,Wb;function $v(){if(Wb)return _p;Wb=1;var t=fe,e=t("%Math.abs%"),r=t("%Math.floor%"),n=Bv(),i=KE();return _p=function(o){if(typeof o!="number"||n(o)||!i(o))return!1;var a=e(o);return r(a)===a},_p}var bp,Gb;function ZM(){if(Gb)return bp;Gb=1;var t=fe,e=t("%Array.prototype%"),r=t("%RangeError%"),n=t("%SyntaxError%"),i=t("%TypeError%"),s=$v(),o=Math.pow(2,32)-1,a=$E(),l=t("%Object.setPrototypeOf%",!0)||(a?function(u,c){return u.__proto__=c,u}:null);return bp=function(c){if(!s(c)||c<0)throw new i("Assertion failed: `length` must be an integer Number >= 0");if(c>o)throw new r("length is greater than (2**32 - 1)");var f=arguments.length>1?arguments[1]:e,d=[];if(f!==e){if(!l)throw new n("ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]");l(d,f)}return c!==0&&(d.length=c),d},bp}var xp,Vb;function ws(){return Vb||(Vb=1,xp=function(e){return typeof e=="string"||typeof e=="symbol"}),xp}var Sp,Qb;function St(){if(Qb)return Sp;Qb=1;var t=GE();return Sp=function(r){return typeof r=="symbol"?"Symbol":typeof r=="bigint"?"BigInt":t(r)},Sp}var Cp,Kb;function YE(){if(Kb)return Cp;Kb=1;var t=fe,e=t("%TypeError%"),r=VE(),n=ws(),i=St();return Cp=function(o,a){if(i(o)!=="Object")throw new e("Assertion failed: Type(O) is not Object");if(!n(a))throw new e("Assertion failed: IsPropertyKey(P) is not true, got "+r(a));return o[a]},Cp}var Ep,Yb;function XE(){if(Yb)return Ep;Yb=1;var t=fe,e=t("%Array%"),r=!e.isArray&&mr()("Object.prototype.toString");return Ep=e.isArray||function(i){return r(i)==="[object Array]"},Ep}var Tp,Xb;function JE(){return Xb||(Xb=1,Tp=XE()),Tp}var qu={exports:{}},kp,Jb;function eN(){return Jb||(Jb=1,kp=fe),kp}var Pp,Zb;function Uv(){if(Zb)return Pp;Zb=1;var t=fe,e=Ti,r=t("%TypeError%");return Pp=function(i,s){if(i.Type(s)!=="Object")return!1;var o={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var a in s)if(e(s,a)&&!o[a])return!1;if(i.IsDataDescriptor(s)&&i.IsAccessorDescriptor(s))throw new r("Property Descriptors may not be both accessor and data descriptors");return!0},Pp}var Ap,e2;function ZE(){if(e2)return Ap;e2=1;var t=Af,e=fe,r=t()&&e("%Object.defineProperty%",!0),n=t.hasArrayLengthDefineBug(),i=n&&XE(),s=mr(),o=s("Object.prototype.propertyIsEnumerable");return Ap=function(l,u,c,f,d,g){if(!r){if(!l(g)||!g["[[Configurable]]"]||!g["[[Writable]]"]||d in f&&o(f,d)!==!!g["[[Enumerable]]"])return!1;var v=g["[[Value]]"];return f[d]=v,u(f[d],v)}return n&&d==="length"&&"[[Value]]"in g&&i(f)&&f.length!==g["[[Value]]"]?(f.length=g["[[Value]]"],f.length===g["[[Value]]"]):(r(f,d,c(g)),!0)},Ap}var Ip,t2;function tN(){if(t2)return Ip;t2=1;var t=Ti;return Ip=function(r){return t(r,"[[StartIndex]]")&&t(r,"[[EndIndex]]")&&r["[[StartIndex]]"]>=0&&r["[[EndIndex]]"]>=r["[[StartIndex]]"]&&String(parseInt(r["[[StartIndex]]"],10))===String(r["[[StartIndex]]"])&&String(parseInt(r["[[EndIndex]]"],10))===String(r["[[EndIndex]]"])},Ip}var Op,r2;function Mf(){if(r2)return Op;r2=1;var t=fe,e=t("%TypeError%"),r=t("%SyntaxError%"),n=Ti,i=$v(),s=tN(),o={"Property Descriptor":function(l){var u={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};if(!l)return!1;for(var c in l)if(n(l,c)&&!u[c])return!1;var f=n(l,"[[Value]]"),d=n(l,"[[Get]]")||n(l,"[[Set]]");if(f&&d)throw new e("Property Descriptors may not be both accessor and data descriptors");return!0},"Match Record":s,"Iterator Record":function(l){return n(l,"[[Iterator]]")&&n(l,"[[NextMethod]]")&&n(l,"[[Done]]")},"PromiseCapability Record":function(l){return!!l&&n(l,"[[Resolve]]")&&typeof l["[[Resolve]]"]=="function"&&n(l,"[[Reject]]")&&typeof l["[[Reject]]"]=="function"&&n(l,"[[Promise]]")&&l["[[Promise]]"]&&typeof l["[[Promise]]"].then=="function"},"AsyncGeneratorRequest Record":function(l){return!!l&&n(l,"[[Completion]]")&&n(l,"[[Capability]]")&&o["PromiseCapability Record"](l["[[Capability]]"])},"RegExp Record":function(l){return l&&n(l,"[[IgnoreCase]]")&&typeof l["[[IgnoreCase]]"]=="boolean"&&n(l,"[[Multiline]]")&&typeof l["[[Multiline]]"]=="boolean"&&n(l,"[[DotAll]]")&&typeof l["[[DotAll]]"]=="boolean"&&n(l,"[[Unicode]]")&&typeof l["[[Unicode]]"]=="boolean"&&n(l,"[[CapturingGroupsCount]]")&&typeof l["[[CapturingGroupsCount]]"]=="number"&&i(l["[[CapturingGroupsCount]]"])&&l["[[CapturingGroupsCount]]"]>=0}};return Op=function(l,u,c,f){var d=o[u];if(typeof d!="function")throw new r("unknown record type: "+u);if(l(f)!=="Object"||!d(f))throw new e(c+" must be a "+u)},Op}var Rp,n2;function rN(){return n2||(n2=1,Rp=function(e){if(typeof e>"u")return e;var r={};return"[[Value]]"in e&&(r.value=e["[[Value]]"]),"[[Writable]]"in e&&(r.writable=!!e["[[Writable]]"]),"[[Get]]"in e&&(r.get=e["[[Get]]"]),"[[Set]]"in e&&(r.set=e["[[Set]]"]),"[[Enumerable]]"in e&&(r.enumerable=!!e["[[Enumerable]]"]),"[[Configurable]]"in e&&(r.configurable=!!e["[[Configurable]]"]),r}),Rp}var Mp,i2;function eT(){if(i2)return Mp;i2=1;var t=Mf(),e=rN(),r=St();return Mp=function(i){return typeof i<"u"&&t(r,"Property Descriptor","Desc",i),e(i)},Mp}var Np,s2;function Nf(){if(s2)return Np;s2=1;var t=Ti,e=St(),r=Mf();return Np=function(i){return!(typeof i>"u"||(r(e,"Property Descriptor","Desc",i),!t(i,"[[Get]]")&&!t(i,"[[Set]]")))},Np}var Dp,o2;function Df(){if(o2)return Dp;o2=1;var t=Ti,e=St(),r=Mf();return Dp=function(i){return!(typeof i>"u"||(r(e,"Property Descriptor","Desc",i),!t(i,"[[Value]]")&&!t(i,"[[Writable]]")))},Dp}var jp,a2;function Fv(){if(a2)return jp;a2=1;var t=Bv();return jp=function(r,n){return r===n?r===0?1/r===1/n:!0:t(r)&&t(n)},jp}var Lp,l2;function nN(){return l2||(l2=1,Lp=function(e){return!!e}),Lp}var Bp,u2;function tT(){if(u2)return Bp;u2=1;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,n;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},e(function(){throw 42},null,r)}catch(m){m!==n&&(e=null)}else e=null;var i=/^\s*class\b/,s=function(y){try{var x=t.call(y);return i.test(x)}catch{return!1}},o=function(y){try{return s(y)?!1:(t.call(y),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",u="[object Function]",c="[object GeneratorFunction]",f="[object HTMLAllCollection]",d="[object HTML document.all class]",g="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,b=!(0 in[,]),w=function(){return!1};if(typeof document=="object"){var p=document.all;a.call(p)===a.call(document.all)&&(w=function(y){if((b||!y)&&(typeof y>"u"||typeof y=="object"))try{var x=a.call(y);return(x===f||x===d||x===g||x===l)&&y("")==null}catch{}return!1})}return Bp=e?function(y){if(w(y))return!0;if(!y||typeof y!="function"&&typeof y!="object")return!1;try{e(y,null,r)}catch(x){if(x!==n)return!1}return!s(y)&&o(y)}:function(y){if(w(y))return!0;if(!y||typeof y!="function"&&typeof y!="object")return!1;if(v)return o(y);if(s(y))return!1;var x=a.call(y);return x!==u&&x!==c&&!/^\[object HTML/.test(x)?!1:o(y)},Bp}var $p,c2;function rT(){return c2||(c2=1,$p=tT()),$p}var Up,d2;function nT(){if(d2)return Up;d2=1;var t=Ti,e=fe,r=e("%TypeError%"),n=St(),i=nN(),s=rT();return Up=function(a){if(n(a)!=="Object")throw new r("ToPropertyDescriptor requires an object");var l={};if(t(a,"enumerable")&&(l["[[Enumerable]]"]=i(a.enumerable)),t(a,"configurable")&&(l["[[Configurable]]"]=i(a.configurable)),t(a,"value")&&(l["[[Value]]"]=a.value),t(a,"writable")&&(l["[[Writable]]"]=i(a.writable)),t(a,"get")){var u=a.get;if(typeof u<"u"&&!s(u))throw new r("getter must be a function");l["[[Get]]"]=u}if(t(a,"set")){var c=a.set;if(typeof c<"u"&&!s(c))throw new r("setter must be a function");l["[[Set]]"]=c}if((t(l,"[[Get]]")||t(l,"[[Set]]"))&&(t(l,"[[Value]]")||t(l,"[[Writable]]")))throw new r("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return l},Up}var Fp,f2;function iN(){if(f2)return Fp;f2=1;var t=fe,e=t("%TypeError%"),r=Uv(),n=ZE(),i=eT(),s=Nf(),o=Df(),a=ws(),l=Fv(),u=nT(),c=St();return Fp=function(d,g,v){if(c(d)!=="Object")throw new e("Assertion failed: Type(O) is not Object");if(!a(g))throw new e("Assertion failed: IsPropertyKey(P) is not true");var b=r({Type:c,IsDataDescriptor:o,IsAccessorDescriptor:s},v)?v:u(v);if(!r({Type:c,IsDataDescriptor:o,IsAccessorDescriptor:s},b))throw new e("Assertion failed: Desc is not a valid Property Descriptor");return n(o,l,i,d,g,b)},Fp}var h2;function sN(){if(h2)return qu.exports;h2=1;var t=eN(),e=t("%Reflect.construct%",!0),r=iN();try{r({},"",{"[[Get]]":function(){}})}catch{r=null}if(r&&e){var n={},i={};r(i,"length",{"[[Get]]":function(){throw n},"[[Enumerable]]":!0}),qu.exports=function(o){try{e(o,i)}catch(a){return a===n}}}else qu.exports=function(o){return typeof o=="function"&&!!o.prototype};return qu.exports}var qp,p2;function oN(){if(p2)return qp;p2=1;var t=fe,e=t("%Symbol.species%",!0),r=t("%TypeError%"),n=ZM(),i=YE(),s=JE(),o=sN(),a=St(),l=$v();return qp=function(c,f){if(!l(f)||f<0)throw new r("Assertion failed: length must be an integer >= 0");var d=s(c);if(!d)return n(f);var g=i(c,"constructor");if(e&&a(g)==="Object"&&(g=i(g,e),g===null&&(g=void 0)),typeof g>"u")return n(f);if(!o(g))throw new r("C must be a constructor");return new g(f)},qp}var Hp,m2;function aN(){if(m2)return Hp;m2=1;var t=fe,e=mr(),r=t("%TypeError%"),n=JE(),i=t("%Reflect.apply%",!0)||e("Function.prototype.apply");return Hp=function(o,a){var l=arguments.length>2?arguments[2]:[];if(!n(l))throw new r("Assertion failed: optional `argumentsList`, if provided, must be a List");return i(o,a,l)},Hp}var zp,g2;function iT(){return g2||(g2=1,zp=function(e){return e===null||typeof e!="function"&&typeof e!="object"}),zp}var Wp,y2;function lN(){if(y2)return Wp;y2=1;var t=fe,e=t("%Object.preventExtensions%",!0),r=t("%Object.isExtensible%",!0),n=iT();return Wp=e?function(s){return!n(s)&&r(s)}:function(s){return!n(s)},Wp}var Gp,v2;function uN(){return v2||(v2=1,Gp=function(e,r){return!!r&&typeof r=="object"&&"[[Enumerable]]"in r&&"[[Configurable]]"in r&&(e.IsAccessorDescriptor(r)||e.IsDataDescriptor(r))}),Gp}var Vp,w2;function cN(){if(w2)return Vp;w2=1;var t=Mf(),e=Nf(),r=Df(),n=St();return Vp=function(s){return typeof s>"u"?!1:(t(n,"Property Descriptor","Desc",s),!e(s)&&!r(s))},Vp}var Qp,_2;function dN(){if(_2)return Qp;_2=1;var t=fe,e=t("%TypeError%"),r=ZE(),n=uN(),i=Uv(),s=eT(),o=Nf(),a=Df(),l=cN(),u=ws(),c=Fv(),f=St();return Qp=function(g,v,b,w,p){var m=f(g);if(m!=="Undefined"&&m!=="Object")throw new e("Assertion failed: O must be undefined or an Object");if(!u(v))throw new e("Assertion failed: P must be a Property Key");if(f(b)!=="Boolean")throw new e("Assertion failed: extensible must be a Boolean");if(!i({Type:f,IsDataDescriptor:a,IsAccessorDescriptor:o},w))throw new e("Assertion failed: Desc must be a Property Descriptor");if(f(p)!=="Undefined"&&!i({Type:f,IsDataDescriptor:a,IsAccessorDescriptor:o},p))throw new e("Assertion failed: current must be a Property Descriptor, or undefined");if(f(p)==="Undefined")return b?m==="Undefined"?!0:o(w)?r(a,c,s,g,v,w):r(a,c,s,g,v,{"[[Configurable]]":!!w["[[Configurable]]"],"[[Enumerable]]":!!w["[[Enumerable]]"],"[[Value]]":w["[[Value]]"],"[[Writable]]":!!w["[[Writable]]"]}):!1;if(!n({IsAccessorDescriptor:o,IsDataDescriptor:a},p))throw new e("`current`, when present, must be a fully populated and valid Property Descriptor");if(!p["[[Configurable]]"]){if("[[Configurable]]"in w&&w["[[Configurable]]"]||"[[Enumerable]]"in w&&!c(w["[[Enumerable]]"],p["[[Enumerable]]"])||!l(w)&&!c(o(w),o(p)))return!1;if(o(p)){if("[[Get]]"in w&&!c(w["[[Get]]"],p["[[Get]]"])||"[[Set]]"in w&&!c(w["[[Set]]"],p["[[Set]]"]))return!1}else if(!p["[[Writable]]"]&&("[[Writable]]"in w&&w["[[Writable]]"]||"[[Value]]"in w&&!c(w["[[Value]]"],p["[[Value]]"])))return!1}if(m!=="Undefined"){var y,x;return a(p)&&o(w)?(y=("[[Configurable]]"in w?w:p)["[[Configurable]]"],x=("[[Enumerable]]"in w?w:p)["[[Enumerable]]"],r(a,c,s,g,v,{"[[Configurable]]":!!y,"[[Enumerable]]":!!x,"[[Get]]":("[[Get]]"in w?w:p)["[[Get]]"],"[[Set]]":("[[Set]]"in w?w:p)["[[Set]]"]})):o(p)&&a(w)?(y=("[[Configurable]]"in w?w:p)["[[Configurable]]"],x=("[[Enumerable]]"in w?w:p)["[[Enumerable]]"],r(a,c,s,g,v,{"[[Configurable]]":!!y,"[[Enumerable]]":!!x,"[[Value]]":("[[Value]]"in w?w:p)["[[Value]]"],"[[Writable]]":!!("[[Writable]]"in w?w:p)["[[Writable]]"]})):r(a,c,s,g,v,w)}return!0},Qp}var Kp,b2;function fN(){if(b2)return Kp;b2=1;var t=fe,e=jv,r=t("%SyntaxError%"),n=t("%TypeError%"),i=Uv(),s=Nf(),o=Df(),a=lN(),l=ws(),u=nT(),c=Fv(),f=St(),d=dN();return Kp=function(v,b,w){if(f(v)!=="Object")throw new n("Assertion failed: O must be an Object");if(!l(b))throw new n("Assertion failed: P must be a Property Key");if(!i({Type:f,IsDataDescriptor:o,IsAccessorDescriptor:s},w))throw new n("Assertion failed: Desc must be a Property Descriptor");if(!e){if(s(w))throw new r("This environment does not support accessor property descriptors.");var p=!(b in v)&&w["[[Writable]]"]&&w["[[Enumerable]]"]&&w["[[Configurable]]"]&&"[[Value]]"in w,m=b in v&&(!("[[Configurable]]"in w)||w["[[Configurable]]"])&&(!("[[Enumerable]]"in w)||w["[[Enumerable]]"])&&(!("[[Writable]]"in w)||w["[[Writable]]"])&&"[[Value]]"in w;if(p||m)return v[b]=w["[[Value]]"],c(v[b],w["[[Value]]"]);throw new r("This environment does not support defining non-writable, non-enumerable, or non-configurable properties")}var y=e(v,b),x=y&&u(y),S=a(v);return d(v,b,S,w,x)},Kp}var Yp,x2;function hN(){if(x2)return Yp;x2=1;var t=fe,e=t("%TypeError%"),r=ws(),n=fN(),i=St();return Yp=function(o,a,l){if(i(o)!=="Object")throw new e("Assertion failed: Type(O) is not Object");if(!r(a))throw new e("Assertion failed: IsPropertyKey(P) is not true");var u={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Value]]":l,"[[Writable]]":!0};return n(o,a,u)},Yp}var Xp,S2;function pN(){if(S2)return Xp;S2=1;var t=fe,e=t("%TypeError%"),r=hN(),n=ws(),i=St();return Xp=function(o,a,l){if(i(o)!=="Object")throw new e("Assertion failed: Type(O) is not Object");if(!n(a))throw new e("Assertion failed: IsPropertyKey(P) is not true");var u=r(o,a,l);if(!u)throw new e("unable to create data property")},Xp}var Jp,C2;function mN(){if(C2)return Jp;C2=1;var t=fe,e=t("%TypeError%"),r=ws(),n=St();return Jp=function(s,o){if(n(s)!=="Object")throw new e("Assertion failed: `O` must be an Object");if(!r(o))throw new e("Assertion failed: `P` must be a Property Key");return o in s},Jp}var Zp,E2;function gN(){if(E2)return Zp;E2=1;var t=Math.floor;return Zp=function(r,n){var i=r%n;return t(i>=0?i:i+n)},Zp}var em,T2;function yN(){if(T2)return em;T2=1;var t=gN();return em=function(r,n){return t(r,n)},em}var tm,k2;function vN(){return k2||(k2=1,tm=function(e){return e===null||typeof e!="function"&&typeof e!="object"}),tm}var rm,P2;function wN(){if(P2)return rm;P2=1;var t=Date.prototype.getDay,e=function(o){try{return t.call(o),!0}catch{return!1}},r=Object.prototype.toString,n="[object Date]",i=Of()();return rm=function(o){return typeof o!="object"||o===null?!1:i?e(o):r.call(o)===n},rm}var Hu={exports:{}},A2;function _N(){if(A2)return Hu.exports;A2=1;var t=Object.prototype.toString,e=Dv();if(e){var r=Symbol.prototype.toString,n=/^Symbol\(.*\)$/,i=function(o){return typeof o.valueOf()!="symbol"?!1:n.test(r.call(o))};Hu.exports=function(o){if(typeof o=="symbol")return!0;if(t.call(o)!=="[object Symbol]")return!1;try{return i(o)}catch{return!1}}}else Hu.exports=function(o){return!1};return Hu.exports}var nm,I2;function bN(){if(I2)return nm;I2=1;var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol",e=vN(),r=tT(),n=wN(),i=_N(),s=function(l,u){if(typeof l>"u"||l===null)throw new TypeError("Cannot call method on "+l);if(typeof u!="string"||u!=="number"&&u!=="string")throw new TypeError('hint must be "string" or "number"');var c=u==="string"?["toString","valueOf"]:["valueOf","toString"],f,d,g;for(g=0;g1&&(arguments[1]===String?u="string":arguments[1]===Number&&(u="number"));var c;if(t&&(Symbol.toPrimitive?c=o(l,Symbol.toPrimitive):i(l)&&(c=Symbol.prototype.valueOf)),typeof c<"u"){var f=c.call(l,u);if(e(f))return f;throw new TypeError("unable to convert exotic object to primitive")}return u==="default"&&(n(l)||i(l))&&(u="string"),s(l,u==="default"?"number":u)},nm}var im,O2;function xN(){if(O2)return im;O2=1;var t=bN();return im=function(r){return arguments.length>1?t(r,arguments[1]):t(r)},im}var sm,R2;function SN(){if(R2)return sm;R2=1;var t=mr(),e=Of()(),r,n,i,s;if(e){r=t("Object.prototype.hasOwnProperty"),n=t("RegExp.prototype.exec"),i={};var o=function(){throw i};s={toString:o,valueOf:o},typeof Symbol.toPrimitive=="symbol"&&(s[Symbol.toPrimitive]=o)}var a=t("Object.prototype.toString"),l=Object.getOwnPropertyDescriptor,u="[object RegExp]";return sm=e?function(f){if(!f||typeof f!="object")return!1;var d=l(f,"lastIndex"),g=d&&r(d,"value");if(!g)return!1;try{n(f,s)}catch(v){return v===i}}:function(f){return!f||typeof f!="object"&&typeof f!="function"?!1:a(f)===u},sm}var om,M2;function CN(){if(M2)return om;M2=1;var t=mr(),e=fe,r=SN(),n=t("RegExp.prototype.exec"),i=e("%TypeError%");return om=function(o){if(!r(o))throw new i("`regex` must be a RegExp");return function(l){return n(o,l)!==null}},om}var am,N2;function sT(){if(N2)return am;N2=1;var t=fe,e=t("%String%"),r=t("%TypeError%");return am=function(i){if(typeof i=="symbol")throw new r("Cannot convert a Symbol value to a string");return e(i)},am}var lm,D2;function oT(){if(D2)return lm;D2=1;var t=Rf(),e=sT(),r=mr(),n=r("String.prototype.replace"),i=/^\s$/.test("᠎"),s=i?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,o=i?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;return lm=function(){var l=e(t(this));return n(n(l,s,""),o,"")},lm}var um,j2;function aT(){if(j2)return um;j2=1;var t=oT(),e="​",r="᠎";return um=function(){return String.prototype.trim&&e.trim()===e&&r.trim()===r&&("_"+r).trim()==="_"+r&&(r+"_").trim()===r+"_"?String.prototype.trim:t},um}var cm,L2;function EN(){if(L2)return cm;L2=1;var t=Go,e=aT();return cm=function(){var n=e();return t(String.prototype,{trim:n},{trim:function(){return String.prototype.trim!==n}}),n},cm}var dm,B2;function TN(){if(B2)return dm;B2=1;var t=iu,e=Go,r=Rf(),n=oT(),i=aT(),s=EN(),o=t(i()),a=function(u){return r(u),o(u)};return e(a,{getPolyfill:i,implementation:n,shim:s}),dm=a,dm}var fm,$2;function kN(){if($2)return fm;$2=1;var t=fe,e=t("%Number%"),r=t("%RegExp%"),n=t("%TypeError%"),i=t("%parseInt%"),s=mr(),o=CN(),a=s("String.prototype.slice"),l=o(/^0b[01]+$/i),u=o(/^0o[0-7]+$/i),c=o(/^[-+]0x[0-9a-f]+$/i),f=["…","​","￾"].join(""),d=new r("["+f+"]","g"),g=o(d),v=TN(),b=St();return fm=function w(p){if(b(p)!=="String")throw new n("Assertion failed: `argument` is not a String");if(l(p))return e(i(a(p,2),2));if(u(p))return e(i(a(p,2),8));if(g(p)||c(p))return NaN;var m=v(p);return m!==p?w(m):e(p)},fm}var hm,U2;function PN(){if(U2)return hm;U2=1;var t=fe,e=t("%TypeError%"),r=t("%Number%"),n=iT(),i=xN(),s=kN();return hm=function(a){var l=n(a)?a:i(a,r);if(typeof l=="symbol")throw new e("Cannot convert a Symbol value to a number");if(typeof l=="bigint")throw new e("Conversion from 'BigInt' to 'number' is not allowed.");return typeof l=="string"?s(l):r(l)},hm}var pm,F2;function AN(){if(F2)return pm;F2=1;var t=St(),e=Math.floor;return pm=function(n){return t(n)==="BigInt"?n:e(n)},pm}var mm,q2;function IN(){if(q2)return mm;q2=1;var t=fe,e=AN(),r=t("%TypeError%");return mm=function(i){if(typeof i!="number"&&typeof i!="bigint")throw new r("argument must be a Number or a BigInt");var s=i<0?-e(-i):e(i);return s===0?0:s},mm}var gm,H2;function ON(){if(H2)return gm;H2=1;var t=yN(),e=PN(),r=IN(),n=KE(),i=4294967296;return gm=function(o){var a=e(o);if(!n(a)||a===0)return 0;var l=r(a),u=t(l,i);return u===0?0:u},gm}var ym,z2;function RN(){if(z2)return ym;z2=1;var t=fe,e=t("%Object%"),r=Rf();return ym=function(i){return r(i),e(i)},ym}var vm,W2;function lT(){if(W2)return vm;W2=1;var t=oN(),e=aN(),r=pN(),n=YE(),i=mN(),s=rT(),o=ON(),a=RN(),l=sT(),u=mr(),c=QE(),f=Object("a"),d=f[0]!=="a"||!(0 in f),g=u("String.prototype.split");return vm=function(b){var w=a(this),p=d&&c(w)?g(w,""):w,m=o(p.length);if(!s(b))throw new TypeError("Array.prototype.map callback must be a function");var y;arguments.length>1&&(y=arguments[1]);for(var x=t(w,m),S=0;S"u"?Promise:this,c)};r(l,{getPolyfill:s,implementation:i,shim:o}),t.exports=l,t.exports.default=l})(LE);var KN=LE.exports;const YN=yn(KN);var qv=function(){function t(e){var r=e.logger;this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=Wo(cs({name:"rate-limiter",emoji:!0},r))}return t.prototype.request=function(e,r){return kr(this,void 0,Promise,function(){var n=this;return ar(this,function(i){switch(i.label){case 0:return this._logger.trace("request start"),[4,new Promise(function(s,o){var a,l={req:e,resolve:s,reject:o,limitReachedBehavior:(a=r==null?void 0:r.limitReachedBehavior)!==null&&a!==void 0?a:"enqueue"};n._batchRunning||n._nextBatchTimer||n._paused?(n._logger.trace("request queued batchRunning:".concat(n._batchRunning.toString()," hasNextBatchTimer:").concat((!!n._nextBatchTimer).toString()," paused:").concat(n._paused.toString())),n._queue.push(l)):n._runRequestBatch([l])})];case 1:return[2,i.sent()]}})})},t.prototype.clear=function(){this._queue=[]},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1,this._runNextBatch()},Object.defineProperty(t.prototype,"stats",{get:function(){var e,r,n,i,s;return{lastKnownLimit:(r=(e=this._parameters)===null||e===void 0?void 0:e.limit)!==null&&r!==void 0?r:null,lastKnownRemainingRequests:(i=(n=this._parameters)===null||n===void 0?void 0:n.remaining)!==null&&i!==void 0?i:null,lastKnownResetDate:hr((s=this._parameters)===null||s===void 0?void 0:s.resetsAt,function(o){return new Date(o)})}},enumerable:!1,configurable:!0}),t.prototype._runRequestBatch=function(e){return kr(this,void 0,void 0,function(){var r,n,i,s,o,a,l,u,c=this;return ar(this,function(f){switch(f.label){case 0:return this._logger.trace("runRequestBatch start specs:".concat(e.length)),this._batchRunning=!0,this._parameters&&this._logger.debug("Remaining requests: ".concat(this._parameters.remaining)),this._logger.debug("Doing ".concat(e.length," requests, new queue length is ").concat(this._queue.length)),r=e.map(function(d){return kr(c,void 0,Promise,function(){var g,v,b,w,p,m,y;return ar(this,function(x){switch(x.label){case 0:g=d.req,v=d.resolve,b=d.reject,x.label=1;case 1:return x.trys.push([1,3,,4]),[4,this.doRequest(g)];case 2:if(w=x.sent(),p=this.needsToRetryAfter(w),p!==null)throw this._queue.unshift(d),this._logger.info("Retrying after ".concat(p," ms")),new ub(p);return m=this.getParametersFromResponse(w),v(w),[2,m];case 3:if(y=x.sent(),y instanceof ub)throw y;return b(y),[2,void 0];case 4:return[2]}})})}),[4,YN.call(Promise,r)];case 1:return n=f.sent(),i=n.filter(function(d){return d.status==="rejected"}),s=Date.now(),i.length?(this._logger.trace("runRequestBatch some rejected"),o=Math.max.apply(Math,vi([s],_n(i.map(function(d){return d.reason.retryAt})),!1)),a=o-s,this._logger.warn("Waiting for ".concat(a," ms because the rate limit was exceeded")),this._nextBatchTimer=setTimeout(function(){c._parameters=void 0,c._runNextBatch()},a)):(this._logger.trace("runRequestBatch none rejected"),l=n.filter(function(d){return d.status==="fulfilled"&&d.value!==void 0}).map(function(d){return d.value}).reduce(function(d,g){return d?g.remaining0?(this._logger.trace("runRequestBatch canRunMore"),this._runNextBatch()):(u=l.resetsAt-s,this._logger.trace("runRequestBatch delay:".concat(u)),this._logger.warn("Waiting for ".concat(u," ms because the rate limit was reached")),this._queue=this._queue.filter(function(d){switch(d.limitReachedBehavior){case"enqueue":return!0;case"null":return d.resolve(null),!1;case"throw":return d.reject(new Rv("Request removed from queue because the rate limit was reached")),!1;default:throw new Error("this should never happen")}}),this._nextBatchTimer=setTimeout(function(){c._parameters=void 0,c._runNextBatch()},u)))),this._logger.trace("runRequestBatch end"),[2]}})})},t.prototype._runNextBatch=function(){if(!this._paused){this._logger.trace("runNextBatch start"),this._nextBatchTimer&&(clearTimeout(this._nextBatchTimer),this._nextBatchTimer=void 0);var e=this._parameters?Math.min(this._parameters.remaining,this._parameters.limit/10):1,r=this._queue.splice(0,e);r.length&&this._runRequestBatch(r),this._logger.trace("runNextBatch end")}},t}(),XN=function(){function t(e){this._children=new Map,this._paused=!1,this._partitionKeyCallback=e.getPartitionKey,this._createChildCallback=e.createChild}return t.prototype.request=function(e,r){return kr(this,void 0,Promise,function(){var n,i;return ar(this,function(s){switch(s.label){case 0:return n=this._partitionKeyCallback(e),i=this._getChild(n),[4,i.request(e,r)];case 1:return[2,s.sent()]}})})},t.prototype.clear=function(){var e,r;try{for(var n=fc(this._children.values()),i=n.next();!i.done;i=n.next()){var s=i.value;s.clear()}}catch(o){e={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.pause=function(){var e,r;this._paused=!0;try{for(var n=fc(this._children.values()),i=n.next();!i.done;i=n.next()){var s=i.value;s.pause()}}catch(o){e={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.resume=function(){var e,r;this._paused=!1;try{for(var n=fc(this._children.values()),i=n.next();!i.done;i=n.next()){var s=i.value;s.resume()}}catch(o){e={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.getChildStats=function(e){if(!this._children.has(e))return null;var r=this._children.get(e);return r instanceof qv?r.stats:null},t.prototype._getChild=function(e){if(this._children.has(e))return this._children.get(e);var r=this._createChildCallback(e);return this._paused&&r.pause(),this._children.set(e,r),r},t}(),pT=function(){function t(e){var r=e.logger,n=e.bucketSize,i=e.timeFrame,s=e.doRequest,o=e.getPartitionKey;this._partitionedQueue=new Map,this._usedFromBucket=new Map,this._paused=!1,this._logger=Wo(cs({name:"rate-limiter",emoji:!0},r)),this._bucketSize=n,this._timeFrame=i,this._callback=s,this._partitionKeyCallback=o}return t.prototype.request=function(e,r){return kr(this,void 0,Promise,function(){var n=this;return ar(this,function(i){switch(i.label){case 0:return[4,new Promise(function(s,o){var a,l,u={req:e,resolve:s,reject:o,limitReachedBehavior:(a=r==null?void 0:r.limitReachedBehavior)!==null&&a!==void 0?a:"enqueue"},c=n._partitionKeyCallback(e),f=(l=n._usedFromBucket.get(c))!==null&&l!==void 0?l:0;if(f>=n._bucketSize||n._paused)switch(u.limitReachedBehavior){case"enqueue":{var d=n._getPartitionedQueue(c);d.push(u),f+d.length>=n._bucketSize?n._logger.warn("Rate limit of ".concat(n._bucketSize," for ").concat(c?"partition ".concat(c):"default partition"," was reached, waiting for ").concat(n._paused?"the limiter to be unpaused":"a free bucket entry","; queue size is ").concat(d.length)):n._logger.info("Enqueueing request for ".concat(c?"partition ".concat(c):"default partition"," because the rate limiter is paused; queue size is ").concat(d.length));break}case"null":{u.resolve(null),n._paused?n._logger.info("Returning null for request for ".concat(c?"partition ".concat(c):"default partition"," because the rate limiter is paused")):n._logger.warn("Rate limit of ".concat(n._bucketSize," for ").concat(c?"partition ".concat(c):"default partition"," was reached, dropping request and returning null"));break}case"throw":{u.reject(new Rv("Request dropped because ".concat(n._paused?"the rate limiter is paused":"the rate limit for ".concat(c?"partition ".concat(c):"default partition"," was reached"))));break}default:throw new Error("this should never happen")}else n._runRequest(u,c)})];case 1:return[2,i.sent()]}})})},t.prototype.clear=function(){this._partitionedQueue.clear()},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){var e,r;this._paused=!1;try{for(var n=fc(this._partitionedQueue.keys()),i=n.next();!i.done;i=n.next()){var s=i.value;this._runNextRequest(s)}}catch(o){e={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype._getPartitionedQueue=function(e){if(this._partitionedQueue.has(e))return this._partitionedQueue.get(e);var r=[];return this._partitionedQueue.set(e,r),r},t.prototype._runRequest=function(e,r){var n;return kr(this,void 0,void 0,function(){var i,s,o,a,l,u,c=this;return ar(this,function(f){switch(f.label){case 0:i=this._getPartitionedQueue(r),this._logger.debug("doing a request for ".concat(r?"partition ".concat(r):"default partition",", new queue length is ").concat(i.length)),this._usedFromBucket.set(r,((n=this._usedFromBucket.get(r))!==null&&n!==void 0?n:0)+1),s=e.req,o=e.resolve,a=e.reject,f.label=1;case 1:return f.trys.push([1,3,4,5]),l=o,[4,this._callback(s)];case 2:return l.apply(void 0,[f.sent()]),[3,5];case 3:return u=f.sent(),a(u),[3,5];case 4:return setTimeout(function(){var d=c._usedFromBucket.get(r)-1;c._usedFromBucket.set(r,d),i.length&&d=n._bucketSize||n._paused)switch(l.limitReachedBehavior){case"enqueue":{n._queue.push(l),n._usedFromBucket+n._queue.length>=n._bucketSize?n._logger.warn("Rate limit of ".concat(n._bucketSize," was reached, waiting for ").concat(n._paused?"the limiter to be unpaused":"a free bucket entry","; queue size is ").concat(n._queue.length)):n._logger.info("Enqueueing request because the rate limiter is paused; queue size is ".concat(n._queue.length));break}case"null":{l.resolve(null),n._logger.warn("Rate limit of ".concat(n._bucketSize," was reached, dropping request and returning null")),n._paused?n._logger.info("Returning null for request because the rate limiter is paused"):n._logger.warn("Rate limit of ".concat(n._bucketSize," was reached, dropping request and returning null"));break}case"throw":{l.reject(new Rv("Request dropped because ".concat(n._paused?"the rate limiter is paused":"the rate limit was reached")));break}default:throw new Error("this should never happen")}else n._runRequest(l)})];case 1:return[2,i.sent()]}})})},t.prototype.clear=function(){this._queue=[]},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1,this._runNextRequest()},t.prototype._runRequest=function(e){return kr(this,void 0,void 0,function(){var r,n,i,s,o,a=this;return ar(this,function(l){switch(l.label){case 0:this._logger.debug("doing a request, new queue length is ".concat(this._queue.length)),this._usedFromBucket+=1,r=e.req,n=e.resolve,i=e.reject,l.label=1;case 1:return l.trys.push([1,3,4,5]),s=n,[4,this._callback(r)];case 2:return s.apply(void 0,[l.sent()]),[3,5];case 3:return o=l.sent(),i(o),[3,5];case 4:return setTimeout(function(){a._usedFromBucket-=1,a._queue.length&&a._usedFromBucketthis.addListener(e,r);return e}emit(e,...r){if(this._eventListeners.has(e))for(const n of this._eventListeners.get(e))n(...r);if(this._internalEventListeners.has(e))for(const n of this._internalEventListeners.get(e))n(...r)}registerInternalEvent(){const e=r=>this.addInternalListener(e,r);return e}addInternalListener(e,r){return this._addListener(!0,e,r)}removeInternalListener(e,r){this._removeListener(!0,e,r)}_addListener(e,r,n){const i=e?this._eventListeners:this._internalEventListeners;return i.has(r)?i.get(r).push(n):i.set(r,[n]),new ZN(this,r,n,e)}_removeListener(e,r,n){const i=e?this._eventListeners:this._internalEventListeners;if(!r)i.clear();else if(typeof r=="object"){const s=r;this._removeListener(s._internal,s.event,s.listener)}else{const s=r;if(i.has(s))if(n){const o=i.get(s);let a=0;for(;(a=o.indexOf(n))!==-1;)o.splice(a,1)}else i.delete(s)}}}const e6=6e4;function t6(t){return hr(t.expiresIn,e=>t.obtainmentTimestamp+e*1e3-e6)}function oo(t){var e;return(e=hr(t6(t),r=>Date.now()>r))!==null&&e!==void 0?e:!1}var ay={exports:{}};(function(t,e){var r=typeof self<"u"?self:tf,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function l(P){return P&&DataView.prototype.isPrototypeOf(P)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(P){return P&&u.indexOf(Object.prototype.toString.call(P))>-1};function f(P){if(typeof P!="string"&&(P=String(P)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(P))throw new TypeError("Invalid character in header field name");return P.toLowerCase()}function d(P){return typeof P!="string"&&(P=String(P)),P}function g(P){var j={next:function(){var Q=P.shift();return{done:Q===void 0,value:Q}}};return a.iterable&&(j[Symbol.iterator]=function(){return j}),j}function v(P){this.map={},P instanceof v?P.forEach(function(j,Q){this.append(Q,j)},this):Array.isArray(P)?P.forEach(function(j){this.append(j[0],j[1])},this):P&&Object.getOwnPropertyNames(P).forEach(function(j){this.append(j,P[j])},this)}v.prototype.append=function(P,j){P=f(P),j=d(j);var Q=this.map[P];this.map[P]=Q?Q+", "+j:j},v.prototype.delete=function(P){delete this.map[f(P)]},v.prototype.get=function(P){return P=f(P),this.has(P)?this.map[P]:null},v.prototype.has=function(P){return this.map.hasOwnProperty(f(P))},v.prototype.set=function(P,j){this.map[f(P)]=d(j)},v.prototype.forEach=function(P,j){for(var Q in this.map)this.map.hasOwnProperty(Q)&&P.call(j,this.map[Q],Q,this)},v.prototype.keys=function(){var P=[];return this.forEach(function(j,Q){P.push(Q)}),g(P)},v.prototype.values=function(){var P=[];return this.forEach(function(j){P.push(j)}),g(P)},v.prototype.entries=function(){var P=[];return this.forEach(function(j,Q){P.push([Q,j])}),g(P)},a.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function b(P){if(P.bodyUsed)return Promise.reject(new TypeError("Already read"));P.bodyUsed=!0}function w(P){return new Promise(function(j,Q){P.onload=function(){j(P.result)},P.onerror=function(){Q(P.error)}})}function p(P){var j=new FileReader,Q=w(j);return j.readAsArrayBuffer(P),Q}function m(P){var j=new FileReader,Q=w(j);return j.readAsText(P),Q}function y(P){for(var j=new Uint8Array(P),Q=new Array(j.length),ue=0;ue-1?j:P}function M(P,j){j=j||{};var Q=j.body;if(P instanceof M){if(P.bodyUsed)throw new TypeError("Already read");this.url=P.url,this.credentials=P.credentials,j.headers||(this.headers=new v(P.headers)),this.method=P.method,this.mode=P.mode,this.signal=P.signal,!Q&&P._bodyInit!=null&&(Q=P._bodyInit,P.bodyUsed=!0)}else this.url=String(P);if(this.credentials=j.credentials||this.credentials||"same-origin",(j.headers||!this.headers)&&(this.headers=new v(j.headers)),this.method=O(j.method||this.method||"GET"),this.mode=j.mode||this.mode||null,this.signal=j.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&Q)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(Q)}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function L(P){var j=new FormData;return P.trim().split("&").forEach(function(Q){if(Q){var ue=Q.split("="),$=ue.shift().replace(/\+/g," "),H=ue.join("=").replace(/\+/g," ");j.append(decodeURIComponent($),decodeURIComponent(H))}}),j}function W(P){var j=new v,Q=P.replace(/\r?\n[\t ]+/g," ");return Q.split(/\r?\n/).forEach(function(ue){var $=ue.split(":"),H=$.shift().trim();if(H){var Y=$.join(":").trim();j.append(H,Y)}}),j}S.call(M.prototype);function ee(P,j){j||(j={}),this.type="default",this.status=j.status===void 0?200:j.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in j?j.statusText:"OK",this.headers=new v(j.headers),this.url=j.url||"",this._initBody(P)}S.call(ee.prototype),ee.prototype.clone=function(){return new ee(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},ee.error=function(){var P=new ee(null,{status:0,statusText:""});return P.type="error",P};var le=[301,302,303,307,308];ee.redirect=function(P,j){if(le.indexOf(j)===-1)throw new RangeError("Invalid status code");return new ee(null,{status:j,headers:{location:P}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(j,Q){this.message=j,this.name=Q;var ue=Error(j);this.stack=ue.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function he(P,j){return new Promise(function(Q,ue){var $=new M(P,j);if($.signal&&$.signal.aborted)return ue(new o.DOMException("Aborted","AbortError"));var H=new XMLHttpRequest;function Y(){H.abort()}H.onload=function(){var se={status:H.status,statusText:H.statusText,headers:W(H.getAllResponseHeaders()||"")};se.url="responseURL"in H?H.responseURL:se.headers.get("X-Request-URL");var ye="response"in H?H.response:H.responseText;Q(new ee(ye,se))},H.onerror=function(){ue(new TypeError("Network request failed"))},H.ontimeout=function(){ue(new TypeError("Network request failed"))},H.onabort=function(){ue(new o.DOMException("Aborted","AbortError"))},H.open($.method,$.url,!0),$.credentials==="include"?H.withCredentials=!0:$.credentials==="omit"&&(H.withCredentials=!1),"responseType"in H&&a.blob&&(H.responseType="blob"),$.headers.forEach(function(se,ye){H.setRequestHeader(ye,se)}),$.signal&&($.signal.addEventListener("abort",Y),H.onreadystatechange=function(){H.readyState===4&&$.signal.removeEventListener("abort",Y)}),H.send(typeof $._bodyInit>"u"?null:$._bodyInit)})}return he.polyfill=!0,s.fetch||(s.fetch=he,s.Headers=v,s.Request=M,s.Response=ee),o.Headers=v,o.Request=M,o.Response=ee,o.fetch=he,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(ay,ay.exports);var mT=ay.exports;const r6=yn(mT);var Sm=Object.prototype.hasOwnProperty,Os=Array.isArray,Dr=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),n6=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Os(n)){for(var i=[],s=0;s=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122){s+=i.charAt(o);continue}if(a<128){s=s+Dr[a];continue}if(a<2048){s=s+(Dr[192|a>>6]+Dr[128|a&63]);continue}if(a<55296||a>=57344){s=s+(Dr[224|a>>12]+Dr[128|a>>6&63]+Dr[128|a&63]);continue}o+=1,a=65536+((a&1023)<<10|i.charCodeAt(o)&1023),s+=Dr[240|a>>18]+Dr[128|a>>12&63]+Dr[128|a>>6&63]+Dr[128|a&63]}return s},l6=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i"u")return w;var p;if(ao(a))p=a;else{var m=Object.keys(v);p=l?m.sort(l):m}for(var y=0;y"u"?ft.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ft.charsetSentinel,delimiter:typeof e.delimiter>"u"?ft.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:ft.encode,encoder:typeof e.encoder=="function"?e.encoder:ft.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:ft.encodeValuesOnly,filter:s,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:ft.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:ft.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ft.strictNullHandling}},x6=function(t,e){var r=t,n=b6(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):ao(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in X2?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var l=X2[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var u=0;u0?d+f:""};const vT=yn(x6);var S6=Hv;S6.decode;const h=Symbol("twurpleRawData");class Z{constructor(e){this[h]=e}}class Zr extends Error{constructor(e,r){var n;super(e,r),Object.setPrototypeOf(this,new.target.prototype),(n=Error.captureStackTrace)===null||n===void 0||n.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}}class C6 extends Zr{constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}}function ne(t){if(t==null)throw new C6;return t}function B(t,e,r){return n=>{const i=r?function(){return`[${e}#${this[r]} - please check https://twurple.js.org/reference/${t}/classes/${e}.html for available properties]`}:function(){return`[${e} - please check https://twurple.js.org/reference/${t}/classes/${e}.html for available properties]`};Object.defineProperty(n.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:i,enumerable:!1})}}let uy=class extends Z{get authorName(){return this[h].author_name}get bitsEnabled(){return this[h].bits_enabled}get installable(){return this[h].can_install}get configurationLocation(){return this[h].configuration_location}get description(){return this[h].description}get tosUrl(){return this[h].eula_tos_url}get hasChatSupport(){return this[h].has_chat_support}get iconUrl(){return this[h].icon_url}getIconUrl(e){return this[h].icon_urls[e]}get id(){return this[h].id}get name(){return this[h].name}get privacyPolicyUrl(){return this[h].privacy_policy_url}get requestsIdentityLink(){return this[h].request_identity_link}get screenshotUrls(){return this[h].screenshot_urls}get state(){return this[h].state}get subscriptionsSupportLevel(){return this[h].subscriptions_support_level}get summary(){return this[h].summary}get supportEmail(){return this[h].support_email}get version(){return this[h].version}get viewerSummery(){return this[h].viewer_summary}get allowedConfigUrls(){return this[h].allowlisted_config_urls}get allowedPanelUrls(){return this[h].allowlisted_panel_urls}get mobileViewerUrl(){var e,r;return(r=(e=this[h].views.mobile)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get panelViewerUrl(){var e,r;return(r=(e=this[h].views.panel)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get panelHeight(){var e,r;return(r=(e=this[h].views.panel)===null||e===void 0?void 0:e.height)!==null&&r!==void 0?r:null}get panelCanLinkExternalContent(){var e,r;return(r=(e=this[h].views.panel)===null||e===void 0?void 0:e.can_link_external_content)!==null&&r!==void 0?r:null}get overlayViewerUrl(){var e,r;return(r=(e=this[h].views.video_overlay)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get overlayCanLinkExternalContent(){var e,r;return(r=(e=this[h].views.video_overlay)===null||e===void 0?void 0:e.can_link_external_content)!==null&&r!==void 0?r:null}get componentViewerUrl(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get componentAspectWidth(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.aspect_width)!==null&&r!==void 0?r:null}get componentAspectHeight(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.aspect_height)!==null&&r!==void 0?r:null}get componentAspectRatioX(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.aspect_ratio_x)!==null&&r!==void 0?r:null}get componentAspectRatioY(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.aspect_ratio_y)!==null&&r!==void 0?r:null}get componentAutoScales(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.autoscale)!==null&&r!==void 0?r:null}get componentScalePixels(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.scale_pixels)!==null&&r!==void 0?r:null}get componentTargetHeight(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.target_height)!==null&&r!==void 0?r:null}get componentSize(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.size)!==null&&r!==void 0?r:null}get componentZoom(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.zoom)!==null&&r!==void 0?r:null}get componentZoomPixels(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.zoom_pixels)!==null&&r!==void 0?r:null}get componentCanLinkExternalContent(){var e,r;return(r=(e=this[h].views.component)===null||e===void 0?void 0:e.can_link_external_content)!==null&&r!==void 0?r:null}get configViewerUrl(){var e,r;return(r=(e=this[h].views.config)===null||e===void 0?void 0:e.viewer_url)!==null&&r!==void 0?r:null}get configCanLinkExternalContent(){var e,r;return(r=(e=this[h].views.config)===null||e===void 0?void 0:e.can_link_external_content)!==null&&r!==void 0?r:null}};uy=C([B("api","HelixExtension","id")],uy);class wi extends Zr{constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}}function E(t){return typeof t=="string"?t:typeof t=="number"?t.toString(10):t.id}function Oa(t){return typeof t=="string"?t:t.name}class ds extends Zr{constructor(e,r,n,i,s,o){super(`Encountered HTTP status code ${e}: ${r} URL: ${n} Method: ${i} Body: -${!o&&s.length>150?`${s.slice(0,147)}...`:s}`),this._statusCode=e,this._url=n,this._method=i,this._body=s}get statusCode(){return this._statusCode}get url(){return this._url}get method(){return this._method}get body(){return this._body}}async function cy(t,e){var r;if(!t.ok){const n=t.headers.get("Content-Type")==="application/json",i=n?JSON.stringify(await t.json(),null,2):await t.text(),s=vT(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new ds(t.status,t.statusText,o,(r=e.method)!==null&&r!==void 0?r:"GET",i,n)}}async function wT(t){if(t.status===204)return;const e=await t.text();if(e)return JSON.parse(e)}function C6(t,e){switch(e){case"helix":return`https://api.twitch.tv/helix/${t.replace(/^\//,"")}`;case"auth":return`https://id.twitch.tv/oauth2/${t.replace(/^\//,"")}`;case"custom":return t;default:return t}}async function jf(t,e,r,n,i={}){var s,o;const a=(s=t.type)!==null&&s!==void 0?s:"helix",l=C6(t.url,a),u=vT(t.query,{arrayFormat:"repeat",addQueryPrefix:!0}),c=new mT.Headers({Accept:"application/json"});let f;t.jsonBody&&(f=JSON.stringify(t.jsonBody),c.append("Content-Type","application/json")),e&&a!=="auth"&&c.append("Client-ID",e),r&&c.append("Authorization",`${a==="helix"?n??"Bearer":"OAuth"} ${r}`);const d={...i,method:(o=t.method)!==null&&o!==void 0?o:"GET",headers:c,body:f};return await t6(`${l}${u}`,d)}async function su(t,e,r,n,i={}){const s=await jf(t,e,r,n,i);return await cy(s,t),await wT(s)}function _e(t){return{broadcaster_id:E(t)}}class rs extends Zr{constructor(e){super("Invalid token supplied",e)}}class mc extends Zr{}function E6(t,e,r,n){return{grant_type:"authorization_code",client_id:t,client_secret:e,code:r,redirect_uri:n}}function T6(t,e){return{grant_type:"client_credentials",client_id:t,client_secret:e}}function k6(t,e,r){return{grant_type:"refresh_token",client_id:t,client_secret:e,refresh_token:r}}let ad=class extends Z{constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[h].client_id}get userId(){var e;return(e=this[h].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[h].login)!==null&&e!==void 0?e:null}get scopes(){return this[h].scopes}get expiryDate(){return hr(this[h].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};ad=C([L("auth","TokenInfo","clientId")],ad);function zv(t){var e,r;return{accessToken:t.access_token,refreshToken:t.refresh_token||null,scope:(e=t.scope)!==null&&e!==void 0?e:[],expiresIn:(r=t.expires_in)!==null&&r!==void 0?r:null,obtainmentTimestamp:Date.now()}}async function P6(t,e,r,n){return zv(await su({type:"auth",url:"token",method:"POST",query:E6(t,e,r,n)}))}async function A6(t,e){return zv(await su({type:"auth",url:"token",method:"POST",query:T6(t,e)}))}async function Z2(t,e,r){return zv(await su({type:"auth",url:"token",method:"POST",query:k6(t,e,r)}))}async function fs(t,e){try{const r=await su({type:"auth",url:"validate"},e,t);return new ad(r)}catch(r){throw r instanceof ds&&r.statusCode===401?new rs({cause:r}):r}}const I6=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 O6(t,e){if(e!=null&&e.length){const r=new Set(t.flatMap(n=>{var i;return[n,...(i=I6.get(n))!==null&&i!==void 0?i:[]]}));if(e.every(n=>!r.has(n))){const n=e.join(", ");throw new Error(`This token does not have any of the requested scopes (${n}) and can not be upgraded. +${!o&&s.length>150?`${s.slice(0,147)}...`:s}`),this._statusCode=e,this._url=n,this._method=i,this._body=s}get statusCode(){return this._statusCode}get url(){return this._url}get method(){return this._method}get body(){return this._body}}async function cy(t,e){var r;if(!t.ok){const n=t.headers.get("Content-Type")==="application/json",i=n?JSON.stringify(await t.json(),null,2):await t.text(),s=vT(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new ds(t.status,t.statusText,o,(r=e.method)!==null&&r!==void 0?r:"GET",i,n)}}async function wT(t){if(t.status===204)return;const e=await t.text();if(e)return JSON.parse(e)}function E6(t,e){switch(e){case"helix":return`https://api.twitch.tv/helix/${t.replace(/^\//,"")}`;case"auth":return`https://id.twitch.tv/oauth2/${t.replace(/^\//,"")}`;case"custom":return t;default:return t}}async function jf(t,e,r,n,i={}){var s,o;const a=(s=t.type)!==null&&s!==void 0?s:"helix",l=E6(t.url,a),u=vT(t.query,{arrayFormat:"repeat",addQueryPrefix:!0}),c=new mT.Headers({Accept:"application/json"});let f;t.jsonBody&&(f=JSON.stringify(t.jsonBody),c.append("Content-Type","application/json")),e&&a!=="auth"&&c.append("Client-ID",e),r&&c.append("Authorization",`${a==="helix"?n??"Bearer":"OAuth"} ${r}`);const d={...i,method:(o=t.method)!==null&&o!==void 0?o:"GET",headers:c,body:f};return await r6(`${l}${u}`,d)}async function su(t,e,r,n,i={}){const s=await jf(t,e,r,n,i);return await cy(s,t),await wT(s)}function _e(t){return{broadcaster_id:E(t)}}class rs extends Zr{constructor(e){super("Invalid token supplied",e)}}class mc extends Zr{}function T6(t,e,r,n){return{grant_type:"authorization_code",client_id:t,client_secret:e,code:r,redirect_uri:n}}function k6(t,e){return{grant_type:"client_credentials",client_id:t,client_secret:e}}function P6(t,e,r){return{grant_type:"refresh_token",client_id:t,client_secret:e,refresh_token:r}}let ad=class extends Z{constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[h].client_id}get userId(){var e;return(e=this[h].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[h].login)!==null&&e!==void 0?e:null}get scopes(){return this[h].scopes}get expiryDate(){return hr(this[h].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};ad=C([B("auth","TokenInfo","clientId")],ad);function zv(t){var e,r;return{accessToken:t.access_token,refreshToken:t.refresh_token||null,scope:(e=t.scope)!==null&&e!==void 0?e:[],expiresIn:(r=t.expires_in)!==null&&r!==void 0?r:null,obtainmentTimestamp:Date.now()}}async function A6(t,e,r,n){return zv(await su({type:"auth",url:"token",method:"POST",query:T6(t,e,r,n)}))}async function I6(t,e){return zv(await su({type:"auth",url:"token",method:"POST",query:k6(t,e)}))}async function Z2(t,e,r){return zv(await su({type:"auth",url:"token",method:"POST",query:P6(t,e,r)}))}async function fs(t,e){try{const r=await su({type:"auth",url:"validate"},e,t);return new ad(r)}catch(r){throw r instanceof ds&&r.statusCode===401?new rs({cause:r}):r}}const O6=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 R6(t,e){if(e!=null&&e.length){const r=new Set(t.flatMap(n=>{var i;return[n,...(i=O6.get(n))!==null&&i!==void 0?i:[]]}));if(e.every(n=>!r.has(n))){const n=e.join(", ");throw new Error(`This token does not have any of the requested scopes (${n}) and can not be upgraded. If you need dynamically upgrading scopes, please implement the AuthProvider interface accordingly: - https://twurple.js.org/reference/auth/interfaces/AuthProvider.html`)}}}function dy(t,e){for(const r of e)O6(t,r)}async function R6(t,e,r,n,i){if(i!=null&&i.length||!r){const s=await fs(e,t);if(!s.userId)throw new Error("Trying to use an app access token as a user access token");const o=n??s.scopes;return i&&dy(o,i.filter(a=>!!a)),[o,s.userId]}return[n,r]}class ex{constructor(e){this._newTokenScopeSets=[],this._newTokenPromise=null,this._queuedScopeSets=[],this._queueExecutor=null,this._queuePromise=null,this._executor=e}async fetch(...e){var r;const n=e.filter(a=>!!a);if(this._newTokenPromise){if(!n.length)return await this._newTokenPromise;if(this._queueExecutor?this._queuedScopeSets.push(...n):this._queuedScopeSets=[...n],!this._queuePromise){const{promise:a,resolve:l,reject:u}=ul();this._queuePromise=a,this._queueExecutor=async()=>{var c;if(this._queuePromise){this._newTokenScopeSets=this._queuedScopeSets,this._queuedScopeSets=[],this._newTokenPromise=this._queuePromise,this._queuePromise=null,this._queueExecutor=null;try{l(await this._executor(this._newTokenScopeSets))}catch(f){u(f)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(c=this._queueExecutor)===null||c===void 0||c.call(this)}}}}return await this._queuePromise}this._newTokenScopeSets=[...n];const{promise:i,resolve:s,reject:o}=ul();this._newTokenPromise=i;try{s(await this._executor(this._newTokenScopeSets))}catch(a){o(a)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(r=this._queueExecutor)===null||r===void 0||r.call(this)}return await i}}class tx extends Zr{constructor(e){super(`The user context for the user ${e} has been disabled. + https://twurple.js.org/reference/auth/interfaces/AuthProvider.html`)}}}function dy(t,e){for(const r of e)R6(t,r)}async function M6(t,e,r,n,i){if(i!=null&&i.length||!r){const s=await fs(e,t);if(!s.userId)throw new Error("Trying to use an app access token as a user access token");const o=n??s.scopes;return i&&dy(o,i.filter(a=>!!a)),[o,s.userId]}return[n,r]}class ex{constructor(e){this._newTokenScopeSets=[],this._newTokenPromise=null,this._queuedScopeSets=[],this._queueExecutor=null,this._queuePromise=null,this._executor=e}async fetch(...e){var r;const n=e.filter(a=>!!a);if(this._newTokenPromise){if(!n.length)return await this._newTokenPromise;if(this._queueExecutor?this._queuedScopeSets.push(...n):this._queuedScopeSets=[...n],!this._queuePromise){const{promise:a,resolve:l,reject:u}=ul();this._queuePromise=a,this._queueExecutor=async()=>{var c;if(this._queuePromise){this._newTokenScopeSets=this._queuedScopeSets,this._queuedScopeSets=[],this._newTokenPromise=this._queuePromise,this._queuePromise=null,this._queueExecutor=null;try{l(await this._executor(this._newTokenScopeSets))}catch(f){u(f)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(c=this._queueExecutor)===null||c===void 0||c.call(this)}}}}return await this._queuePromise}this._newTokenScopeSets=[...n];const{promise:i,resolve:s,reject:o}=ul();this._newTokenPromise=i;try{s(await this._executor(this._newTokenScopeSets))}catch(a){o(a)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(r=this._queueExecutor)===null||r===void 0||r.call(this)}return await i}}class tx extends Zr{constructor(e){super(`The user context for the user ${e} has been disabled. 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). -Use .addUser(), .addUserForToken() or .addUserForCode() for the same user context to re-enable the user with a new, valid token.`),this.userId=e}}class M6 extends Zr{constructor(e){super(`User ${e} was removed while trying to fetch a token. +Use .addUser(), .addUserForToken() or .addUserForCode() for the same user context to re-enable the user with a new, valid token.`),this.userId=e}}class N6 extends Zr{constructor(e){super(`User ${e} was removed while trying to fetch a token. -Make sure you're not executing any actions when you want to remove a user.`),this.userId=e}}class N6 extends Zr{constructor(e){super(`Unknown intent: ${e}`),this.intent=e}}let _i=class extends Vo{constructor(e){var r;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=(r=e.appImpliedScopes)!==null&&r!==void 0?r:[],this._appTokenFetcher=new ex(async n=>await this._fetchAppToken(n))}addUser(e,r,n){const i=E(e);if(!r.refreshToken)throw new Error(`Trying to add user ${i} without refresh token`);this._cachedRefreshFailures.delete(i),this._userAccessTokens.set(i,{...r,userId:i}),this._userTokenFetchers.has(i)||this._userTokenFetchers.set(i,new ex(async s=>await this._fetchUserToken(i,s))),n&&this.addIntentsToUser(e,n)}async addUserForToken(e,r){let n=null;if(e.accessToken&&!oo(e))try{const a=await fs(e.accessToken);n=[e,a]}catch(a){if(!(a instanceof rs))throw a}if(!n){if(!e.refreshToken)throw new rs;const a=await Z2(this._clientId,this._clientSecret,e.refreshToken),l=await fs(a.accessToken);this.emit(this.onRefresh,l.userId,a),n=[a,l]}const[i,s]=n;if(!s.userId)throw new mc("Could not determine a user ID for your token; you might be trying to disguise an app token as a user token.");const o=i.scope?i:{...i,scope:s.scopes};return this.addUser(s.userId,o,r),s.userId}async addUserForCode(e,r){if(!this._redirectUri)throw new Error("This method requires you to pass a `redirectUri` as a configuration property");const n=await P6(this._clientId,this._clientSecret,e,this._redirectUri);return await this.addUserForToken(n,r)}hasUser(e){return this._userTokenFetchers.has(E(e))}removeUser(e){const r=E(e);if(this._userIdToIntents.has(r)){const n=this._userIdToIntents.get(r);for(const i of n)this._intentToUserId.delete(i);this._userIdToIntents.delete(r)}this._userAccessTokens.delete(r),this._userTokenFetchers.delete(r),this._cachedRefreshFailures.delete(r)}addIntentsToUser(e,r){const n=E(e);if(!this._userAccessTokens.has(n))throw new Error("Trying to add intents to a user that was not added to this provider");for(const i of r)this._intentToUserId.has(i)&&this._userIdToIntents.get(this._intentToUserId.get(i)).delete(i),this._intentToUserId.set(i,n),this._userIdToIntents.has(n)?this._userIdToIntents.get(n).add(i):this._userIdToIntents.set(n,new Set([i]))}getIntentsForUser(e){const r=E(e);return this._userIdToIntents.has(r)?Array.from(this._userIdToIntents.get(r)):[]}removeIntents(e){var r;for(const n of e)if(this._intentToUserId.has(n)){const i=this._intentToUserId.get(n);(r=this._userIdToIntents.get(i))===null||r===void 0||r.delete(n),this._intentToUserId.delete(n)}}async refreshAccessTokenForUser(e){const r=E(e);if(this._cachedRefreshFailures.has(r))throw new tx(r);const n=this._userAccessTokens.get(r);if(!n)throw new Error("Trying to refresh token for user that was not added to the provider");const i=await this._refreshUserTokenWithCallback(r,n.refreshToken);return this._checkIntermediateUserRemoval(r),this._userAccessTokens.set(r,{...i,userId:r}),this.emit(this.onRefresh,r,i),{...i,userId:r}}async refreshAccessTokenForIntent(e){if(!this._intentToUserId.has(e))throw new N6(e);const r=this._intentToUserId.get(e);return await this.refreshAccessTokenForUser(r)}get clientId(){return this._clientId}getCurrentScopesForUser(e){var r;const n=this._userAccessTokens.get(E(e));if(!n)throw new Error("Trying to get scopes for user that was not added to the provider");return(r=n.scope)!==null&&r!==void 0?r:[]}async getAccessTokenForUser(e,...r){const n=E(e),i=this._userTokenFetchers.get(n);if(!i)return null;if(this._cachedRefreshFailures.has(n))throw new tx(n);return await i.fetch(...r)}async getAccessTokenForIntent(e,...r){if(!this._intentToUserId.has(e))return null;const n=this._intentToUserId.get(e),i=await this.getAccessTokenForUser(n,...r);if(!i)throw new wi(`Found intent ${e} corresponding to user ID ${n} but no token was found`);return{...i,userId:n}}async getAnyAccessToken(e){if(e){const r=E(e);if(this._userAccessTokens.has(r)){const n=await this.getAccessTokenForUser(r);if(!n)throw new wi(`Token for user ID ${r} exists but nothing was returned by getAccessTokenForUser`);return{...n,userId:r}}}return await this.getAppAccessToken()}async getAppAccessToken(e=!1){return e&&(this._appAccessToken=void 0),await this._appTokenFetcher.fetch(...this._appImpliedScopes.map(r=>[r]))}_checkIntermediateUserRemoval(e){if(!this._userTokenFetchers.has(e))throw this._cachedRefreshFailures.delete(e),new M6(e)}async _fetchUserToken(e,r){const n=this._userAccessTokens.get(e);if(!n)throw new Error("Trying to get token for user that was not added to the provider");if(n.accessToken&&!oo(n))try{if(n.scope)return dy(n.scope,r),n;const[s=[]]=await R6(this._clientId,n.accessToken,e,n.scope,r),o={...n,scope:s};return this._checkIntermediateUserRemoval(e),this._userAccessTokens.set(e,o),o}catch(s){if(!(s instanceof rs))throw s}this._checkIntermediateUserRemoval(e);const i=await this.refreshAccessTokenForUser(e);return dy(i.scope,r),i}async _refreshUserTokenWithCallback(e,r){try{return await Z2(this.clientId,this._clientSecret,r)}catch(n){throw this._cachedRefreshFailures.add(e),this.emit(this.onRefreshFailure,e),n}}async _fetchAppToken(e){if(e.length>0)for(const r of e)if(this._appImpliedScopes.length){if(r.every(n=>!this._appImpliedScopes.includes(n)))throw new Error(`One of the scopes ${r.join(", ")} requested but only the scope ${this._appImpliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${r.join(", ")} requested but the client credentials flow does not support scopes`);return!this._appAccessToken||oo(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await A6(this._clientId,this._clientSecret)}};C([K(!1)],_i.prototype,"_clientSecret",void 0);C([K(!1)],_i.prototype,"_userAccessTokens",void 0);C([K(!1)],_i.prototype,"_userTokenFetchers",void 0);C([K(!1)],_i.prototype,"_appAccessToken",void 0);C([K(!1)],_i.prototype,"_appTokenFetcher",void 0);_i=C([L("auth","RefreshingAuthProvider","clientId")],_i);class D6 extends Vo{constructor({lineBased:e,logger:r,additionalOptions:n}={}){super(),this._currentLine="",this._connecting=!1,this._connected=!1,this.onReceive=this.registerEvent(),this.onConnect=this.registerEvent(),this.onDisconnect=this.registerEvent(),this.onEnd=this.registerEvent(),this._lineBased=e??!1,this._logger=r,this._additionalOptions=n}get isConnecting(){return this._connecting}get isConnected(){return this._connected}sendLine(e){this._connected&&(e=e.replace(/[\0\r\n]/g,""),this.sendRaw(`${e}\r +Make sure you're not executing any actions when you want to remove a user.`),this.userId=e}}class D6 extends Zr{constructor(e){super(`Unknown intent: ${e}`),this.intent=e}}let _i=class extends Vo{constructor(e){var r;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=(r=e.appImpliedScopes)!==null&&r!==void 0?r:[],this._appTokenFetcher=new ex(async n=>await this._fetchAppToken(n))}addUser(e,r,n){const i=E(e);if(!r.refreshToken)throw new Error(`Trying to add user ${i} without refresh token`);this._cachedRefreshFailures.delete(i),this._userAccessTokens.set(i,{...r,userId:i}),this._userTokenFetchers.has(i)||this._userTokenFetchers.set(i,new ex(async s=>await this._fetchUserToken(i,s))),n&&this.addIntentsToUser(e,n)}async addUserForToken(e,r){let n=null;if(e.accessToken&&!oo(e))try{const a=await fs(e.accessToken);n=[e,a]}catch(a){if(!(a instanceof rs))throw a}if(!n){if(!e.refreshToken)throw new rs;const a=await Z2(this._clientId,this._clientSecret,e.refreshToken),l=await fs(a.accessToken);this.emit(this.onRefresh,l.userId,a),n=[a,l]}const[i,s]=n;if(!s.userId)throw new mc("Could not determine a user ID for your token; you might be trying to disguise an app token as a user token.");const o=i.scope?i:{...i,scope:s.scopes};return this.addUser(s.userId,o,r),s.userId}async addUserForCode(e,r){if(!this._redirectUri)throw new Error("This method requires you to pass a `redirectUri` as a configuration property");const n=await A6(this._clientId,this._clientSecret,e,this._redirectUri);return await this.addUserForToken(n,r)}hasUser(e){return this._userTokenFetchers.has(E(e))}removeUser(e){const r=E(e);if(this._userIdToIntents.has(r)){const n=this._userIdToIntents.get(r);for(const i of n)this._intentToUserId.delete(i);this._userIdToIntents.delete(r)}this._userAccessTokens.delete(r),this._userTokenFetchers.delete(r),this._cachedRefreshFailures.delete(r)}addIntentsToUser(e,r){const n=E(e);if(!this._userAccessTokens.has(n))throw new Error("Trying to add intents to a user that was not added to this provider");for(const i of r)this._intentToUserId.has(i)&&this._userIdToIntents.get(this._intentToUserId.get(i)).delete(i),this._intentToUserId.set(i,n),this._userIdToIntents.has(n)?this._userIdToIntents.get(n).add(i):this._userIdToIntents.set(n,new Set([i]))}getIntentsForUser(e){const r=E(e);return this._userIdToIntents.has(r)?Array.from(this._userIdToIntents.get(r)):[]}removeIntents(e){var r;for(const n of e)if(this._intentToUserId.has(n)){const i=this._intentToUserId.get(n);(r=this._userIdToIntents.get(i))===null||r===void 0||r.delete(n),this._intentToUserId.delete(n)}}async refreshAccessTokenForUser(e){const r=E(e);if(this._cachedRefreshFailures.has(r))throw new tx(r);const n=this._userAccessTokens.get(r);if(!n)throw new Error("Trying to refresh token for user that was not added to the provider");const i=await this._refreshUserTokenWithCallback(r,n.refreshToken);return this._checkIntermediateUserRemoval(r),this._userAccessTokens.set(r,{...i,userId:r}),this.emit(this.onRefresh,r,i),{...i,userId:r}}async refreshAccessTokenForIntent(e){if(!this._intentToUserId.has(e))throw new D6(e);const r=this._intentToUserId.get(e);return await this.refreshAccessTokenForUser(r)}get clientId(){return this._clientId}getCurrentScopesForUser(e){var r;const n=this._userAccessTokens.get(E(e));if(!n)throw new Error("Trying to get scopes for user that was not added to the provider");return(r=n.scope)!==null&&r!==void 0?r:[]}async getAccessTokenForUser(e,...r){const n=E(e),i=this._userTokenFetchers.get(n);if(!i)return null;if(this._cachedRefreshFailures.has(n))throw new tx(n);return await i.fetch(...r)}async getAccessTokenForIntent(e,...r){if(!this._intentToUserId.has(e))return null;const n=this._intentToUserId.get(e),i=await this.getAccessTokenForUser(n,...r);if(!i)throw new wi(`Found intent ${e} corresponding to user ID ${n} but no token was found`);return{...i,userId:n}}async getAnyAccessToken(e){if(e){const r=E(e);if(this._userAccessTokens.has(r)){const n=await this.getAccessTokenForUser(r);if(!n)throw new wi(`Token for user ID ${r} exists but nothing was returned by getAccessTokenForUser`);return{...n,userId:r}}}return await this.getAppAccessToken()}async getAppAccessToken(e=!1){return e&&(this._appAccessToken=void 0),await this._appTokenFetcher.fetch(...this._appImpliedScopes.map(r=>[r]))}_checkIntermediateUserRemoval(e){if(!this._userTokenFetchers.has(e))throw this._cachedRefreshFailures.delete(e),new N6(e)}async _fetchUserToken(e,r){const n=this._userAccessTokens.get(e);if(!n)throw new Error("Trying to get token for user that was not added to the provider");if(n.accessToken&&!oo(n))try{if(n.scope)return dy(n.scope,r),n;const[s=[]]=await M6(this._clientId,n.accessToken,e,n.scope,r),o={...n,scope:s};return this._checkIntermediateUserRemoval(e),this._userAccessTokens.set(e,o),o}catch(s){if(!(s instanceof rs))throw s}this._checkIntermediateUserRemoval(e);const i=await this.refreshAccessTokenForUser(e);return dy(i.scope,r),i}async _refreshUserTokenWithCallback(e,r){try{return await Z2(this.clientId,this._clientSecret,r)}catch(n){throw this._cachedRefreshFailures.add(e),this.emit(this.onRefreshFailure,e),n}}async _fetchAppToken(e){if(e.length>0)for(const r of e)if(this._appImpliedScopes.length){if(r.every(n=>!this._appImpliedScopes.includes(n)))throw new Error(`One of the scopes ${r.join(", ")} requested but only the scope ${this._appImpliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${r.join(", ")} requested but the client credentials flow does not support scopes`);return!this._appAccessToken||oo(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await I6(this._clientId,this._clientSecret)}};C([K(!1)],_i.prototype,"_clientSecret",void 0);C([K(!1)],_i.prototype,"_userAccessTokens",void 0);C([K(!1)],_i.prototype,"_userTokenFetchers",void 0);C([K(!1)],_i.prototype,"_appAccessToken",void 0);C([K(!1)],_i.prototype,"_appTokenFetcher",void 0);_i=C([B("auth","RefreshingAuthProvider","clientId")],_i);class j6 extends Vo{constructor({lineBased:e,logger:r,additionalOptions:n}={}){super(),this._currentLine="",this._connecting=!1,this._connected=!1,this.onReceive=this.registerEvent(),this.onConnect=this.registerEvent(),this.onDisconnect=this.registerEvent(),this.onEnd=this.registerEvent(),this._lineBased=e??!1,this._logger=r,this._additionalOptions=n}get isConnecting(){return this._connecting}get isConnected(){return this._connected}sendLine(e){this._connected&&(e=e.replace(/[\0\r\n]/g,""),this.sendRaw(`${e}\r `))}assumeExternalDisconnect(){var e;(e=this._logger)===null||e===void 0||e.trace("AbstractConnection assumeExternalDisconnect"),this._connected=!1,this._connecting=!1,this.clearSocket(),this.emit(this.onDisconnect,!1)}receiveRaw(e){var r,n;if(!this._lineBased){this.emit(this.onReceive,e);return}const i=e.split(`\r -`);if(this._currentLine+=(r=i.shift())!==null&&r!==void 0?r:"",i.length){this.emit(this.onReceive,this._currentLine),this._currentLine=(n=i.pop())!==null&&n!==void 0?n:"";for(const s of i)this.emit(this.onReceive,s)}}}class j6{constructor(){throw new Error("DirectConnection is not implemented in a browser environment")}}class L6 extends Vo{constructor(e,r,n={}){var i;super(),this._type=e,this._target=r,this._config=n,this._retryLimit=1/0,this._initialRetryLimit=3,this._connecting=!1,this._connectionRetryCount=0,this.onReceive=this.registerEvent(),this.onConnect=this.registerEvent(),this.onDisconnect=this.registerEvent(),this.onEnd=this.registerEvent(),this._retryLimit=(i=n.retryLimit)!==null&&i!==void 0?i:1/0,this._logger=n.logger}get isConnected(){var e,r;return(r=(e=this._currentConnection)===null||e===void 0?void 0:e.isConnected)!==null&&r!==void 0?r:!1}get isConnecting(){var e,r;return(r=(e=this._currentConnection)===null||e===void 0?void 0:e.isConnecting)!==null&&r!==void 0?r:this._connecting}get hasSocket(){var e,r;return(r=(e=this._currentConnection)===null||e===void 0?void 0:e.hasSocket)!==null&&r!==void 0?r:!1}sendLine(e){var r;(r=this._currentConnection)===null||r===void 0||r.sendLine(e)}connect(){if(this._currentConnection||this._connecting)throw new Error("Connection already present");this._connecting=!0,this._connectionRetryCount=0,this._tryConnect(!0)}disconnect(){var e;if((e=this._logger)===null||e===void 0||e.trace(`PersistentConnection disconnect currentConnectionExists:${(!!this._currentConnection).toString()} connecting:${this._connecting.toString()}`),this._connecting=!1,this._currentConnection){const r=this._currentConnection;this._currentConnection=void 0,r.disconnect()}}assumeExternalDisconnect(){var e,r;(e=this._logger)===null||e===void 0||e.trace("PersistentConnection assumeExternalDisconnect"),(r=this._currentConnection)===null||r===void 0||r.assumeExternalDisconnect()}reconnect(){this._reconnect(!0)}acknowledgeSuccessfulReconnect(){this._previousConnection&&(this._previousConnection.disconnect(),this._previousConnection=void 0)}_startTryingToConnect(e=!1){this._connecting=!0,this._connectionRetryCount=0,this._tryConnect(e)}_tryConnect(e=!1){var r,n;(r=this._logger)===null||r===void 0||r.trace(`PersistentConnection tryConnect currentConnectionExists:${(!!this._currentConnection).toString()} connecting:${this._connecting.toString()}`);const i=e?this._initialRetryLimit:this._retryLimit;(n=this._retryTimerGenerator)!==null&&n!==void 0||(this._retryTimerGenerator=AE(120));const s=this._currentConnection=new this._type(L4(this._target),this._config);s.onReceive(o=>this.emit(this.onReceive,o)),s.onConnect(()=>{this.emit(this.onConnect),this._connecting=!1,this._retryTimerGenerator=void 0}),s.onDisconnect((o,a)=>{var l,u,c;if(this.emit(this.onDisconnect,o,a),o)this.emit(this.onEnd,!0),this._connecting=!1,this._retryTimerGenerator=void 0,s.disconnect(),this._currentConnection===s&&(this._currentConnection=void 0),this._previousConnection===s&&(this._previousConnection=void 0);else if(this._connecting){if((l=this._logger)===null||l===void 0||l.debug(`Connection error caught: ${(u=a==null?void 0:a.message)!==null&&u!==void 0?u:"unknown error"}`),this._connectionRetryCount>=i)return;this._connectionRetryCount++;const f=this._retryTimerGenerator.next().value;f!==0&&((c=this._logger)===null||c===void 0||c.info(`Retrying in ${f} seconds`)),setTimeout(()=>{var d;this._connecting&&((d=this._logger)===null||d===void 0||d.info(e?"Retrying connection":"Trying to reconnect"),this._tryConnect())},f*1e3)}else this._reconnect()}),s.connect()}_reconnect(e=!1){e&&this._config.overlapManualReconnect?(this._previousConnection=this._currentConnection,this._currentConnection=void 0):this.disconnect(),this._startTryingToConnect(e)}}var Rs=null;typeof WebSocket<"u"?Rs=WebSocket:typeof MozWebSocket<"u"?Rs=MozWebSocket:typeof global<"u"?Rs=global.WebSocket||global.MozWebSocket:typeof window<"u"?Rs=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Rs=self.WebSocket||self.MozWebSocket);class B6 extends D6{constructor(e,r){if(super(r),this._socket=null,this._closingOnDemand=!1,e.hostName&&e.port)this._url=`ws${e.secure?"s":""}://${e.hostName}:${e.port}`;else if(e.url)this._url=e.url;else throw new Error("WebSocketConnection requires either hostName & port or url to be set")}get hasSocket(){return!!this._socket}sendRaw(e){var r;(r=this._socket)===null||r===void 0||r.send(e)}connect(){var e,r;(e=this._logger)===null||e===void 0||e.trace("WebSocketConnection connect"),this._connecting=!0,this._socket=new Rs(this._url,(r=this._additionalOptions)===null||r===void 0?void 0:r.wsOptions),this._socket.onopen=()=>{var n;(n=this._logger)===null||n===void 0||n.trace("WebSocketConnection onOpen"),this._connected=!0,this._connecting=!1,this.emit(this.onConnect)},this._socket.onmessage=({data:n})=>{this.receiveRaw(n.toString())},this._socket.onerror=n=>{var i;(i=this._logger)===null||i===void 0||i.trace(`WebSocketConnection onError message:${n.message}`)},this._socket.onclose=n=>{var i;const s=this._connected,o=this._connecting;if((i=this._logger)===null||i===void 0||i.trace(`WebSocketConnection onClose wasConnected:${s.toString()} wasConnecting:${o.toString()} closingOnDemand:${this._closingOnDemand.toString()} wasClean:${n.wasClean.toString()}`),this._connected=!1,this._connecting=!1,n.wasClean||this._closingOnDemand)this._closingOnDemand=!1,this.emit(this.onDisconnect,!0),this.emit(this.onEnd,!0);else{const a=new Error(`[${n.code}] ${n.reason}`);this.emit(this.onDisconnect,!1,a),this.emit(this.onEnd,!1,a)}this.clearSocket()}}disconnect(){var e,r;(e=this._logger)===null||e===void 0||e.trace("WebSocketConnection disconnect"),this._closingOnDemand=!0,(r=this._socket)===null||r===void 0||r.close()}clearSocket(){this._socket&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onerror=null,this._socket.onclose=null,this._socket=null)}}function Ra(t){var e,r,n;if(Array.isArray(t)){for(r=Array(e=t.length);e--;)r[e]=(n=t[e])&&typeof n=="object"?Ra(n):n;return r}if(Object.prototype.toString.call(t)==="[object Object]"){r={};for(e in t)e==="__proto__"?Object.defineProperty(r,e,{value:Ra(t[e]),configurable:!0,enumerable:!0,writable:!0}):r[e]=(n=t[e])&&typeof n=="object"?Ra(n):n;return r}return t}const $6={name:"away-notify"};class ld extends Error{constructor(e,r,n){super(`command "${e}" expected ${r} or more parameters, got ${n}`),this._command=e,this._expectedParams=r,this._actualParams=n,Object.setPrototypeOf(this,ld.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ld)}get command(){return this._command}get expectedParams(){return this._expectedParams}get actualParams(){return this._actualParams}}class ud extends Error{constructor(e,r,n,i){var s;super(`required parameter "${r}" did not validate against ${(s=n.type)!==null&&s!==void 0?s:"regex"} validation: "${i}"`),this._command=e,this._paramName=r,this._paramSpec=n,this._givenValue=i,Object.setPrototypeOf(this,ud.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ud)}get command(){return this._command}get paramName(){return this._paramName}get paramSpec(){return this._paramSpec}get givenValue(){return this._givenValue}}const lo={channelTypes:"#&",supportedUserModes:"iwso",supportedChannelModes:{prefix:"ov",list:"b",alwaysWithParam:"ovk",paramWhenSet:"l",noParam:"imnpst"},prefixes:[{modeChar:"v",prefix:"+"},{modeChar:"o",prefix:"@"}]};var _T={exports:{}};(function(t){t.exports=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},t.exports.default=t.exports})(_T);var U6=_T.exports;const F6=yn(U6);function fy(t,e="#&"){return new RegExp(`^[${F6(e)}][^ \b\0 +`);if(this._currentLine+=(r=i.shift())!==null&&r!==void 0?r:"",i.length){this.emit(this.onReceive,this._currentLine),this._currentLine=(n=i.pop())!==null&&n!==void 0?n:"";for(const s of i)this.emit(this.onReceive,s)}}}class L6{constructor(){throw new Error("DirectConnection is not implemented in a browser environment")}}class B6 extends Vo{constructor(e,r,n={}){var i;super(),this._type=e,this._target=r,this._config=n,this._retryLimit=1/0,this._initialRetryLimit=3,this._connecting=!1,this._connectionRetryCount=0,this.onReceive=this.registerEvent(),this.onConnect=this.registerEvent(),this.onDisconnect=this.registerEvent(),this.onEnd=this.registerEvent(),this._retryLimit=(i=n.retryLimit)!==null&&i!==void 0?i:1/0,this._logger=n.logger}get isConnected(){var e,r;return(r=(e=this._currentConnection)===null||e===void 0?void 0:e.isConnected)!==null&&r!==void 0?r:!1}get isConnecting(){var e,r;return(r=(e=this._currentConnection)===null||e===void 0?void 0:e.isConnecting)!==null&&r!==void 0?r:this._connecting}get hasSocket(){var e,r;return(r=(e=this._currentConnection)===null||e===void 0?void 0:e.hasSocket)!==null&&r!==void 0?r:!1}sendLine(e){var r;(r=this._currentConnection)===null||r===void 0||r.sendLine(e)}connect(){if(this._currentConnection||this._connecting)throw new Error("Connection already present");this._connecting=!0,this._connectionRetryCount=0,this._tryConnect(!0)}disconnect(){var e;if((e=this._logger)===null||e===void 0||e.trace(`PersistentConnection disconnect currentConnectionExists:${(!!this._currentConnection).toString()} connecting:${this._connecting.toString()}`),this._connecting=!1,this._currentConnection){const r=this._currentConnection;this._currentConnection=void 0,r.disconnect()}}assumeExternalDisconnect(){var e,r;(e=this._logger)===null||e===void 0||e.trace("PersistentConnection assumeExternalDisconnect"),(r=this._currentConnection)===null||r===void 0||r.assumeExternalDisconnect()}reconnect(){this._reconnect(!0)}acknowledgeSuccessfulReconnect(){this._previousConnection&&(this._previousConnection.disconnect(),this._previousConnection=void 0)}_startTryingToConnect(e=!1){this._connecting=!0,this._connectionRetryCount=0,this._tryConnect(e)}_tryConnect(e=!1){var r,n;(r=this._logger)===null||r===void 0||r.trace(`PersistentConnection tryConnect currentConnectionExists:${(!!this._currentConnection).toString()} connecting:${this._connecting.toString()}`);const i=e?this._initialRetryLimit:this._retryLimit;(n=this._retryTimerGenerator)!==null&&n!==void 0||(this._retryTimerGenerator=AE(120));const s=this._currentConnection=new this._type(B4(this._target),this._config);s.onReceive(o=>this.emit(this.onReceive,o)),s.onConnect(()=>{this.emit(this.onConnect),this._connecting=!1,this._retryTimerGenerator=void 0}),s.onDisconnect((o,a)=>{var l,u,c;if(this.emit(this.onDisconnect,o,a),o)this.emit(this.onEnd,!0),this._connecting=!1,this._retryTimerGenerator=void 0,s.disconnect(),this._currentConnection===s&&(this._currentConnection=void 0),this._previousConnection===s&&(this._previousConnection=void 0);else if(this._connecting){if((l=this._logger)===null||l===void 0||l.debug(`Connection error caught: ${(u=a==null?void 0:a.message)!==null&&u!==void 0?u:"unknown error"}`),this._connectionRetryCount>=i)return;this._connectionRetryCount++;const f=this._retryTimerGenerator.next().value;f!==0&&((c=this._logger)===null||c===void 0||c.info(`Retrying in ${f} seconds`)),setTimeout(()=>{var d;this._connecting&&((d=this._logger)===null||d===void 0||d.info(e?"Retrying connection":"Trying to reconnect"),this._tryConnect())},f*1e3)}else this._reconnect()}),s.connect()}_reconnect(e=!1){e&&this._config.overlapManualReconnect?(this._previousConnection=this._currentConnection,this._currentConnection=void 0):this.disconnect(),this._startTryingToConnect(e)}}var Rs=null;typeof WebSocket<"u"?Rs=WebSocket:typeof MozWebSocket<"u"?Rs=MozWebSocket:typeof global<"u"?Rs=global.WebSocket||global.MozWebSocket:typeof window<"u"?Rs=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Rs=self.WebSocket||self.MozWebSocket);class $6 extends j6{constructor(e,r){if(super(r),this._socket=null,this._closingOnDemand=!1,e.hostName&&e.port)this._url=`ws${e.secure?"s":""}://${e.hostName}:${e.port}`;else if(e.url)this._url=e.url;else throw new Error("WebSocketConnection requires either hostName & port or url to be set")}get hasSocket(){return!!this._socket}sendRaw(e){var r;(r=this._socket)===null||r===void 0||r.send(e)}connect(){var e,r;(e=this._logger)===null||e===void 0||e.trace("WebSocketConnection connect"),this._connecting=!0,this._socket=new Rs(this._url,(r=this._additionalOptions)===null||r===void 0?void 0:r.wsOptions),this._socket.onopen=()=>{var n;(n=this._logger)===null||n===void 0||n.trace("WebSocketConnection onOpen"),this._connected=!0,this._connecting=!1,this.emit(this.onConnect)},this._socket.onmessage=({data:n})=>{this.receiveRaw(n.toString())},this._socket.onerror=n=>{var i;(i=this._logger)===null||i===void 0||i.trace(`WebSocketConnection onError message:${n.message}`)},this._socket.onclose=n=>{var i;const s=this._connected,o=this._connecting;if((i=this._logger)===null||i===void 0||i.trace(`WebSocketConnection onClose wasConnected:${s.toString()} wasConnecting:${o.toString()} closingOnDemand:${this._closingOnDemand.toString()} wasClean:${n.wasClean.toString()}`),this._connected=!1,this._connecting=!1,n.wasClean||this._closingOnDemand)this._closingOnDemand=!1,this.emit(this.onDisconnect,!0),this.emit(this.onEnd,!0);else{const a=new Error(`[${n.code}] ${n.reason}`);this.emit(this.onDisconnect,!1,a),this.emit(this.onEnd,!1,a)}this.clearSocket()}}disconnect(){var e,r;(e=this._logger)===null||e===void 0||e.trace("WebSocketConnection disconnect"),this._closingOnDemand=!0,(r=this._socket)===null||r===void 0||r.close()}clearSocket(){this._socket&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onerror=null,this._socket.onclose=null,this._socket=null)}}function Ra(t){var e,r,n;if(Array.isArray(t)){for(r=Array(e=t.length);e--;)r[e]=(n=t[e])&&typeof n=="object"?Ra(n):n;return r}if(Object.prototype.toString.call(t)==="[object Object]"){r={};for(e in t)e==="__proto__"?Object.defineProperty(r,e,{value:Ra(t[e]),configurable:!0,enumerable:!0,writable:!0}):r[e]=(n=t[e])&&typeof n=="object"?Ra(n):n;return r}return t}const U6={name:"away-notify"};class ld extends Error{constructor(e,r,n){super(`command "${e}" expected ${r} or more parameters, got ${n}`),this._command=e,this._expectedParams=r,this._actualParams=n,Object.setPrototypeOf(this,ld.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ld)}get command(){return this._command}get expectedParams(){return this._expectedParams}get actualParams(){return this._actualParams}}class ud extends Error{constructor(e,r,n,i){var s;super(`required parameter "${r}" did not validate against ${(s=n.type)!==null&&s!==void 0?s:"regex"} validation: "${i}"`),this._command=e,this._paramName=r,this._paramSpec=n,this._givenValue=i,Object.setPrototypeOf(this,ud.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ud)}get command(){return this._command}get paramName(){return this._paramName}get paramSpec(){return this._paramSpec}get givenValue(){return this._givenValue}}const lo={channelTypes:"#&",supportedUserModes:"iwso",supportedChannelModes:{prefix:"ov",list:"b",alwaysWithParam:"ovk",paramWhenSet:"l",noParam:"imnpst"},prefixes:[{modeChar:"v",prefix:"+"},{modeChar:"o",prefix:"@"}]};var _T={exports:{}};(function(t){t.exports=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},t.exports.default=t.exports})(_T);var F6=_T.exports;const q6=yn(F6);function fy(t,e="#&"){return new RegExp(`^[${q6(e)}][^ \b\0 \r,]+$`).test(t)}const rx={0:"\0",n:` -`,r:"\r","":""};function nx(t){if(!t.startsWith("")||(t=t.substring(1),t.endsWith("")&&(t=t.slice(0,-1)),!t))return!1;t=t.replace(/\x10(.)/,(n,i)=>i in rx?rx[i]:"");let[e,r=""]=Zi(t," ",2);return e=e?e.toUpperCase():"",{command:e,params:r}}const q6={"\\":"\\",";":":","\n":"n","\r":"r"," ":"s"};function H6(t){return t.replace(/[\\;\n\r ]/g,e=>`\\${q6[e]}`)}function z6(t){let e=`${t.nick}`;return t.user&&(e+=`!${t.user}`),t.host&&(e+=`@${t.host}`),e}function W6(t,e,r,n,i=lo,s=!1){const o=new t(t.COMMAND,void 0,{serverProperties:i}),a={};if(o._paramSpec&&ry(o._paramSpec,(l,u)=>{if(!(s&&l.noServer)&&!(!s&&l.noClient)){if(u in e){const c=e[u];if(c!==void 0){if(t.checkParam(c,l,i))a[u]={value:c,trailing:!!l.trailing};else if(!l.optional)throw new Error(`required parameter "${u}" did not suit requirements: "${c}"`)}}if(!(u in a)&&!l.optional)throw new Error(`required parameter "${u}" not found in command "${t.COMMAND}"`)}}),o._parsedParams=a,o._paramSpec)for(const l of Object.keys(o._paramSpec))Object.defineProperty(o,l,{get(){var u,c;return(c=(u=this._parsedParams)===null||u===void 0?void 0:u[l])===null||c===void 0?void 0:c.value}});return o._initPrefixAndTags(r,n),o}class D{static checkParam(e,r,n=lo){return!(r.type==="channel"&&!fy(e,n.channelTypes)||r.type==="channelList"&&!e.split(",").every(s=>fy(s,n.channelTypes))||r.match&&!r.match.test(e))}constructor(e,{params:r,tags:n,prefix:i,rawLine:s}={},{serverProperties:o=lo,isServer:a=!1,shouldParseParams:l=!0}={},u){this._params=[],this._serverProperties=lo,this._paramSpec=u,this._command=e,this._params=r,this._tags=n??new Map,this._prefix=i,this._serverProperties=o,this._raw=s,l&&this.parseParams(a)}getMinParamCount(e=!1){return this._paramSpec?Object.values(this._paramSpec).filter(r=>r.noServer&&e||r.noClient&&!e?!1:!r.optional).length:0}get paramCount(){var e,r;return(r=(e=this._params)===null||e===void 0?void 0:e.length)!==null&&r!==void 0?r:0}prefixToString(){return this._prefix?z6(this._prefix):""}tagsToString(){return[...this._tags.entries()].map(([e,r])=>r?`${e}=${H6(r)}`:e).join(";")}toString(e=!1,r=!1){const i=[r?this._buildCommandFromRawParams():this._buildCommandFromNamedParams()];if(e){const o=this.prefixToString();o&&i.unshift(`:${o}`)}const s=this.tagsToString();return s&&i.unshift(`@${s}`),i.join(" ")}_initPrefixAndTags(e,r){this._prefix=e,r&&(this._tags=r)}parseParams(e=!1){if(this._params){let r=this.getMinParamCount(e);if(r>this._params.length)throw new ld(this._command,r,this._params.length);const n=this._paramSpec;if(!n)return;let i=0;const s={};for(const[o,a]of Object.entries(n)){if(a.noServer&&e||a.noClient&&!e)continue;if(this._params.length-i<=r){if(a.optional)continue;if(this._params.length-i!==r)throw new Error("not enough parameters left for required parameters parsing (this is a library bug)")}let l=this._params[i];if(!l){if(a.optional)break;throw new Error("unexpected parameter underflow")}if(a.rest){const u=[];for(;this._params[i]&&!this._params[i].trailing;)u.push(this._params[i].value),++i;if(!u.length){if(a.optional)continue;throw new Error(`no parameters left for required rest parameter "${o}"`)}l={value:u.join(" "),trailing:!1}}if(D.checkParam(l.value,a))s[o]={...l},a.optional||--r,a.rest||++i;else if(!a.optional)throw new ud(this._command,o,a,l.value);if(a.trailing)break}if(this._parsedParams=s,this._paramSpec)for(const o of Object.keys(this._paramSpec))Object.defineProperty(this,o,{get(){var a,l;return(l=(a=this._parsedParams)===null||a===void 0?void 0:a[o])===null||l===void 0?void 0:l.value}})}}get rawParamValues(){var e,r;return(r=(e=this._params)===null||e===void 0?void 0:e.map(n=>n.value))!==null&&r!==void 0?r:[]}get prefix(){return this._prefix}get command(){return this._command}get tags(){return this._tags}get rawLine(){return this._raw}isResponseTo(e){return!1}endsResponseTo(e){return!1}_acceptsInReplyCollection(e){return e.isResponseTo(this)}_buildCommandFromNamedParams(){const e=this._paramSpec?Object.keys(this._paramSpec):[];return[this._command,...e.map(r=>{var n;const i=(n=this._parsedParams)===null||n===void 0?void 0:n[r];if(i)return(i.trailing?":":"")+i.value}).filter(r=>r!==void 0)].join(" ")}_buildCommandFromRawParams(){var e,r;return[this._command,...(r=(e=this._params)===null||e===void 0?void 0:e.map(n=>`${n.trailing?":":""}${n.value}`))!==null&&r!==void 0?r:[]].join(" ")}}D.COMMAND="";D.SUPPORTS_CAPTURE=!1;class bT extends D{constructor(e,r,n){super(e,r,n,{reference:{},type:{optional:!0},additionalParams:{optional:!0}})}}bT.COMMAND="BATCH";const G6={name:"batch",messageTypes:[bT],usesTags:!0},V6={name:"cap-notify"};class xT extends D{constructor(e,r,n){super(e,r,n,{newUser:{},newHost:{}})}}xT.COMMAND="CHGHOST";const Q6={name:"chghost",messageTypes:[xT]},K6={name:"invite-notify"};class ST extends D{}ST.COMMAND="ACK";const Y6={name:"labeled-response",messageTypes:[ST],usesTags:!0},X6={name:"message-tags",usesTags:!0},J6={name:"multi-prefix"},Z6=Object.freeze(Object.defineProperty({__proto__:null,AwayNotify:$6,Batch:G6,CapNotify:V6,ChgHost:Q6,InviteNotify:K6,LabeledResponse:Y6,MessageTags:X6,MultiPrefix:J6},Symbol.toStringTag,{value:"Module"}));class eD{constructor(e,r,...n){this._client=e,this._originalMessage=r,this._messages=[],this._endEventHandlers=new Map,this._types=new Set(n)}untilEvent(e){this._cleanEndEventHandler(e);const r=this._client.on(e,()=>this.end());this._endEventHandlers.set(e,r)}async promise(){return this._promise||(this._promise=new Promise(e=>this._promiseResolve=e)),await this._promise}collect(e){return this._originalMessage._acceptsInReplyCollection(e)?(this._messages.push(e),e.endsResponseTo(this._originalMessage)&&this.end(),!0):!1}end(){this._client.stopCollect(this),this._cleanEndEventHandlers(),this._promiseResolve&&this._promiseResolve(this._messages)}_cleanEndEventHandlers(){this._endEventHandlers.forEach(e=>this._client.removeListener(e)),this._endEventHandlers.clear()}_cleanEndEventHandler(e){this._endEventHandlers.has(e)&&(this._client.removeListener(this._endEventHandlers.get(e)),this._endEventHandlers.delete(e))}}class Wv extends D{constructor(e,r,n){super(e,r,n,{password:{}})}}Wv.COMMAND="PASS";class Ma extends D{constructor(e,r,n){super(e,r,n,{nick:{}})}}Ma.COMMAND="NICK";class Gv extends D{constructor(e,r,n){super(e,r,n,{user:{},mode:{},unused:{},realName:{trailing:!0}})}}Gv.COMMAND="USER";class CT extends D{constructor(e,r,n){super(e,r,n,{name:{},password:{}})}}CT.COMMAND="OPER";class Vv extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0,optional:!0}})}}Vv.COMMAND="QUIT";class ET extends D{constructor(e,r,n){super(e,r,n,{server:{},reason:{trailing:!0}})}}ET.COMMAND="SQUIT";class cl extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},key:{optional:!0}})}}cl.COMMAND="JOIN";class dl extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},reason:{trailing:!0,optional:!0}})}}dl.COMMAND="PART";class cd extends Error{constructor(e){super(`Unknown channel mode character ${e}`),this._char=e,Object.setPrototypeOf(this,cd.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,cd)}get char(){return this._char}}class TT extends D{constructor(e,r,n){super(e,r,n,{target:{},modes:{rest:!0,optional:!0}})}get isChannel(){return fy(this.target,this._serverProperties.channelTypes)}separate(){const e=[],r=this.modes;if(!r)throw new Error("can't separate a channel mode request, just set actions");const n=r.split(" "),i=n.shift();let s="add";for(const o of i){let a=s;switch(o){case"+":{s="add";break}case"-":{s="remove";break}default:{let l=!1,u=!0;if(this.isChannel){if(this._serverProperties.supportedChannelModes.alwaysWithParam.includes(o)||this._serverProperties.supportedChannelModes.prefix.includes(o))l=!0;else if(this._serverProperties.supportedChannelModes.paramWhenSet.includes(o))s==="add"&&(l=!0);else if(this._serverProperties.supportedChannelModes.list.includes(o))n.length?l=!0:a="getList";else if(!this._serverProperties.supportedChannelModes.noParam.includes(o))throw new cd(o)}else u=this._serverProperties.supportedUserModes.includes(o);if(l&&!n.length)continue;e.push({prefix:this._prefix,action:a,letter:o,param:l?n.shift():void 0,known:u})}}}return e}}TT.COMMAND="MODE";class kT extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},newTopic:{optional:!0,trailing:!0}})}}kT.COMMAND="TOPIC";class ou extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channelList",optional:!0}})}}ou.COMMAND="NAMES";ou.SUPPORTS_CAPTURE=!0;class PT extends D{constructor(e,r,n){super(e,r,n,{channel:{optional:!0},server:{optional:!0}})}}PT.COMMAND="LIST";class AT extends D{constructor(e,r,n){super(e,r,n,{target:{},channel:{type:"channel"}})}}AT.COMMAND="INVITE";class IT extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},target:{},reason:{trailing:!0,optional:!0}})}}IT.COMMAND="KICK";class OT extends D{constructor(e,r,n){super(e,r,n,{server:{optional:!0}})}}OT.COMMAND="TIME";class fl extends D{constructor(e,r,n){super(e,r,n,{target:{},text:{trailing:!0}})}}fl.COMMAND="PRIVMSG";class Lf extends D{constructor(e,r,n){super(e,r,n,{target:{},text:{trailing:!0}})}}Lf.COMMAND="NOTICE";class Bf extends D{constructor(e,r,n){super(e,r,n,{mask:{},flags:{optional:!0},extendedMask:{optional:!0,trailing:!0}})}}Bf.COMMAND="WHO";class RT extends D{constructor(e,r,n){super(e,r,n,{server:{optional:!0},nickMask:{}})}}RT.COMMAND="WHOIS";class MT extends D{constructor(e,r,n){super(e,r,n,{nick:{},count:{optional:!0},server:{optional:!0}})}}MT.COMMAND="WHOWAS";class NT extends D{constructor(e,r,n){super(e,r,n,{target:{},reason:{trailing:!0,optional:!0}})}}NT.COMMAND="KILL";class dd extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0}})}}dd.COMMAND="PING";class fd extends D{constructor(e,r,n){super(e,r,n,{server:{noClient:!0},text:{trailing:!0}})}}fd.COMMAND="PONG";class DT extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0}})}}DT.COMMAND="ERROR";class jT extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0,optional:!0}})}}jT.COMMAND="AWAY";class LT extends D{}LT.COMMAND="REHASH";class BT extends D{}BT.COMMAND="RESTART";class $T extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0}})}}$T.COMMAND="WALLOPS";class UT extends D{constructor(e,r,n){super(e,r,n,{nicks:{rest:!0}})}}UT.COMMAND="USERHOST";class FT extends D{constructor(e,r,n){super(e,r,n,{nicks:{rest:!0}})}}FT.COMMAND="ISON";class tr extends D{constructor(e,r,n){super(e,r,n,{target:{match:/^(?:[a-z_\-\[\]\\^{}|`][a-z0-9_\-\[\]\\^{}|`]+|\*)$/i,optional:!0,noClient:!0},subCommand:{match:/^(?:LS|LIST|REQ|ACK|NAK|END|NEW|DEL)$/i},version:{match:/^\d+$/,optional:!0},continued:{match:/^\*$/,optional:!0},capabilities:{trailing:!0,optional:!0}})}isResponseTo(e){if(!(e instanceof tr))return!1;switch(this.subCommand){case"ACK":case"NAK":return e.subCommand==="REQ"&&e.capabilities===this.capabilities.trim();case"LS":case"LIST":return e.subCommand===this.subCommand;default:return!1}}endsResponseTo(e){if(!(e instanceof tr))return!1;switch(this.subCommand){case"LS":case"LIST":return!this.continued;default:return!0}}}tr.COMMAND="CAP";tr.SUPPORTS_CAPTURE=!0;class qT extends D{constructor(e,r,n){super(e,r,n,{target:{}})}}qT.COMMAND="TAGMSG";const HT=Object.freeze(Object.defineProperty({__proto__:null,Away:jT,CapabilityNegotiation:tr,ChannelInvite:AT,ChannelJoin:cl,ChannelKick:IT,ChannelList:PT,ChannelPart:dl,ClientQuit:Vv,ErrorMessage:DT,IsOnQuery:FT,Kill:NT,Mode:TT,Names:ou,NickChange:Ma,Notice:Lf,OperLogin:CT,Password:Wv,Ping:dd,Pong:fd,PrivateMessage:fl,Rehash:LT,Restart:BT,ServerQuit:ET,TagMessage:qT,Time:OT,Topic:kT,UserHostQuery:UT,UserRegistration:Gv,Wallops:$T,WhoIsQuery:RT,WhoQuery:Bf,WhoWasQuery:MT},Symbol.toStringTag,{value:"Module"}));class Qv extends D{constructor(e,r,n){super(e,r,n,{me:{},welcomeText:{trailing:!0}})}}Qv.COMMAND="001";class zT extends D{constructor(e,r,n){super(e,r,n,{me:{},yourHost:{trailing:!0}})}}zT.COMMAND="002";class WT extends D{constructor(e,r,n){super(e,r,n,{me:{},createdText:{trailing:!0}})}}WT.COMMAND="003";class Kv extends D{constructor(e,r,n){super(e,r,n,{me:{},serverName:{},version:{},userModes:{},channelModes:{},channelModesWithParam:{optional:!0}})}}Kv.COMMAND="004";class Yv extends D{constructor(e,r,n){super(e,r,n,{me:{},supports:{rest:!0},suffix:{trailing:!0}})}}Yv.COMMAND="005";class GT extends D{constructor(e,r,n){super(e,r,n,{me:{},modes:{}})}}GT.COMMAND="221";class VT extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},text:{trailing:!0}})}}VT.COMMAND="301";class QT extends D{constructor(e,r,n){super(e,r,n,{me:{},hosts:{trailing:!0}})}}QT.COMMAND="302";class KT extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}KT.COMMAND="305";class YT extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}YT.COMMAND="306";class XT extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},username:{},host:{},_unused:{},realname:{trailing:!0}})}}XT.COMMAND="311";class JT extends D{constructor(e,r,n){super(e,r,n,{me:{},query:{},suffix:{trailing:!0}})}isResponseTo(e){return e instanceof Bf}endsResponseTo(){return!0}}JT.COMMAND="315";class ZT extends D{constructor(e,r,n){super(e,r,n,{me:{},nickMask:{},suffix:{trailing:!0}})}}ZT.COMMAND="318";class ek extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},channels:{trailing:!0}})}}ek.COMMAND="319";class tk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},memberCount:{},topic:{trailing:!0}})}}tk.COMMAND="322";class rk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}rk.COMMAND="323";class nk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},modes:{rest:!0}})}}nk.COMMAND="324";class ik extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}ik.COMMAND="331";class sk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},topic:{trailing:!0}})}}sk.COMMAND="332";class ok extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},who:{},ts:{}})}}ok.COMMAND="333";class ak extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},channel:{type:"channel"}})}}ak.COMMAND="341";class lk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},mask:{},creatorName:{optional:!0},timestamp:{optional:!0}})}}lk.COMMAND="348";class uk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}uk.COMMAND="349";class ck extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},user:{},host:{},server:{},nick:{},flags:{},hopsAndRealName:{trailing:!0}})}get isAway(){return this.flags.includes("G")}get isOper(){return this.flags.includes("*")}get isBot(){return this.flags.includes("B")}isResponseTo(e){return e instanceof Bf}}ck.COMMAND="352";class dk extends D{constructor(e,r,n){super(e,r,n,{me:{},channelType:{},channel:{type:"channel"},names:{trailing:!0}})}isResponseTo(e){return e instanceof ou}}dk.COMMAND="353";class fk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},suffix:{trailing:!0}})}isResponseTo(e){return e instanceof ou}endsResponseTo(){return!0}}fk.COMMAND="366";class hk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},mask:{},creatorName:{optional:!0},timestamp:{optional:!0}})}}hk.COMMAND="367";class pk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}pk.COMMAND="368";class mk extends D{constructor(e,r,n){super(e,r,n,{me:{},line:{trailing:!0}})}}mk.COMMAND="372";class gk extends D{constructor(e,r,n){super(e,r,n,{me:{},line:{trailing:!0}})}}gk.COMMAND="375";class Xv extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Xv.COMMAND="376";class yk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}yk.COMMAND="381";class vk extends D{constructor(e,r,n){super(e,r,n,{me:{},server:{optional:!0},timestamp:{trailing:!0}})}}vk.COMMAND="391";class wk extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},suffix:{trailing:!0}})}}wk.COMMAND="401";class _k extends D{constructor(e,r,n){super(e,r,n,{me:{},server:{},suffix:{trailing:!0}})}}_k.COMMAND="402";class bk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},suffix:{trailing:!0}})}}bk.COMMAND="403";class xk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}xk.COMMAND="404";class Sk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}Sk.COMMAND="405";class Ck extends D{constructor(e,r,n){super(e,r,n,{me:{},subCommand:{},suffix:{trailing:!0}})}}Ck.COMMAND="410";class Ek extends D{constructor(e,r,n){super(e,r,n,{me:{},originalCommand:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command===this.originalCommand}endsResponseTo(){return!0}}Ek.COMMAND="421";class Jv extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Jv.COMMAND="422";class Tk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Tk.COMMAND="431";class kk extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}kk.COMMAND="432";class Pk extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Pk.COMMAND="433";class Ak extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Ak.COMMAND="436";class Ik extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},channel:{type:"channel"},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Ik.COMMAND="441";class Ok extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Ok.COMMAND="442";class Rk extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},channel:{type:"channel"},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Rk.COMMAND="443";class Mk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Mk.COMMAND="451";class Nk extends D{constructor(e,r,n){super(e,r,n,{me:{},originalCommand:{},suffix:{trailing:!0}})}}Nk.COMMAND="461";class Zv extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Zv.COMMAND="462";class Dk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}Dk.COMMAND="471";class jk extends D{constructor(e,r,n){super(e,r,n,{me:{},char:{},suffix:{trailing:!0}})}}jk.COMMAND="472";class Lk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}Lk.COMMAND="473";class Bk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}Bk.COMMAND="474";class $k extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}$k.COMMAND="475";class Uk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},suffix:{trailing:!0}})}}Uk.COMMAND="479";class Fk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Fk.COMMAND="481";class qk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},suffix:{trailing:!0}})}}qk.COMMAND="482";class Hk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Hk.COMMAND="491";class zk extends D{constructor(e,r,n){super(e,r,n,{me:{},modeChar:{optional:!0,match:/^\w$/},suffix:{trailing:!0}})}}zk.COMMAND="501";class Wk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Wk.COMMAND="502";const Gk=Object.freeze(Object.defineProperty({__proto__:null,Error401NoSuchNick:wk,Error402NoSuchServer:_k,Error403NoSuchChannel:bk,Error404CanNotSendToChan:xk,Error405TooManyChannels:Sk,Error410InvalidCapCmd:Ck,Error421UnknownCommand:Ek,Error422NoMotd:Jv,Error431NoNickNameGiven:Tk,Error432ErroneusNickname:kk,Error433NickNameInUse:Pk,Error436NickCollision:Ak,Error441UserNotInChannel:Ik,Error442NotOnChannel:Ok,Error443UserOnChannel:Rk,Error451NotRegistered:Mk,Error461NeedMoreParams:Nk,Error462AlreadyRegistered:Zv,Error471ChannelIsFull:Dk,Error472UnknownMode:jk,Error473InviteOnlyChan:Lk,Error474BannedFromChan:Bk,Error475BadChannelKey:$k,Error479BadChanName:Uk,Error481NoPrivileges:Fk,Error482ChanOpPrivsNeeded:qk,Error491NoOperHost:Hk,Error501UmodeUnknownFlag:zk,Error502UsersDontMatch:Wk,Reply001Welcome:Qv,Reply002YourHost:zT,Reply003Created:WT,Reply004ServerInfo:Kv,Reply005Isupport:Yv,Reply221UmodeIs:GT,Reply301Away:VT,Reply302UserHost:QT,Reply305UnAway:KT,Reply306NowAway:YT,Reply311WhoisUser:XT,Reply315EndOfWho:JT,Reply318EndOfWhois:ZT,Reply319WhoisChannels:ek,Reply322List:tk,Reply323ListEnd:rk,Reply324ChannelModeIs:nk,Reply331NoTopic:ik,Reply332Topic:sk,Reply333TopicWhoTime:ok,Reply341Inviting:ak,Reply348ExceptList:lk,Reply349EndOfExceptList:uk,Reply352WhoReply:ck,Reply353NamesReply:dk,Reply366EndOfNames:fk,Reply367BanList:hk,Reply368EndOfBanList:pk,Reply372Motd:mk,Reply375MotdStart:gk,Reply376EndOfMotd:Xv,Reply381YoureOper:yk,Reply391Time:vk},Symbol.toStringTag,{value:"Module"})),tD=new Map([...Object.values(HT),...Object.values(Gk)].map(t=>[t.COMMAND,t]));function rD(t){const[e,r]=Zi(t,"!",2);if(r){const[n,i]=Zi(r,"@",2);return i?{nick:e,user:n,host:i}:{nick:e,host:n}}else return{nick:e}}const ix={":":";",n:` -`,r:"\r",s:" "};function nD(t){const e=new Map,r=t.split(";");for(const n of r){const[i,s]=Zi(n,"=",2);i!==""&&e.set(i,s?s.replace(/\\(.?)/g,(o,a)=>Object.prototype.hasOwnProperty.call(ix,a)?ix[a]:a):"")}return e}function iD(t,e=lo,r=tD,n=!1,i=[],s=!0){const o=t.split(" ");let a,l;const u=[];let c,f;for(;o.length;){if(a=o[0],a.startsWith("@")&&!c&&!l&&!f)c=nD(a.slice(1));else if(a.startsWith(":"))if(!f&&!l)a.length>1&&(f=rD(a.slice(1)));else{u.push({value:o.join(" ").slice(1),trailing:!0});break}else l?u.push({value:a,trailing:!1}):l=a.toUpperCase();o.shift()}if(c||(c=new Map),!l)throw new Error(`line without command received: ${t}`);s&&(s=!i.includes(l));let d=D;return r.has(l)&&(d=r.get(l)),new d(l,{params:u,tags:c,prefix:f,rawLine:t},{serverProperties:e,isServer:n,shouldParseParams:s})}class Vk extends Vo{constructor(e){super(),this._registered=!1,this._supportsCapabilities=!0,this._events=new Map,this._registeredMessageTypes=new Map,this.onConnect=this.registerEvent(),this.onRegister=this.registerEvent(),this.onDisconnect=this.registerEvent(),this.onPrivmsg=this.registerEvent(),this.onAction=this.registerEvent(),this.onNotice=this.registerEvent(),this.onNickChange=this.registerEvent(),this.onCtcp=this.registerEvent(),this.onCtcpReply=this.registerEvent(),this.onPasswordError=this.registerEvent(),this.onAnyMessage=this.registerEvent(),this._serverProperties=Ra(lo),this._supportedFeatures={},this._collectors=[],this._clientCapabilities=new Map,this._serverCapabilities=new Map,this._negotiatedCapabilities=new Map,this._currentChannels=new Set,this._hasRegisteredBefore=!1,this._channelsFromLastRegister=new Set,this._initialConnectionSetupDone=!1;const{connection:r,credentials:n,channels:i,channelTypes:s,webSocket:o,logger:a={}}=e;this._options=e;const{pingOnInactivity:l=60,pingTimeout:u=10}=r;this._pingOnInactivity=l,this._pingTimeout=u,this._currentNick=n.nick,this._logger=Wo({name:"ircv3",emoji:!0,...a}),this.registerCoreMessageTypes();const{hostName:c,secure:f,reconnect:d=!0}=r,y={hostName:c,port:this.port,secure:f},v={lineBased:!0,logger:this._logger,additionalOptions:e.connectionOptions},b=o?B6:j6;d?this._connection=new L6(b,y,v):this._connection=new b(v,this._logger,e.connectionOptions);for(const w of Object.values(Z6))this.addCapability(w);this.addInternalListener(this.onRegister,async()=>{const w=this._hasRegisteredBefore,p=this._channelsFromLastRegister;this._hasRegisteredBefore=!0,this._channelsFromLastRegister=new Set;const m=w&&this._options.rejoinChannelsOnReconnect?p:await ty(i);if(m)for(const g of m)this.join(g)}),this.onTypedMessage(tr,async({subCommand:w,capabilities:p})=>{const m=p.split(" ");switch(w.toUpperCase()){case"NEW":{this._logger.debug(`Server registered new capabilities: ${m.join(", ")}`);const g=va(m,S=>{if(!S)return{};const[k,R]=Zi(S,"=",2);return{[k]:{name:k,param:R||!0}}});for(const[S,k]of Object.entries(g))this._serverCapabilities.set(S,k);const x=Object.keys(g);await this._negotiateCapabilities(Array.from(this._clientCapabilities.entries()).filter(([S])=>x.includes(S)).map(([,S])=>S));break}case"DEL":{this._logger.debug(`Server removed capabilities: ${m.join(", ")}`);for(const g of m)this._serverCapabilities.delete(g),this._negotiatedCapabilities.delete(g)}}}),this.onTypedMessage(dd,({text:w})=>{this.sendMessage(fd,{text:w})}),this.onTypedMessage(Qv,({me:w})=>this._handleReceivedClientNick(w)),this.onTypedMessage(Kv,({userModes:w})=>{w&&(this._serverProperties.supportedUserModes=w)}),this.onTypedMessage(Yv,({supports:w})=>{const p=va(w.split(" "),m=>{const[g,x]=Zi(m,"=",2);return{[g]:x||!0}});this._supportedFeatures={...this._supportedFeatures,...p}}),this.onTypedMessage(Xv,({me:w})=>{this._registered||(this._handleReceivedClientNick(w),this._registered=!0,this.emit(this.onRegister))}),this.onTypedMessage(Jv,({me:w})=>{this._registered||(this._handleReceivedClientNick(w),this._registered=!0,this.emit(this.onRegister))}),this.onTypedMessage(Zv,({me:w})=>{this._registered||(this._logger.warn("We thought we're not registered yet, but we actually are"),this._handleReceivedClientNick(w),this._registered=!0,this.emit(this.onRegister))}),this.onTypedMessage(fl,w=>{var p;const{target:m,text:g}=w,x=nx(g),S=(p=w.prefix)===null||p===void 0?void 0:p.nick;x?x.command==="ACTION"?this.emit(this.onAction,m,S,x.params,w):this.emit(this.onCtcp,m,S,x.command,x.params,w):this.emit(this.onPrivmsg,m,S,g,w)}),this.onTypedMessage(Ma,w=>{var p;const{nick:m}=w,g=(p=w.prefix)===null||p===void 0?void 0:p.nick;g===this._currentNick&&(this._currentNick=m),this.emit(this.onNickChange,g,m,w)}),this.onTypedMessage(Lf,w=>{var p;const{target:m,text:g}=w,x=nx(g),S=(p=w.prefix)===null||p===void 0?void 0:p.nick;x&&this.emit(this.onCtcpReply,m,S,x.command,x.params,w),this.emit(this.onNotice,m,S,g,w)}),this._options.manuallyAcknowledgeJoins||this.onTypedMessage(cl,({channel:w,prefix:p})=>{(p==null?void 0:p.nick)===this._currentNick&&this.acknowledgeJoin(w)}),this.onTypedMessage(dl,w=>{var p;((p=w.prefix)===null||p===void 0?void 0:p.nick)===this._currentNick&&(this._currentChannels.delete(w.channel),this._channelsFromLastRegister.delete(w.channel))}),this.addInternalListener(this.onRegister,()=>this._startPingCheckTimer()),this._desiredNick=n.nick,this._userName=n.userName,this._realName=n.realName,s&&(this._serverProperties.channelTypes=s)}receiveLine(e){var r;this._logger.debug(`Received message: ${e}`);let n;try{n=iD(e,this._serverProperties,this._registeredMessageTypes,!0,this._options.nonConformingCommands)}catch(i){this._logger.error(`Error parsing message: ${i.message}`),this._logger.trace((r=i.stack)!==null&&r!==void 0?r:"No stack available");return}this._logger.trace(`Parsed message: ${JSON.stringify(n)}`),this._startPingCheckTimer(),this.emit(this.onAnyMessage,n),this._handleEvents(n)}get serverProperties(){return Ra(this._serverProperties)}get port(){const{webSocket:e,connection:{port:r,secure:n}}=this._options;return r||(e?n?443:80:n?6697:6667)}pingCheck(){const e=Date.now(),r=e.toString(),n=this.onTypedMessage(fd,i=>{const{text:s}=i;s===r&&(this._logger.debug(`Current ping: ${Date.now()-e}ms`),this._pingTimeoutTimer&&clearTimeout(this._pingTimeoutTimer),this.removeMessageListener(n))});this._pingTimeoutTimer=setTimeout(()=>{this.removeMessageListener(n),this._options.connection.reconnect===!1?this._logger.error(`Disconnecting because the last ping took over ${this._pingTimeout} seconds`):this._logger.warn(`Reconnecting because the last ping took over ${this._pingTimeout} seconds`),this._connection.assumeExternalDisconnect()},this._pingTimeout*1e3),this.sendMessage(dd,{text:r})}reconnect(e){this.quit(e),this.connect()}registerMessageType(e){e.COMMAND!==""&&(this._logger.trace(`Registering message type ${e.COMMAND}`),this._registeredMessageTypes.set(e.COMMAND.toUpperCase(),e))}knowsCommand(e){return this._registeredMessageTypes.has(e.toUpperCase())}getCommandClass(e){return this._registeredMessageTypes.get(e.toUpperCase())}acknowledgeJoin(e){this._currentChannels.add(e),this._channelsFromLastRegister.add(e)}connect(){this._supportsCapabilities=!1,this._negotiatedCapabilities=new Map,this._currentChannels=new Set,this._currentNick=this._desiredNick,this._setupConnection(),this._logger.info(`Connecting to ${this._options.connection.hostName}:${this.port}`),this._connection.connect()}addCapability(e){if(this._clientCapabilities.set(e.name,e),e.messageTypes)for(const r of Object.values(e.messageTypes))this.registerMessageType(r)}async registerCapability(e){return this.addCapability(e),this._serverCapabilities.has(e.name)?await this._negotiateCapabilities([e]):[]}send(e){this.sendRaw(e.toString())}sendRaw(e){this._connection.isConnected&&(this._logger.debug(`Sending message: ${e}`),this._connection.sendLine(e))}onNamedMessage(e,r,n){this._events.has(e)||this._events.set(e,new Map);const i=this._events.get(e);if(!n)do n=`${e}:${$4(Math.random()*1e4,4,"0")}`;while(i.has(n));return i.set(n,r),n}onTypedMessage(e,r,n){return this.onNamedMessage(e.COMMAND,r,n)}removeMessageListener(e){const[r]=e.split(":");this._events.has(r)&&this._events.get(r).delete(e)}createMessage(e,r,n){const i=n?new Map(Object.entries(n)):void 0;return W6(e,r,void 0,i,this.serverProperties)}sendMessage(e,r,n){this.send(this.createMessage(e,r,n))}async sendMessageAndCaptureReply(e,r){if(!e.SUPPORTS_CAPTURE)throw new Error(`The command "${e.COMMAND}" does not support reply capture`);const n=this.createMessage(e,r),i=this.collect(n).promise();return this.send(n),await i}get isConnected(){return this._connection.isConnected}get isConnecting(){return this._connection.isConnecting}get isRegistered(){return this._registered}get currentNick(){return this._currentNick}get currentChannels(){return Array.from(this._currentChannels)}collect(e,...r){const n=new eD(this,e,...r);return this._collectors.push(n),n}stopCollect(e){this._collectors.splice(this._collectors.findIndex(r=>r===e),1)}join(e,r){this.sendMessage(cl,{channel:e,key:r})}part(e){this.sendMessage(dl,{channel:e})}quit(e){this.sendMessage(Vv,{text:e}),this.quitAbruptly()}quitAbruptly(){this._registered=!1,this._connection.disconnect()}say(e,r,n={}){this.sendMessage(fl,{target:e,text:r},n)}sendCtcp(e,r,n){this.say(e,`${r.toUpperCase()} ${n}`)}action(e,r){this.sendCtcp(e,"ACTION",r)}changeNick(e){this._currentNick!==e&&(this._desiredNick=e,this.isRegistered&&this.sendMessage(Ma,{nick:e}))}registerCoreMessageTypes(){ry(HT,e=>{this.registerMessageType(e)}),ry(Gk,e=>{this.registerMessageType(e)})}async _negotiateCapabilityBatch(e){return await Promise.all(e.filter(r=>r.length).map(async r=>await this._negotiateCapabilities(r)))}async _negotiateCapabilities(e){const r=va(e,o=>({[o.name]:o})),i=(await this.sendMessageAndCaptureReply(tr,{subCommand:"REQ",capabilities:e.map(o=>o.name).join(" ")})).shift();if(!i)throw new Error("capability negotiation failed unexpectedly without any reply");if(!(i instanceof tr))throw new Error(`capability negotiation failed unexpectedly with "${i.command}" command`);const s=i.capabilities.split(" ").filter(o=>o);if(i.subCommand==="ACK"){this._logger.debug(`Successfully negotiated capabilities: ${s.join(", ")}`);const o=s.map(a=>r[a]);for(const a of o){const l=this._clientCapabilities.get(a.name);l.param=a.param,this._negotiatedCapabilities.set(l.name,l)}return o}else return this._logger.warn(`Failed to negotiate capabilities: ${s.join(", ")}`),new Error("capabilities failed to negotiate")}_setupConnection(){this._initialConnectionSetupDone||(this._connection.onConnect(async()=>{var e,r;this._logger.info(`Connection to server ${this._options.connection.hostName}:${this.port} established`),this.emit(this.onConnect),this._logger.debug("Determining connection password");try{const[n]=await Promise.all([ty(this._options.credentials.password),this.sendMessageAndCaptureReply(tr,{subCommand:"LS",version:"302"}).then(i=>{if(!i.length||!(i[0]instanceof tr))return this._logger.debug("Server does not support capabilities"),[];this._supportsCapabilities=!0;const s=i.map(a=>va(a.capabilities.split(" "),l=>{if(!l)return{};const[u,c]=Zi(l,"=",2);return{[u]:{name:u,param:c||!0}}}));this._serverCapabilities=new Map(Object.entries(Object.assign({},...s))),this._logger.debug(`Capabilities supported by server: ${Array.from(this._serverCapabilities.keys()).join(", ")}`);const o=s.map(a=>{const l=Object.keys(a);return Array.from(this._clientCapabilities.entries()).filter(([u])=>l.includes(u)).map(([,u])=>u)});return this._negotiateCapabilityBatch(o)}).then(()=>{this.sendMessage(tr,{subCommand:"END"})})]);n&&this.sendMessage(Wv,{password:n}),this.sendMessage(Ma,{nick:this._desiredNick}),this.sendMessage(Gv,{user:(e=this._userName)!==null&&e!==void 0?e:this._desiredNick,mode:"8",unused:"*",realName:(r=this._realName)!==null&&r!==void 0?r:this._desiredNick})}catch(n){this.emit(this.onPasswordError,n),this.quit()}}),this._initialConnectionSetupDone=!0,this._connection.onReceive(e=>{this.receiveLine(e)}),this._connection.onDisconnect((e,r)=>{var n;if(this._registered=!1,this._pingCheckTimer&&clearTimeout(this._pingCheckTimer),this._pingTimeoutTimer&&clearTimeout(this._pingTimeoutTimer),e)this._logger.info("Disconnected");else{const i=(n=this._options.connection.reconnect)!==null&&n!==void 0?n:!0,s=r?`Disconnected unexpectedly: ${r.message}`:"Disconnected unexpectedly";i?this._logger.warn(`${s}; trying to reconnect`):this._logger.error(s)}this.emit(this.onDisconnect,e,r)}),this._connection.onEnd(e=>{e||this._logger.warn("No further retries will be made")}))}_handleReceivedClientNick(e){this._currentNick!==e&&(this._currentNick!==""&&this._logger.warn(`Mismatching nicks: passed ${this._currentNick}, but you're actually ${e}`),this._currentNick=e)}_handleEvents(e){this._collectors.some(n=>n.collect(e));const r=this._events.get(e.constructor.COMMAND);if(r)for(const n of r.values())n(e)}_startPingCheckTimer(){this._pingCheckTimer&&clearTimeout(this._pingCheckTimer),this._connection.isConnected?this._pingCheckTimer=setTimeout(()=>this.pingCheck(),this._pingOnInactivity*1e3):this._pingCheckTimer=void 0}}C([K(!1)],Vk.prototype,"_options",void 0);class ew extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},user:{trailing:!0,optional:!0}})}get date(){const e=this._tags.get("tmi-sent-ts");return new Date(Number(e))}get channelId(){return this._tags.get("room-id")}get targetUserId(){var e;return(e=this._tags.get("target-user-id"))!==null&&e!==void 0?e:null}}ew.COMMAND="CLEARCHAT";class Qk extends D{}Qk.COMMAND="RECONNECT";class tw extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"}})}}tw.COMMAND="ROOMSTATE";function sD(t){switch(typeof t){case"undefined":return"";case"object":{if(t===null)return"";if("cacheKey"in t)return t.cacheKey;const e=JSON.stringify(t);if(e!=="{}")return e}default:return t.toString()}}function Kk(t,e,r){return[t,...e.map(sD)].join("/")+(r?"/":"")}function au(t){return class extends t{constructor(){super(...arguments),this.cache=new Map}getFromCache(e){if(this._cleanCache(),this.cache.has(e)){const r=this.cache.get(e);if(r)return r.value}}setCache(e,r,n){this.cache.set(e,{value:r,expires:Date.now()+n*1e3})}removeFromCache(e,r){const n=this._getInternalCacheKey(e,r);r?this.cache.forEach((i,s)=>{s.startsWith(n)&&this.cache.delete(s)}):this.cache.delete(n)}_cleanCache(){const e=Date.now();this.cache.forEach((r,n)=>{r.expires{const n=r.indexOf("/");return n===-1?[r,""]:[r.slice(0,n),r.slice(n+1)]})):new Map}get userName(){return this._userName}get displayName(){var e;return(e=this._userData.get("display-name"))!==null&&e!==void 0?e:this._userName}get color(){return this._userData.get("color")}get badges(){const e=this._userData.get("badges");return gc._parseBadgesLike(e)}get badgeInfo(){const e=this._userData.get("badge-info");return gc._parseBadgesLike(e)}get userId(){return this._userData.get("user-id")}get userType(){return this._userData.get("user-type")}get isBroadcaster(){return this.badges.has("broadcaster")}get isSubscriber(){return this.badges.has("subscriber")||this.isFounder}get isFounder(){return this.badges.has("founder")}get isMod(){return this.badges.has("moderator")}get isVip(){const e=this._userData.get("vip");return e!=null&&e!=="0"}get isArtist(){return this.badges.has("artist-badge")}};C([K(!1)],bi.prototype,"_userData",void 0);C([Se()],bi.prototype,"badges",null);C([Se()],bi.prototype,"badgeInfo",null);bi=gc=C([au,L("chat","ChatUser","userId")],bi);function rw(t){return t?new Map(t.split("/").map(e=>{const[r,n]=e.split(":",2);return n?[r,n.split(",")]:null}).filter(e=>e!==null)):new Map}class $f extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},text:{trailing:!0,optional:!0}})}get id(){return this._tags.get("id")}get date(){const e=this._tags.get("tmi-sent-ts");return new Date(Number(e))}get userInfo(){return new bi(this._tags.get("login"),this._tags)}get channelId(){var e;return(e=this._tags.get("room-id"))!==null&&e!==void 0?e:null}get emoteOffsets(){return rw(this._tags.get("emotes"))}}$f.COMMAND="USERNOTICE";class Yk extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"}})}}Yk.COMMAND="USERSTATE";class nw extends D{constructor(e,r,n){super(e,r,n,{target:{},text:{trailing:!0}})}get userInfo(){return new bi(this._prefix.nick,this._tags)}get emoteOffsets(){return rw(this._tags.get("emotes"))}}nw.COMMAND="WHISPER";const oD={name:"twitch.tv/commands",messageTypes:[ew,Qk,tw,$f,Yk,nw]},aD={name:"twitch.tv/membership"};class iw extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},text:{trailing:!0}})}get date(){const e=this._tags.get("tmi-sent-ts");return new Date(Number(e))}get userName(){return this._tags.get("login")}get channelId(){return this._tags.get("room-id")}get targetMessageId(){return this._tags.get("target-msg-id")}}iw.COMMAND="CLEARMSG";class Xk extends D{}Xk.COMMAND="GLOBALUSERSTATE";const lD={name:"twitch.tv/tags",messageTypes:[Xk,iw]},uD=["ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN"];let hd=class extends fl{get id(){return this._tags.get("id")}get date(){const e=this._tags.get("tmi-sent-ts");return new Date(Number(e))}get userInfo(){return new bi(this._prefix.nick,this._tags)}get channelId(){var e;return(e=this._tags.get("room-id"))!==null&&e!==void 0?e:null}get isCheer(){return this._tags.has("bits")}get isRedemption(){return!!this._tags.get("custom-reward-id")}get rewardId(){return this._tags.get("custom-reward-id")||null}get isFirst(){return this._tags.get("first-msg")==="1"}get isReturningChatter(){return this._tags.get("returning-chatter")==="1"}get isHighlight(){return this._tags.get("msg-id")==="highlighted-message"}get isReply(){return this._tags.has("reply-parent-msg-id")}get parentMessageId(){var e;return(e=this._tags.get("reply-parent-msg-id"))!==null&&e!==void 0?e:null}get parentMessageText(){var e;return(e=this._tags.get("reply-parent-msg-body"))!==null&&e!==void 0?e:null}get parentMessageUserId(){var e;return(e=this._tags.get("reply-parent-user-id"))!==null&&e!==void 0?e:null}get parentMessageUserName(){var e;return(e=this._tags.get("reply-parent-user-login"))!==null&&e!==void 0?e:null}get parentMessageUserDisplayName(){var e;return(e=this._tags.get("reply-parent-display-name"))!==null&&e!==void 0?e:null}get threadMessageId(){var e;return(e=this._tags.get("reply-thread-parent-msg-id"))!==null&&e!==void 0?e:null}get threadMessageUserId(){var e;return(e=this._tags.get("reply-thread-parent-user-id"))!==null&&e!==void 0?e:null}get bits(){var e;return Number((e=this._tags.get("bits"))!==null&&e!==void 0?e:0)}get emoteOffsets(){return rw(this._tags.get("emotes"))}get isHypeChat(){return this._tags.has("pinned-chat-paid-amount")}get hypeChatAmount(){return hr(this._tags.get("pinned-chat-paid-amount"),Number)}get hypeChatDecimalPlaces(){return hr(this._tags.get("pinned-chat-paid-exponent"),Number)}get hypeChatLocalizedAmount(){const e=this.hypeChatAmount;return e?e/10**this.hypeChatDecimalPlaces:null}get hypeChatCurrency(){var e;return(e=this._tags.get("pinned-chat-paid-currency"))!==null&&e!==void 0?e:null}get hypeChatLevel(){const e=this._tags.get("pinned-chat-paid-level");return e?uD.indexOf(e)+1:null}get hypeChatIsSystemMessage(){const e=this._tags.get("pinned-chat-paid-is-system-message");return e?!!Number(e):null}};hd=C([L("chat","ChatMessage","id")],hd);function cD(t){return t instanceof hd?t.tags.get("id"):t}function sx(t,e){if(t.length<=e)return[t];t=t.trim();const r=[];let n=0,i=e;for(;nawait this._getAuthToken()},webSocket:(s=e.webSocket)!==null&&s!==void 0?s:!0,connectionOptions:e.connectionOptions,logger:{name:"twurple:chat:irc",...e.logger},nonConformingCommands:["004"],manuallyAcknowledgeJoins:!0,rejoinChannelsOnReconnect:e.rejoinChannelsOnReconnect}),this._ircClient.onDisconnect((u,c)=>{this._messageRateLimiter.clear(),this._messageRateLimiter.pause(),this._joinRateLimiter.clear(),this._joinRateLimiter.pause(),this.emit(this.onDisconnect,u,c)}),this._ircClient.registerMessageType(hd),this._chatLogger=Wo({name:"twurple:chat:twitch",...e.logger}),this._authProvider=e.authProvider,this._useLegacyScopes=!!e.legacyScopes,this._readOnly=!!e.readOnly,this._authIntents=[...(o=e.authIntents)!==null&&o!==void 0?o:[],"chat"];const a=async({type:u,text:c,channel:f,tags:d})=>{u==="say"?this._ircClient.say(f,c,d):this._ircClient.action(f,c)},l=async u=>{const{promise:c,resolve:f,reject:d}=ul();let y;const v=this.addInternalListener(this._onJoinResult,(b,w,p)=>{b===u&&(clearTimeout(y),p?d(p):f(),this.removeListener(v))});y=setTimeout(()=>{this.removeListener(v),this.emit(this._onJoinResult,u,void 0,"twurple_timeout"),d(new Error(`Did not receive a reply to join ${u} in time; assuming that the join failed`))},1e4),this._ircClient.join(u),await c};if(e.isAlwaysMod)this._messageRateLimiter=new oy({bucketSize:e.botLevel==="verified"?7500:100,timeFrame:32e3,doRequest:a});else{let u=20;e.botLevel==="verified"?u=7500:e.botLevel==="known"&&(u=50),this._messageRateLimiter=new XN(new pT({bucketSize:1,timeFrame:1200,logger:{minLevel:te.ERROR},doRequest:a,getPartitionKey:({channel:c})=>c}),{bucketSize:u,timeFrame:32e3})}this._joinRateLimiter=new oy({bucketSize:e.botLevel==="verified"?2e3:20,timeFrame:11e3,doRequest:l}),this._messageRateLimiter.pause(),this._joinRateLimiter.pause(),this._ircClient.addCapability(lD),this._ircClient.addCapability(oD),e.requestMembershipEvents&&this._ircClient.addCapability(aD),this._ircClient.onConnect(()=>{this.emit(this.onConnect)}),this._ircClient.onRegister(async()=>{this._messageRateLimiter.resume(),this._joinRateLimiter.resume(),this._authVerified=!0,this._authRetryTimer=void 0,this._authRetryCount=0,this.emit(this.onAuthenticationSuccess);const u=await ty(e.channels);u&&await Promise.all(u.map(async c=>{var f;try{await this.join(c)}catch(d){this._chatLogger.warn(`Failed to join configured channel ${c}; original message: ${(f=d==null?void 0:d.message)!==null&&f!==void 0?f:d}`)}}))}),this._ircClient.onPasswordError(u=>{this._chatLogger.error(`Error fetching a token for connecting to the server: ${u.message}`),this.emit(this.onTokenFetchFailure,u)}),this._ircClient.onPrivmsg((u,c,f,d)=>{c!=="jtv"&&this.emit(this.onMessage,Qe(u),c,f,d)}),this._ircClient.onAction((u,c,f,d)=>{this.emit(this.onAction,Qe(u),c,f,d)}),this.addInternalListener(this._onJoinResult,(u,c,f)=>{f?this.emit(this.onJoinFailure,Qe(u),f):this._ircClient.acknowledgeJoin(u)}),this._ircClient.onTypedMessage(ew,u=>{const{channel:c,user:f,tags:d}=u,y=Qe(c);if(f){const v=d.get("ban-duration");v===void 0?this.emit(this.onBan,y,f,u):this.emit(this.onTimeout,y,f,Number(v),u)}else this.emit(this.onChatClear,y,u)}),this._ircClient.onTypedMessage(iw,u=>{const{channel:c,targetMessageId:f}=u;this.emit(this.onMessageRemove,Qe(c),f,u)}),this._ircClient.onTypedMessage(cl,({prefix:u,channel:c})=>{this.emit(this.onJoin,Qe(c),u.nick)}),this._ircClient.onTypedMessage(dl,({prefix:u,channel:c})=>{this.emit(this.onPart,Qe(c),u.nick)}),this._ircClient.onTypedMessage(tw,({channel:u,tags:c})=>{let f=!1;if(c.has("subs-only")&&c.has("slow")&&(this.emit(this._onJoinResult,u,c),f=!0),!f){const d=Qe(u);if(c.has("slow")){const y=Number(c.get("slow"));y?this.emit(this.onSlow,d,!0,y):this.emit(this.onSlow,d,!1)}if(c.has("followers-only")){const y=Number(c.get("followers-only"));y===-1?this.emit(this.onFollowersOnly,d,!1):this.emit(this.onFollowersOnly,d,!0,y)}}}),this._ircClient.onTypedMessage($f,u=>{const{channel:c,text:f,tags:d}=u,y=d.get("msg-id"),v=Qe(c);switch(y){case"sub":case"resub":{const b=y==="sub"?this.onSub:this.onResub,w=d.get("msg-param-sub-plan"),p=d.get("msg-param-streak-months"),m={userId:d.get("user-id"),displayName:d.get("display-name"),plan:w,planName:d.get("msg-param-sub-plan-name"),isPrime:w==="Prime",months:Number(d.get("msg-param-cumulative-months")),streak:p?Number(p):void 0,message:f};if(d.get("msg-param-was-gifted")==="true"){const x=d.get("msg-param-anon-gift")==="true",S=Number(d.get("msg-param-gift-months")),k=Number(d.get("msg-param-gift-month-being-redeemed"));x?m.originalGiftInfo={anonymous:!0,duration:S,redeemedMonth:k}:m.originalGiftInfo={anonymous:!1,duration:S,redeemedMonth:k,userId:d.get("msg-param-gifter-id"),userName:d.get("msg-param-gifter-login"),userDisplayName:d.get("msg-param-gifter-name")}}this.emit(b,v,d.get("login"),m,u);break}case"subgift":{const b=d.get("msg-param-sub-plan"),w=d.get("login"),p=w==="ananonymousgifter",m={userId:d.get("msg-param-recipient-id"),displayName:d.get("msg-param-recipient-display-name"),gifter:p?void 0:w,gifterUserId:p?void 0:d.get("user-id"),gifterDisplayName:p?void 0:d.get("display-name"),gifterGiftCount:p?void 0:Number(d.get("msg-param-sender-count")),giftDuration:Number(d.get("msg-param-gift-months")),plan:b,planName:d.get("msg-param-sub-plan-name"),isPrime:b==="Prime",months:Number(d.get("msg-param-months"))};this.emit(this.onSubGift,v,d.get("msg-param-recipient-user-name"),m,u);break}case"submysterygift":{const b=d.get("login"),w=b==="ananonymousgifter",p={gifter:w?void 0:b,gifterUserId:w?void 0:d.get("user-id"),gifterDisplayName:w?void 0:d.get("display-name"),gifterGiftCount:w?void 0:Number(d.get("msg-param-sender-count")),count:Number(d.get("msg-param-mass-gift-count")),plan:d.get("msg-param-sub-plan")};this.emit(this.onCommunitySub,v,d.get("login"),p,u);break}case"primepaidupgrade":{const b={userId:d.get("user-id"),displayName:d.get("display-name"),plan:d.get("msg-param-sub-plan")};this.emit(this.onPrimePaidUpgrade,v,d.get("login"),b,u);break}case"giftpaidupgrade":{const b={userId:d.get("user-id"),displayName:d.get("display-name"),gifter:d.get("msg-param-sender-login"),gifterDisplayName:d.get("msg-param-sender-name")};this.emit(this.onGiftPaidUpgrade,v,d.get("login"),b,u);break}case"standardpayforward":{const b=d.get("msg-param-prior-gifter-anonymous")==="true",w={userId:d.get("user-id"),displayName:d.get("display-name"),originalGifterUserId:b?void 0:d.get("msg-param-prior-gifter-id"),originalGifterDisplayName:b?void 0:d.get("msg-param-prior-gifter-display-name"),recipientUserId:d.get("msg-param-recipient-id"),recipientDisplayName:d.get("msg-param-recipient-display-name")};this.emit(this.onStandardPayForward,v,d.get("login"),w,u);break}case"communitypayforward":{const b=d.get("msg-param-prior-gifter-anonymous")==="true",w={userId:d.get("user-id"),displayName:d.get("display-name"),originalGifterUserId:b?void 0:d.get("msg-param-prior-gifter-id"),originalGifterDisplayName:b?void 0:d.get("msg-param-prior-gifter-display-name")};this.emit(this.onCommunityPayForward,v,d.get("login"),w,u);break}case"primecommunitygiftreceived":{const b={name:d.get("msg-param-gift-name"),gifter:d.get("login"),gifterDisplayName:d.get("display-name")};this.emit(this.onPrimeCommunityGift,v,d.get("msg-param-recipient"),b,u);break}case"raid":{const b={displayName:d.get("msg-param-displayName"),viewerCount:Number(d.get("msg-param-viewerCount"))};this.emit(this.onRaid,v,d.get("login"),b,u);break}case"unraid":{this.emit(this.onRaidCancel,v,u);break}case"ritual":{const b={ritualName:d.get("msg-param-ritual-name"),message:f};this.emit(this.onRitual,v,d.get("login"),b,u);break}case"bitsbadgetier":{const b={displayName:d.get("display-name"),threshold:Number(d.get("msg-param-threshold"))};this.emit(this.onBitsBadgeUpgrade,v,d.get("login"),b,u);break}case"extendsub":{const b={userId:d.get("user-id"),displayName:d.get("display-name"),plan:d.get("msg-param-sub-plan"),months:Number(d.get("msg-param-cumulative-months")),endMonth:Number(d.get("msg-param-sub-benefit-end-month"))};this.emit(this.onSubExtend,v,d.get("login"),b,u);break}case"rewardgift":{const b={domain:d.get("msg-param-domain"),gifterId:d.get("user-id"),gifterDisplayName:d.get("display-name"),count:Number(d.get("msg-param-selected-count")),gifterGiftCount:Number(d.get("msg-param-total-reward-count")),triggerType:d.get("msg-param-trigger-type")};this.emit(this.onRewardGift,v,d.get("login"),b,u);break}case"announcement":{const b={color:d.get("msg-param-color")};this.emit(this.onAnnouncement,v,d.get("login"),b,u);break}default:this._chatLogger.warn(`Unrecognized usernotice ID: ${y}`)}}),this._ircClient.onTypedMessage(nw,u=>{this.emit(this.onWhisper,u.prefix.nick,u.text,u)}),this._ircClient.onTypedMessage(Lf,async({target:u,text:c,tags:f})=>{const d=f.get("msg-id");switch(d){case"emote_only_on":{this.emit(this.onEmoteOnly,Qe(u),!0);break}case"emote_only_off":{this.emit(this.onEmoteOnly,Qe(u),!1);break}case"msg_channel_suspended":case"msg_banned":{this.emit(this._onJoinResult,u,void 0,d);break}case"r9k_on":{this.emit(this.onUniqueChat,Qe(u),!0);break}case"r9k_off":{this.emit(this.onUniqueChat,Qe(u),!1);break}case"subs_on":{this.emit(this.onSubsOnly,Qe(u),!0);break}case"subs_off":{this.emit(this.onSubsOnly,Qe(u),!1);break}case"cmds_available":break;case"followers_on":case"followers_on_zero":case"followers_off":case"slow_on":case"slow_off":break;case"timeout_success":break;case"unrecognized_cmd":break;case"no_permission":{this.emit(this.onNoPermission,Qe(u),c);break}case"msg_ratelimit":{this.emit(this.onMessageRatelimit,Qe(u),c);break}case"msg_duplicate":case"msg_emoteonly":case"msg_followersonly":case"msg_followersonly_followed":case"msg_followersonly_zero":case"msg_subsonly":case"msg_slowmode":case"msg_r9k":case"msg_verified_email":case"msg_timedout":case"msg_rejected_mandatory":case"msg_channel_blocked":{this.emit(this.onMessageFailed,Qe(u),d);break}case void 0:{if(c==="Login authentication failed"||c==="Improperly formatted AUTH"||c==="Invalid NICK"){this._authVerified=!1,this._authRetryTimer||(this._authRetryTimer=AE(120),this._authRetryCount=0);const y=this._authRetryTimer.next().value,v=++this._authRetryCount;this.emit(this.onAuthenticationFailure,c,v),y!==0&&this._chatLogger.info(`Retrying authentication in ${y} seconds`),await B4(y*1e3),this._ircClient.reconnect()}break}default:d.startsWith("usage_")||this._chatLogger.warn(`Unrecognized notice ID: '${d}'`)}})}connect(){this._authProvider||this._ircClient.changeNick(hy._generateJustinfanNick()),this._ircClient.connect()}get irc(){return this._ircClient}get isConnected(){return this._ircClient.isConnected}get isConnecting(){return this._ircClient.isConnecting}get currentChannels(){return this._ircClient.currentChannels}async say(e,r,n={},i){const s={};n.replyTo&&(s["reply-parent-msg-id"]=cD(n.replyTo));const o=sx(r,500);await Promise.all(o.map(async a=>await this._messageRateLimiter.request({type:"say",channel:zu(e),text:a,tags:s},i)))}async action(e,r,n){const i=sx(r,490);await Promise.all(i.map(async s=>await this._messageRateLimiter.request({type:"action",channel:zu(e),text:s},n)))}async join(e){await this._joinRateLimiter.request(zu(e))}part(e){this._ircClient.part(zu(e))}quit(){this._ircClient.quitAbruptly()}reconnect(){this.quit(),this.connect()}async _getAuthToken(){var e,r;if(!this._authProvider){this._chatLogger.debug("No authProvider given; connecting anonymously");return}if(this._authToken&&!oo(this._authToken)&&this._authVerified)return this._chatLogger.debug("AccessToken assumed to be correct from last connection"),`oauth:${this._authToken.accessToken}`;const n=this._getNecessaryScopes();let i,s=!1;for(const o of this._authIntents){try{if(this._authToken=await this._authProvider.getAccessTokenForIntent(o,n),!this._authToken)continue;s=!0;const a=await fs(this._authToken.accessToken);if(!a.userName)throw new mc("Could not determine a user name for your token; you might be trying to disguise an app token as a user token.");return this._ircClient.changeNick(a.userName),`oauth:${this._authToken.accessToken}`}catch(a){a instanceof rs?i=a:this._chatLogger.error(`Retrieving an access token failed: ${a.message}`)}this._chatLogger.warn("No valid token available; trying to refresh");try{if(this._authToken=await((r=(e=this._authProvider).refreshAccessTokenForIntent)===null||r===void 0?void 0:r.call(e,"chat")),this._authToken){const a=await fs(this._authToken.accessToken);if(!a.userName)throw new mc("Could not determine a user name for your token; you might be trying to disguise an app token as a user token.");return this._ircClient.changeNick(a.userName),`oauth:${this._authToken.accessToken}`}}catch(a){a instanceof rs?i=a:this._chatLogger.error(`Refreshing the access token failed: ${a.message}`)}}throw this._authVerified=!1,i??new Error(s?"Could not retrieve a valid token":`None of the queried intents (${this._authIntents.join(", ")}) are known by the auth provider${this._authProvider instanceof _i?".\nPlease add one of these to the user you want to connect with using the `addIntentToUser` method or the additional parameter to `addUser` or `addUserForToken`.":""}`)}_getNecessaryScopes(){return this._useLegacyScopes?["chat_login"]:this._readOnly?["chat:read"]:["chat:read","chat:edit"]}static _generateJustinfanNick(){return`justinfan${Math.floor(Math.random()*1e5).toString().padStart(5,"0")}`}};C([K(!1)],pd.prototype,"_authProvider",void 0);pd=hy=C([L("chat","ChatClient")],pd);function Jk(t,e={}){const{animationSettings:r="default",backgroundType:n="dark",size:i="1.0"}=e;return`https://static-cdn.jtvnw.net/emoticons/v2/${t}/${r}/${n}/${i}`}function fD(t,e){return[...e.entries()].flatMap(([r,n])=>n.map(i=>{const[s,o]=i.split("-"),a=+s,l=+o,u=ny(t,a,l+1);return{type:"emote",position:a,length:l-a+1,id:r,name:u}})).sort((r,n)=>r.position-n.position)}function hD(t,e){const r=[],n=new RegExp("(?<=^|\\s)([a-z]+(?:\\d+[a-z]+)*)(\\d+)(?=\\s|$)","gi");let i=null;for(;i=n.exec(t);){const s=i[1].toLowerCase();if(e.includes(s)){const o=Number(i[2]);r.push({type:"cheer",name:s,amount:o,position:RE(t.slice(0,i.index)),length:i[0].length})}}return r}function pD(t,e){const r=RE(t);if(!e.length)return[{type:"text",position:0,length:r,text:t}];const n=[];let i=0;for(const s of e)s.position>i&&n.push({type:"text",position:i,length:s.position-i,text:ny(t,i,s.position)}),n.push(s),i=s.position+s.length;return ii.position-s.position)),pD(t,n)}const py={twitch:{clientId:"xrjkdmui65qd33jdx8itfslt61qys8",scopes:["chat:read","channel:read:redemptions","moderator:read:followers"]},google:{clientId:"932208815805-oq2sevf3ida5idi4k84tlsh03nqc35cs.apps.googleusercontent.com",scopes:["https://www.googleapis.com/auth/youtube.readonly"]}};function Zk(t,e){return function(){return t.apply(e,arguments)}}const{toString:gD}=Object.prototype,{getPrototypeOf:sw}=Object,Uf=(t=>e=>{const r=gD.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),en=t=>(t=t.toLowerCase(),e=>Uf(e)===t),Ff=t=>e=>typeof e===t,{isArray:Qo}=Array,hl=Ff("undefined");function yD(t){return t!==null&&!hl(t)&&t.constructor!==null&&!hl(t.constructor)&&lr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const eP=en("ArrayBuffer");function vD(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&eP(t.buffer),e}const wD=Ff("string"),lr=Ff("function"),tP=Ff("number"),qf=t=>t!==null&&typeof t=="object",_D=t=>t===!0||t===!1,yc=t=>{if(Uf(t)!=="object")return!1;const e=sw(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},bD=en("Date"),xD=en("File"),SD=en("Blob"),CD=en("FileList"),ED=t=>qf(t)&&lr(t.pipe),TD=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||lr(t.append)&&((e=Uf(t))==="formdata"||e==="object"&&lr(t.toString)&&t.toString()==="[object FormData]"))},kD=en("URLSearchParams"),PD=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lu(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Qo(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const nP=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),iP=t=>!hl(t)&&t!==nP;function my(){const{caseless:t}=iP(this)&&this||{},e={},r=(n,i)=>{const s=t&&rP(e,i)||i;yc(e[s])&&yc(n)?e[s]=my(e[s],n):yc(n)?e[s]=my({},n):Qo(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(lu(e,(i,s)=>{r&&lr(i)?t[s]=Zk(i,r):t[s]=i},{allOwnKeys:n}),t),ID=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),OD=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},RD=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&sw(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},MD=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},ND=t=>{if(!t)return null;if(Qo(t))return t;let e=t.length;if(!tP(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},DD=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&sw(Uint8Array)),jD=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},LD=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},BD=en("HTMLFormElement"),$D=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),ox=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),UD=en("RegExp"),sP=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};lu(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},FD=t=>{sP(t,(e,r)=>{if(lr(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(lr(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},qD=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Qo(t)?n(t):n(String(t).split(e)),r},HD=()=>{},zD=(t,e)=>(t=+t,Number.isFinite(t)?t:e),Cm="abcdefghijklmnopqrstuvwxyz",ax="0123456789",oP={DIGIT:ax,ALPHA:Cm,ALPHA_DIGIT:Cm+Cm.toUpperCase()+ax},WD=(t=16,e=oP.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function GD(t){return!!(t&&lr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const VD=t=>{const e=new Array(10),r=(n,i)=>{if(qf(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Qo(n)?[]:{};return lu(n,(o,a)=>{const l=r(o,i+1);!hl(l)&&(s[a]=l)}),e[i]=void 0,s}}return n};return r(t,0)},QD=en("AsyncFunction"),KD=t=>t&&(qf(t)||lr(t))&&lr(t.then)&&lr(t.catch),N={isArray:Qo,isArrayBuffer:eP,isBuffer:yD,isFormData:TD,isArrayBufferView:vD,isString:wD,isNumber:tP,isBoolean:_D,isObject:qf,isPlainObject:yc,isUndefined:hl,isDate:bD,isFile:xD,isBlob:SD,isRegExp:UD,isFunction:lr,isStream:ED,isURLSearchParams:kD,isTypedArray:DD,isFileList:CD,forEach:lu,merge:my,extend:AD,trim:PD,stripBOM:ID,inherits:OD,toFlatObject:RD,kindOf:Uf,kindOfTest:en,endsWith:MD,toArray:ND,forEachEntry:jD,matchAll:LD,isHTMLForm:BD,hasOwnProperty:ox,hasOwnProp:ox,reduceDescriptors:sP,freezeMethods:FD,toObjectSet:qD,toCamelCase:$D,noop:HD,toFiniteNumber:zD,findKey:rP,global:nP,isContextDefined:iP,ALPHABET:oP,generateString:WD,isSpecCompliantForm:GD,toJSONObject:VD,isAsyncFn:QD,isThenable:KD};function me(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}N.inherits(me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:N.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const aP=me.prototype,lP={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{lP[t]={value:t}});Object.defineProperties(me,lP);Object.defineProperty(aP,"isAxiosError",{value:!0});me.from=(t,e,r,n,i,s)=>{const o=Object.create(aP);return N.toFlatObject(t,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),me.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const YD=null;function gy(t){return N.isPlainObject(t)||N.isArray(t)}function uP(t){return N.endsWith(t,"[]")?t.slice(0,-2):t}function lx(t,e,r){return t?t.concat(e).map(function(i,s){return i=uP(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function XD(t){return N.isArray(t)&&!t.some(gy)}const JD=N.toFlatObject(N,{},null,function(e){return/^is[A-Z]/.test(e)});function Hf(t,e,r){if(!N.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=N.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,w){return!N.isUndefined(w[b])});const n=r.metaTokens,i=r.visitor||c,s=r.dots,o=r.indexes,l=(r.Blob||typeof Blob<"u"&&Blob)&&N.isSpecCompliantForm(e);if(!N.isFunction(i))throw new TypeError("visitor must be a function");function u(v){if(v===null)return"";if(N.isDate(v))return v.toISOString();if(!l&&N.isBlob(v))throw new me("Blob is not supported. Use a Buffer instead.");return N.isArrayBuffer(v)||N.isTypedArray(v)?l&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function c(v,b,w){let p=v;if(v&&!w&&typeof v=="object"){if(N.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=JSON.stringify(v);else if(N.isArray(v)&&XD(v)||(N.isFileList(v)||N.endsWith(b,"[]"))&&(p=N.toArray(v)))return b=uP(b),p.forEach(function(g,x){!(N.isUndefined(g)||g===null)&&e.append(o===!0?lx([b],x,s):o===null?b:b+"[]",u(g))}),!1}return gy(v)?!0:(e.append(lx(w,b,s),u(v)),!1)}const f=[],d=Object.assign(JD,{defaultVisitor:c,convertValue:u,isVisitable:gy});function y(v,b){if(!N.isUndefined(v)){if(f.indexOf(v)!==-1)throw Error("Circular reference detected in "+b.join("."));f.push(v),N.forEach(v,function(p,m){(!(N.isUndefined(p)||p===null)&&i.call(e,p,N.isString(m)?m.trim():m,b,d))===!0&&y(p,b?b.concat(m):[m])}),f.pop()}}if(!N.isObject(t))throw new TypeError("data must be an object");return y(t),e}function ux(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ow(t,e){this._pairs=[],t&&Hf(t,this,e)}const cP=ow.prototype;cP.append=function(e,r){this._pairs.push([e,r])};cP.toString=function(e){const r=e?function(n){return e.call(this,n,ux)}:ux;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function ZD(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function dP(t,e,r){if(!e)return t;const n=r&&r.encode||ZD,i=r&&r.serialize;let s;if(i?s=i(e,r):s=N.isURLSearchParams(e)?e.toString():new ow(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class ej{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){N.forEach(this.handlers,function(n){n!==null&&e(n)})}}const cx=ej,fP={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},tj=typeof URLSearchParams<"u"?URLSearchParams:ow,rj=typeof FormData<"u"?FormData:null,nj=typeof Blob<"u"?Blob:null,ij=(()=>{let t;return typeof navigator<"u"&&((t=navigator.product)==="ReactNative"||t==="NativeScript"||t==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),sj=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Vr={isBrowser:!0,classes:{URLSearchParams:tj,FormData:rj,Blob:nj},isStandardBrowserEnv:ij,isStandardBrowserWebWorkerEnv:sj,protocols:["http","https","file","blob","url","data"]};function oj(t,e){return Hf(t,new Vr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Vr.isNode&&N.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function aj(t){return N.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function lj(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&N.isArray(i)?i.length:o,l?(N.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!N.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&N.isArray(i[o])&&(i[o]=lj(i[o])),!a)}if(N.isFormData(t)&&N.isFunction(t.entries)){const r={};return N.forEachEntry(t,(n,i)=>{e(aj(n),i,r,0)}),r}return null}function uj(t,e,r){if(N.isString(t))try{return(e||JSON.parse)(t),N.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const aw={transitional:fP,adapter:["xhr","http"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=N.isObject(e);if(s&&N.isHTMLForm(e)&&(e=new FormData(e)),N.isFormData(e))return i&&i?JSON.stringify(hP(e)):e;if(N.isArrayBuffer(e)||N.isBuffer(e)||N.isStream(e)||N.isFile(e)||N.isBlob(e))return e;if(N.isArrayBufferView(e))return e.buffer;if(N.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return oj(e,this.formSerializer).toString();if((a=N.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Hf(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),uj(e)):e}],transformResponse:[function(e){const r=this.transitional||aw.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&N.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?me.from(a,me.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Vr.classes.FormData,Blob:Vr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};N.forEach(["delete","get","head","post","put","patch"],t=>{aw.headers[t]={}});const lw=aw,cj=N.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"]),dj=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&cj[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},dx=Symbol("internals");function ua(t){return t&&String(t).trim().toLowerCase()}function vc(t){return t===!1||t==null?t:N.isArray(t)?t.map(vc):String(t)}function fj(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const hj=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Em(t,e,r,n,i){if(N.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!N.isString(e)){if(N.isString(n))return e.indexOf(n)!==-1;if(N.isRegExp(n))return n.test(e)}}function pj(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function mj(t,e){const r=N.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}class zf{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,l,u){const c=ua(l);if(!c)throw new Error("header name must be a non-empty string");const f=N.findKey(i,c);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||l]=vc(a))}const o=(a,l)=>N.forEach(a,(u,c)=>s(u,c,l));return N.isPlainObject(e)||e instanceof this.constructor?o(e,r):N.isString(e)&&(e=e.trim())&&!hj(e)?o(dj(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=ua(e),e){const n=N.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return fj(i);if(N.isFunction(r))return r.call(this,i,n);if(N.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ua(e),e){const n=N.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Em(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=ua(o),o){const a=N.findKey(n,o);a&&(!r||Em(n,n[a],a,r))&&(delete n[a],i=!0)}}return N.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||Em(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return N.forEach(this,(i,s)=>{const o=N.findKey(n,s);if(o){r[o]=vc(i),delete r[s];return}const a=e?pj(s):String(s).trim();a!==s&&delete r[s],r[a]=vc(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return N.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&N.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[dx]=this[dx]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=ua(o);n[a]||(mj(i,o),n[a]=!0)}return N.isArray(e)?e.forEach(s):s(e),this}}zf.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);N.reduceDescriptors(zf.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});N.freezeMethods(zf);const fn=zf;function Tm(t,e){const r=this||lw,n=e||r,i=fn.from(n.headers);let s=n.data;return N.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function pP(t){return!!(t&&t.__CANCEL__)}function uu(t,e,r){me.call(this,t??"canceled",me.ERR_CANCELED,e,r),this.name="CanceledError"}N.inherits(uu,me,{__CANCEL__:!0});function gj(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new me("Request failed with status code "+r.status,[me.ERR_BAD_REQUEST,me.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}const yj=Vr.isStandardBrowserEnv?function(){return{write:function(r,n,i,s,o,a){const l=[];l.push(r+"="+encodeURIComponent(n)),N.isNumber(i)&&l.push("expires="+new Date(i).toGMTString()),N.isString(s)&&l.push("path="+s),N.isString(o)&&l.push("domain="+o),a===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(r){const n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function vj(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function wj(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function mP(t,e){return t&&!vj(e)?wj(t,e):e}const _j=Vr.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){const a=N.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function bj(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function xj(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const u=Date.now(),c=n[s];o||(o=u),r[i]=l,n[i]=u;let f=s,d=0;for(;f!==i;)d+=r[f++],f=f%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-o{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-r,l=n(a),u=s<=o;r=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&u?(o-s)/l:void 0,event:i};c[e?"download":"upload"]=!0,t(c)}}const Sj=typeof XMLHttpRequest<"u",Cj=Sj&&function(t){return new Promise(function(r,n){let i=t.data;const s=fn.from(t.headers).normalize(),o=t.responseType;let a;function l(){t.cancelToken&&t.cancelToken.unsubscribe(a),t.signal&&t.signal.removeEventListener("abort",a)}let u;N.isFormData(i)&&(Vr.isStandardBrowserEnv||Vr.isStandardBrowserWebWorkerEnv?s.setContentType(!1):s.getContentType(/^\s*multipart\/form-data/)?N.isString(u=s.getContentType())&&s.setContentType(u.replace(/^\s*(multipart\/form-data);+/,"$1")):s.setContentType("multipart/form-data"));let c=new XMLHttpRequest;if(t.auth){const v=t.auth.username||"",b=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(v+":"+b))}const f=mP(t.baseURL,t.url);c.open(t.method.toUpperCase(),dP(f,t.params,t.paramsSerializer),!0),c.timeout=t.timeout;function d(){if(!c)return;const v=fn.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),w={data:!o||o==="text"||o==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:v,config:t,request:c};gj(function(m){r(m),l()},function(m){n(m),l()},w),c=null}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){c&&(n(new me("Request aborted",me.ECONNABORTED,t,c)),c=null)},c.onerror=function(){n(new me("Network Error",me.ERR_NETWORK,t,c)),c=null},c.ontimeout=function(){let b=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const w=t.transitional||fP;t.timeoutErrorMessage&&(b=t.timeoutErrorMessage),n(new me(b,w.clarifyTimeoutError?me.ETIMEDOUT:me.ECONNABORTED,t,c)),c=null},Vr.isStandardBrowserEnv){const v=(t.withCredentials||_j(f))&&t.xsrfCookieName&&yj.read(t.xsrfCookieName);v&&s.set(t.xsrfHeaderName,v)}i===void 0&&s.setContentType(null),"setRequestHeader"in c&&N.forEach(s.toJSON(),function(b,w){c.setRequestHeader(w,b)}),N.isUndefined(t.withCredentials)||(c.withCredentials=!!t.withCredentials),o&&o!=="json"&&(c.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&c.addEventListener("progress",fx(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",fx(t.onUploadProgress)),(t.cancelToken||t.signal)&&(a=v=>{c&&(n(!v||v.type?new uu(null,t,c):v),c.abort(),c=null)},t.cancelToken&&t.cancelToken.subscribe(a),t.signal&&(t.signal.aborted?a():t.signal.addEventListener("abort",a)));const y=bj(f);if(y&&Vr.protocols.indexOf(y)===-1){n(new me("Unsupported protocol "+y+":",me.ERR_BAD_REQUEST,t));return}c.send(i||null)})},yy={http:YD,xhr:Cj};N.forEach(yy,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const hx=t=>`- ${t}`,Ej=t=>N.isFunction(t)||t===null||t===!1,gP={getAdapter:t=>{t=N.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +`,r:"\r","":""};function nx(t){if(!t.startsWith("")||(t=t.substring(1),t.endsWith("")&&(t=t.slice(0,-1)),!t))return!1;t=t.replace(/\x10(.)/,(n,i)=>i in rx?rx[i]:"");let[e,r=""]=Zi(t," ",2);return e=e?e.toUpperCase():"",{command:e,params:r}}const H6={"\\":"\\",";":":","\n":"n","\r":"r"," ":"s"};function z6(t){return t.replace(/[\\;\n\r ]/g,e=>`\\${H6[e]}`)}function W6(t){let e=`${t.nick}`;return t.user&&(e+=`!${t.user}`),t.host&&(e+=`@${t.host}`),e}function G6(t,e,r,n,i=lo,s=!1){const o=new t(t.COMMAND,void 0,{serverProperties:i}),a={};if(o._paramSpec&&ry(o._paramSpec,(l,u)=>{if(!(s&&l.noServer)&&!(!s&&l.noClient)){if(u in e){const c=e[u];if(c!==void 0){if(t.checkParam(c,l,i))a[u]={value:c,trailing:!!l.trailing};else if(!l.optional)throw new Error(`required parameter "${u}" did not suit requirements: "${c}"`)}}if(!(u in a)&&!l.optional)throw new Error(`required parameter "${u}" not found in command "${t.COMMAND}"`)}}),o._parsedParams=a,o._paramSpec)for(const l of Object.keys(o._paramSpec))Object.defineProperty(o,l,{get(){var u,c;return(c=(u=this._parsedParams)===null||u===void 0?void 0:u[l])===null||c===void 0?void 0:c.value}});return o._initPrefixAndTags(r,n),o}class D{static checkParam(e,r,n=lo){return!(r.type==="channel"&&!fy(e,n.channelTypes)||r.type==="channelList"&&!e.split(",").every(s=>fy(s,n.channelTypes))||r.match&&!r.match.test(e))}constructor(e,{params:r,tags:n,prefix:i,rawLine:s}={},{serverProperties:o=lo,isServer:a=!1,shouldParseParams:l=!0}={},u){this._params=[],this._serverProperties=lo,this._paramSpec=u,this._command=e,this._params=r,this._tags=n??new Map,this._prefix=i,this._serverProperties=o,this._raw=s,l&&this.parseParams(a)}getMinParamCount(e=!1){return this._paramSpec?Object.values(this._paramSpec).filter(r=>r.noServer&&e||r.noClient&&!e?!1:!r.optional).length:0}get paramCount(){var e,r;return(r=(e=this._params)===null||e===void 0?void 0:e.length)!==null&&r!==void 0?r:0}prefixToString(){return this._prefix?W6(this._prefix):""}tagsToString(){return[...this._tags.entries()].map(([e,r])=>r?`${e}=${z6(r)}`:e).join(";")}toString(e=!1,r=!1){const i=[r?this._buildCommandFromRawParams():this._buildCommandFromNamedParams()];if(e){const o=this.prefixToString();o&&i.unshift(`:${o}`)}const s=this.tagsToString();return s&&i.unshift(`@${s}`),i.join(" ")}_initPrefixAndTags(e,r){this._prefix=e,r&&(this._tags=r)}parseParams(e=!1){if(this._params){let r=this.getMinParamCount(e);if(r>this._params.length)throw new ld(this._command,r,this._params.length);const n=this._paramSpec;if(!n)return;let i=0;const s={};for(const[o,a]of Object.entries(n)){if(a.noServer&&e||a.noClient&&!e)continue;if(this._params.length-i<=r){if(a.optional)continue;if(this._params.length-i!==r)throw new Error("not enough parameters left for required parameters parsing (this is a library bug)")}let l=this._params[i];if(!l){if(a.optional)break;throw new Error("unexpected parameter underflow")}if(a.rest){const u=[];for(;this._params[i]&&!this._params[i].trailing;)u.push(this._params[i].value),++i;if(!u.length){if(a.optional)continue;throw new Error(`no parameters left for required rest parameter "${o}"`)}l={value:u.join(" "),trailing:!1}}if(D.checkParam(l.value,a))s[o]={...l},a.optional||--r,a.rest||++i;else if(!a.optional)throw new ud(this._command,o,a,l.value);if(a.trailing)break}if(this._parsedParams=s,this._paramSpec)for(const o of Object.keys(this._paramSpec))Object.defineProperty(this,o,{get(){var a,l;return(l=(a=this._parsedParams)===null||a===void 0?void 0:a[o])===null||l===void 0?void 0:l.value}})}}get rawParamValues(){var e,r;return(r=(e=this._params)===null||e===void 0?void 0:e.map(n=>n.value))!==null&&r!==void 0?r:[]}get prefix(){return this._prefix}get command(){return this._command}get tags(){return this._tags}get rawLine(){return this._raw}isResponseTo(e){return!1}endsResponseTo(e){return!1}_acceptsInReplyCollection(e){return e.isResponseTo(this)}_buildCommandFromNamedParams(){const e=this._paramSpec?Object.keys(this._paramSpec):[];return[this._command,...e.map(r=>{var n;const i=(n=this._parsedParams)===null||n===void 0?void 0:n[r];if(i)return(i.trailing?":":"")+i.value}).filter(r=>r!==void 0)].join(" ")}_buildCommandFromRawParams(){var e,r;return[this._command,...(r=(e=this._params)===null||e===void 0?void 0:e.map(n=>`${n.trailing?":":""}${n.value}`))!==null&&r!==void 0?r:[]].join(" ")}}D.COMMAND="";D.SUPPORTS_CAPTURE=!1;class bT extends D{constructor(e,r,n){super(e,r,n,{reference:{},type:{optional:!0},additionalParams:{optional:!0}})}}bT.COMMAND="BATCH";const V6={name:"batch",messageTypes:[bT],usesTags:!0},Q6={name:"cap-notify"};class xT extends D{constructor(e,r,n){super(e,r,n,{newUser:{},newHost:{}})}}xT.COMMAND="CHGHOST";const K6={name:"chghost",messageTypes:[xT]},Y6={name:"invite-notify"};class ST extends D{}ST.COMMAND="ACK";const X6={name:"labeled-response",messageTypes:[ST],usesTags:!0},J6={name:"message-tags",usesTags:!0},Z6={name:"multi-prefix"},eD=Object.freeze(Object.defineProperty({__proto__:null,AwayNotify:U6,Batch:V6,CapNotify:Q6,ChgHost:K6,InviteNotify:Y6,LabeledResponse:X6,MessageTags:J6,MultiPrefix:Z6},Symbol.toStringTag,{value:"Module"}));class tD{constructor(e,r,...n){this._client=e,this._originalMessage=r,this._messages=[],this._endEventHandlers=new Map,this._types=new Set(n)}untilEvent(e){this._cleanEndEventHandler(e);const r=this._client.on(e,()=>this.end());this._endEventHandlers.set(e,r)}async promise(){return this._promise||(this._promise=new Promise(e=>this._promiseResolve=e)),await this._promise}collect(e){return this._originalMessage._acceptsInReplyCollection(e)?(this._messages.push(e),e.endsResponseTo(this._originalMessage)&&this.end(),!0):!1}end(){this._client.stopCollect(this),this._cleanEndEventHandlers(),this._promiseResolve&&this._promiseResolve(this._messages)}_cleanEndEventHandlers(){this._endEventHandlers.forEach(e=>this._client.removeListener(e)),this._endEventHandlers.clear()}_cleanEndEventHandler(e){this._endEventHandlers.has(e)&&(this._client.removeListener(this._endEventHandlers.get(e)),this._endEventHandlers.delete(e))}}class Wv extends D{constructor(e,r,n){super(e,r,n,{password:{}})}}Wv.COMMAND="PASS";class Ma extends D{constructor(e,r,n){super(e,r,n,{nick:{}})}}Ma.COMMAND="NICK";class Gv extends D{constructor(e,r,n){super(e,r,n,{user:{},mode:{},unused:{},realName:{trailing:!0}})}}Gv.COMMAND="USER";class CT extends D{constructor(e,r,n){super(e,r,n,{name:{},password:{}})}}CT.COMMAND="OPER";class Vv extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0,optional:!0}})}}Vv.COMMAND="QUIT";class ET extends D{constructor(e,r,n){super(e,r,n,{server:{},reason:{trailing:!0}})}}ET.COMMAND="SQUIT";class cl extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},key:{optional:!0}})}}cl.COMMAND="JOIN";class dl extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},reason:{trailing:!0,optional:!0}})}}dl.COMMAND="PART";class cd extends Error{constructor(e){super(`Unknown channel mode character ${e}`),this._char=e,Object.setPrototypeOf(this,cd.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,cd)}get char(){return this._char}}class TT extends D{constructor(e,r,n){super(e,r,n,{target:{},modes:{rest:!0,optional:!0}})}get isChannel(){return fy(this.target,this._serverProperties.channelTypes)}separate(){const e=[],r=this.modes;if(!r)throw new Error("can't separate a channel mode request, just set actions");const n=r.split(" "),i=n.shift();let s="add";for(const o of i){let a=s;switch(o){case"+":{s="add";break}case"-":{s="remove";break}default:{let l=!1,u=!0;if(this.isChannel){if(this._serverProperties.supportedChannelModes.alwaysWithParam.includes(o)||this._serverProperties.supportedChannelModes.prefix.includes(o))l=!0;else if(this._serverProperties.supportedChannelModes.paramWhenSet.includes(o))s==="add"&&(l=!0);else if(this._serverProperties.supportedChannelModes.list.includes(o))n.length?l=!0:a="getList";else if(!this._serverProperties.supportedChannelModes.noParam.includes(o))throw new cd(o)}else u=this._serverProperties.supportedUserModes.includes(o);if(l&&!n.length)continue;e.push({prefix:this._prefix,action:a,letter:o,param:l?n.shift():void 0,known:u})}}}return e}}TT.COMMAND="MODE";class kT extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},newTopic:{optional:!0,trailing:!0}})}}kT.COMMAND="TOPIC";class ou extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channelList",optional:!0}})}}ou.COMMAND="NAMES";ou.SUPPORTS_CAPTURE=!0;class PT extends D{constructor(e,r,n){super(e,r,n,{channel:{optional:!0},server:{optional:!0}})}}PT.COMMAND="LIST";class AT extends D{constructor(e,r,n){super(e,r,n,{target:{},channel:{type:"channel"}})}}AT.COMMAND="INVITE";class IT extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},target:{},reason:{trailing:!0,optional:!0}})}}IT.COMMAND="KICK";class OT extends D{constructor(e,r,n){super(e,r,n,{server:{optional:!0}})}}OT.COMMAND="TIME";class fl extends D{constructor(e,r,n){super(e,r,n,{target:{},text:{trailing:!0}})}}fl.COMMAND="PRIVMSG";class Lf extends D{constructor(e,r,n){super(e,r,n,{target:{},text:{trailing:!0}})}}Lf.COMMAND="NOTICE";class Bf extends D{constructor(e,r,n){super(e,r,n,{mask:{},flags:{optional:!0},extendedMask:{optional:!0,trailing:!0}})}}Bf.COMMAND="WHO";class RT extends D{constructor(e,r,n){super(e,r,n,{server:{optional:!0},nickMask:{}})}}RT.COMMAND="WHOIS";class MT extends D{constructor(e,r,n){super(e,r,n,{nick:{},count:{optional:!0},server:{optional:!0}})}}MT.COMMAND="WHOWAS";class NT extends D{constructor(e,r,n){super(e,r,n,{target:{},reason:{trailing:!0,optional:!0}})}}NT.COMMAND="KILL";class dd extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0}})}}dd.COMMAND="PING";class fd extends D{constructor(e,r,n){super(e,r,n,{server:{noClient:!0},text:{trailing:!0}})}}fd.COMMAND="PONG";class DT extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0}})}}DT.COMMAND="ERROR";class jT extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0,optional:!0}})}}jT.COMMAND="AWAY";class LT extends D{}LT.COMMAND="REHASH";class BT extends D{}BT.COMMAND="RESTART";class $T extends D{constructor(e,r,n){super(e,r,n,{text:{trailing:!0}})}}$T.COMMAND="WALLOPS";class UT extends D{constructor(e,r,n){super(e,r,n,{nicks:{rest:!0}})}}UT.COMMAND="USERHOST";class FT extends D{constructor(e,r,n){super(e,r,n,{nicks:{rest:!0}})}}FT.COMMAND="ISON";class tr extends D{constructor(e,r,n){super(e,r,n,{target:{match:/^(?:[a-z_\-\[\]\\^{}|`][a-z0-9_\-\[\]\\^{}|`]+|\*)$/i,optional:!0,noClient:!0},subCommand:{match:/^(?:LS|LIST|REQ|ACK|NAK|END|NEW|DEL)$/i},version:{match:/^\d+$/,optional:!0},continued:{match:/^\*$/,optional:!0},capabilities:{trailing:!0,optional:!0}})}isResponseTo(e){if(!(e instanceof tr))return!1;switch(this.subCommand){case"ACK":case"NAK":return e.subCommand==="REQ"&&e.capabilities===this.capabilities.trim();case"LS":case"LIST":return e.subCommand===this.subCommand;default:return!1}}endsResponseTo(e){if(!(e instanceof tr))return!1;switch(this.subCommand){case"LS":case"LIST":return!this.continued;default:return!0}}}tr.COMMAND="CAP";tr.SUPPORTS_CAPTURE=!0;class qT extends D{constructor(e,r,n){super(e,r,n,{target:{}})}}qT.COMMAND="TAGMSG";const HT=Object.freeze(Object.defineProperty({__proto__:null,Away:jT,CapabilityNegotiation:tr,ChannelInvite:AT,ChannelJoin:cl,ChannelKick:IT,ChannelList:PT,ChannelPart:dl,ClientQuit:Vv,ErrorMessage:DT,IsOnQuery:FT,Kill:NT,Mode:TT,Names:ou,NickChange:Ma,Notice:Lf,OperLogin:CT,Password:Wv,Ping:dd,Pong:fd,PrivateMessage:fl,Rehash:LT,Restart:BT,ServerQuit:ET,TagMessage:qT,Time:OT,Topic:kT,UserHostQuery:UT,UserRegistration:Gv,Wallops:$T,WhoIsQuery:RT,WhoQuery:Bf,WhoWasQuery:MT},Symbol.toStringTag,{value:"Module"}));class Qv extends D{constructor(e,r,n){super(e,r,n,{me:{},welcomeText:{trailing:!0}})}}Qv.COMMAND="001";class zT extends D{constructor(e,r,n){super(e,r,n,{me:{},yourHost:{trailing:!0}})}}zT.COMMAND="002";class WT extends D{constructor(e,r,n){super(e,r,n,{me:{},createdText:{trailing:!0}})}}WT.COMMAND="003";class Kv extends D{constructor(e,r,n){super(e,r,n,{me:{},serverName:{},version:{},userModes:{},channelModes:{},channelModesWithParam:{optional:!0}})}}Kv.COMMAND="004";class Yv extends D{constructor(e,r,n){super(e,r,n,{me:{},supports:{rest:!0},suffix:{trailing:!0}})}}Yv.COMMAND="005";class GT extends D{constructor(e,r,n){super(e,r,n,{me:{},modes:{}})}}GT.COMMAND="221";class VT extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},text:{trailing:!0}})}}VT.COMMAND="301";class QT extends D{constructor(e,r,n){super(e,r,n,{me:{},hosts:{trailing:!0}})}}QT.COMMAND="302";class KT extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}KT.COMMAND="305";class YT extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}YT.COMMAND="306";class XT extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},username:{},host:{},_unused:{},realname:{trailing:!0}})}}XT.COMMAND="311";class JT extends D{constructor(e,r,n){super(e,r,n,{me:{},query:{},suffix:{trailing:!0}})}isResponseTo(e){return e instanceof Bf}endsResponseTo(){return!0}}JT.COMMAND="315";class ZT extends D{constructor(e,r,n){super(e,r,n,{me:{},nickMask:{},suffix:{trailing:!0}})}}ZT.COMMAND="318";class ek extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},channels:{trailing:!0}})}}ek.COMMAND="319";class tk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},memberCount:{},topic:{trailing:!0}})}}tk.COMMAND="322";class rk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}rk.COMMAND="323";class nk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},modes:{rest:!0}})}}nk.COMMAND="324";class ik extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}ik.COMMAND="331";class sk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},topic:{trailing:!0}})}}sk.COMMAND="332";class ok extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},who:{},ts:{}})}}ok.COMMAND="333";class ak extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},channel:{type:"channel"}})}}ak.COMMAND="341";class lk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},mask:{},creatorName:{optional:!0},timestamp:{optional:!0}})}}lk.COMMAND="348";class uk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}uk.COMMAND="349";class ck extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},user:{},host:{},server:{},nick:{},flags:{},hopsAndRealName:{trailing:!0}})}get isAway(){return this.flags.includes("G")}get isOper(){return this.flags.includes("*")}get isBot(){return this.flags.includes("B")}isResponseTo(e){return e instanceof Bf}}ck.COMMAND="352";class dk extends D{constructor(e,r,n){super(e,r,n,{me:{},channelType:{},channel:{type:"channel"},names:{trailing:!0}})}isResponseTo(e){return e instanceof ou}}dk.COMMAND="353";class fk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},suffix:{trailing:!0}})}isResponseTo(e){return e instanceof ou}endsResponseTo(){return!0}}fk.COMMAND="366";class hk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},mask:{},creatorName:{optional:!0},timestamp:{optional:!0}})}}hk.COMMAND="367";class pk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}pk.COMMAND="368";class mk extends D{constructor(e,r,n){super(e,r,n,{me:{},line:{trailing:!0}})}}mk.COMMAND="372";class gk extends D{constructor(e,r,n){super(e,r,n,{me:{},line:{trailing:!0}})}}gk.COMMAND="375";class Xv extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Xv.COMMAND="376";class yk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}yk.COMMAND="381";class vk extends D{constructor(e,r,n){super(e,r,n,{me:{},server:{optional:!0},timestamp:{trailing:!0}})}}vk.COMMAND="391";class wk extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},suffix:{trailing:!0}})}}wk.COMMAND="401";class _k extends D{constructor(e,r,n){super(e,r,n,{me:{},server:{},suffix:{trailing:!0}})}}_k.COMMAND="402";class bk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},suffix:{trailing:!0}})}}bk.COMMAND="403";class xk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}xk.COMMAND="404";class Sk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}Sk.COMMAND="405";class Ck extends D{constructor(e,r,n){super(e,r,n,{me:{},subCommand:{},suffix:{trailing:!0}})}}Ck.COMMAND="410";class Ek extends D{constructor(e,r,n){super(e,r,n,{me:{},originalCommand:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command===this.originalCommand}endsResponseTo(){return!0}}Ek.COMMAND="421";class Jv extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Jv.COMMAND="422";class Tk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Tk.COMMAND="431";class kk extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}kk.COMMAND="432";class Pk extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Pk.COMMAND="433";class Ak extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Ak.COMMAND="436";class Ik extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},channel:{type:"channel"},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Ik.COMMAND="441";class Ok extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Ok.COMMAND="442";class Rk extends D{constructor(e,r,n){super(e,r,n,{me:{},nick:{},channel:{type:"channel"},suffix:{trailing:!0}})}isResponseTo(e){return e.command==="NICK"}endsResponseTo(){return!0}}Rk.COMMAND="443";class Mk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Mk.COMMAND="451";class Nk extends D{constructor(e,r,n){super(e,r,n,{me:{},originalCommand:{},suffix:{trailing:!0}})}}Nk.COMMAND="461";class Zv extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Zv.COMMAND="462";class Dk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}Dk.COMMAND="471";class jk extends D{constructor(e,r,n){super(e,r,n,{me:{},char:{},suffix:{trailing:!0}})}}jk.COMMAND="472";class Lk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}Lk.COMMAND="473";class Bk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}Bk.COMMAND="474";class $k extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{type:"channel"},suffix:{trailing:!0}})}}$k.COMMAND="475";class Uk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},suffix:{trailing:!0}})}}Uk.COMMAND="479";class Fk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Fk.COMMAND="481";class qk extends D{constructor(e,r,n){super(e,r,n,{me:{},channel:{},suffix:{trailing:!0}})}}qk.COMMAND="482";class Hk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Hk.COMMAND="491";class zk extends D{constructor(e,r,n){super(e,r,n,{me:{},modeChar:{optional:!0,match:/^\w$/},suffix:{trailing:!0}})}}zk.COMMAND="501";class Wk extends D{constructor(e,r,n){super(e,r,n,{me:{},suffix:{trailing:!0}})}}Wk.COMMAND="502";const Gk=Object.freeze(Object.defineProperty({__proto__:null,Error401NoSuchNick:wk,Error402NoSuchServer:_k,Error403NoSuchChannel:bk,Error404CanNotSendToChan:xk,Error405TooManyChannels:Sk,Error410InvalidCapCmd:Ck,Error421UnknownCommand:Ek,Error422NoMotd:Jv,Error431NoNickNameGiven:Tk,Error432ErroneusNickname:kk,Error433NickNameInUse:Pk,Error436NickCollision:Ak,Error441UserNotInChannel:Ik,Error442NotOnChannel:Ok,Error443UserOnChannel:Rk,Error451NotRegistered:Mk,Error461NeedMoreParams:Nk,Error462AlreadyRegistered:Zv,Error471ChannelIsFull:Dk,Error472UnknownMode:jk,Error473InviteOnlyChan:Lk,Error474BannedFromChan:Bk,Error475BadChannelKey:$k,Error479BadChanName:Uk,Error481NoPrivileges:Fk,Error482ChanOpPrivsNeeded:qk,Error491NoOperHost:Hk,Error501UmodeUnknownFlag:zk,Error502UsersDontMatch:Wk,Reply001Welcome:Qv,Reply002YourHost:zT,Reply003Created:WT,Reply004ServerInfo:Kv,Reply005Isupport:Yv,Reply221UmodeIs:GT,Reply301Away:VT,Reply302UserHost:QT,Reply305UnAway:KT,Reply306NowAway:YT,Reply311WhoisUser:XT,Reply315EndOfWho:JT,Reply318EndOfWhois:ZT,Reply319WhoisChannels:ek,Reply322List:tk,Reply323ListEnd:rk,Reply324ChannelModeIs:nk,Reply331NoTopic:ik,Reply332Topic:sk,Reply333TopicWhoTime:ok,Reply341Inviting:ak,Reply348ExceptList:lk,Reply349EndOfExceptList:uk,Reply352WhoReply:ck,Reply353NamesReply:dk,Reply366EndOfNames:fk,Reply367BanList:hk,Reply368EndOfBanList:pk,Reply372Motd:mk,Reply375MotdStart:gk,Reply376EndOfMotd:Xv,Reply381YoureOper:yk,Reply391Time:vk},Symbol.toStringTag,{value:"Module"})),rD=new Map([...Object.values(HT),...Object.values(Gk)].map(t=>[t.COMMAND,t]));function nD(t){const[e,r]=Zi(t,"!",2);if(r){const[n,i]=Zi(r,"@",2);return i?{nick:e,user:n,host:i}:{nick:e,host:n}}else return{nick:e}}const ix={":":";",n:` +`,r:"\r",s:" "};function iD(t){const e=new Map,r=t.split(";");for(const n of r){const[i,s]=Zi(n,"=",2);i!==""&&e.set(i,s?s.replace(/\\(.?)/g,(o,a)=>Object.prototype.hasOwnProperty.call(ix,a)?ix[a]:a):"")}return e}function sD(t,e=lo,r=rD,n=!1,i=[],s=!0){const o=t.split(" ");let a,l;const u=[];let c,f;for(;o.length;){if(a=o[0],a.startsWith("@")&&!c&&!l&&!f)c=iD(a.slice(1));else if(a.startsWith(":"))if(!f&&!l)a.length>1&&(f=nD(a.slice(1)));else{u.push({value:o.join(" ").slice(1),trailing:!0});break}else l?u.push({value:a,trailing:!1}):l=a.toUpperCase();o.shift()}if(c||(c=new Map),!l)throw new Error(`line without command received: ${t}`);s&&(s=!i.includes(l));let d=D;return r.has(l)&&(d=r.get(l)),new d(l,{params:u,tags:c,prefix:f,rawLine:t},{serverProperties:e,isServer:n,shouldParseParams:s})}class Vk extends Vo{constructor(e){super(),this._registered=!1,this._supportsCapabilities=!0,this._events=new Map,this._registeredMessageTypes=new Map,this.onConnect=this.registerEvent(),this.onRegister=this.registerEvent(),this.onDisconnect=this.registerEvent(),this.onPrivmsg=this.registerEvent(),this.onAction=this.registerEvent(),this.onNotice=this.registerEvent(),this.onNickChange=this.registerEvent(),this.onCtcp=this.registerEvent(),this.onCtcpReply=this.registerEvent(),this.onPasswordError=this.registerEvent(),this.onAnyMessage=this.registerEvent(),this._serverProperties=Ra(lo),this._supportedFeatures={},this._collectors=[],this._clientCapabilities=new Map,this._serverCapabilities=new Map,this._negotiatedCapabilities=new Map,this._currentChannels=new Set,this._hasRegisteredBefore=!1,this._channelsFromLastRegister=new Set,this._initialConnectionSetupDone=!1;const{connection:r,credentials:n,channels:i,channelTypes:s,webSocket:o,logger:a={}}=e;this._options=e;const{pingOnInactivity:l=60,pingTimeout:u=10}=r;this._pingOnInactivity=l,this._pingTimeout=u,this._currentNick=n.nick,this._logger=Wo({name:"ircv3",emoji:!0,...a}),this.registerCoreMessageTypes();const{hostName:c,secure:f,reconnect:d=!0}=r,g={hostName:c,port:this.port,secure:f},v={lineBased:!0,logger:this._logger,additionalOptions:e.connectionOptions},b=o?$6:L6;d?this._connection=new B6(b,g,v):this._connection=new b(v,this._logger,e.connectionOptions);for(const w of Object.values(eD))this.addCapability(w);this.addInternalListener(this.onRegister,async()=>{const w=this._hasRegisteredBefore,p=this._channelsFromLastRegister;this._hasRegisteredBefore=!0,this._channelsFromLastRegister=new Set;const m=w&&this._options.rejoinChannelsOnReconnect?p:await ty(i);if(m)for(const y of m)this.join(y)}),this.onTypedMessage(tr,async({subCommand:w,capabilities:p})=>{const m=p.split(" ");switch(w.toUpperCase()){case"NEW":{this._logger.debug(`Server registered new capabilities: ${m.join(", ")}`);const y=va(m,S=>{if(!S)return{};const[k,O]=Zi(S,"=",2);return{[k]:{name:k,param:O||!0}}});for(const[S,k]of Object.entries(y))this._serverCapabilities.set(S,k);const x=Object.keys(y);await this._negotiateCapabilities(Array.from(this._clientCapabilities.entries()).filter(([S])=>x.includes(S)).map(([,S])=>S));break}case"DEL":{this._logger.debug(`Server removed capabilities: ${m.join(", ")}`);for(const y of m)this._serverCapabilities.delete(y),this._negotiatedCapabilities.delete(y)}}}),this.onTypedMessage(dd,({text:w})=>{this.sendMessage(fd,{text:w})}),this.onTypedMessage(Qv,({me:w})=>this._handleReceivedClientNick(w)),this.onTypedMessage(Kv,({userModes:w})=>{w&&(this._serverProperties.supportedUserModes=w)}),this.onTypedMessage(Yv,({supports:w})=>{const p=va(w.split(" "),m=>{const[y,x]=Zi(m,"=",2);return{[y]:x||!0}});this._supportedFeatures={...this._supportedFeatures,...p}}),this.onTypedMessage(Xv,({me:w})=>{this._registered||(this._handleReceivedClientNick(w),this._registered=!0,this.emit(this.onRegister))}),this.onTypedMessage(Jv,({me:w})=>{this._registered||(this._handleReceivedClientNick(w),this._registered=!0,this.emit(this.onRegister))}),this.onTypedMessage(Zv,({me:w})=>{this._registered||(this._logger.warn("We thought we're not registered yet, but we actually are"),this._handleReceivedClientNick(w),this._registered=!0,this.emit(this.onRegister))}),this.onTypedMessage(fl,w=>{var p;const{target:m,text:y}=w,x=nx(y),S=(p=w.prefix)===null||p===void 0?void 0:p.nick;x?x.command==="ACTION"?this.emit(this.onAction,m,S,x.params,w):this.emit(this.onCtcp,m,S,x.command,x.params,w):this.emit(this.onPrivmsg,m,S,y,w)}),this.onTypedMessage(Ma,w=>{var p;const{nick:m}=w,y=(p=w.prefix)===null||p===void 0?void 0:p.nick;y===this._currentNick&&(this._currentNick=m),this.emit(this.onNickChange,y,m,w)}),this.onTypedMessage(Lf,w=>{var p;const{target:m,text:y}=w,x=nx(y),S=(p=w.prefix)===null||p===void 0?void 0:p.nick;x&&this.emit(this.onCtcpReply,m,S,x.command,x.params,w),this.emit(this.onNotice,m,S,y,w)}),this._options.manuallyAcknowledgeJoins||this.onTypedMessage(cl,({channel:w,prefix:p})=>{(p==null?void 0:p.nick)===this._currentNick&&this.acknowledgeJoin(w)}),this.onTypedMessage(dl,w=>{var p;((p=w.prefix)===null||p===void 0?void 0:p.nick)===this._currentNick&&(this._currentChannels.delete(w.channel),this._channelsFromLastRegister.delete(w.channel))}),this.addInternalListener(this.onRegister,()=>this._startPingCheckTimer()),this._desiredNick=n.nick,this._userName=n.userName,this._realName=n.realName,s&&(this._serverProperties.channelTypes=s)}receiveLine(e){var r;this._logger.debug(`Received message: ${e}`);let n;try{n=sD(e,this._serverProperties,this._registeredMessageTypes,!0,this._options.nonConformingCommands)}catch(i){this._logger.error(`Error parsing message: ${i.message}`),this._logger.trace((r=i.stack)!==null&&r!==void 0?r:"No stack available");return}this._logger.trace(`Parsed message: ${JSON.stringify(n)}`),this._startPingCheckTimer(),this.emit(this.onAnyMessage,n),this._handleEvents(n)}get serverProperties(){return Ra(this._serverProperties)}get port(){const{webSocket:e,connection:{port:r,secure:n}}=this._options;return r||(e?n?443:80:n?6697:6667)}pingCheck(){const e=Date.now(),r=e.toString(),n=this.onTypedMessage(fd,i=>{const{text:s}=i;s===r&&(this._logger.debug(`Current ping: ${Date.now()-e}ms`),this._pingTimeoutTimer&&clearTimeout(this._pingTimeoutTimer),this.removeMessageListener(n))});this._pingTimeoutTimer=setTimeout(()=>{this.removeMessageListener(n),this._options.connection.reconnect===!1?this._logger.error(`Disconnecting because the last ping took over ${this._pingTimeout} seconds`):this._logger.warn(`Reconnecting because the last ping took over ${this._pingTimeout} seconds`),this._connection.assumeExternalDisconnect()},this._pingTimeout*1e3),this.sendMessage(dd,{text:r})}reconnect(e){this.quit(e),this.connect()}registerMessageType(e){e.COMMAND!==""&&(this._logger.trace(`Registering message type ${e.COMMAND}`),this._registeredMessageTypes.set(e.COMMAND.toUpperCase(),e))}knowsCommand(e){return this._registeredMessageTypes.has(e.toUpperCase())}getCommandClass(e){return this._registeredMessageTypes.get(e.toUpperCase())}acknowledgeJoin(e){this._currentChannels.add(e),this._channelsFromLastRegister.add(e)}connect(){this._supportsCapabilities=!1,this._negotiatedCapabilities=new Map,this._currentChannels=new Set,this._currentNick=this._desiredNick,this._setupConnection(),this._logger.info(`Connecting to ${this._options.connection.hostName}:${this.port}`),this._connection.connect()}addCapability(e){if(this._clientCapabilities.set(e.name,e),e.messageTypes)for(const r of Object.values(e.messageTypes))this.registerMessageType(r)}async registerCapability(e){return this.addCapability(e),this._serverCapabilities.has(e.name)?await this._negotiateCapabilities([e]):[]}send(e){this.sendRaw(e.toString())}sendRaw(e){this._connection.isConnected&&(this._logger.debug(`Sending message: ${e}`),this._connection.sendLine(e))}onNamedMessage(e,r,n){this._events.has(e)||this._events.set(e,new Map);const i=this._events.get(e);if(!n)do n=`${e}:${U4(Math.random()*1e4,4,"0")}`;while(i.has(n));return i.set(n,r),n}onTypedMessage(e,r,n){return this.onNamedMessage(e.COMMAND,r,n)}removeMessageListener(e){const[r]=e.split(":");this._events.has(r)&&this._events.get(r).delete(e)}createMessage(e,r,n){const i=n?new Map(Object.entries(n)):void 0;return G6(e,r,void 0,i,this.serverProperties)}sendMessage(e,r,n){this.send(this.createMessage(e,r,n))}async sendMessageAndCaptureReply(e,r){if(!e.SUPPORTS_CAPTURE)throw new Error(`The command "${e.COMMAND}" does not support reply capture`);const n=this.createMessage(e,r),i=this.collect(n).promise();return this.send(n),await i}get isConnected(){return this._connection.isConnected}get isConnecting(){return this._connection.isConnecting}get isRegistered(){return this._registered}get currentNick(){return this._currentNick}get currentChannels(){return Array.from(this._currentChannels)}collect(e,...r){const n=new tD(this,e,...r);return this._collectors.push(n),n}stopCollect(e){this._collectors.splice(this._collectors.findIndex(r=>r===e),1)}join(e,r){this.sendMessage(cl,{channel:e,key:r})}part(e){this.sendMessage(dl,{channel:e})}quit(e){this.sendMessage(Vv,{text:e}),this.quitAbruptly()}quitAbruptly(){this._registered=!1,this._connection.disconnect()}say(e,r,n={}){this.sendMessage(fl,{target:e,text:r},n)}sendCtcp(e,r,n){this.say(e,`${r.toUpperCase()} ${n}`)}action(e,r){this.sendCtcp(e,"ACTION",r)}changeNick(e){this._currentNick!==e&&(this._desiredNick=e,this.isRegistered&&this.sendMessage(Ma,{nick:e}))}registerCoreMessageTypes(){ry(HT,e=>{this.registerMessageType(e)}),ry(Gk,e=>{this.registerMessageType(e)})}async _negotiateCapabilityBatch(e){return await Promise.all(e.filter(r=>r.length).map(async r=>await this._negotiateCapabilities(r)))}async _negotiateCapabilities(e){const r=va(e,o=>({[o.name]:o})),i=(await this.sendMessageAndCaptureReply(tr,{subCommand:"REQ",capabilities:e.map(o=>o.name).join(" ")})).shift();if(!i)throw new Error("capability negotiation failed unexpectedly without any reply");if(!(i instanceof tr))throw new Error(`capability negotiation failed unexpectedly with "${i.command}" command`);const s=i.capabilities.split(" ").filter(o=>o);if(i.subCommand==="ACK"){this._logger.debug(`Successfully negotiated capabilities: ${s.join(", ")}`);const o=s.map(a=>r[a]);for(const a of o){const l=this._clientCapabilities.get(a.name);l.param=a.param,this._negotiatedCapabilities.set(l.name,l)}return o}else return this._logger.warn(`Failed to negotiate capabilities: ${s.join(", ")}`),new Error("capabilities failed to negotiate")}_setupConnection(){this._initialConnectionSetupDone||(this._connection.onConnect(async()=>{var e,r;this._logger.info(`Connection to server ${this._options.connection.hostName}:${this.port} established`),this.emit(this.onConnect),this._logger.debug("Determining connection password");try{const[n]=await Promise.all([ty(this._options.credentials.password),this.sendMessageAndCaptureReply(tr,{subCommand:"LS",version:"302"}).then(i=>{if(!i.length||!(i[0]instanceof tr))return this._logger.debug("Server does not support capabilities"),[];this._supportsCapabilities=!0;const s=i.map(a=>va(a.capabilities.split(" "),l=>{if(!l)return{};const[u,c]=Zi(l,"=",2);return{[u]:{name:u,param:c||!0}}}));this._serverCapabilities=new Map(Object.entries(Object.assign({},...s))),this._logger.debug(`Capabilities supported by server: ${Array.from(this._serverCapabilities.keys()).join(", ")}`);const o=s.map(a=>{const l=Object.keys(a);return Array.from(this._clientCapabilities.entries()).filter(([u])=>l.includes(u)).map(([,u])=>u)});return this._negotiateCapabilityBatch(o)}).then(()=>{this.sendMessage(tr,{subCommand:"END"})})]);n&&this.sendMessage(Wv,{password:n}),this.sendMessage(Ma,{nick:this._desiredNick}),this.sendMessage(Gv,{user:(e=this._userName)!==null&&e!==void 0?e:this._desiredNick,mode:"8",unused:"*",realName:(r=this._realName)!==null&&r!==void 0?r:this._desiredNick})}catch(n){this.emit(this.onPasswordError,n),this.quit()}}),this._initialConnectionSetupDone=!0,this._connection.onReceive(e=>{this.receiveLine(e)}),this._connection.onDisconnect((e,r)=>{var n;if(this._registered=!1,this._pingCheckTimer&&clearTimeout(this._pingCheckTimer),this._pingTimeoutTimer&&clearTimeout(this._pingTimeoutTimer),e)this._logger.info("Disconnected");else{const i=(n=this._options.connection.reconnect)!==null&&n!==void 0?n:!0,s=r?`Disconnected unexpectedly: ${r.message}`:"Disconnected unexpectedly";i?this._logger.warn(`${s}; trying to reconnect`):this._logger.error(s)}this.emit(this.onDisconnect,e,r)}),this._connection.onEnd(e=>{e||this._logger.warn("No further retries will be made")}))}_handleReceivedClientNick(e){this._currentNick!==e&&(this._currentNick!==""&&this._logger.warn(`Mismatching nicks: passed ${this._currentNick}, but you're actually ${e}`),this._currentNick=e)}_handleEvents(e){this._collectors.some(n=>n.collect(e));const r=this._events.get(e.constructor.COMMAND);if(r)for(const n of r.values())n(e)}_startPingCheckTimer(){this._pingCheckTimer&&clearTimeout(this._pingCheckTimer),this._connection.isConnected?this._pingCheckTimer=setTimeout(()=>this.pingCheck(),this._pingOnInactivity*1e3):this._pingCheckTimer=void 0}}C([K(!1)],Vk.prototype,"_options",void 0);class ew extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},user:{trailing:!0,optional:!0}})}get date(){const e=this._tags.get("tmi-sent-ts");return new Date(Number(e))}get channelId(){return this._tags.get("room-id")}get targetUserId(){var e;return(e=this._tags.get("target-user-id"))!==null&&e!==void 0?e:null}}ew.COMMAND="CLEARCHAT";class Qk extends D{}Qk.COMMAND="RECONNECT";class tw extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"}})}}tw.COMMAND="ROOMSTATE";function oD(t){switch(typeof t){case"undefined":return"";case"object":{if(t===null)return"";if("cacheKey"in t)return t.cacheKey;const e=JSON.stringify(t);if(e!=="{}")return e}default:return t.toString()}}function Kk(t,e,r){return[t,...e.map(oD)].join("/")+(r?"/":"")}function au(t){return class extends t{constructor(){super(...arguments),this.cache=new Map}getFromCache(e){if(this._cleanCache(),this.cache.has(e)){const r=this.cache.get(e);if(r)return r.value}}setCache(e,r,n){this.cache.set(e,{value:r,expires:Date.now()+n*1e3})}removeFromCache(e,r){const n=this._getInternalCacheKey(e,r);r?this.cache.forEach((i,s)=>{s.startsWith(n)&&this.cache.delete(s)}):this.cache.delete(n)}_cleanCache(){const e=Date.now();this.cache.forEach((r,n)=>{r.expires{const n=r.indexOf("/");return n===-1?[r,""]:[r.slice(0,n),r.slice(n+1)]})):new Map}get userName(){return this._userName}get displayName(){var e;return(e=this._userData.get("display-name"))!==null&&e!==void 0?e:this._userName}get color(){return this._userData.get("color")}get badges(){const e=this._userData.get("badges");return gc._parseBadgesLike(e)}get badgeInfo(){const e=this._userData.get("badge-info");return gc._parseBadgesLike(e)}get userId(){return this._userData.get("user-id")}get userType(){return this._userData.get("user-type")}get isBroadcaster(){return this.badges.has("broadcaster")}get isSubscriber(){return this.badges.has("subscriber")||this.isFounder}get isFounder(){return this.badges.has("founder")}get isMod(){return this.badges.has("moderator")}get isVip(){const e=this._userData.get("vip");return e!=null&&e!=="0"}get isArtist(){return this.badges.has("artist-badge")}};C([K(!1)],bi.prototype,"_userData",void 0);C([Se()],bi.prototype,"badges",null);C([Se()],bi.prototype,"badgeInfo",null);bi=gc=C([au,B("chat","ChatUser","userId")],bi);function rw(t){return t?new Map(t.split("/").map(e=>{const[r,n]=e.split(":",2);return n?[r,n.split(",")]:null}).filter(e=>e!==null)):new Map}class $f extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},text:{trailing:!0,optional:!0}})}get id(){return this._tags.get("id")}get date(){const e=this._tags.get("tmi-sent-ts");return new Date(Number(e))}get userInfo(){return new bi(this._tags.get("login"),this._tags)}get channelId(){var e;return(e=this._tags.get("room-id"))!==null&&e!==void 0?e:null}get emoteOffsets(){return rw(this._tags.get("emotes"))}}$f.COMMAND="USERNOTICE";class Yk extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"}})}}Yk.COMMAND="USERSTATE";class nw extends D{constructor(e,r,n){super(e,r,n,{target:{},text:{trailing:!0}})}get userInfo(){return new bi(this._prefix.nick,this._tags)}get emoteOffsets(){return rw(this._tags.get("emotes"))}}nw.COMMAND="WHISPER";const aD={name:"twitch.tv/commands",messageTypes:[ew,Qk,tw,$f,Yk,nw]},lD={name:"twitch.tv/membership"};class iw extends D{constructor(e,r,n){super(e,r,n,{channel:{type:"channel"},text:{trailing:!0}})}get date(){const e=this._tags.get("tmi-sent-ts");return new Date(Number(e))}get userName(){return this._tags.get("login")}get channelId(){return this._tags.get("room-id")}get targetMessageId(){return this._tags.get("target-msg-id")}}iw.COMMAND="CLEARMSG";class Xk extends D{}Xk.COMMAND="GLOBALUSERSTATE";const uD={name:"twitch.tv/tags",messageTypes:[Xk,iw]},cD=["ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN"];let hd=class extends fl{get id(){return this._tags.get("id")}get date(){const e=this._tags.get("tmi-sent-ts");return new Date(Number(e))}get userInfo(){return new bi(this._prefix.nick,this._tags)}get channelId(){var e;return(e=this._tags.get("room-id"))!==null&&e!==void 0?e:null}get isCheer(){return this._tags.has("bits")}get isRedemption(){return!!this._tags.get("custom-reward-id")}get rewardId(){return this._tags.get("custom-reward-id")||null}get isFirst(){return this._tags.get("first-msg")==="1"}get isReturningChatter(){return this._tags.get("returning-chatter")==="1"}get isHighlight(){return this._tags.get("msg-id")==="highlighted-message"}get isReply(){return this._tags.has("reply-parent-msg-id")}get parentMessageId(){var e;return(e=this._tags.get("reply-parent-msg-id"))!==null&&e!==void 0?e:null}get parentMessageText(){var e;return(e=this._tags.get("reply-parent-msg-body"))!==null&&e!==void 0?e:null}get parentMessageUserId(){var e;return(e=this._tags.get("reply-parent-user-id"))!==null&&e!==void 0?e:null}get parentMessageUserName(){var e;return(e=this._tags.get("reply-parent-user-login"))!==null&&e!==void 0?e:null}get parentMessageUserDisplayName(){var e;return(e=this._tags.get("reply-parent-display-name"))!==null&&e!==void 0?e:null}get threadMessageId(){var e;return(e=this._tags.get("reply-thread-parent-msg-id"))!==null&&e!==void 0?e:null}get threadMessageUserId(){var e;return(e=this._tags.get("reply-thread-parent-user-id"))!==null&&e!==void 0?e:null}get bits(){var e;return Number((e=this._tags.get("bits"))!==null&&e!==void 0?e:0)}get emoteOffsets(){return rw(this._tags.get("emotes"))}get isHypeChat(){return this._tags.has("pinned-chat-paid-amount")}get hypeChatAmount(){return hr(this._tags.get("pinned-chat-paid-amount"),Number)}get hypeChatDecimalPlaces(){return hr(this._tags.get("pinned-chat-paid-exponent"),Number)}get hypeChatLocalizedAmount(){const e=this.hypeChatAmount;return e?e/10**this.hypeChatDecimalPlaces:null}get hypeChatCurrency(){var e;return(e=this._tags.get("pinned-chat-paid-currency"))!==null&&e!==void 0?e:null}get hypeChatLevel(){const e=this._tags.get("pinned-chat-paid-level");return e?cD.indexOf(e)+1:null}get hypeChatIsSystemMessage(){const e=this._tags.get("pinned-chat-paid-is-system-message");return e?!!Number(e):null}};hd=C([B("chat","ChatMessage","id")],hd);function dD(t){return t instanceof hd?t.tags.get("id"):t}function sx(t,e){if(t.length<=e)return[t];t=t.trim();const r=[];let n=0,i=e;for(;nawait this._getAuthToken()},webSocket:(s=e.webSocket)!==null&&s!==void 0?s:!0,connectionOptions:e.connectionOptions,logger:{name:"twurple:chat:irc",...e.logger},nonConformingCommands:["004"],manuallyAcknowledgeJoins:!0,rejoinChannelsOnReconnect:e.rejoinChannelsOnReconnect}),this._ircClient.onDisconnect((u,c)=>{this._messageRateLimiter.clear(),this._messageRateLimiter.pause(),this._joinRateLimiter.clear(),this._joinRateLimiter.pause(),this.emit(this.onDisconnect,u,c)}),this._ircClient.registerMessageType(hd),this._chatLogger=Wo({name:"twurple:chat:twitch",...e.logger}),this._authProvider=e.authProvider,this._useLegacyScopes=!!e.legacyScopes,this._readOnly=!!e.readOnly,this._authIntents=[...(o=e.authIntents)!==null&&o!==void 0?o:[],"chat"];const a=async({type:u,text:c,channel:f,tags:d})=>{u==="say"?this._ircClient.say(f,c,d):this._ircClient.action(f,c)},l=async u=>{const{promise:c,resolve:f,reject:d}=ul();let g;const v=this.addInternalListener(this._onJoinResult,(b,w,p)=>{b===u&&(clearTimeout(g),p?d(p):f(),this.removeListener(v))});g=setTimeout(()=>{this.removeListener(v),this.emit(this._onJoinResult,u,void 0,"twurple_timeout"),d(new Error(`Did not receive a reply to join ${u} in time; assuming that the join failed`))},1e4),this._ircClient.join(u),await c};if(e.isAlwaysMod)this._messageRateLimiter=new oy({bucketSize:e.botLevel==="verified"?7500:100,timeFrame:32e3,doRequest:a});else{let u=20;e.botLevel==="verified"?u=7500:e.botLevel==="known"&&(u=50),this._messageRateLimiter=new JN(new pT({bucketSize:1,timeFrame:1200,logger:{minLevel:te.ERROR},doRequest:a,getPartitionKey:({channel:c})=>c}),{bucketSize:u,timeFrame:32e3})}this._joinRateLimiter=new oy({bucketSize:e.botLevel==="verified"?2e3:20,timeFrame:11e3,doRequest:l}),this._messageRateLimiter.pause(),this._joinRateLimiter.pause(),this._ircClient.addCapability(uD),this._ircClient.addCapability(aD),e.requestMembershipEvents&&this._ircClient.addCapability(lD),this._ircClient.onConnect(()=>{this.emit(this.onConnect)}),this._ircClient.onRegister(async()=>{this._messageRateLimiter.resume(),this._joinRateLimiter.resume(),this._authVerified=!0,this._authRetryTimer=void 0,this._authRetryCount=0,this.emit(this.onAuthenticationSuccess);const u=await ty(e.channels);u&&await Promise.all(u.map(async c=>{var f;try{await this.join(c)}catch(d){this._chatLogger.warn(`Failed to join configured channel ${c}; original message: ${(f=d==null?void 0:d.message)!==null&&f!==void 0?f:d}`)}}))}),this._ircClient.onPasswordError(u=>{this._chatLogger.error(`Error fetching a token for connecting to the server: ${u.message}`),this.emit(this.onTokenFetchFailure,u)}),this._ircClient.onPrivmsg((u,c,f,d)=>{c!=="jtv"&&this.emit(this.onMessage,Qe(u),c,f,d)}),this._ircClient.onAction((u,c,f,d)=>{this.emit(this.onAction,Qe(u),c,f,d)}),this.addInternalListener(this._onJoinResult,(u,c,f)=>{f?this.emit(this.onJoinFailure,Qe(u),f):this._ircClient.acknowledgeJoin(u)}),this._ircClient.onTypedMessage(ew,u=>{const{channel:c,user:f,tags:d}=u,g=Qe(c);if(f){const v=d.get("ban-duration");v===void 0?this.emit(this.onBan,g,f,u):this.emit(this.onTimeout,g,f,Number(v),u)}else this.emit(this.onChatClear,g,u)}),this._ircClient.onTypedMessage(iw,u=>{const{channel:c,targetMessageId:f}=u;this.emit(this.onMessageRemove,Qe(c),f,u)}),this._ircClient.onTypedMessage(cl,({prefix:u,channel:c})=>{this.emit(this.onJoin,Qe(c),u.nick)}),this._ircClient.onTypedMessage(dl,({prefix:u,channel:c})=>{this.emit(this.onPart,Qe(c),u.nick)}),this._ircClient.onTypedMessage(tw,({channel:u,tags:c})=>{let f=!1;if(c.has("subs-only")&&c.has("slow")&&(this.emit(this._onJoinResult,u,c),f=!0),!f){const d=Qe(u);if(c.has("slow")){const g=Number(c.get("slow"));g?this.emit(this.onSlow,d,!0,g):this.emit(this.onSlow,d,!1)}if(c.has("followers-only")){const g=Number(c.get("followers-only"));g===-1?this.emit(this.onFollowersOnly,d,!1):this.emit(this.onFollowersOnly,d,!0,g)}}}),this._ircClient.onTypedMessage($f,u=>{const{channel:c,text:f,tags:d}=u,g=d.get("msg-id"),v=Qe(c);switch(g){case"sub":case"resub":{const b=g==="sub"?this.onSub:this.onResub,w=d.get("msg-param-sub-plan"),p=d.get("msg-param-streak-months"),m={userId:d.get("user-id"),displayName:d.get("display-name"),plan:w,planName:d.get("msg-param-sub-plan-name"),isPrime:w==="Prime",months:Number(d.get("msg-param-cumulative-months")),streak:p?Number(p):void 0,message:f};if(d.get("msg-param-was-gifted")==="true"){const x=d.get("msg-param-anon-gift")==="true",S=Number(d.get("msg-param-gift-months")),k=Number(d.get("msg-param-gift-month-being-redeemed"));x?m.originalGiftInfo={anonymous:!0,duration:S,redeemedMonth:k}:m.originalGiftInfo={anonymous:!1,duration:S,redeemedMonth:k,userId:d.get("msg-param-gifter-id"),userName:d.get("msg-param-gifter-login"),userDisplayName:d.get("msg-param-gifter-name")}}this.emit(b,v,d.get("login"),m,u);break}case"subgift":{const b=d.get("msg-param-sub-plan"),w=d.get("login"),p=w==="ananonymousgifter",m={userId:d.get("msg-param-recipient-id"),displayName:d.get("msg-param-recipient-display-name"),gifter:p?void 0:w,gifterUserId:p?void 0:d.get("user-id"),gifterDisplayName:p?void 0:d.get("display-name"),gifterGiftCount:p?void 0:Number(d.get("msg-param-sender-count")),giftDuration:Number(d.get("msg-param-gift-months")),plan:b,planName:d.get("msg-param-sub-plan-name"),isPrime:b==="Prime",months:Number(d.get("msg-param-months"))};this.emit(this.onSubGift,v,d.get("msg-param-recipient-user-name"),m,u);break}case"submysterygift":{const b=d.get("login"),w=b==="ananonymousgifter",p={gifter:w?void 0:b,gifterUserId:w?void 0:d.get("user-id"),gifterDisplayName:w?void 0:d.get("display-name"),gifterGiftCount:w?void 0:Number(d.get("msg-param-sender-count")),count:Number(d.get("msg-param-mass-gift-count")),plan:d.get("msg-param-sub-plan")};this.emit(this.onCommunitySub,v,d.get("login"),p,u);break}case"primepaidupgrade":{const b={userId:d.get("user-id"),displayName:d.get("display-name"),plan:d.get("msg-param-sub-plan")};this.emit(this.onPrimePaidUpgrade,v,d.get("login"),b,u);break}case"giftpaidupgrade":{const b={userId:d.get("user-id"),displayName:d.get("display-name"),gifter:d.get("msg-param-sender-login"),gifterDisplayName:d.get("msg-param-sender-name")};this.emit(this.onGiftPaidUpgrade,v,d.get("login"),b,u);break}case"standardpayforward":{const b=d.get("msg-param-prior-gifter-anonymous")==="true",w={userId:d.get("user-id"),displayName:d.get("display-name"),originalGifterUserId:b?void 0:d.get("msg-param-prior-gifter-id"),originalGifterDisplayName:b?void 0:d.get("msg-param-prior-gifter-display-name"),recipientUserId:d.get("msg-param-recipient-id"),recipientDisplayName:d.get("msg-param-recipient-display-name")};this.emit(this.onStandardPayForward,v,d.get("login"),w,u);break}case"communitypayforward":{const b=d.get("msg-param-prior-gifter-anonymous")==="true",w={userId:d.get("user-id"),displayName:d.get("display-name"),originalGifterUserId:b?void 0:d.get("msg-param-prior-gifter-id"),originalGifterDisplayName:b?void 0:d.get("msg-param-prior-gifter-display-name")};this.emit(this.onCommunityPayForward,v,d.get("login"),w,u);break}case"primecommunitygiftreceived":{const b={name:d.get("msg-param-gift-name"),gifter:d.get("login"),gifterDisplayName:d.get("display-name")};this.emit(this.onPrimeCommunityGift,v,d.get("msg-param-recipient"),b,u);break}case"raid":{const b={displayName:d.get("msg-param-displayName"),viewerCount:Number(d.get("msg-param-viewerCount"))};this.emit(this.onRaid,v,d.get("login"),b,u);break}case"unraid":{this.emit(this.onRaidCancel,v,u);break}case"ritual":{const b={ritualName:d.get("msg-param-ritual-name"),message:f};this.emit(this.onRitual,v,d.get("login"),b,u);break}case"bitsbadgetier":{const b={displayName:d.get("display-name"),threshold:Number(d.get("msg-param-threshold"))};this.emit(this.onBitsBadgeUpgrade,v,d.get("login"),b,u);break}case"extendsub":{const b={userId:d.get("user-id"),displayName:d.get("display-name"),plan:d.get("msg-param-sub-plan"),months:Number(d.get("msg-param-cumulative-months")),endMonth:Number(d.get("msg-param-sub-benefit-end-month"))};this.emit(this.onSubExtend,v,d.get("login"),b,u);break}case"rewardgift":{const b={domain:d.get("msg-param-domain"),gifterId:d.get("user-id"),gifterDisplayName:d.get("display-name"),count:Number(d.get("msg-param-selected-count")),gifterGiftCount:Number(d.get("msg-param-total-reward-count")),triggerType:d.get("msg-param-trigger-type")};this.emit(this.onRewardGift,v,d.get("login"),b,u);break}case"announcement":{const b={color:d.get("msg-param-color")};this.emit(this.onAnnouncement,v,d.get("login"),b,u);break}default:this._chatLogger.warn(`Unrecognized usernotice ID: ${g}`)}}),this._ircClient.onTypedMessage(nw,u=>{this.emit(this.onWhisper,u.prefix.nick,u.text,u)}),this._ircClient.onTypedMessage(Lf,async({target:u,text:c,tags:f})=>{const d=f.get("msg-id");switch(d){case"emote_only_on":{this.emit(this.onEmoteOnly,Qe(u),!0);break}case"emote_only_off":{this.emit(this.onEmoteOnly,Qe(u),!1);break}case"msg_channel_suspended":case"msg_banned":{this.emit(this._onJoinResult,u,void 0,d);break}case"r9k_on":{this.emit(this.onUniqueChat,Qe(u),!0);break}case"r9k_off":{this.emit(this.onUniqueChat,Qe(u),!1);break}case"subs_on":{this.emit(this.onSubsOnly,Qe(u),!0);break}case"subs_off":{this.emit(this.onSubsOnly,Qe(u),!1);break}case"cmds_available":break;case"followers_on":case"followers_on_zero":case"followers_off":case"slow_on":case"slow_off":break;case"timeout_success":break;case"unrecognized_cmd":break;case"no_permission":{this.emit(this.onNoPermission,Qe(u),c);break}case"msg_ratelimit":{this.emit(this.onMessageRatelimit,Qe(u),c);break}case"msg_duplicate":case"msg_emoteonly":case"msg_followersonly":case"msg_followersonly_followed":case"msg_followersonly_zero":case"msg_subsonly":case"msg_slowmode":case"msg_r9k":case"msg_verified_email":case"msg_timedout":case"msg_rejected_mandatory":case"msg_channel_blocked":{this.emit(this.onMessageFailed,Qe(u),d);break}case void 0:{if(c==="Login authentication failed"||c==="Improperly formatted AUTH"||c==="Invalid NICK"){this._authVerified=!1,this._authRetryTimer||(this._authRetryTimer=AE(120),this._authRetryCount=0);const g=this._authRetryTimer.next().value,v=++this._authRetryCount;this.emit(this.onAuthenticationFailure,c,v),g!==0&&this._chatLogger.info(`Retrying authentication in ${g} seconds`),await $4(g*1e3),this._ircClient.reconnect()}break}default:d.startsWith("usage_")||this._chatLogger.warn(`Unrecognized notice ID: '${d}'`)}})}connect(){this._authProvider||this._ircClient.changeNick(hy._generateJustinfanNick()),this._ircClient.connect()}get irc(){return this._ircClient}get isConnected(){return this._ircClient.isConnected}get isConnecting(){return this._ircClient.isConnecting}get currentChannels(){return this._ircClient.currentChannels}async say(e,r,n={},i){const s={};n.replyTo&&(s["reply-parent-msg-id"]=dD(n.replyTo));const o=sx(r,500);await Promise.all(o.map(async a=>await this._messageRateLimiter.request({type:"say",channel:zu(e),text:a,tags:s},i)))}async action(e,r,n){const i=sx(r,490);await Promise.all(i.map(async s=>await this._messageRateLimiter.request({type:"action",channel:zu(e),text:s},n)))}async join(e){await this._joinRateLimiter.request(zu(e))}part(e){this._ircClient.part(zu(e))}quit(){this._ircClient.quitAbruptly()}reconnect(){this.quit(),this.connect()}async _getAuthToken(){var e,r;if(!this._authProvider){this._chatLogger.debug("No authProvider given; connecting anonymously");return}if(this._authToken&&!oo(this._authToken)&&this._authVerified)return this._chatLogger.debug("AccessToken assumed to be correct from last connection"),`oauth:${this._authToken.accessToken}`;const n=this._getNecessaryScopes();let i,s=!1;for(const o of this._authIntents){try{if(this._authToken=await this._authProvider.getAccessTokenForIntent(o,n),!this._authToken)continue;s=!0;const a=await fs(this._authToken.accessToken);if(!a.userName)throw new mc("Could not determine a user name for your token; you might be trying to disguise an app token as a user token.");return this._ircClient.changeNick(a.userName),`oauth:${this._authToken.accessToken}`}catch(a){a instanceof rs?i=a:this._chatLogger.error(`Retrieving an access token failed: ${a.message}`)}this._chatLogger.warn("No valid token available; trying to refresh");try{if(this._authToken=await((r=(e=this._authProvider).refreshAccessTokenForIntent)===null||r===void 0?void 0:r.call(e,"chat")),this._authToken){const a=await fs(this._authToken.accessToken);if(!a.userName)throw new mc("Could not determine a user name for your token; you might be trying to disguise an app token as a user token.");return this._ircClient.changeNick(a.userName),`oauth:${this._authToken.accessToken}`}}catch(a){a instanceof rs?i=a:this._chatLogger.error(`Refreshing the access token failed: ${a.message}`)}}throw this._authVerified=!1,i??new Error(s?"Could not retrieve a valid token":`None of the queried intents (${this._authIntents.join(", ")}) are known by the auth provider${this._authProvider instanceof _i?".\nPlease add one of these to the user you want to connect with using the `addIntentToUser` method or the additional parameter to `addUser` or `addUserForToken`.":""}`)}_getNecessaryScopes(){return this._useLegacyScopes?["chat_login"]:this._readOnly?["chat:read"]:["chat:read","chat:edit"]}static _generateJustinfanNick(){return`justinfan${Math.floor(Math.random()*1e5).toString().padStart(5,"0")}`}};C([K(!1)],pd.prototype,"_authProvider",void 0);pd=hy=C([B("chat","ChatClient")],pd);function Jk(t,e={}){const{animationSettings:r="default",backgroundType:n="dark",size:i="1.0"}=e;return`https://static-cdn.jtvnw.net/emoticons/v2/${t}/${r}/${n}/${i}`}function hD(t,e){return[...e.entries()].flatMap(([r,n])=>n.map(i=>{const[s,o]=i.split("-"),a=+s,l=+o,u=ny(t,a,l+1);return{type:"emote",position:a,length:l-a+1,id:r,name:u}})).sort((r,n)=>r.position-n.position)}function pD(t,e){const r=[],n=new RegExp("(?<=^|\\s)([a-z]+(?:\\d+[a-z]+)*)(\\d+)(?=\\s|$)","gi");let i=null;for(;i=n.exec(t);){const s=i[1].toLowerCase();if(e.includes(s)){const o=Number(i[2]);r.push({type:"cheer",name:s,amount:o,position:RE(t.slice(0,i.index)),length:i[0].length})}}return r}function mD(t,e){const r=RE(t);if(!e.length)return[{type:"text",position:0,length:r,text:t}];const n=[];let i=0;for(const s of e)s.position>i&&n.push({type:"text",position:i,length:s.position-i,text:ny(t,i,s.position)}),n.push(s),i=s.position+s.length;return ii.position-s.position)),mD(t,n)}const py={twitch:{clientId:"xrjkdmui65qd33jdx8itfslt61qys8",scopes:["chat:read","channel:read:redemptions","moderator:read:followers"]},google:{clientId:"932208815805-oq2sevf3ida5idi4k84tlsh03nqc35cs.apps.googleusercontent.com",scopes:["https://www.googleapis.com/auth/youtube.readonly"]}};function Zk(t,e){return function(){return t.apply(e,arguments)}}const{toString:yD}=Object.prototype,{getPrototypeOf:sw}=Object,Uf=(t=>e=>{const r=yD.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),en=t=>(t=t.toLowerCase(),e=>Uf(e)===t),Ff=t=>e=>typeof e===t,{isArray:Qo}=Array,hl=Ff("undefined");function vD(t){return t!==null&&!hl(t)&&t.constructor!==null&&!hl(t.constructor)&&lr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const eP=en("ArrayBuffer");function wD(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&eP(t.buffer),e}const _D=Ff("string"),lr=Ff("function"),tP=Ff("number"),qf=t=>t!==null&&typeof t=="object",bD=t=>t===!0||t===!1,yc=t=>{if(Uf(t)!=="object")return!1;const e=sw(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},xD=en("Date"),SD=en("File"),CD=en("Blob"),ED=en("FileList"),TD=t=>qf(t)&&lr(t.pipe),kD=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||lr(t.append)&&((e=Uf(t))==="formdata"||e==="object"&&lr(t.toString)&&t.toString()==="[object FormData]"))},PD=en("URLSearchParams"),AD=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lu(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Qo(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const nP=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),iP=t=>!hl(t)&&t!==nP;function my(){const{caseless:t}=iP(this)&&this||{},e={},r=(n,i)=>{const s=t&&rP(e,i)||i;yc(e[s])&&yc(n)?e[s]=my(e[s],n):yc(n)?e[s]=my({},n):Qo(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(lu(e,(i,s)=>{r&&lr(i)?t[s]=Zk(i,r):t[s]=i},{allOwnKeys:n}),t),OD=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),RD=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},MD=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&sw(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ND=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},DD=t=>{if(!t)return null;if(Qo(t))return t;let e=t.length;if(!tP(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},jD=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&sw(Uint8Array)),LD=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},BD=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},$D=en("HTMLFormElement"),UD=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),ox=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),FD=en("RegExp"),sP=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};lu(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},qD=t=>{sP(t,(e,r)=>{if(lr(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(lr(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},HD=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Qo(t)?n(t):n(String(t).split(e)),r},zD=()=>{},WD=(t,e)=>(t=+t,Number.isFinite(t)?t:e),Cm="abcdefghijklmnopqrstuvwxyz",ax="0123456789",oP={DIGIT:ax,ALPHA:Cm,ALPHA_DIGIT:Cm+Cm.toUpperCase()+ax},GD=(t=16,e=oP.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function VD(t){return!!(t&&lr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const QD=t=>{const e=new Array(10),r=(n,i)=>{if(qf(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Qo(n)?[]:{};return lu(n,(o,a)=>{const l=r(o,i+1);!hl(l)&&(s[a]=l)}),e[i]=void 0,s}}return n};return r(t,0)},KD=en("AsyncFunction"),YD=t=>t&&(qf(t)||lr(t))&&lr(t.then)&&lr(t.catch),N={isArray:Qo,isArrayBuffer:eP,isBuffer:vD,isFormData:kD,isArrayBufferView:wD,isString:_D,isNumber:tP,isBoolean:bD,isObject:qf,isPlainObject:yc,isUndefined:hl,isDate:xD,isFile:SD,isBlob:CD,isRegExp:FD,isFunction:lr,isStream:TD,isURLSearchParams:PD,isTypedArray:jD,isFileList:ED,forEach:lu,merge:my,extend:ID,trim:AD,stripBOM:OD,inherits:RD,toFlatObject:MD,kindOf:Uf,kindOfTest:en,endsWith:ND,toArray:DD,forEachEntry:LD,matchAll:BD,isHTMLForm:$D,hasOwnProperty:ox,hasOwnProp:ox,reduceDescriptors:sP,freezeMethods:qD,toObjectSet:HD,toCamelCase:UD,noop:zD,toFiniteNumber:WD,findKey:rP,global:nP,isContextDefined:iP,ALPHABET:oP,generateString:GD,isSpecCompliantForm:VD,toJSONObject:QD,isAsyncFn:KD,isThenable:YD};function me(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}N.inherits(me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:N.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const aP=me.prototype,lP={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{lP[t]={value:t}});Object.defineProperties(me,lP);Object.defineProperty(aP,"isAxiosError",{value:!0});me.from=(t,e,r,n,i,s)=>{const o=Object.create(aP);return N.toFlatObject(t,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),me.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const XD=null;function gy(t){return N.isPlainObject(t)||N.isArray(t)}function uP(t){return N.endsWith(t,"[]")?t.slice(0,-2):t}function lx(t,e,r){return t?t.concat(e).map(function(i,s){return i=uP(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function JD(t){return N.isArray(t)&&!t.some(gy)}const ZD=N.toFlatObject(N,{},null,function(e){return/^is[A-Z]/.test(e)});function Hf(t,e,r){if(!N.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=N.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,w){return!N.isUndefined(w[b])});const n=r.metaTokens,i=r.visitor||c,s=r.dots,o=r.indexes,l=(r.Blob||typeof Blob<"u"&&Blob)&&N.isSpecCompliantForm(e);if(!N.isFunction(i))throw new TypeError("visitor must be a function");function u(v){if(v===null)return"";if(N.isDate(v))return v.toISOString();if(!l&&N.isBlob(v))throw new me("Blob is not supported. Use a Buffer instead.");return N.isArrayBuffer(v)||N.isTypedArray(v)?l&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function c(v,b,w){let p=v;if(v&&!w&&typeof v=="object"){if(N.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=JSON.stringify(v);else if(N.isArray(v)&&JD(v)||(N.isFileList(v)||N.endsWith(b,"[]"))&&(p=N.toArray(v)))return b=uP(b),p.forEach(function(y,x){!(N.isUndefined(y)||y===null)&&e.append(o===!0?lx([b],x,s):o===null?b:b+"[]",u(y))}),!1}return gy(v)?!0:(e.append(lx(w,b,s),u(v)),!1)}const f=[],d=Object.assign(ZD,{defaultVisitor:c,convertValue:u,isVisitable:gy});function g(v,b){if(!N.isUndefined(v)){if(f.indexOf(v)!==-1)throw Error("Circular reference detected in "+b.join("."));f.push(v),N.forEach(v,function(p,m){(!(N.isUndefined(p)||p===null)&&i.call(e,p,N.isString(m)?m.trim():m,b,d))===!0&&g(p,b?b.concat(m):[m])}),f.pop()}}if(!N.isObject(t))throw new TypeError("data must be an object");return g(t),e}function ux(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ow(t,e){this._pairs=[],t&&Hf(t,this,e)}const cP=ow.prototype;cP.append=function(e,r){this._pairs.push([e,r])};cP.toString=function(e){const r=e?function(n){return e.call(this,n,ux)}:ux;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function ej(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function dP(t,e,r){if(!e)return t;const n=r&&r.encode||ej,i=r&&r.serialize;let s;if(i?s=i(e,r):s=N.isURLSearchParams(e)?e.toString():new ow(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class tj{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){N.forEach(this.handlers,function(n){n!==null&&e(n)})}}const cx=tj,fP={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},rj=typeof URLSearchParams<"u"?URLSearchParams:ow,nj=typeof FormData<"u"?FormData:null,ij=typeof Blob<"u"?Blob:null,sj=(()=>{let t;return typeof navigator<"u"&&((t=navigator.product)==="ReactNative"||t==="NativeScript"||t==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),oj=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Vr={isBrowser:!0,classes:{URLSearchParams:rj,FormData:nj,Blob:ij},isStandardBrowserEnv:sj,isStandardBrowserWebWorkerEnv:oj,protocols:["http","https","file","blob","url","data"]};function aj(t,e){return Hf(t,new Vr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Vr.isNode&&N.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function lj(t){return N.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function uj(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&N.isArray(i)?i.length:o,l?(N.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!N.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&N.isArray(i[o])&&(i[o]=uj(i[o])),!a)}if(N.isFormData(t)&&N.isFunction(t.entries)){const r={};return N.forEachEntry(t,(n,i)=>{e(lj(n),i,r,0)}),r}return null}function cj(t,e,r){if(N.isString(t))try{return(e||JSON.parse)(t),N.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const aw={transitional:fP,adapter:["xhr","http"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=N.isObject(e);if(s&&N.isHTMLForm(e)&&(e=new FormData(e)),N.isFormData(e))return i&&i?JSON.stringify(hP(e)):e;if(N.isArrayBuffer(e)||N.isBuffer(e)||N.isStream(e)||N.isFile(e)||N.isBlob(e))return e;if(N.isArrayBufferView(e))return e.buffer;if(N.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return aj(e,this.formSerializer).toString();if((a=N.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Hf(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),cj(e)):e}],transformResponse:[function(e){const r=this.transitional||aw.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&N.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?me.from(a,me.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Vr.classes.FormData,Blob:Vr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};N.forEach(["delete","get","head","post","put","patch"],t=>{aw.headers[t]={}});const lw=aw,dj=N.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"]),fj=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&dj[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},dx=Symbol("internals");function ua(t){return t&&String(t).trim().toLowerCase()}function vc(t){return t===!1||t==null?t:N.isArray(t)?t.map(vc):String(t)}function hj(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const pj=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Em(t,e,r,n,i){if(N.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!N.isString(e)){if(N.isString(n))return e.indexOf(n)!==-1;if(N.isRegExp(n))return n.test(e)}}function mj(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function gj(t,e){const r=N.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}class zf{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,l,u){const c=ua(l);if(!c)throw new Error("header name must be a non-empty string");const f=N.findKey(i,c);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||l]=vc(a))}const o=(a,l)=>N.forEach(a,(u,c)=>s(u,c,l));return N.isPlainObject(e)||e instanceof this.constructor?o(e,r):N.isString(e)&&(e=e.trim())&&!pj(e)?o(fj(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=ua(e),e){const n=N.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return hj(i);if(N.isFunction(r))return r.call(this,i,n);if(N.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ua(e),e){const n=N.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Em(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=ua(o),o){const a=N.findKey(n,o);a&&(!r||Em(n,n[a],a,r))&&(delete n[a],i=!0)}}return N.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||Em(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return N.forEach(this,(i,s)=>{const o=N.findKey(n,s);if(o){r[o]=vc(i),delete r[s];return}const a=e?mj(s):String(s).trim();a!==s&&delete r[s],r[a]=vc(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return N.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&N.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[dx]=this[dx]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=ua(o);n[a]||(gj(i,o),n[a]=!0)}return N.isArray(e)?e.forEach(s):s(e),this}}zf.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);N.reduceDescriptors(zf.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});N.freezeMethods(zf);const fn=zf;function Tm(t,e){const r=this||lw,n=e||r,i=fn.from(n.headers);let s=n.data;return N.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function pP(t){return!!(t&&t.__CANCEL__)}function uu(t,e,r){me.call(this,t??"canceled",me.ERR_CANCELED,e,r),this.name="CanceledError"}N.inherits(uu,me,{__CANCEL__:!0});function yj(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new me("Request failed with status code "+r.status,[me.ERR_BAD_REQUEST,me.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}const vj=Vr.isStandardBrowserEnv?function(){return{write:function(r,n,i,s,o,a){const l=[];l.push(r+"="+encodeURIComponent(n)),N.isNumber(i)&&l.push("expires="+new Date(i).toGMTString()),N.isString(s)&&l.push("path="+s),N.isString(o)&&l.push("domain="+o),a===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(r){const n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function wj(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function _j(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function mP(t,e){return t&&!wj(e)?_j(t,e):e}const bj=Vr.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){const a=N.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function xj(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Sj(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const u=Date.now(),c=n[s];o||(o=u),r[i]=l,n[i]=u;let f=s,d=0;for(;f!==i;)d+=r[f++],f=f%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-o{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-r,l=n(a),u=s<=o;r=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&u?(o-s)/l:void 0,event:i};c[e?"download":"upload"]=!0,t(c)}}const Cj=typeof XMLHttpRequest<"u",Ej=Cj&&function(t){return new Promise(function(r,n){let i=t.data;const s=fn.from(t.headers).normalize(),o=t.responseType;let a;function l(){t.cancelToken&&t.cancelToken.unsubscribe(a),t.signal&&t.signal.removeEventListener("abort",a)}let u;N.isFormData(i)&&(Vr.isStandardBrowserEnv||Vr.isStandardBrowserWebWorkerEnv?s.setContentType(!1):s.getContentType(/^\s*multipart\/form-data/)?N.isString(u=s.getContentType())&&s.setContentType(u.replace(/^\s*(multipart\/form-data);+/,"$1")):s.setContentType("multipart/form-data"));let c=new XMLHttpRequest;if(t.auth){const v=t.auth.username||"",b=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(v+":"+b))}const f=mP(t.baseURL,t.url);c.open(t.method.toUpperCase(),dP(f,t.params,t.paramsSerializer),!0),c.timeout=t.timeout;function d(){if(!c)return;const v=fn.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),w={data:!o||o==="text"||o==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:v,config:t,request:c};yj(function(m){r(m),l()},function(m){n(m),l()},w),c=null}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){c&&(n(new me("Request aborted",me.ECONNABORTED,t,c)),c=null)},c.onerror=function(){n(new me("Network Error",me.ERR_NETWORK,t,c)),c=null},c.ontimeout=function(){let b=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const w=t.transitional||fP;t.timeoutErrorMessage&&(b=t.timeoutErrorMessage),n(new me(b,w.clarifyTimeoutError?me.ETIMEDOUT:me.ECONNABORTED,t,c)),c=null},Vr.isStandardBrowserEnv){const v=(t.withCredentials||bj(f))&&t.xsrfCookieName&&vj.read(t.xsrfCookieName);v&&s.set(t.xsrfHeaderName,v)}i===void 0&&s.setContentType(null),"setRequestHeader"in c&&N.forEach(s.toJSON(),function(b,w){c.setRequestHeader(w,b)}),N.isUndefined(t.withCredentials)||(c.withCredentials=!!t.withCredentials),o&&o!=="json"&&(c.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&c.addEventListener("progress",fx(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",fx(t.onUploadProgress)),(t.cancelToken||t.signal)&&(a=v=>{c&&(n(!v||v.type?new uu(null,t,c):v),c.abort(),c=null)},t.cancelToken&&t.cancelToken.subscribe(a),t.signal&&(t.signal.aborted?a():t.signal.addEventListener("abort",a)));const g=xj(f);if(g&&Vr.protocols.indexOf(g)===-1){n(new me("Unsupported protocol "+g+":",me.ERR_BAD_REQUEST,t));return}c.send(i||null)})},yy={http:XD,xhr:Ej};N.forEach(yy,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const hx=t=>`- ${t}`,Tj=t=>N.isFunction(t)||t===null||t===!1,gP={getAdapter:t=>{t=N.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : `+s.map(hx).join(` -`):" "+hx(s[0]):"as no adapter specified";throw new me("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:yy};function km(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new uu(null,t)}function px(t){return km(t),t.headers=fn.from(t.headers),t.data=Tm.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),gP.getAdapter(t.adapter||lw.adapter)(t).then(function(n){return km(t),n.data=Tm.call(t,t.transformResponse,n),n.headers=fn.from(n.headers),n},function(n){return pP(n)||(km(t),n&&n.response&&(n.response.data=Tm.call(t,t.transformResponse,n.response),n.response.headers=fn.from(n.response.headers))),Promise.reject(n)})}const mx=t=>t instanceof fn?t.toJSON():t;function jo(t,e){e=e||{};const r={};function n(u,c,f){return N.isPlainObject(u)&&N.isPlainObject(c)?N.merge.call({caseless:f},u,c):N.isPlainObject(c)?N.merge({},c):N.isArray(c)?c.slice():c}function i(u,c,f){if(N.isUndefined(c)){if(!N.isUndefined(u))return n(void 0,u,f)}else return n(u,c,f)}function s(u,c){if(!N.isUndefined(c))return n(void 0,c)}function o(u,c){if(N.isUndefined(c)){if(!N.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function a(u,c,f){if(f in e)return n(u,c);if(f in t)return n(void 0,u)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials: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:a,headers:(u,c)=>i(mx(u),mx(c),!0)};return N.forEach(Object.keys(Object.assign({},t,e)),function(c){const f=l[c]||i,d=f(t[c],e[c],c);N.isUndefined(d)&&f!==a||(r[c]=d)}),r}const yP="1.5.1",uw={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{uw[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const gx={};uw.transitional=function(e,r,n){function i(s,o){return"[Axios v"+yP+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new me(i(o," has been removed"+(r?" in "+r:"")),me.ERR_DEPRECATED);return r&&!gx[o]&&(gx[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Tj(t,e,r){if(typeof t!="object")throw new me("options must be an object",me.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],l=a===void 0||o(a,s,t);if(l!==!0)throw new me("option "+s+" must be "+l,me.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new me("Unknown option "+s,me.ERR_BAD_OPTION)}}const vy={assertOptions:Tj,validators:uw},Rn=vy.validators;class md{constructor(e){this.defaults=e,this.interceptors={request:new cx,response:new cx}}request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=jo(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&vy.assertOptions(n,{silentJSONParsing:Rn.transitional(Rn.boolean),forcedJSONParsing:Rn.transitional(Rn.boolean),clarifyTimeoutError:Rn.transitional(Rn.boolean)},!1),i!=null&&(N.isFunction(i)?r.paramsSerializer={serialize:i}:vy.assertOptions(i,{encode:Rn.function,serialize:Rn.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&N.merge(s.common,s[r.method]);s&&N.forEach(["delete","get","head","post","put","patch","common"],v=>{delete s[v]}),r.headers=fn.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(r)===!1||(l=l&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let c,f=0,d;if(!l){const v=[px.bind(this),void 0];for(v.unshift.apply(v,a),v.push.apply(v,u),d=v.length,c=Promise.resolve(r);f{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new uu(s,o,a),r(n.reason))})}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;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new cw(function(i){e=i}),cancel:e}}}const kj=cw;function Pj(t){return function(r){return t.apply(null,r)}}function Aj(t){return N.isObject(t)&&t.isAxiosError===!0}const wy={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(wy).forEach(([t,e])=>{wy[e]=t});const Ij=wy;function vP(t){const e=new wc(t),r=Zk(wc.prototype.request,e);return N.extend(r,wc.prototype,e,{allOwnKeys:!0}),N.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return vP(jo(t,i))},r}const Ve=vP(lw);Ve.Axios=wc;Ve.CanceledError=uu;Ve.CancelToken=kj;Ve.isCancel=pP;Ve.VERSION=yP;Ve.toFormData=Hf;Ve.AxiosError=me;Ve.Cancel=Ve.CanceledError;Ve.all=function(e){return Promise.all(e)};Ve.spread=Pj;Ve.isAxiosError=Aj;Ve.mergeConfig=jo;Ve.AxiosHeaders=fn;Ve.formToJSON=t=>hP(N.isHTMLForm(t)?new FormData(t):t);Ve.getAdapter=gP.getAdapter;Ve.HttpStatusCode=Ij;Ve.default=Ve;const Wf=Ve,Oj=Wf.create({baseURL:"https://slime2.stream/api"});function dw(t){const{keys:e,platforms:r}=wn(),n=e[t],[i,s]=I.useState(!1),o=t==="google"?"youtube":t,a=r.includes(o);return I.useEffect(()=>{function l(){s(!0)}return addEventListener("slime2:ready",l),()=>{removeEventListener("slime2:ready",l)}},[]),xi({enabled:i,queryKey:[t,a,"accessToken",n||null],queryFn:async()=>{if(!a)throw Error("Not an actual error");return wP(t,n)},...ys})}async function wP(t,e){if(!e)throw new _P(`Key not found for platform ${t}`);return Oj.get(`/auth/${t}/token`,{headers:{Authorization:`Bearer ${e}`}}).then(r=>r.data.token).catch(r=>{const n=`Invalid key for platform ${t}, download a new one from https://slime2.stream/account`;throw console.error(n,r),new bP(`Invalid key for platform ${t}, download a new one from https://slime2.stream/account`,{cause:r})})}class _P extends Error{constructor(e,r){super(e,r),this.name="KeyNotFoundError"}}class bP extends Error{constructor(e,r){super(e,r),this.name="KeyInvalidError"}}class Rj extends Zr{}class Mj extends qv{async doRequest({options:e,clientId:r,accessToken:n,authorizationType:i,fetchOptions:s}){return await jf(e,r,n,i,s)}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){const{headers:r}=e;return{limit:+r.get("ratelimit-limit"),remaining:+r.get("ratelimit-remaining"),resetsAt:+r.get("ratelimit-reset")*1e3}}}var xP={};function pr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,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))}var Nj=pr;pr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};pr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};pr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};pr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};pr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};pr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};pr.prototype.start=pr.prototype.try;pr.prototype.errors=function(){return this._errors};pr.prototype.attempts=function(){return this._attempts};pr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n=r&&(e=i,r=o)}return e};(function(t){var e=Nj;t.operation=function(r){var n=t.timeouts(r);return new e(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(r){if(r instanceof Array)return[].concat(r);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var i in r)n[i]=r[i];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],o=0;onew gd(e,this._client))}get totalCount(){return this[h].total}};C([K(!1)],pl.prototype,"_client",void 0);C([Se()],pl.prototype,"entries",null);pl=C([au,L("api","HelixBitsLeaderboard")],pl);let _y=class extends Z{constructor(e){super(IE(e,r=>r.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,r,n){e=e.toLowerCase();const{background:i,state:s,scale:o}=n,{tiers:a}=this[h][e],l=a.sort((u,c)=>c.min_bits-u.min_bits).find(u=>u.min_bits<=r);if(!l)throw new wi(`Cheermote "${e}" does not have an applicable tier for ${r} bits`);return{url:l.images[i][s][o],color:l.color}}getPossibleNames(){return Object.keys(this[h])}};_y=C([L("api","HelixCheermoteList")],_y);let by=class extends Ae{async getLeaderboard(e,r={}){const n=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:E(e),scopes:["bits:read"],query:jj(r)});return new pl(n,this._client)}async getCheermotes(e){const r=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:Xr(e,E),query:Xr(e,_e)});return new _y(r.data)}};by=C([L("api","HelixBitsApi")],by);function Lj(t){var e;return{game_id:t.gameId,broadcaster_language:t.language,title:t.title,delay:(e=t.delay)===null||e===void 0?void 0:e.toString(),tags:t.tags,content_classification_labels:t.contentClassificationLabels,is_branded_content:t.isBrandedContent}}function Bj(t,e){return{broadcaster_id:E(t),length:e}}function yx(t,e){return{broadcaster_id:E(t),user_id:E(e)}}function Pm(t,e){return{broadcaster_id:E(t),user_id:Xr(e,E)}}function vx(t,e){return{broadcaster_id:Xr(e,E),user_id:E(t)}}function He(t,e){return{[t]:e}}function wx(t){return{user_id:E(t)}}function SP(t,e){return{broadcaster_id:t,moderator_id:e}}function Gf(t,e){return{broadcaster_id:E(t),id:e}}function CP(t,e){return{broadcaster_id:E(t),user_id:e.map(E)}}let ns=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].user_id}get name(){return this[h].user_login}get displayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],ns.prototype,"_client",void 0);ns=C([L("api","HelixUserRelation","id")],ns);class ur{constructor(e,r,n,i,s,o=100){this._callOptions=e,this._queryParamName=r,this._matchKey=n,this._mapper=s,this._limitPerRequest=o,this._requestedIds=[],this._requestResolversById=new Map,this._waitTimer=null,this._client=i,this._delay=i._batchDelay}async request(e){const{promise:r,resolve:n,reject:i}=ul();return this._requestedIds.includes(e)||this._requestedIds.push(e),this._requestResolversById.has(e)?this._requestResolversById.get(e).push({resolve:n,reject:i}):this._requestResolversById.set(e,[{resolve:n,reject:i}]),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 r}async _handleBatch(e){var r;try{const{data:n}=await this._doRequest(e),i=IE(n,this._matchKey);for(const s of e){for(const o of(r=this._requestResolversById.get(s))!==null&&r!==void 0?r:[])Object.prototype.hasOwnProperty.call(i,s)?o.resolve(this._mapper(i[s])):o.resolve(null);this._requestResolversById.delete(s)}}catch{await Promise.all(e.map(async i=>{var s,o;try{const a=await this._doRequest([i]);for(const l of(s=this._requestResolversById.get(i))!==null&&s!==void 0?s:[])l.resolve(a.data.length?this._mapper(a.data[0]):null)}catch(a){for(const l of(o=this._requestResolversById.get(i))!==null&&o!==void 0?o:[])l.reject(a)}this._requestResolversById.delete(i)}))}}async _doRequest(e){return await this._client.callApi({type:"helix",...this._callOptions,query:{...this._callOptions.query,[this._queryParamName]:e}})}}C([K(!1)],ur.prototype,"_client",void 0);var Am;Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(Am=Symbol.asyncIterator)!==null&&Am!==void 0?Am:Symbol.for("Symbol.asyncIterator"));let Me=class{constructor(e,r,n,i=100){this._callOptions=e,this._mapper=n,this._limitPerPage=i,this._isFinished=!1,this._client=r}get current(){var e;return(e=this._currentData)===null||e===void 0?void 0:e.data}async getNext(){var e;if(this._isFinished)return[];const r=await this._fetchData();return!((e=r.data)===null||e===void 0)&&e.length?this._processResult(r):(this._isFinished=!0,[])}async getAll(){this.reset();const e=[];do{const r=await this.getNext();if(!r.length)break;e.push(...r)}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();;){const 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){return this._currentCursor=e.pagination?e.pagination.cursor:void 0,this._currentCursor===void 0&&(this._isFinished=!0),this._currentData=e,e.data.reduce((r,n)=>{const i=this._mapper(n);return Array.isArray(i)?[...r,...i]:[...r,i]},[])}};C([K(!1)],Me.prototype,"_client",void 0);Me=C([L("api","HelixPaginatedRequest")],Me);let hs=class extends Me{async getTotalCount(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total}};hs=C([L("api","HelixPaginatedRequestWithTotal")],hs);function Ge(t,e,r){var n;let i;return{get data(){var s,o;return i??(i=(o=(s=t.data)===null||s===void 0?void 0:s.map(a=>new e(a,r)))!==null&&o!==void 0?o:[])},cursor:(n=t.pagination)===null||n===void 0?void 0:n.cursor}}function ei(t,e,r){let n;return{get data(){var i,s;return n??(n=(s=(i=t.data)===null||i===void 0?void 0:i.map(o=>new e(o,r)))!==null&&s!==void 0?s:[])},cursor:t.pagination.cursor,total:t.total}}function ve({after:t,before:e,limit:r}={}){return{after:t,before:e,first:r==null?void 0:r.toString()}}let uo=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].broadcaster_id}get name(){return this[h].broadcaster_login}get displayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get language(){return this[h].broadcaster_language}get gameId(){return this[h].game_id}get gameName(){return this[h].game_name}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get title(){return this[h].title}get delay(){return this[h].delay}get tags(){return this[h].tags}get contentClassificationLabels(){return this[h].content_classification_labels}get isBrandedContent(){return this[h].is_branded_content}};C([K(!1)],uo.prototype,"_client",void 0);uo=C([L("api","HelixChannel","id")],uo);let yd=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get creationDate(){return new Date(this[h].created_at)}};C([K(!1)],yd.prototype,"_client",void 0);yd=C([L("api","HelixChannelEditor","userId")],yd);let ml=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get followDate(){return new Date(this[h].followed_at)}};C([K(!1)],ml.prototype,"_client",void 0);ml=C([L("api","HelixChannelFollower","userId")],ml);let gl=class extends Z{constructor(e,r){super(e),this._client=r}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get followDate(){return new Date(this[h].followed_at)}};C([K(!1)],gl.prototype,"_client",void 0);gl=C([L("api","HelixFollowedChannel","broadcasterId")],gl);let vd=class extends Ae{constructor(){super(...arguments),this._getChannelByIdBatcher=new ur({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new uo(e,this._client))}async getChannelInfoById(e){const r=E(e),n=await this._client.callApi({type:"helix",url:"channels",userId:r,query:_e(r)});return hr(n.data[0],i=>new uo(i,this._client))}async getChannelInfoByIdBatched(e){return await this._getChannelByIdBatcher.request(E(e))}async getChannelInfoByIds(e){const r=e.map(E);return(await this._client.callApi({type:"helix",url:"channels",query:He("broadcaster_id",r)})).data.map(i=>new uo(i,this._client))}async updateChannelInfo(e,r){await this._client.callApi({type:"helix",url:"channels",method:"PATCH",userId:E(e),scopes:["channel:manage:broadcast"],query:_e(e),jsonBody:Lj(r)})}async startChannelCommercial(e,r){await this._client.callApi({type:"helix",url:"channels/commercial",method:"POST",userId:E(e),scopes:["channel:edit:commercial"],jsonBody:Bj(e,r)})}async getChannelEditors(e){return(await this._client.callApi({type:"helix",url:"channels/editors",userId:E(e),scopes:["channel:read:editors"],query:_e(e)})).data.map(n=>new yd(n,this._client))}async getVips(e,r){const n=await this._client.callApi({type:"helix",url:"channels/vips",userId:E(e),scopes:["channel:read:vips","channel:manage:vips"],query:{..._e(e),...ve(r)}});return Ge(n,ns,this._client)}getVipsPaginated(e){return new Me({url:"channels/vips",userId:E(e),scopes:["channel:read:vips","channel:manage:vips"],query:_e(e)},this._client,r=>new ns(r,this._client))}async checkVipForUsers(e,r){return(await this._client.callApi({type:"helix",url:"channels/vips",userId:E(e),scopes:["channel:read:vips","channel:manage:vips"],query:CP(e,r)})).data.map(i=>new ns(i,this._client))}async checkVipForUser(e,r){const n=E(r);return(await this.checkVipForUsers(e,[n])).some(s=>s.id===n)}async addVip(e,r){await this._client.callApi({type:"helix",url:"channels/vips",method:"POST",userId:E(e),scopes:["channel:manage:vips"],query:yx(e,r)})}async removeVip(e,r){await this._client.callApi({type:"helix",url:"channels/vips",method:"DELETE",userId:E(e),scopes:["channel:manage:vips"],query:yx(e,r)})}async getChannelFollowerCount(e){return(await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:E(e),query:{...Pm(e),...ve({limit:1})}})).total}async getChannelFollowers(e,r,n){const i=await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:E(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:{...Pm(e,r),...ve(n)}});return ei(i,ml,this._client)}getChannelFollowersPaginated(e){return new hs({url:"channels/followers",method:"GET",userId:E(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:Pm(e)},this._client,r=>new ml(r,this._client))}async getFollowedChannels(e,r,n){const i=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:E(e),scopes:["user:read:follows"],query:{...vx(e,r),...ve(n)}});return ei(i,gl,this._client)}getFollowedChannelsPaginated(e,r){return new hs({url:"channels/followed",method:"GET",userId:E(e),scopes:["user:read:follows"],query:vx(e,r)},this._client,n=>new gl(n,this._client))}};C([K(!1)],vd.prototype,"_getChannelByIdBatcher",void 0);vd=C([L("api","HelixChannelApi")],vd);function $j(t,e){return{broadcaster_id:E(t),only_manageable_rewards:e==null?void 0:e.toString()}}function _x(t,e){return{broadcaster_id:E(t),id:e}}function bx(t){var e,r,n;const i={title:t.title,cost:t.cost,prompt:t.prompt,background_color:t.backgroundColor,is_enabled:t.isEnabled,is_user_input_required:t.userInputRequired,should_redemptions_skip_request_queue:t.autoFulfill};return t.maxRedemptionsPerStream!==void 0&&(i.is_max_per_stream_enabled=!!t.maxRedemptionsPerStream,i.max_per_stream=(e=t.maxRedemptionsPerStream)!==null&&e!==void 0?e:0),t.maxRedemptionsPerUserPerStream!==void 0&&(i.is_max_per_user_per_stream_enabled=!!t.maxRedemptionsPerUserPerStream,i.max_per_user_per_stream=(r=t.maxRedemptionsPerUserPerStream)!==null&&r!==void 0?r:0),t.globalCooldown!==void 0&&(i.is_global_cooldown_enabled=!!t.globalCooldown,i.global_cooldown_seconds=(n=t.globalCooldown)!==null&&n!==void 0?n:0),"isPaused"in t&&(i.is_paused=t.isPaused),i}function xx(t,e,r){return{broadcaster_id:E(t),reward_id:e,id:r}}function Sx(t,e,r,n){return{broadcaster_id:E(t),reward_id:e,status:r,sort:n.newestFirst?"NEWEST":"OLDEST"}}let Bi=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}getImageUrl(e){var r,n;const i=`url_${e}x`;return(n=(r=this[h].image)===null||r===void 0?void 0:r[i])!==null&&n!==void 0?n:this[h].default_image[i]}get backgroundColor(){return this[h].background_color}get isEnabled(){return this[h].is_enabled}get cost(){return this[h].cost}get title(){return this[h].title}get prompt(){return this[h].prompt}get userInputRequired(){return this[h].is_user_input_required}get maxRedemptionsPerStream(){return this[h].max_per_stream_setting.is_enabled?this[h].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[h].max_per_user_per_stream_setting.is_enabled?this[h].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[h].global_cooldown_setting.is_enabled?this[h].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[h].is_paused}get isInStock(){return this[h].is_in_stock}get redemptionsThisStream(){return this[h].redemptions_redeemed_current_stream}get autoFulfill(){return this[h].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[h].cooldown_expires_at?new Date(this[h].cooldown_expires_at):null}};C([K(!1)],Bi.prototype,"_client",void 0);Bi=C([L("api","HelixCustomReward","id")],Bi);let $i=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get userInput(){return this[h].user_input}get isFulfilled(){return this[h].status==="FULFILLED"}get isCanceled(){return this[h].status==="CANCELED"}get redemptionDate(){return new Date(this[h].redeemed_at)}get rewardId(){return this[h].reward.id}get rewardTitle(){return this[h].reward.title}get rewardPrompt(){return this[h].reward.prompt}get rewardCost(){return this[h].reward.cost}async getReward(){return ne(await this._client.channelPoints.getCustomRewardById(this[h].broadcaster_id,this[h].reward.id))}async updateStatus(e){return(await this._client.channelPoints.updateRedemptionStatusByIds(this[h].broadcaster_id,this[h].reward.id,[this[h].id],e))[0]}};C([K(!1)],$i.prototype,"_client",void 0);$i=C([L("api","HelixCustomRewardRedemption","id")],$i);let xy=class extends Ae{async getCustomRewards(e,r){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:$j(e,r)})).data.map(i=>new Bi(i,this._client))}async getCustomRewardsByIds(e,r){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:Gf(e,r)})).data.map(i=>new Bi(i,this._client)):[]}async getCustomRewardById(e,r){const n=await this.getCustomRewardsByIds(e,[r]);return n.length?n[0]:null}async createCustomReward(e,r){const n=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"POST",userId:E(e),scopes:["channel:manage:redemptions"],query:_e(e),jsonBody:bx(r)});return new Bi(n.data[0],this._client)}async updateCustomReward(e,r,n){const i=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"PATCH",userId:E(e),scopes:["channel:manage:redemptions"],query:_x(e,r),jsonBody:bx(n)});return new Bi(i.data[0],this._client)}async deleteCustomReward(e,r){await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"DELETE",userId:E(e),scopes:["channel:manage:redemptions"],query:_x(e,r)})}async getRedemptionsByIds(e,r,n){return n.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:xx(e,r,n)})).data.map(s=>new $i(s,this._client)):[]}async getRedemptionById(e,r,n){const i=await this.getRedemptionsByIds(e,r,[n]);return i.length?i[0]:null}async getRedemptionsForBroadcaster(e,r,n,i){const s=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...Sx(e,r,n,i),...ve(i)}});return Ge(s,$i,this._client)}getRedemptionsForBroadcasterPaginated(e,r,n,i){return new Me({url:"channel_points/custom_rewards/redemptions",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:Sx(e,r,n,i)},this._client,s=>new $i(s,this._client),50)}async updateRedemptionStatusByIds(e,r,n,i){return n.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",method:"PATCH",userId:E(e),scopes:["channel:manage:redemptions"],query:xx(e,r,n),jsonBody:{status:i}})).data.map(o=>new $i(o,this._client)):[]}};xy=C([L("api","HelixChannelPointsApi")],xy);let yl=class extends Z{get value(){return this[h].value}get decimalPlaces(){return this[h].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[h].currency}};yl=C([L("api","HelixCharityCampaignAmount")],yl);let wd=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get charityName(){return this[h].charity_name}get charityDescription(){return this[h].charity_description}get charityLogo(){return this[h].charity_logo}get charityWebsite(){return this[h].charity_website}get currentAmount(){return new yl(this[h].current_amount)}get targetAmount(){return new yl(this[h].target_amount)}};C([K(!1)],wd.prototype,"_client",void 0);wd=C([L("api","HelixCharityCampaign","id")],wd);let _d=class extends Z{constructor(e,r){super(e),this._client=r}get campaignId(){return this[h].campaign_id}get donorId(){return this[h].user_id}get donorName(){return this[h].user_login}get donorDisplayName(){return this[h].user_name}async getDonor(){return ne(await this._client.users.getUserById(this[h].user_id))}get amount(){return new yl(this[h].amount)}};C([K(!1)],_d.prototype,"_client",void 0);_d=C([L("api","HelixCharityCampaignDonation")],_d);let Sy=class extends Ae{async getCharityCampaign(e){const r=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:E(e),scopes:["channel:read:charity"],query:_e(e)});return new wd(r.data[0],this._client)}async getCharityCampaignDonations(e,r){const n=await this._client.callApi({type:"helix",url:"charity/donations",userId:E(e),scopes:["channel:read:charity"],query:{..._e(e),...ve(r)}});return Ge(n,_d,this._client)}};Sy=C([L("api","HelixCharityApi")],Sy);function Uj(t){return{slow_mode:t.slowModeEnabled,slow_mode_wait_time:t.slowModeDelay,follower_mode:t.followerOnlyModeEnabled,follower_mode_duration:t.followerOnlyModeDelay,subscriber_mode:t.subscriberOnlyModeEnabled,emote_mode:t.emoteOnlyModeEnabled,unique_chat_mode:t.uniqueChatModeEnabled,non_moderator_chat_delay:t.nonModeratorChatDelayEnabled,non_moderator_chat_delay_duration:t.nonModeratorChatDelay}}function Fj(t,e){return{user_id:E(t),color:e}}function qj(t,e,r){return{from_broadcaster_id:E(t),to_broadcaster_id:E(e),moderator_id:r}}let vl=class extends Z{get id(){return this[h].id}get name(){return this[h].name}get formats(){return this[h].format}get scales(){return this[h].scale}get themeModes(){return this[h].theme_mode}getImageUrl(e){return this[h].images[`url_${e}x`]}getStaticImageUrl(e="1.0",r="light"){return this[h].format.includes("static")&&this[h].scale.includes(e)?this.getFormattedImageUrl(e,"static",r):null}getAnimatedImageUrl(e="1.0",r="light"){return this[h].format.includes("animated")&&this[h].scale.includes(e)?this.getFormattedImageUrl(e,"animated",r):null}getFormattedImageUrl(e="1.0",r="static",n="light"){return`https://static-cdn.jtvnw.net/emoticons/v2/${this[h].id}/${r}/${n}/${e}`}};vl=C([L("api","HelixEmote","id")],vl);let bd=class extends vl{constructor(e,r){super(e),this._client=r}get tier(){return this[h].tier||null}get type(){return this[h].emote_type}get emoteSetId(){return this[h].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[h].emote_set_id])}};C([K(!1)],bd.prototype,"_client",void 0);bd=C([L("api","HelixChannelEmote","id")],bd);let Cy=class extends Z{get id(){return this[h].id}getImageUrl(e){return this[h][`image_url_${e}x`]}get title(){return this[h].title}get description(){return this[h].description}get clickAction(){return this[h].click_action}get clickUrl(){return this[h].click_url}};Cy=C([L("api","HelixChatBadgeVersion","id")],Cy);let wl=class extends Z{get id(){return this[h].set_id}get versions(){return this[h].versions.map(e=>new Cy(e))}getVersion(e){var r;return(r=this.versions.find(n=>n.id===e))!==null&&r!==void 0?r:null}};C([Se()],wl.prototype,"versions",null);wl=C([au,L("api","HelixChatBadgeSet","id")],wl);let _l=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],_l.prototype,"_client",void 0);_l=C([L("api","HelixChatChatter")],_l);let xd=class extends Z{get broadcasterId(){return this[h].broadcaster_id}get slowModeEnabled(){return this[h].slow_mode}get slowModeDelay(){return this[h].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[h].follower_mode}get followerOnlyModeDelay(){return this[h].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[h].subscriber_mode}get emoteOnlyModeEnabled(){return this[h].emote_mode}get uniqueChatModeEnabled(){return this[h].unique_chat_mode}};xd=C([L("api","HelixChatSettings","broadcasterId")],xd);let Sd=class extends vl{constructor(e,r){super(e),this._client=r}get type(){return this[h].emote_type}get emoteSetId(){return this[h].emote_set_id}get ownerId(){switch(this[h].owner_id){case"0":case"twitch":return null;default:return this[h].owner_id}}async getOwner(){switch(this[h].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[h].owner_id)}}};C([K(!1)],Sd.prototype,"_client",void 0);Sd=C([L("api","HelixEmoteFromSet","id")],Sd);let Cd=class extends xd{get nonModeratorChatDelayEnabled(){return this[h].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[h].non_moderator_chat_delay_duration}};Cd=C([L("api","HelixPrivilegedChatSettings","broadcasterId")],Cd);let Ey=class extends Ae{async getChatters(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"chat/chatters",userId:n,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:{...this._createModeratorActionQuery(n),...ve(r)}});return ei(i,_l,this._client)}getChattersPaginated(e){const r=E(e);return new hs({url:"chat/chatters",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(r)},this._client,n=>new _l(n,this._client))}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(r=>new wl(r))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:E(e),query:_e(e)})).data.map(n=>new wl(n))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(r=>new vl(r))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:E(e),query:_e(e)})).data.map(n=>new bd(n,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:He("emote_set_id",e)})).data.map(n=>new Sd(n,this._client))}async getSettings(e){const r=await this._client.callApi({type:"helix",url:"chat/settings",userId:E(e),query:_e(e)});return new xd(r.data[0])}async getSettingsPrivileged(e){const r=E(e),n=await this._client.callApi({type:"helix",url:"chat/settings",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:read:chat_settings"],query:this._createModeratorActionQuery(r)});return new Cd(n.data[0])}async updateSettings(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"chat/settings",method:"PATCH",userId:n,canOverrideScopedUserContext:!0,scopes:["moderator:manage:chat_settings"],query:this._createModeratorActionQuery(n),jsonBody:Uj(r)});return new Cd(i.data[0])}async sendAnnouncement(e,r){const n=E(e);await this._client.callApi({type:"helix",url:"chat/announcements",method:"POST",userId:n,canOverrideScopedUserContext:!0,scopes:["moderator:manage:announcements"],query:this._createModeratorActionQuery(n),jsonBody:{message:r.message,color:r.color}})}async getColorsForUsers(e){const r=await this._client.callApi({type:"helix",url:"chat/color",query:He("user_id",e.map(E))});return new Map(r.data.map(n=>[n.user_id,n.color||null]))}async getColorForUser(e){const r=await this._client.callApi({type:"helix",url:"chat/color",userId:E(e),query:He("user_id",E(e))});if(r.data.length)return r.data[0].color||null}async setColorForUser(e,r){await this._client.callApi({type:"helix",url:"chat/color",method:"PUT",userId:E(e),scopes:["user:manage:chat_color"],query:Fj(e,r)})}async shoutoutUser(e,r){const n=E(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:n,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:qj(e,r,this._getUserContextIdWithDefault(n))})}_createModeratorActionQuery(e){return SP(e,this._getUserContextIdWithDefault(e))}};Ey=C([L("api","HelixChatApi")],Ey);function Hj(t,e){return{broadcaster_id:E(t),has_delay:e.toString()}}function Cx(t){const{filterType:e,ids:r,startDate:n,endDate:i,isFeatured:s}=t;return{[e]:r,started_at:n,ended_at:i,is_featured:s==null?void 0:s.toString()}}let co=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get url(){return this[h].url}get embedUrl(){return this[h].embed_url}get broadcasterId(){return this[h].broadcaster_id}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get creatorId(){return this[h].creator_id}get creatorDisplayName(){return this[h].creator_name}async getCreator(){return ne(await this._client.users.getUserById(this[h].creator_id))}get videoId(){return this[h].video_id}async getVideo(){return ne(await this._client.videos.getVideoById(this[h].video_id))}get gameId(){return this[h].game_id}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get language(){return this[h].language}get title(){return this[h].title}get views(){return this[h].view_count}get creationDate(){return new Date(this[h].created_at)}get thumbnailUrl(){return this[h].thumbnail_url}get duration(){return this[h].duration}get vodOffset(){return this[h].vod_offset}get isFeatured(){return this[h].is_featured}};C([K(!1)],co.prototype,"_client",void 0);co=C([L("api","HelixClip","id")],co);let Ed=class extends Ae{constructor(){super(...arguments),this._getClipByIdBatcher=new ur({url:"clips"},"id","id",this._client,e=>new co(e,this._client))}async getClipsForBroadcaster(e,r={}){return await this._getClips({...r,filterType:"broadcaster_id",ids:E(e),userId:E(e)})}getClipsForBroadcasterPaginated(e,r={}){return this._getClipsPaginated({...r,filterType:"broadcaster_id",ids:E(e),userId:E(e)})}async getClipsForGame(e,r={}){return await this._getClips({...r,filterType:"game_id",ids:e})}getClipsForGamePaginated(e,r={}){return this._getClipsPaginated({...r,filterType:"game_id",ids:e})}async getClipsByIds(e){return(await this._getClips({filterType:"id",ids:e})).data}async getClipById(e){const r=await this.getClipsByIds([e]);return r.length?r[0]:null}async getClipByIdBatched(e){return await this._getClipByIdBatcher.request(e)}async createClip(e){const{channel:r,createAfterDelay:n=!1}=e;return(await this._client.callApi({type:"helix",url:"clips",method:"POST",userId:E(r),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:Hj(r,n)})).data[0].id}async _getClips(e){if(!e.ids.length)return{data:[]};const r=await this._client.callApi({type:"helix",url:"clips",userId:e.userId,query:{...Cx(e),...ve(e)}});return Ge(r,co,this._client)}_getClipsPaginated(e){return new Me({url:"clips",userId:e.userId,query:Cx(e)},this._client,r=>new co(r,this._client))}};C([K(!1)],Ed.prototype,"_getClipByIdBatcher",void 0);Ed=C([L("api","HelixClipApi")],Ed);class zj extends Z{get id(){return this[h].id}get name(){return this[h].name}get description(){return this[h].description}}let Ty=class extends Ae{async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(n=>new zj(n))}};Ty=C([L("api","HelixContentClassificationLabelApi")],Ty);function Ex(t,e){return{user_id:e?Xr(t.user,E):void 0,game_id:t.gameId,fulfillment_status:t.fulfillmentStatus}}function Wj(t,e){return{fulfillment_status:e,entitlement_ids:t}}let Ui=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get rewardId(){return this[h].benefit_id}get grantDate(){return new Date(this[h].timestamp)}get userId(){return this[h].user_id}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get gameId(){return this[h].game_id}async getGame(){return ne(await this._client.games.getGameById(this[h].game_id))}get fulfillmentStatus(){return this[h].fulfillment_status}get updateDate(){return new Date(this[h].last_updated)}};C([K(!1)],Ui.prototype,"_client",void 0);Ui=C([L("api","HelixDropsEntitlement")],Ui);let Td=class extends Ae{constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new ur({url:"entitlements/drops"},"id","id",this._client,e=>new Ui(e,this._client))}async getDropsEntitlements(e,r=!1){const n=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:Xr(e.user,E),forceType:e.user&&r?"app":void 0,query:{...Ex(e,r),...ve(e)}});return Ge(n,Ui,this._client)}getDropsEntitlementsPaginated(e,r=!1){return new Me({url:"entitlements/drops",userId:Xr(e.user,E),forceType:e.user&&r?"app":void 0,query:Ex(e,r)},this._client,n=>new Ui(n,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(n=>new Ui(n,this._client))}async getDropsEntitlementById(e){var r;return(r=(await this.getDropsEntitlementsByIds([e]))[0])!==null&&r!==void 0?r:null}async getDropsEntitlementByIdBatched(e){return await this._getDropsEntitlementByIdBatcher.request(e)}async updateDropsEntitlements(e,r){const n=await this._client.callApi({type:"helix",url:"entitlements/drops",method:"PATCH",jsonBody:Wj(e,r)});return new Map(n.data.flatMap(i=>i.ids.map(s=>[s,i.status])))}};C([K(!1)],Td.prototype,"_getDropsEntitlementByIdBatcher",void 0);Td=C([L("api","HelixEntitlementApi")],Td);function pe(t){return{broadcaster_user_id:E(t)}}function Wu(t,e){return{broadcaster_user_id:E(t),reward_id:e}}function ca(t,e){return{broadcaster_user_id:t,moderator_user_id:e}}function Gj(t){return{organization_id:t.organizationId,category_id:t.categoryId,campaign_id:t.campaignId}}let ln=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get status(){return this[h].status}get type(){return this[h].type}get cost(){return this[h].cost}get condition(){return this[h].condition}get creationDate(){return new Date(this[h].created_at)}async unsubscribe(){await this._client.eventSub.deleteSubscription(this[h].id)}get _transport(){return this[h].transport}set _status(e){this[h].status=e}};C([K(!1)],ln.prototype,"_client",void 0);ln=C([L("api","HelixEventSubSubscription","id")],ln);let Qs=class extends hs{constructor(e,r,n){super({url:"eventsub/subscriptions",userId:r,query:e},n,i=>new ln(i,n))}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}};Qs=C([L("api","HelixPaginatedEventSubSubscriptionsRequest")],Qs);let ky=class extends Ae{async getSubscriptions(e){const r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:ve(e)});return{...ei(r,ln,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsPaginated(){return new Qs({},void 0,this._client)}async getSubscriptionsForStatus(e,r){const n=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...ve(r),status:e}});return{...ei(n,ln,this._client),totalCost:n.total_cost,maxTotalCost:n.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new Qs({status:e},void 0,this._client)}async getSubscriptionsForType(e,r){const n=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...ve(r),type:e}});return{...ei(n,ln,this._client),totalCost:n.total_cost,maxTotalCost:n.max_total_cost}}getSubscriptionsForTypePaginated(e){return new Qs({type:e},void 0,this._client)}async getSubscriptionsForUser(e,r){const n=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:E(e),query:{...He("user_id",E(e)),...ve(r)}});return{...ei(n,ln,this._client),totalCost:n.total_cost,maxTotalCost:n.max_total_cost}}getSubscriptionsForUserPaginated(e){const r=E(e);return new Qs(He("user_id",r),r,this._client)}async createSubscription(e,r,n,i,s,o,a,l){const u=i.method==="webhook",c=u?void 0:o;if(!u&&!s)throw new Error(`Transport ${i.method} can only handle subscriptions with user context`);const f={type:e,version:r,condition:n,transport:i};l&&(f.is_batching_enabled=!0);const d=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:c,userId:Xr(s,E),forceType:u?"app":"user",jsonBody:f});return new ln(d.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,r){return await this.createSubscription("stream.online","1",pe(e),r,e)}async subscribeToStreamOfflineEvents(e,r){return await this.createSubscription("stream.offline","1",pe(e),r,e)}async subscribeToChannelUpdateEvents(e,r){return await this.createSubscription("channel.update","1",pe(e),r,e)}async subscribeToChannelFollowEvents(e,r){const n=E(e);return await this.createSubscription("channel.follow","2",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:followers"],!0)}async subscribeToChannelSubscriptionEvents(e,r){return await this.createSubscription("channel.subscribe","1",pe(e),r,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionGiftEvents(e,r){return await this.createSubscription("channel.subscription.gift","1",pe(e),r,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionMessageEvents(e,r){return await this.createSubscription("channel.subscription.message","1",pe(e),r,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionEndEvents(e,r){return await this.createSubscription("channel.subscription.end","1",pe(e),r,e,["channel:read:subscriptions"])}async subscribeToChannelCheerEvents(e,r){return await this.createSubscription("channel.cheer","1",pe(e),r,e,["bits:read"])}async subscribeToChannelCharityCampaignStartEvents(e,r){return await this.createSubscription("channel.charity_campaign.start","1",pe(e),r,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignStopEvents(e,r){return await this.createSubscription("channel.charity_campaign.stop","1",pe(e),r,e,["channel:read:charity"])}async subscribeToChannelCharityDonationEvents(e,r){return await this.createSubscription("channel.charity_campaign.donate","1",pe(e),r,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignProgressEvents(e,r){return await this.createSubscription("channel.charity_campaign.progress","1",pe(e),r,e,["channel:read:charity"])}async subscribeToChannelBanEvents(e,r){return await this.createSubscription("channel.ban","1",pe(e),r,e,["channel:moderate"])}async subscribeToChannelUnbanEvents(e,r){return await this.createSubscription("channel.unban","1",pe(e),r,e,["channel:moderate"])}async subscribeToChannelShieldModeBeginEvents(e,r){const n=E(e);return await this.createSubscription("channel.shield_mode.begin","1",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,r){const n=E(e);return await this.createSubscription("channel.shield_mode.end","1",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelModeratorAddEvents(e,r){return await this.createSubscription("channel.moderator.add","1",pe(e),r,e,["moderation:read"])}async subscribeToChannelModeratorRemoveEvents(e,r){return await this.createSubscription("channel.moderator.remove","1",pe(e),r,e,["moderation:read"])}async subscribeToChannelRaidEventsFrom(e,r){return await this.createSubscription("channel.raid","1",He("from_broadcaster_user_id",E(e)),r,e)}async subscribeToChannelRaidEventsTo(e,r){return await this.createSubscription("channel.raid","1",He("to_broadcaster_user_id",E(e)),r,e)}async subscribeToChannelRewardAddEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward.add","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward.update","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEventsForReward(e,r,n){return await this.createSubscription("channel.channel_points_custom_reward.update","1",Wu(e,r),n,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEventsForReward(e,r,n){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",Wu(e,r),n,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEventsForReward(e,r,n){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",Wu(e,r),n,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEventsForReward(e,r,n){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",Wu(e,r),n,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelPollBeginEvents(e,r){return await this.createSubscription("channel.poll.begin","1",pe(e),r,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollProgressEvents(e,r){return await this.createSubscription("channel.poll.progress","1",pe(e),r,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollEndEvents(e,r){return await this.createSubscription("channel.poll.end","1",pe(e),r,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPredictionBeginEvents(e,r){return await this.createSubscription("channel.prediction.begin","1",pe(e),r,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionProgressEvents(e,r){return await this.createSubscription("channel.prediction.progress","1",pe(e),r,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionLockEvents(e,r){return await this.createSubscription("channel.prediction.lock","1",pe(e),r,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionEndEvents(e,r){return await this.createSubscription("channel.prediction.end","1",pe(e),r,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelGoalBeginEvents(e,r){return await this.createSubscription("channel.goal.begin","1",pe(e),r,e,["channel:read:goals"])}async subscribeToChannelGoalProgressEvents(e,r){return await this.createSubscription("channel.goal.progress","1",pe(e),r,e,["channel:read:goals"])}async subscribeToChannelGoalEndEvents(e,r){return await this.createSubscription("channel.goal.end","1",pe(e),r,e,["channel:read:goals"])}async subscribeToChannelHypeTrainBeginEvents(e,r){return await this.createSubscription("channel.hype_train.begin","1",pe(e),r,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressEvents(e,r){return await this.createSubscription("channel.hype_train.progress","1",pe(e),r,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndEvents(e,r){return await this.createSubscription("channel.hype_train.end","1",pe(e),r,e,["channel:read:hype_train"])}async subscribeToChannelShoutoutCreateEvents(e,r){const n=E(e);return await this.createSubscription("channel.shoutout.create","1",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,r){const n=E(e);return await this.createSubscription("channel.shoutout.receive","1",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToExtensionBitsTransactionCreateEvents(e,r){return await this.createSubscription("extension.bits_transaction.create","1",He("extension_client_id",e),r)}async subscribeToUserAuthorizationGrantEvents(e,r){return await this.createSubscription("user.authorization.grant","1",He("client_id",e),r)}async subscribeToUserAuthorizationRevokeEvents(e,r){return await this.createSubscription("user.authorization.revoke","1",He("client_id",e),r)}async subscribeToUserUpdateEvents(e,r,n){return await this.createSubscription("user.update","1",He("user_id",E(e)),r,e,n?["user:read:email"]:void 0)}async subscribeToDropEntitlementGrantEvents(e,r){return await this.createSubscription("drop.entitlement.grant","1",Gj(e),r,void 0,void 0,!1,!0)}async _deleteSubscriptionsWithCondition(e){const r=this.getSubscriptionsPaginated();for await(const n of r)(!e||e(n))&&await n.unsubscribe()}};ky=C([L("api","HelixEventSubApi")],ky);function Vj(t,e){return{extension_id:t,extension_version:e}}function Qj(t){return{sku:t.sku,cost:{amount:t.cost,type:"bits"},display_name:t.displayName,in_development:t.inDevelopment,expiration:t.expirationDate,is_broadcast:t.broadcast}}function Tx(t,e){return{extension_id:t,id:e.transactionIds}}let bl=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].broadcaster_id}get displayName(){return this[h].broadcaster_name}async getChannel(){return ne(await this._client.channels.getChannelInfoById(this[h].broadcaster_id))}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get gameId(){return this[h].game_id}get gameName(){return this[h].game_name}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get title(){return this[h].title}};C([K(!1)],bl.prototype,"_client",void 0);bl=C([L("api","HelixChannelReference","id")],bl);let kd=class extends Z{get sku(){return this[h].sku}get cost(){return this[h].cost.amount}get displayName(){return this[h].display_name}get inDevelopment(){return this[h].in_development}get isBroadcast(){return this[h].is_broadcast}get expirationDate(){return hr(this[h].expiration,e=>new Date(e))}};kd=C([L("api","HelixExtensionBitsProduct","sku")],kd);let xl=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get transactionDate(){return new Date(this[h].timestamp)}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_name}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get productType(){return this[h].product_type}get productSku(){return this[h].product_data.sku}get productCost(){return this[h].product_data.cost.amount}get productDisplayName(){return this[h].product_data.displayName}get productInDevelopment(){return this[h].product_data.inDevelopment}};C([K(!1)],xl.prototype,"_client",void 0);xl=C([L("api","HelixExtensionTransaction","id")],xl);let Py=class extends Ae{async getReleasedExtension(e,r){const n=await this._client.callApi({type:"helix",url:"extensions/released",query:Vj(e,r)});return new uy(n.data[0])}async getLiveChannelsWithExtension(e,r){const n=await this._client.callApi({type:"helix",url:"extensions/live",query:{...He("extension_id",e),...ve(r)}});return Ge(n,bl,this._client)}getLiveChannelsWithExtensionPaginated(e){return new Me({url:"extensions/live",query:He("extension_id",e)},this._client,r=>new bl(r,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:He("should_include_all",e==null?void 0:e.toString())})).data.map(n=>new kd(n))}async putExtensionBitsProduct(e){const r=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:Qj(e)});return new kd(r.data[0])}async getExtensionTransactions(e,r={}){const n=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...Tx(e,r),...ve(r)}});return Ge(n,xl,this._client)}getExtensionTransactionsPaginated(e,r={}){return new Me({url:"extensions/transactions",forceType:"app",query:Tx(e,r)},this._client,n=>new xl(n,this._client))}};Py=C([L("api","HelixExtensionsApi")],Py);let Sr=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get name(){return this[h].name}get boxArtUrl(){return this[h].box_art_url}get igdbId(){return this[h].igdb_id||null}getBoxArtUrl(e,r){return this[h].box_art_url.replace("{width}",e.toString()).replace("{height}",r.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[h].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[h].id})}};C([K(!1)],Sr.prototype,"_client",void 0);Sr=C([L("api","HelixGame","id")],Sr);let Lo=class extends Ae{constructor(){super(...arguments),this._getGameByIdBatcher=new ur({url:"games"},"id","id",this._client,e=>new Sr(e,this._client)),this._getGameByNameBatcher=new ur({url:"games"},"name","name",this._client,e=>new Sr(e,this._client)),this._getGameByIgdbIdBatcher=new ur({url:"games"},"igdb_id","igdb_id",this._client,e=>new Sr(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 r;return(r=(await this._getGames("id",[e]))[0])!==null&&r!==void 0?r:null}async getGameByName(e){var r;return(r=(await this._getGames("name",[e]))[0])!==null&&r!==void 0?r:null}async getGameByIgdbId(e){var r;return(r=(await this._getGames("igdb_id",[e]))[0])!==null&&r!==void 0?r: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){const r=await this._client.callApi({type:"helix",url:"games/top",query:ve(e)});return Ge(r,Sr,this._client)}getTopGamesPaginated(){return new Me({url:"games/top"},this._client,e=>new Sr(e,this._client))}async _getGames(e,r){return r.length?(await this._client.callApi({type:"helix",url:"games",query:{[e]:r}})).data.map(i=>new Sr(i,this._client)):[]}};C([K(!1)],Lo.prototype,"_getGameByIdBatcher",void 0);C([K(!1)],Lo.prototype,"_getGameByNameBatcher",void 0);C([K(!1)],Lo.prototype,"_getGameByIgdbIdBatcher",void 0);Lo=C([L("api","HelixGameApi")],Lo);let Pd=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterDisplayName(){return this[h].broadcaster_name}get broadcasterName(){return this[h].broadcaster_login}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get type(){return this[h].type}get description(){return this[h].description}get currentAmount(){return this[h].current_amount}get targetAmount(){return this[h].target_amount}get creationDate(){return this[h].created_at}};C([K(!1)],Pd.prototype,"_client",void 0);Pd=C([L("api","HelixGoal","id")],Pd);let Ay=class extends Ae{async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:E(e),scopes:["channel:read:goals"],query:_e(e)})).data.map(n=>new Pd(n,this._client))}};Ay=C([L("api","HelixGoalApi")],Ay);let Sl=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user}async getUser(){return ne(await this._client.users.getUserById(this[h].user))}get type(){return this[h].type}get total(){return this[h].total}};C([K(!1)],Sl.prototype,"_client",void 0);Sl=C([L("api","HelixHypeTrainContribution","userId")],Sl);let Cl=class extends Z{constructor(e,r){super(e),this._client=r}get eventId(){return this[h].id}get eventType(){return this[h].event_type}get eventDate(){return new Date(this[h].event_timestamp)}get eventVersion(){return this[h].version}get id(){return this[h].event_data.id}get broadcasterId(){return this[h].event_data.broadcaster_id}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].event_data.broadcaster_id))}get level(){return this[h].event_data.level}get startDate(){return new Date(this[h].event_data.started_at)}get expiryDate(){return new Date(this[h].event_data.expires_at)}get cooldownDate(){return new Date(this[h].event_data.cooldown_end_time)}get total(){return this[h].event_data.total}get goal(){return this[h].event_data.goal}get lastContribution(){return new Sl(this[h].event_data.last_contribution,this._client)}get topContributions(){return this[h].event_data.top_contributions.map(e=>new Sl(e,this._client))}};C([K(!1)],Cl.prototype,"_client",void 0);Cl=C([L("api","HelixHypeTrainEvent","id")],Cl);class Kj extends Ae{async getHypeTrainEventsForBroadcaster(e,r){const n=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:E(e),scopes:["channel:read:hype_train"],query:{..._e(e),...ve(r)}});return Ge(n,Cl,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new Me({url:"hypetrain/events",userId:E(e),scopes:["channel:read:hype_train"],query:_e(e)},this._client,r=>new Cl(r,this._client))}}function kx(t,e){return{broadcaster_id:E(t),user_id:e==null?void 0:e.userId}}function Px(t,e){return{broadcaster_id:E(t),user_id:E(e)}}function Yj(t,e,r){return{user_id:E(t),msg_id:e,action:r?"ALLOW":"DENY"}}function Xj(t){return{overall_level:t.overallLevel,aggression:t.aggression,bullying:t.bullying,disability:t.disability,misogyny:t.misogyny,race_ethnicity_or_religion:t.raceEthnicityOrReligion,sex_based_terms:t.sexBasedTerms,sexuality_sex_or_gender:t.sexualitySexOrGender,swearing:t.swearing}}function Jj(t){return{data:{duration:t.duration,reason:t.reason,user_id:E(t.user)}}}function Zj(t){return{is_active:t}}let Ad=class extends Z{get broadcasterId(){return this[h].broadcaster_id}get moderatorId(){return this[h].moderator_id}get overallLevel(){return this[h].overall_level?this[h].overall_level:null}get disability(){return this[h].disability}get aggression(){return this[h].aggression}get sexualitySexOrGender(){return this[h].sexuality_sex_or_gender}get misogyny(){return this[h].misogyny}get bullying(){return this[h].bullying}get swearing(){return this[h].swearing}get raceEthnicityOrReligion(){return this[h].race_ethnicity_or_religion}get sexBasedTerms(){return this[h].sex_based_terms}};Ad=C([L("api","HelixAutoModSettings","broadcasterId")],Ad);let Iy=class extends Z{get messageId(){return this[h].msg_id}get isPermitted(){return this[h].is_permitted}};Iy=C([L("api","HelixAutoModStatus","messageId")],Iy);let Bo=class extends Z{constructor(e,r,n){super(e),this._expiryTimestamp=r,this._client=n}get creationDate(){return new Date(this[h].created_at)}get expiryDate(){return hr(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[h].moderator_id}async getModerator(){return ne(await this._client.users.getUserById(this[h].moderator_id))}get userId(){return this[h].user_id}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],Bo.prototype,"_client",void 0);C([K(!1)],Bo.prototype,"_expiryTimestamp",void 0);Bo=C([L("api","HelixBanUser","userId")],Bo);let Id=class extends Bo{constructor(e,r){super(e,e.expires_at||null,r)}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}get moderatorName(){return this[h].moderator_login}get moderatorDisplayName(){return this[h].moderator_name}get reason(){return this[h].reason||null}};Id=C([L("api","HelixBan","userId")],Id);let Od=class extends Z{get broadcasterId(){return this[h].broadcaster_id}get creationDate(){return new Date(this[h].created_at)}get expirationDate(){return this[h].expires_at?new Date(this[h].expires_at):null}get id(){return this[h].id}get moderatorId(){return this[h].moderator_id}get text(){return this[h].text}get updatedDate(){return new Date(this[h].updated_at)}};Od=C([L("api","HelixBlockedTerm","id")],Od);let El=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],El.prototype,"_client",void 0);El=C([L("api","HelixModerator","userId")],El);let Tl=class extends Z{constructor(e,r){super(e),this._client=r}get isActive(){return this[h].is_active}get moderatorId(){return this[h].moderator_id}get moderatorName(){return this[h].moderator_login}get moderatorDisplayName(){return this[h].moderator_name}async getModerator(){return ne(await this._client.users.getUserById(this[h].moderator_id))}get lastActivationDate(){return this[h].last_activated_at===""?null:new Date(this[h].last_activated_at)}};C([K(!1)],Tl.prototype,"_client",void 0);Tl=C([L("api","HelixShieldModeStatus")],Tl);let Oy=class extends Ae{async getBannedUsers(e,r){const n=await this._client.callApi({type:"helix",url:"moderation/banned",userId:E(e),scopes:["moderation:read"],query:{...kx(e,r),...ve(r)}});return Ge(n,Id,this._client)}getBannedUsersPaginated(e){return new Me({url:"moderation/banned",userId:E(e),scopes:["moderation:read"],query:_e(e)},this._client,r=>new Id(r,this._client),50)}async checkUserBan(e,r){const n=E(r);return(await this.getBannedUsers(e,{userId:n})).data.some(s=>s.userId===n)}async getModerators(e,r){const n=await this._client.callApi({type:"helix",url:"moderation/moderators",userId:E(e),scopes:["moderation:read","channel:manage:moderators"],query:{...kx(e,r),...ve(r)}});return Ge(n,El,this._client)}getModeratorsPaginated(e){return new Me({url:"moderation/moderators",userId:E(e),scopes:["moderation:read","channel:manage:moderators"],query:_e(e)},this._client,r=>new El(r,this._client))}async checkUserMod(e,r){const n=E(r);return(await this.getModerators(e,{userId:n})).data.some(s=>s.userId===n)}async addModerator(e,r){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"POST",userId:E(e),scopes:["channel:manage:moderators"],query:Px(e,r)})}async removeModerator(e,r){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"DELETE",userId:E(e),scopes:["channel:manage:moderators"],query:Px(e,r)})}async checkAutoModStatus(e,r){return(await this._client.callApi({type:"helix",url:"moderation/enforcements/status",method:"POST",userId:E(e),scopes:["moderation:read"],query:_e(e),jsonBody:{data:r}})).data.map(i=>new Iy(i))}async processHeldAutoModMessage(e,r,n){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:E(e),scopes:["moderator:manage:automod"],jsonBody:Yj(e,r,n)})}async getAutoModSettings(e){const r=E(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",userId:r,scopes:["moderator:read:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r)})).data.map(i=>new Ad(i))}async updateAutoModSettings(e,r){const n=E(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",method:"PUT",userId:n,scopes:["moderator:manage:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(n),jsonBody:Xj(r)})).data.map(s=>new Ad(s))}async banUser(e,r){const n=E(e);return(await this._client.callApi({type:"helix",url:"moderation/bans",method:"POST",userId:n,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(n),jsonBody:Jj(r)})).data.map(s=>new Bo(s,s.end_time,this._client))}async unbanUser(e,r){const n=E(e);await this._client.callApi({type:"helix",url:"moderation/bans",method:"DELETE",userId:n,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(n),...He("user_id",E(r))}})}async getBlockedTerms(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"moderation/blocked_terms",userId:n,scopes:["moderator:read:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(n),...ve(r)}});return Ge(i,Od,this._client)}async addBlockedTerm(e,r){const n=E(e);return(await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"POST",userId:n,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(n),jsonBody:{text:r}})).data.map(s=>new Od(s))}async removeBlockedTerm(e,r,n){const i=E(e);await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"DELETE",userId:i,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(i),id:n}})}async deleteChatMessages(e,r){const n=E(e);await this._client.callApi({type:"helix",url:"moderation/chat",method:"DELETE",userId:n,scopes:["moderator:manage:chat_messages"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(n),...He("message_id",r)}})}async getShieldModeStatus(e){const r=E(e),n=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"GET",userId:r,scopes:["moderator:read:shield_mode","moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r)});return new Tl(n.data[0],this._client)}async updateShieldModeStatus(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"PUT",userId:n,scopes:["moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(n),jsonBody:Zj(r)});return new Tl(i.data[0],this._client)}_createModeratorActionQuery(e){return SP(e,this._getUserContextIdWithDefault(e))}};Oy=C([L("api","HelixModerationApi")],Oy);function e8(t,e){var r;return{broadcaster_id:E(t),title:e.title,choices:e.choices.map(n=>({title:n})),duration:e.duration,channel_points_voting_enabled:e.channelPointsPerVote!=null,channel_points_per_vote:(r=e.channelPointsPerVote)!==null&&r!==void 0?r:0}}function t8(t,e,r){return{broadcaster_id:E(t),id:e,status:r?"TERMINATED":"ARCHIVED"}}let Ry=class extends Z{get id(){return this[h].id}get title(){return this[h].title}get totalVotes(){return this[h].votes}get channelPointsVotes(){return this[h].channel_points_votes}};Ry=C([L("api","HelixPollChoice","id")],Ry);let qn=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get title(){return this[h].title}get isChannelPointsVotingEnabled(){return this[h].channel_points_voting_enabled}get channelPointsPerVote(){return this[h].channel_points_per_vote}get status(){return this[h].status}get durationInSeconds(){return this[h].duration}get startDate(){return new Date(this[h].started_at)}get endDate(){return new Date(this.startDate.getTime()+this[h].duration*1e3)}get choices(){return this[h].choices.map(e=>new Ry(e))}};C([K(!1)],qn.prototype,"_client",void 0);qn=C([L("api","HelixPoll","id")],qn);let My=class extends Ae{async getPolls(e,r){const n=await this._client.callApi({type:"helix",url:"polls",userId:E(e),scopes:["channel:read:polls"],query:{..._e(e),...ve(r)}});return Ge(n,qn,this._client)}getPollsPaginated(e){return new Me({url:"polls",userId:E(e),scopes:["channel:read:polls"],query:_e(e)},this._client,r=>new qn(r,this._client),20)}async getPollsByIds(e,r){return r.length?(await this._client.callApi({type:"helix",url:"polls",userId:E(e),scopes:["channel:read:polls"],query:Gf(e,r)})).data.map(i=>new qn(i,this._client)):[]}async getPollById(e,r){const n=await this.getPollsByIds(e,[r]);return n.length?n[0]:null}async createPoll(e,r){const n=await this._client.callApi({type:"helix",url:"polls",method:"POST",userId:E(e),scopes:["channel:manage:polls"],jsonBody:e8(e,r)});return new qn(n.data[0],this._client)}async endPoll(e,r,n=!0){const i=await this._client.callApi({type:"helix",url:"polls",method:"PATCH",userId:E(e),scopes:["channel:manage:polls"],jsonBody:t8(e,r,n)});return new qn(i.data[0],this._client)}};My=C([L("api","HelixPollApi")],My);function r8(t,e){return{broadcaster_id:E(t),title:e.title,outcomes:e.outcomes.map(r=>({title:r})),prediction_window:e.autoLockAfter}}function n8(t,e,r,n){return{broadcaster_id:E(t),id:e,status:r,winning_outcome_id:n}}let Rd=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].id}get userName(){return this[h].login}get userDisplayName(){return this[h].name}async getUser(){return await this._client.users.getUserById(this[h].id)}get channelPointsUsed(){return this[h].channel_points_used}get channelPointsWon(){return this[h].channel_points_won}};C([K(!1)],Rd.prototype,"_client",void 0);Rd=C([L("api","HelixPredictor","userId")],Rd);let kl=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get title(){return this[h].title}get users(){return this[h].users}get totalChannelPoints(){return this[h].channel_points}get color(){return this[h].color}get topPredictors(){var e,r;return(r=(e=this[h].top_predictors)===null||e===void 0?void 0:e.map(n=>new Rd(n,this._client)))!==null&&r!==void 0?r:[]}};C([K(!1)],kl.prototype,"_client",void 0);kl=C([L("api","HelixPredictionOutcome","id")],kl);let Hn=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get title(){return this[h].title}get status(){return this[h].status}get autoLockAfter(){return this[h].prediction_window}get creationDate(){return new Date(this[h].created_at)}get endDate(){return this[h].ended_at?new Date(this[h].ended_at):null}get lockDate(){return this[h].locked_at?new Date(this[h].locked_at):null}get outcomes(){return this[h].outcomes.map(e=>new kl(e,this._client))}get winningOutcomeId(){return this[h].winning_outcome_id||null}get winningOutcome(){if(!this[h].winning_outcome_id)return null;const e=this[h].outcomes.find(r=>r.id===this[h].winning_outcome_id);if(!e)throw new wi("Winning outcome not found in outcomes array");return new kl(e,this._client)}};C([K(!1)],Hn.prototype,"_client",void 0);Hn=C([L("api","HelixPrediction","id")],Hn);let Ny=class extends Ae{async getPredictions(e,r){const n=await this._client.callApi({type:"helix",url:"predictions",userId:E(e),scopes:["channel:read:predictions"],query:{..._e(e),...ve(r)}});return Ge(n,Hn,this._client)}getPredictionsPaginated(e){return new Me({url:"predictions",userId:E(e),scopes:["channel:read:predictions"],query:_e(e)},this._client,r=>new Hn(r,this._client),20)}async getPredictionsByIds(e,r){return r.length?(await this._client.callApi({type:"helix",url:"predictions",userId:E(e),scopes:["channel:read:predictions"],query:Gf(e,r)})).data.map(i=>new Hn(i,this._client)):[]}async getPredictionById(e,r){const n=await this.getPredictionsByIds(e,[r]);return n.length?n[0]:null}async createPrediction(e,r){const n=await this._client.callApi({type:"helix",url:"predictions",method:"POST",userId:E(e),scopes:["channel:manage:predictions"],jsonBody:r8(e,r)});return new Hn(n.data[0],this._client)}async lockPrediction(e,r){return await this._endPrediction(e,r,"LOCKED")}async resolvePrediction(e,r,n){return await this._endPrediction(e,r,"RESOLVED",n)}async cancelPrediction(e,r){return await this._endPrediction(e,r,"CANCELED")}async _endPrediction(e,r,n,i){const s=await this._client.callApi({type:"helix",url:"predictions",method:"PATCH",userId:E(e),scopes:["channel:manage:predictions"],jsonBody:n8(e,r,n,i)});return new Hn(s.data[0],this._client)}};Ny=C([L("api","HelixPredictionApi")],Ny);function i8(t,e){return{from_broadcaster_id:E(t),to_broadcaster_id:E(e)}}let Dy=class extends Z{get creationDate(){return new Date(this[h].created_at)}get targetIsMature(){return this[h].is_mature}};Dy=C([L("api","HelixRaid")],Dy);let jy=class extends Ae{async startRaid(e,r){const n=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:E(e),scopes:["channel:manage:raids"],query:i8(e,r)});return new Dy(n.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:E(e),scopes:["channel:manage:raids"],query:_e(e)})}};jy=C([L("api","HelixRaidApi")],jy);function EP(t,e){var r;return{broadcaster_id:E(t),start_time:e==null?void 0:e.startDate,utc_offset:(r=e==null?void 0:e.utcOffset)===null||r===void 0?void 0:r.toString()}}function s8(t,e){return e.vacation?{broadcaster_id:E(t),is_vacation_enabled:"true",vacation_start_time:e.vacation.startDate,vacation_end_time:e.vacation.endDate,timezone:e.vacation.timezone}:{broadcaster_id:E(t),is_vacation_enabled:"false"}}function o8(t){return{start_time:t.startDate,timezone:t.timezone,is_recurring:t.isRecurring,duration:t.duration,category_id:t.categoryId,title:t.title}}function Ax(t,e){return{broadcaster_id:E(t),id:e}}function a8(t){return{start_time:t.startDate,timezone:t.timezone,is_canceled:t.isCanceled,duration:t.duration,category_id:t.categoryId,title:t.title}}let di=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get startDate(){return new Date(this[h].start_time)}get endDate(){return new Date(this[h].end_time)}get title(){return this[h].title}get cancelEndDate(){return hr(this[h].canceled_until,e=>new Date(e))}get categoryId(){var e,r;return(r=(e=this[h].category)===null||e===void 0?void 0:e.id)!==null&&r!==void 0?r:null}get categoryName(){var e,r;return(r=(e=this[h].category)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:null}async getCategory(){var e;const r=(e=this[h].category)===null||e===void 0?void 0:e.id;return r?await this._client.games.getGameById(r):null}get isRecurring(){return this[h].is_recurring}};C([K(!1)],di.prototype,"_client",void 0);di=C([L("api","HelixScheduleSegment","id")],di);let Ly=class extends Me{constructor(e,r,n){super({url:"schedule",query:EP(e,n)},r,i=>new di(i,r),25)}async _fetchData(e={}){var r;const n=await super._fetchData(e);return{data:(r=n.data.segments)!==null&&r!==void 0?r:[],pagination:n.pagination}}};Ly=C([L("api","HelixPaginatedScheduleSegmentRequest")],Ly);let Md=class extends Z{constructor(e,r){super(e),this._client=r}get segments(){var e,r;return(r=(e=this[h].segments)===null||e===void 0?void 0:e.map(n=>new di(n,this._client)))!==null&&r!==void 0?r:[]}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get vacationStartDate(){var e;const r=(e=this[h].vacation)===null||e===void 0?void 0:e.start_time;return r?new Date(r):null}get vacationEndDate(){var e;const r=(e=this[h].vacation)===null||e===void 0?void 0:e.end_time;return r?new Date(r):null}};C([K(!1)],Md.prototype,"_client",void 0);Md=C([L("api","HelixSchedule","broadcasterId")],Md);class l8 extends Ae{async getSchedule(e,r){const n=await this._client.callApi({type:"helix",url:"schedule",userId:E(e),query:{...EP(e,r),...ve(r)}});return{data:new Md(n.data,this._client),cursor:n.pagination.cursor}}getScheduleSegmentsPaginated(e,r){return new Ly(e,this._client,r)}async getScheduleSegmentsByIds(e,r){var n,i;return(i=(n=(await this._client.callApi({type:"helix",url:"schedule",userId:E(e),query:Gf(e,r)})).data.segments)===null||n===void 0?void 0:n.map(o=>new di(o,this._client)))!==null&&i!==void 0?i:[]}async getScheduleSegmentById(e,r){const n=await this.getScheduleSegmentsByIds(e,[r]);return n.length?n[0]:null}async getScheduleAsIcal(e){return await this._client.callApi({type:"helix",url:"schedule/icalendar",query:_e(e)})}async updateScheduleSettings(e,r){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:E(e),scopes:["channel:manage:schedule"],query:s8(e,r)})}async createScheduleSegment(e,r){const n=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:E(e),scopes:["channel:manage:schedule"],query:_e(e),jsonBody:o8(r)});return new di(n.data.segments[0],this._client)}async updateScheduleSegment(e,r,n){const i=await this._client.callApi({type:"helix",url:"schedule/segment",method:"PATCH",userId:E(e),scopes:["channel:manage:schedule"],query:Ax(e,r),jsonBody:a8(n)});return new di(i.data.segments[0],this._client)}async deleteScheduleSegment(e,r){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:E(e),scopes:["channel:manage:schedule"],query:Ax(e,r)})}}function Ix(t,e){var r;return{query:t,live_only:(r=e.liveOnly)===null||r===void 0?void 0:r.toString()}}let Pl=class extends Z{constructor(e,r){super(e),this._client=r}get language(){return this[h].broadcaster_language}get id(){return this[h].id}get name(){return this[h].broadcaster_login}get displayName(){return this[h].display_name}async getUser(){return ne(await this._client.users.getUserById(this[h].id))}get gameId(){return this[h].game_id}get gameName(){return this[h].game_name}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get isLive(){return this[h].is_live}get tags(){return this[h].tags}get thumbnailUrl(){return this[h].thumbnail_url}get startDate(){return this[h].is_live?new Date(this[h].started_at):null}};C([K(!1)],Pl.prototype,"_client",void 0);Pl=C([L("api","HelixChannelSearchResult","id")],Pl);let By=class extends Ae{async searchCategories(e,r){const n=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...ve(r)}});return Ge(n,Sr,this._client)}searchCategoriesPaginated(e){return new Me({url:"search/categories",query:{query:e}},this._client,r=>new Sr(r,this._client))}async searchChannels(e,r={}){const n=await this._client.callApi({type:"helix",url:"search/channels",query:{...Ix(e,r),...ve(r)}});return Ge(n,Pl,this._client)}searchChannelsPaginated(e,r={}){return new Me({url:"search/channels",query:Ix(e,r)},this._client,n=>new Pl(n,this._client))}};By=C([L("api","HelixSearchApi")],By);class u8 extends Zr{constructor(e){super("Your stream needs to be live to do this",e)}}function Im(t){return{game_id:t.game,language:t.language,type:t.type,user_id:t.userId,user_login:t.userName}}function c8(t,e){return{user_id:E(t),description:e}}function Ox(t){return{video_id:t}}let Ur=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get gameId(){return this[h].game_id}get gameName(){return this[h].game_name}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get type(){return this[h].type}get title(){return this[h].title}get viewers(){return this[h].viewer_count}get startDate(){return new Date(this[h].started_at)}get language(){return this[h].language}get thumbnailUrl(){return this[h].thumbnail_url}getThumbnailUrl(e,r){return this[h].thumbnail_url.replace("{width}",e.toString()).replace("{height}",r.toString())}get tags(){return this[h].tags}get isMature(){return this[h].is_mature}};C([K(!1)],Ur.prototype,"_client",void 0);Ur=C([L("api","HelixStream","id")],Ur);let Al=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get creationDate(){return new Date(this[h].created_at)}get description(){return this[h].description}get positionInSeconds(){return this[h].position_seconds}};C([K(!1)],Al.prototype,"_client",void 0);Al=C([L("api","HelixStreamMarker","id")],Al);let $y=class extends Al{constructor(e,r,n){super(e,n),this._videoId=r}get url(){return this[h].URL}get videoId(){return this._videoId}async getVideo(){return ne(await this._client.videos.getVideoById(this._videoId))}};$y=C([L("api","HelixStreamMarkerWithVideo","id")],$y);var Ms;let Il=Ms=class extends Ae{constructor(){super(...arguments),this._getStreamByUserIdBatcher=new ur({url:"streams"},"user_id","user_id",this._client,e=>new Ur(e,this._client)),this._getStreamByUserNameBatcher=new ur({url:"streams"},"user_login","user_login",this._client,e=>new Ur(e,this._client))}async getStreams(e={}){const r=await this._client.callApi({url:"streams",type:"helix",query:{...Im(e),...ve(e)}});return Ge(r,Ur,this._client)}getStreamsPaginated(e={}){return new Me({url:"streams",query:Im(e)},this._client,r=>new Ur(r,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(Oa)})).data}async getStreamByUserName(e){var r;return(r=(await this.getStreamsByUserNames([e]))[0])!==null&&r!==void 0?r:null}async getStreamByUserNameBatched(e){return await this._getStreamByUserNameBatcher.request(Oa(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(E)})).data}async getStreamByUserId(e){const r=E(e),n=await this._client.callApi({url:"streams",type:"helix",userId:r,query:Im({userId:r})});return hr(n.data[0],i=>new Ur(i,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request(E(e))}async getStreamMarkersForUser(e,r){var n;const i=await this._client.callApi({url:"streams/markers",type:"helix",query:{...wx(e),...ve(r)},userId:E(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:ab(i.data.map(s=>Ms._mapGetStreamMarkersResult(s,this._client))),cursor:(n=i.pagination)===null||n===void 0?void 0:n.cursor}}getStreamMarkersForUserPaginated(e){return new Me({url:"streams/markers",query:wx(e),userId:E(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,r=>Ms._mapGetStreamMarkersResult(r,this._client))}async getStreamMarkersForVideo(e,r,n){var i;const s=await this._client.callApi({url:"streams/markers",type:"helix",query:{...Ox(r),...ve(n)},userId:E(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:ab(s.data.map(o=>Ms._mapGetStreamMarkersResult(o,this._client))),cursor:(i=s.pagination)===null||i===void 0?void 0:i.cursor}}getStreamMarkersForVideoPaginated(e,r){return new Me({url:"streams/markers",query:Ox(r),userId:E(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,n=>Ms._mapGetStreamMarkersResult(n,this._client))}async createStreamMarker(e,r){try{const n=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:E(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:c8(e,r)});return new Al(n.data[0],this._client)}catch(n){throw n instanceof ds&&n.statusCode===404?new u8({cause:n}):n}}async getStreamKey(e){const r=E(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:r,scopes:["channel:read:stream_key"],query:_e(e)})).data[0].stream_key}async getFollowedStreams(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"streams/followed",userId:n,scopes:["user:read:follows"],query:{...He("user_id",n),...ve(r)}});return Ge(i,Ur,this._client)}getFollowedStreamsPaginated(e){const r=E(e);return new Me({url:"streams/followed",userId:r,scopes:["user:read:follows"],query:He("user_id",r)},this._client,n=>new Ur(n,this._client))}static _mapGetStreamMarkersResult(e,r){return e.videos.reduce((n,i)=>[...n,...i.markers.map(s=>new $y(s,i.video_id,r))],[])}};C([K(!1)],Il.prototype,"_getStreamByUserIdBatcher",void 0);C([K(!1)],Il.prototype,"_getStreamByUserNameBatcher",void 0);Il=Ms=C([L("api","HelixStreamApi")],Il);function d8(t,e){return{broadcaster_id:E(t),user_id:E(e)}}let Ol=class extends Z{constructor(e,r){super(e),this._client=r}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[h].broadcaster_id)}get isGift(){return this[h].is_gift}get tier(){return this[h].tier}};C([K(!1)],Ol.prototype,"_client",void 0);Ol=C([L("api","HelixUserSubscription","broadcasterId")],Ol);let Rl=class extends Ol{get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get gifterId(){return this[h].is_gift?this[h].gifter_id:null}get gifterName(){return this[h].is_gift?this[h].gifter_login:null}get gifterDisplayName(){return this[h].is_gift?this[h].gifter_name:null}async getGifter(){return this[h].is_gift?ne(await this._client.users.getUserById(this[h].gifter_id)):null}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};Rl=C([L("api","HelixSubscription","userId")],Rl);let Uy=class extends hs{constructor(e,r){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:E(e),query:_e(e)},r,n=>new Rl(n,r))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};Uy=C([L("api","HelixPaginatedSubscriptionsRequest")],Uy);let Fy=class extends Ae{async getSubscriptions(e,r){const n=await this._client.callApi({url:"subscriptions",scopes:["channel:read:subscriptions"],type:"helix",userId:E(e),query:{..._e(e),...ve(r)}});return{...ei(n,Rl,this._client),points:n.points}}getSubscriptionsPaginated(e){return new Uy(e,this._client)}async getSubscriptionsForUsers(e,r){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:E(e),scopes:["channel:read:subscriptions"],query:CP(e,r)})).data.map(i=>new Rl(i,this._client))}async getSubscriptionForUser(e,r){const n=await this.getSubscriptionsForUsers(e,[r]);return n.length?n[0]:null}async checkUserSubscription(e,r){try{const n=await this._client.callApi({type:"helix",url:"subscriptions/user",userId:E(e),scopes:["user:read:subscriptions"],query:d8(r,e)});return new Ol(n.data[0],this._client)}catch(n){if(n instanceof ds&&n.statusCode===404)return null;throw n}}};Fy=C([L("api","HelixSubscriptionApi")],Fy);let Ml=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get name(){return this[h].team_name}get displayName(){return this[h].team_display_name}get backgroundImageUrl(){return this[h].background_image_url}get bannerUrl(){return this[h].banner}get creationDate(){return new Date(this[h].created_at)}get updateDate(){return new Date(this[h].updated_at)}get info(){return this[h].info}get logoThumbnailUrl(){return this[h].thumbnail_url}async getUserRelations(){return(await this._client.teams.getTeamById(this.id)).userRelations}};C([K(!1)],Ml.prototype,"_client",void 0);Ml=C([L("api","HelixTeam","id")],Ml);let Nd=class extends Ml{get userRelations(){return this[h].users.map(e=>new ns(e,this._client))}};Nd=C([L("api","HelixTeamWithUsers","id")],Nd);let qy=class extends Ae{async getTeamsForBroadcaster(e){var r,n;return(n=(r=(await this._client.callApi({type:"helix",url:"teams/channel",userId:E(e),query:_e(e)})).data)===null||r===void 0?void 0:r.map(s=>new Ml(s,this._client)))!==null&&n!==void 0?n:[]}async getTeamById(e){try{const r=await this._client.callApi({type:"helix",url:"teams",query:{id:e}});return new Nd(r.data[0],this._client)}catch(r){if(r instanceof ds&&r.statusCode===500)return null;throw r}}async getTeamByName(e){try{const r=await this._client.callApi({type:"helix",url:"teams",query:{name:e}});return new Nd(r.data[0],this._client)}catch(r){if(r instanceof ds&&r.statusCode===404)return null;throw r}}};qy=C([L("api","HelixTeamApi")],qy);function f8(t,e){return{target_user_id:E(t),source_context:e.sourceContext,reason:e.reason}}function h8(t){return{target_user_id:E(t)}}class TP extends Z{get id(){return this[h].id}get version(){return this[h].version}get name(){return this[h].name}}let Na=class extends TP{constructor(e,r,n){super(n),this._slotType=e,this._slotId=r}get slotType(){return this._slotType}get slotId(){return this._slotId}};Na=C([L("api","HelixInstalledExtension","id")],Na);let Dd=class extends Z{getExtensionAtSlot(e,r){const n=this[h][e][r];return n.active?new Na(e,r,n):null}getExtensionsForSlotType(e){return[...Object.entries(this[h][e])].filter(r=>r[1].active).map(([r,n])=>new Na(e,r,n))}getAllExtensions(){return[...Object.entries(this[h])].flatMap(([e,r])=>[...Object.entries(r)].filter(n=>n[1].active).map(([n,i])=>new Na(e,n,i)))}};Dd=C([L("api","HelixInstalledExtensionList")],Dd);let Hy=class extends TP{get canActivate(){return this[h].can_activate}get types(){return this[h].type}};Hy=C([L("api","HelixUserExtension","id")],Hy);let ti=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get name(){return this[h].login}get displayName(){return this[h].display_name}get description(){return this[h].description}get type(){return this[h].type}get broadcasterType(){return this[h].broadcaster_type}get profilePictureUrl(){return this[h].profile_image_url}get offlinePlaceholderUrl(){return this[h].offline_image_url}get creationDate(){return new Date(this[h].created_at)}async getStream(){return await this._client.streams.getStreamByUserId(this)}async getFollowedChannels(){return await this._client.channels.getFollowedChannels(this)}async getFollowedChannel(e){var r;return(r=(await this._client.channels.getFollowedChannels(this,e)).data[0])!==null&&r!==void 0?r:null}async follows(e){return await this.getFollowedChannel(e)!==null}async getChannelFollowers(){return await this._client.channels.getChannelFollowers(this)}async getChannelFollower(e){var r;return(r=(await this._client.channels.getChannelFollowers(this,e)).data[0])!==null&&r!==void 0?r: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}};C([K(!1)],ti.prototype,"_client",void 0);ti=C([L("api","HelixUser","id")],ti);let jd=class extends ti{get email(){return this[h].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};jd=C([L("api","HelixPrivilegedUser","id")],jd);let Nl=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].display_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],Nl.prototype,"_client",void 0);Nl=C([L("api","HelixUserBlock","userId")],Nl);let Dl=class extends Ae{constructor(){super(...arguments),this._getUserByIdBatcher=new ur({url:"users"},"id","id",this._client,e=>new ti(e,this._client)),this._getUserByNameBatcher=new ur({url:"users"},"login","login",this._client,e=>new ti(e,this._client))}async getUsersByIds(e){return await this._getUsers("id",e.map(E))}async getUsersByNames(e){return await this._getUsers("login",e.map(Oa))}async getUserById(e){const r=E(e),n=await this._client.callApi({type:"helix",url:"users",userId:r,query:{id:r}});return hr(n.data[0],i=>new ti(i,this._client))}async getUserByIdBatched(e){return await this._getUserByIdBatcher.request(E(e))}async getUserByName(e){const r=await this._getUsers("login",[Oa(e)]);return r.length?r[0]:null}async getUserByNameBatched(e){return await this._getUserByNameBatcher.request(Oa(e))}async getAuthenticatedUser(e,r=!1){var n;const i=await this._client.callApi({type:"helix",url:"users",forceType:"user",userId:E(e),scopes:r?["user:read:email"]:void 0});if(!(!((n=i.data)===null||n===void 0)&&n.length))throw new wi("Could not get authenticated user");return new jd(i.data[0],this._client)}async updateAuthenticatedUser(e,r){const n=await this._client.callApi({type:"helix",url:"users",method:"PUT",userId:E(e),scopes:["user:edit"],query:{description:r.description}});return new jd(n.data[0],this._client)}async getBlocks(e,r){const n=await this._client.callApi({type:"helix",url:"users/blocks",userId:E(e),scopes:["user:read:blocked_users"],query:{..._e(e),...ve(r)}});return Ge(n,Nl,this._client)}getBlocksPaginated(e){return new Me({url:"users/blocks",userId:E(e),scopes:["user:read:blocked_users"],query:_e(e)},this._client,r=>new Nl(r,this._client))}async createBlock(e,r,n={}){await this._client.callApi({type:"helix",url:"users/blocks",method:"PUT",userId:E(e),scopes:["user:manage:blocked_users"],query:f8(r,n)})}async deleteBlock(e,r){await this._client.callApi({type:"helix",url:"users/blocks",method:"DELETE",userId:E(e),scopes:["user:manage:blocked_users"],query:h8(r)})}async getExtensionsForAuthenticatedUser(e,r=!1){return(await this._client.callApi({type:"helix",url:"users/extensions/list",userId:E(e),scopes:r?["user:edit:broadcast"]:["user:read:broadcast","user:edit:broadcast"]})).data.map(i=>new Hy(i))}async getActiveExtensions(e,r=!1){const n=E(e),i=await this._client.callApi({type:"helix",url:"users/extensions",userId:n,scopes:r?["user:read:broadcast","user:edit:broadcast"]:void 0,query:He("user_id",n)});return new Dd(i.data)}async updateActiveExtensionsForAuthenticatedUser(e,r){const n=await this._client.callApi({type:"helix",url:"users/extensions",method:"PUT",userId:E(e),scopes:["user:edit:broadcast"],jsonBody:{data:r}});return new Dd(n.data)}async _getUsers(e,r){if(r.length===0)return[];const n={[e]:r};return(await this._client.callApi({type:"helix",url:"users",query:n})).data.map(s=>new ti(s,this._client))}};C([K(!1)],Dl.prototype,"_getUserByIdBatcher",void 0);C([K(!1)],Dl.prototype,"_getUserByNameBatcher",void 0);Dl=C([L("api","HelixUserApi")],Dl);let is=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get title(){return this[h].title}get description(){return this[h].description}get creationDate(){return new Date(this[h].created_at)}get publishDate(){return new Date(this[h].published_at)}get url(){return this[h].url}get thumbnailUrl(){return this[h].thumbnail_url}getThumbnailUrl(e,r){return this[h].thumbnail_url.replace("%{width}",e.toString()).replace("%{height}",r.toString())}get isPublic(){return this[h].viewable==="public"}get views(){return this[h].view_count}get language(){return this[h].language}get type(){return this[h].type}get duration(){return this[h].duration}get durationInSeconds(){const e=this[h].duration.match(/\d+[hms]/g);if(!e)throw new wi(`Could not parse duration string: ${this[h].duration}`);return e.map(r=>{const n=/(\d+)([hms])/.exec(r);if(!n)throw new wi(`Could not parse partial duration string: ${r}`);const[,i,s]=n;return parseInt(i,10)*{h:3600,m:60,s:1}[s]}).reduce((r,n)=>r+n)}get streamId(){return this[h].stream_id}get mutedSegmentData(){var e,r;return(r=(e=this[h].muted_segments)===null||e===void 0?void 0:e.slice())!==null&&r!==void 0?r:[]}isMutedAt(e,r,n=!1){if(this[h].muted_segments===null)return!1;if(r==null)return this[h].muted_segments.some(s=>s.offset<=e&&e<=s.offset+s.duration);const i=e+r;return n?this[h].muted_segments.some(s=>{const o=s.offset+s.duration;return e{const o=s.offset+s.duration;return s.offset<=e&&i<=o})}};C([K(!1)],is.prototype,"_client",void 0);C([Se()],is.prototype,"durationInSeconds",null);is=C([au,L("api","HelixVideo","id")],is);var _c;let Ld=_c=class extends Ae{constructor(){super(...arguments),this._getVideoByIdBatcher=new ur({url:"videos"},"id","id",this._client,e=>new is(e,this._client))}async getVideosByIds(e){return(await this._getVideos("id",e)).data}async getVideoById(e){const r=await this.getVideosByIds([e]);return r.length?r[0]:null}async getVideoByIdBatched(e){return await this._getVideoByIdBatcher.request(e)}async getVideosByUser(e,r={}){const n=E(e);return await this._getVideos("user_id",[n],r)}getVideosByUserPaginated(e,r={}){const n=E(e);return this._getVideosPaginated("user_id",[n],r)}async getVideosByGame(e,r={}){return await this._getVideos("game_id",[e],r)}getVideosByGamePaginated(e,r={}){return this._getVideosPaginated("game_id",[e],r)}async deleteVideosByIds(e,r){await this._client.callApi({type:"helix",url:"videos",method:"DELETE",scopes:["channel:manage:videos"],userId:E(e),query:{id:r}})}async _getVideos(e,r,n={}){if(!r.length)return{data:[]};const i=await this._client.callApi({type:"helix",url:"videos",userId:e==="user_id"?r[0]:void 0,query:{..._c._makeVideosQuery(e,r,n),...ve(n)}});return Ge(i,is,this._client)}_getVideosPaginated(e,r,n={}){return new Me({url:"videos",userId:e==="user_id"?r[0]:void 0,query:_c._makeVideosQuery(e,r,n)},this._client,i=>new is(i,this._client))}static _makeVideosQuery(e,r,n={}){const{language:i,period:s,orderBy:o,type:a}=n;return{[e]:r,language:i,period:s,sort:o,type:a}}};C([K(!1)],Ld.prototype,"_getVideoByIdBatcher",void 0);Ld=_c=C([L("api","HelixVideoApi")],Ld);function p8(t,e){return{from_user_id:E(t),to_user_id:E(e)}}let zy=class extends Ae{async sendWhisper(e,r,n){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:E(e),scopes:["user:manage:whispers"],query:p8(e,r),jsonBody:{message:n}})}};zy=C([L("api","HelixWhisperApi")],zy);class m8{constructor(e,r,n){this._options=e,this._httpStatus=r,this._resolvedUserId=n}get options(){return this._options}get httpStatus(){return this._httpStatus}get resolvedUserId(){return this._resolvedUserId}}let xe=class extends Vo{constructor(e,r,n){super(),this.onRequest=this.registerEvent(),this._config=e,this._logger=r,this._rateLimiter=n}async requestScopesForUser(e,r){await this._config.authProvider.getAccessTokenForUser(e,...r.map(n=>[n]))}async getTokenInfo(){try{const e=await this.callApi({type:"auth",url:"validate"});return new ad(e)}catch(e){throw e instanceof ds&&e.statusCode===401?new rs({cause:e}):e}}async callApi(e){var r;const{authProvider:n}=this._config;if(!((r=e.auth)!==null&&r!==void 0?r:!0))return await su(e,n.clientId,void 0,void 0,this._config.fetchOptions);let s=!1;if(e.forceType)switch(e.forceType){case"app":{if(!n.getAppAccessToken)throw new Error("Tried to make an API call that requires an app access token but your auth provider does not support that");const l=await n.getAppAccessToken();return await this._callApiUsingInitialToken(e,l)}case"user":{s=!0;break}default:throw new wi(`Unknown forced token type: ${e.forceType}`)}if(e.scopes&&(s=!0),s){const l=e.canOverrideScopedUserContext?this._getUserIdFromRequestContext(e.userId):e.userId;if(!l)throw new Error("Tried to make an API call with a user context but no context user ID");const u=await n.getAccessTokenForUser(l,e.scopes);if(!u)throw new Error(`Tried to make an API call with a user context for user ID ${l} but no token was found`);if(oo(u)&&n.refreshAccessTokenForUser){const c=await n.refreshAccessTokenForUser(l);return await this._callApiUsingInitialToken(e,c,!0)}return await this._callApiUsingInitialToken(e,u)}const o=this._getUserIdFromRequestContext(e.userId),a=o===null?await n.getAnyAccessToken():await n.getAnyAccessToken(o??e.userId);if(oo(a)&&a.userId&&n.refreshAccessTokenForUser){const l=await n.refreshAccessTokenForUser(a.userId);return await this._callApiUsingInitialToken(e,l,!0)}return await this._callApiUsingInitialToken(e,a)}get bits(){return new by(this)}get channels(){return new vd(this)}get channelPoints(){return new xy(this)}get charity(){return new Sy(this)}get chat(){return new Ey(this)}get clips(){return new Ed(this)}get contentClassificationLabels(){return new Ty(this)}get entitlements(){return new Td(this)}get eventSub(){return new ky(this)}get extensions(){return new Py(this)}get games(){return new Lo(this)}get hypeTrain(){return new Kj(this)}get goals(){return new Ay(this)}get moderation(){return new Oy(this)}get polls(){return new My(this)}get predictions(){return new Ny(this)}get raids(){return new jy(this)}get schedule(){return new l8(this)}get search(){return new By(this)}get streams(){return new Il(this)}get subscriptions(){return new Fy(this)}get teams(){return new qy(this)}get users(){return new Dl(this)}get videos(){return new Ld(this)}get whispers(){return new zy(this)}get rateLimiterStats(){return this._rateLimiter instanceof qv?this._rateLimiter.stats:null}get _authProvider(){return this._config.authProvider}get _batchDelay(){var e;return(e=this._config.batchDelay)!==null&&e!==void 0?e:0}_getUserIdFromRequestContext(e){return e}async _callApiUsingInitialToken(e,r,n=!1){var i;const{authProvider:s}=this._config,{authorizationType:o}=s;let a=await this._callApiInternal(e,s.clientId,r.accessToken,o);if(a.status===401&&!n){if(r.userId){if(s.refreshAccessTokenForUser){const l=await s.refreshAccessTokenForUser(r.userId);a=await this._callApiInternal(e,s.clientId,l.accessToken,o)}}else if(s.getAppAccessToken){const l=await s.getAppAccessToken(!0);a=await this._callApiInternal(e,s.clientId,l.accessToken,o)}}return this.emit(this.onRequest,new m8(e,a.status,(i=r.userId)!==null&&i!==void 0?i:null)),await cy(a,e),await wT(a)}async _callApiInternal(e,r,n,i){var s,o,a;const{fetchOptions:l}=this._config,u=(s=e.type)!==null&&s!==void 0?s:"helix";this._logger.debug(`Calling ${u} 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)}`);const c=Dj.operation({retries:3,minTimeout:500,factor:2}),{promise:f,resolve:d,reject:y}=ul();c.attempt(async()=>{try{const b=u==="helix"?await this._rateLimiter.request({options:e,clientId:r,accessToken:n,authorizationType:i,fetchOptions:l}):await jf(e,r,n,i,l);!b.ok&&b.status>=500&&b.status<600&&await cy(b,e),d(b)}catch(b){if(c.retry(b))return;y(c.mainError())}});const v=await f;return this._logger.debug(`Called ${u} API: ${(a=e.method)!==null&&a!==void 0?a:"GET"} ${e.url} - result: ${v.status}`),v}};C([Se()],xe.prototype,"bits",null);C([Se()],xe.prototype,"channels",null);C([Se()],xe.prototype,"channelPoints",null);C([Se()],xe.prototype,"charity",null);C([Se()],xe.prototype,"chat",null);C([Se()],xe.prototype,"clips",null);C([Se()],xe.prototype,"contentClassificationLabels",null);C([Se()],xe.prototype,"entitlements",null);C([Se()],xe.prototype,"eventSub",null);C([Se()],xe.prototype,"extensions",null);C([Se()],xe.prototype,"games",null);C([Se()],xe.prototype,"hypeTrain",null);C([Se()],xe.prototype,"goals",null);C([Se()],xe.prototype,"moderation",null);C([Se()],xe.prototype,"polls",null);C([Se()],xe.prototype,"predictions",null);C([Se()],xe.prototype,"raids",null);C([Se()],xe.prototype,"schedule",null);C([Se()],xe.prototype,"search",null);C([Se()],xe.prototype,"streams",null);C([Se()],xe.prototype,"subscriptions",null);C([Se()],xe.prototype,"teams",null);C([Se()],xe.prototype,"users",null);C([Se()],xe.prototype,"videos",null);C([Se()],xe.prototype,"whispers",null);xe=C([au,L("api","ApiClient")],xe);let Wy=class extends xe{_getUserIdFromRequestContext(){return null}};Wy=C([L("api","ApiClient")],Wy);let Bd=class extends xe{constructor(e,r,n,i){super(e,r,n),this._userId=i}_getUserIdFromRequestContext(){return this._userId}};Bd=C([L("api","ApiClient")],Bd);let Gy=class extends xe{constructor(e){if(!e.authProvider)throw new Rj("No auth provider given. Please supply the `authProvider` option.");const r={name:"twurple:api:rate-limiter",...e.logger};super(e,Wo({name:"twurple:api:client",...e.logger}),kf?new YN({getPartitionKey:n=>{var i;return(i=n.userId)!==null&&i!==void 0?i:null},createChild:()=>new Mj({logger:r})}):new pT({logger:r,bucketSize:800,timeFrame:64e3,doRequest:async({options:n,clientId:i,accessToken:s,authorizationType:o,fetchOptions:a})=>await jf(n,i,s,o,a),getPartitionKey:n=>{var i;return(i=n.userId)!==null&&i!==void 0?i:null}}))}async asUser(e,r){const n=new Bd(this._config,this._logger,this._rateLimiter,E(e));return await r(n)}async asIntent(e,r){if(!this._authProvider.getAccessTokenForIntent)throw new Error("Trying to use intents with an auth provider that does not support them");for(const n of e){const i=await this._authProvider.getAccessTokenForIntent(n);if(i){const s=new Bd(this._config,this._logger,this._rateLimiter,i.userId);return await r(s)}}throw new Error(`Intents [${e.join(", ")}] not found in auth provider`)}async withoutUser(e){const r=new Wy(this._config,this._logger,this._rateLimiter);return await e(r)}};Gy=C([L("api","ApiClient")],Gy);class g8{constructor(e="",r=""){Mr(this,"_clientId",py.twitch.clientId);Mr(this,"_scopes",py.twitch.scopes);Mr(this,"_accessToken");Mr(this,"_key");this._accessToken={accessToken:e,refreshToken:null,scope:this._scopes,expiresIn:null,obtainmentTimestamp:Date.now()},this._key=r}setAccessToken(e=""){e&&!this._accessToken.accessToken&&(this._accessToken.accessToken=e)}setKey(e=""){e&&!this._key&&(this._key=e)}get clientId(){return this._clientId}getCurrentScopesForUser(){return this._scopes}async getAccessTokenForUser(e,...r){return this._getAccessToken(r)}async getAnyAccessToken(){return this._getAccessToken()}async refreshAccessTokenForUser(){console.info("Refreshing authorization...");const e=await wP("twitch",this._key);return this._accessToken.accessToken=e,this._accessToken.obtainmentTimestamp=Date.now(),console.info("Reauthorized!"),this._getAccessToken()}async _getAccessToken(e){try{this._checkScopes(e);const{[h]:{expires_in:r},userId:n}=await fs(this._accessToken.accessToken,this._clientId);return this._accessToken.expiresIn=r||null,{...this._accessToken,userId:n}}catch{return await this.refreshAccessTokenForUser()}}_checkScopes(e){if(e!=null&&e.length){const r=new Set(this._scopes);e.forEach(n=>{if(!(!n||!n.length)&&n.every(i=>!r.has(i)))throw new y8(n)})}}}class y8 extends Error{constructor(e){const r=`This token does not have one of the requested scopes: [${e.join(", ")}]`;super(r),this.name="MissingScopesError"}}const Vy=new g8,v8=new Gy({authProvider:Vy});function Ko(){const{data:t}=dw("twitch"),{keys:e}=wn();return Vy.setAccessToken(t),Vy.setKey(e.twitch),v8}function ki(){const{data:t}=dw("twitch"),e=Ko();return xi({enabled:!!t,queryKey:["twitch","broadcaster",t||null],queryFn:async()=>{const{clientId:r}=py.twitch,{userId:n}=await fs(t,r);if(!n)throw Error("Twitch broadcaster not found");const i=await e.users.getUserById(n);if(!i)throw Error("Twitch broadcaster not found");return{id:i.id,userName:i.name,displayName:i.displayName,image:i.profilePictureUrl,url:`https://www.twitch.tv/${i.name}`}},...ys})}function kP(){const{data:t}=ki(),e=Ko();return xi({enabled:!!t,queryKey:["twitch","channelPointRewards",t==null?void 0:t.id],queryFn:async()=>{const r=new Map;return(await e.channelPoints.getCustomRewards(t.id).catch(()=>[])).forEach(i=>{r.set(i.id,i)}),r},...ys})}function Vf(){const{data:t}=ki(),e=Ko();return xi({enabled:!!t,queryKey:["twitch","cheermotes",t==null?void 0:t.id],queryFn:async()=>{const r=await e.bits.getCheermotes(t.id);return new w8(r)},...ys})}class w8{constructor(e){Mr(this,"cheermoteList");this.cheermoteList=e}getAllNames(){return this.cheermoteList.getPossibleNames()}get(e,r){return{name:e,amount:r,color:this.cheerColor(e,r),images:{default:this.buildCheermoteUrls(e,r),static:this.buildCheermoteUrls(e,r,!0)}}}cheerColor(e,r){return this.cheermoteList.getCheermoteDisplayInfo(e,r,{background:"light",scale:"1",state:"static"}).color}buildCheermoteUrls(e,r,n=!1){const i=this.cheermoteList;function s(o){return i.getCheermoteDisplayInfo(e,r,{background:"light",scale:o,state:n?"static":"animated"}).url}return{x1:s("1"),x2:s("2"),x4:s("4")}}}function _8(){const{data:t}=Vf();function e(r,n){const{name:i,amount:s,position:o,length:a}=r;return{type:"cheer",text:n.slice(o,o+a),cheer:t.get(i,s)}}return e}const b8=Wf.create({baseURL:"https://api.betterttv.net/3/cached"});async function x8(t,e){const r=new Map,n=await b8.get(`/users/${t}/${e}`).then(a=>a.data).catch(()=>null);if(!n)return r;const{channelEmotes:i,sharedEmotes:s}=n;if(!i||!s)return r;function o(a){a.forEach(l=>{r.set(l.code,{id:l.id,name:l.code,images:{default:Rx(l.id),static:Rx(l.id,!0)},source:"betterttv"})})}return o(i),o(s),r}function Rx(t,e=!1){function r(n){return`https://cdn.betterttv.net/emote/${t}${e?"/static":""}/${n}x`}return{x1:r(1),x2:r(2),x4:r(3)}}const S8=Wf.create({baseURL:"https://api.frankerfacez.com/v1"});async function C8(t,e){const r=new Map,n=await S8.get(`/room/${E8(t)}/${e}`).then(s=>s.data).catch(()=>null);if(!n)return r;const{sets:i}=n;return i&&Object.keys(i).forEach(s=>{i[s].emoticons.forEach(o=>{r.set(o.name,{id:o.id.toString(),name:o.name,images:{default:Mx(o),static:Mx(o,!0)},source:"frankerfacez"})})}),r}function Mx(t,e=!1){let r=t.urls[1],n=t.urls[2]||r,i=t.urls[4]||n;return!e&&t.animated&&(r=t.animated[1],n=t.animated[2]||r,i=t.animated[4]||n),{x1:r,x2:n,x4:i}}function E8(t){switch(t){case"twitch":return"id";case"youtube":return"yt";default:throw Error(`Unhandled platform "${t}" in FFZ Platform URL Transformer`)}}function Qf(){const{data:t}=ki();return xi({enabled:!!t,queryKey:["twitch","thirdPartyEmotes",t==null?void 0:t.id],queryFn:async()=>{const e=new Map;return(await Promise.all([x8("twitch",t.id),C8("twitch",t.id)])).forEach(n=>{n.forEach((i,s)=>{e.set(s,i)})}),e},retry:1,retryOnMount:!1,gcTime:1/0,staleTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1})}function T8(){const{data:t}=Qf();function e(r,n){const{position:i,length:s,id:o,name:a}=r,l=n.slice(i,i+s),u=t.get(l);return u?{type:"emote",text:l,emote:u}:{type:"emote",text:l,emote:{id:o,name:a,images:{default:Nx(o),static:Nx(o,!0)},source:"twitch"}}}return e}function Nx(t,e=!1){function r(n){return Jk(t,{animationSettings:e?"static":"default",backgroundType:"light",size:n})}return{x1:r("1.0"),x2:r("2.0"),x4:r("3.0")}}function k8(){const{data:t}=Qf();function e(r){const n=[],{text:i}=r,s=P8(Array.from(t.keys()));return i.split(s).forEach(o=>{if(o==="")return;const a=t.get(o);a?n.push({type:"emote",text:o,emote:a}):n.push({type:"text",text:o})}),n}return e}function P8(t){const e=t.map(A8).join("|"),r=String.raw`(?<=\s|[.,!]|^)(${e})(?=\s|[.,!]|$)`;return new RegExp(r,"g")}function A8(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I8(){const{data:t}=Vf(),e=k8(),r=_8(),n=T8();function i(s,o,a=!1){if(!s)return[];const l=mD(s,o,a?t.getAllNames():void 0),u=[];return l.forEach(c=>{switch(c.type){default:case"text":u.push(...e(c));break;case"cheer":u.push(r(c,s));break;case"emote":u.push(n(c,s));break}}),u}return i}function fw(){const{data:t}=ki(),e=Ko();return xi({enabled:!!t,queryKey:["twitch","badges",t==null?void 0:t.id],queryFn:async()=>{const[r,n]=await Promise.all([e.chat.getGlobalBadges(),e.chat.getChannelBadges(t.id)]);return new O8(r,n)},...ys})}class O8{constructor(e,r){Mr(this,"badgeMap",new Map);this.set(e),this.set(r)}transform(e){const r=[];return e.forEach((n,i)=>{const s=this.get(i,n);s&&r.push(s)}),r}get(e,r=e==="subscriber"||e==="founder"?"0":"1"){var i,s;const n=(s=(i=this.badgeMap.get(e))==null?void 0:i.get(r))==null?void 0:s.getImageUrl(4);if(n)return{id:e,image:n}}set(e){e.forEach(r=>{const n=new Map;r.versions.forEach(i=>{n.set(i.id,i)}),this.badgeMap.set(r.id,n)})}}function R8(){const{data:t}=ki(),e=Ko(),r=sf();async function n(i){return t?await r.fetchQuery({queryKey:["twitch","followDate",i],queryFn:async()=>{if(i===t.id)return new Date(0);const s=await e.channels.getChannelFollowers(t.id,i),[o]=s.data;return o?o.followDate:null},staleTime:1*60*60*1e3,gcTime:2*60*60*1e3,retry:1}):null}return{getFollowDate:n}}function M8(){const{data:t}=hw(),e=sf();async function r(n){return t?await e.fetchQuery({queryKey:["twitch","pronouns","user",n],queryFn:async()=>{const i=await N8(n);return i?t.get(i):null},staleTime:5*60*1e3,gcTime:1*60*60*1e3,retry:0}):null}return{getPronouns:r}}function hw(){return xi({queryKey:["twitch","pronouns","all"],queryFn:async()=>D8(),...ys})}const PP=Wf.create({baseURL:"https://pronouns.alejo.io/api"});async function N8(t){const e=await PP.get(`/users/${t}`).then(n=>n.data).catch(()=>null);if(!e)return null;const[r]=e;return r?r.pronoun_id:null}async function D8(){const t=new Map;return(await PP.get("/pronouns").then(r=>r.data)).forEach(({name:r,display:n})=>{t.set(r,n)}),t}class qe{static number(e,r){return Math.random()*(r-e)+e}static integer(e,r){return Math.floor(Math.random()*(r-e+1))+e}static chance(e){return Math.random()n||qe.item(j8),staleTime:1/0,gcTime:1/0})}return e}const j8=["red","blue","green","firebrick","coral","yellowgreen","orangered","seagreen","goldenrod","chocolate","cadetblue","dodgerblue","hotpink","blueviolet","springgreen"];function L8(){const{getPronouns:t}=M8(),{getFollowDate:e}=R8(),{data:r}=fw(),n=AP();async function i(s){const{userId:o,userName:a,displayName:l,badges:u,color:c,isBroadcaster:f,isMod:d,isArtist:y,isVip:v,isFounder:b,isSubscriber:w}=s;return{id:o,userName:a,displayName:l,pronouns:await t(a),badges:r.transform(u),color:await n(o,c),roles:{broadcaster:f,moderator:d,artist:y,vip:v,founder:b,subscriber:w},followDate:await e(o)}}return i}function B8(){const{data:t}=kP(),e=I8(),r=L8();async function n(i,s,o){if(s instanceof $f&&(o=s.text),!o)return;const{type:a}=i,l={id:s.id,first:s.tags.get("first-msg")==="1",date:s.date,text:o,parts:e(o,s.emoteOffsets,a==="cheer"),user:await r(s.userInfo),tags:s.tags,...i};if(a!=="basic")return l;if(s.tags.get("msg-id")==="highlighted-message")return{...l,type:"highlight"};const u=s.tags.get("custom-reward-id");if(u){const d=t.get(u);if(d){const y={id:d.id,name:d.title,cost:d.cost,image:d.getImageUrl(4),color:d.backgroundColor};return{...l,type:"redeem",redeem:y}}}function c(d){return s.tags.get(`reply-parent-${d}`)||""}const f=c("msg-id");if(f){const d={id:f,text:c("msg-body"),user:{id:c("user-id"),userName:c("user-login"),displayName:c("display-name")}};return{...l,type:"reply",reply:d}}return l}return n}const Gu="twitch";function $8(){const{data:t}=ki(),{isPlatformReady:e}=Tf(),r=wn(),{addEvent:n,removeEvent:i,removeUser:s,removeMessages:o}=Iv(),a=B8(),l=I.useRef(new pd),u=e("twitch");I.useEffect(()=>{if(!u)return;const c=l.current;!c.isConnected&&!c.isConnecting&&(c.connect(),c.join(t.userName));function f(w){w&&n({type:"message",id:w.id,userId:w.user.id,message:w,source:Gu})}function d(w){i("message",w),r.sendEvent({type:"remove-message",messageId:w,source:Gu})}function y(){o(),r.sendEvent({type:"clear-messages",source:Gu})}function v(w){w&&(s(w),r.sendEvent({type:"remove-user",userId:w,source:Gu}))}const b=[];return b.push(c.onMessage(async(w,p,m,g)=>{const{bits:x}=g,k=await a(x?{type:"cheer",cheer:{amount:x}}:{type:"basic"},g,m);f(k)}),c.onAction(async(w,p,m,g)=>{const x=await a({type:"action"},g,m);f(x)}),c.onResub(async(w,p,m,g)=>{const x={type:"resub",resub:{months:m.months,tier:m.plan}},S=await a(x,g);f(S)}),c.onAnnouncement(async(w,p,m,g)=>{const x={type:"announcement",announcement:{color:m.color}},S=await a(x,g);f(S)}),c.onChatClear(()=>{y()}),c.onTimeout((w,p,m,g)=>{v(g.targetUserId)}),c.onBan((w,p,m)=>{v(m.targetUserId)}),c.onMessageRemove((w,p)=>{d(p)})),()=>{b.forEach(w=>{w&&c.removeListener(w)})}},[u,r,n,i,s,o,a,t])}function IP(){const{data:t}=ki(),e=Ko();return xi({enabled:!!t,queryKey:["twitch","channelEmotes",t==null?void 0:t.id],queryFn:async()=>(await e.chat.getChannelEmotes(t.id)).map(n=>{const{id:i,name:s}=n;return{id:i,name:s,images:{default:Dx(i),static:Dx(i,!0)},source:"twitch"}}),...ys})}function Dx(t,e=!1){function r(n){return Jk(t,{animationSettings:e?"static":"default",backgroundType:"light",size:n})}return{x1:r("1.0"),x2:r("2.0"),x4:r("3.0")}}function U8(){const{data:t,status:e}=ki(),{status:r}=fw(),{status:n}=IP(),{status:i}=kP(),{status:s}=Vf(),{status:o}=hw(),{status:a}=Qf(),{isPlatformReady:l}=Tf(),{setPlatformReady:u}=M4();$8();const c=[e,r,n,i,s,o,a].some(f=>f==="pending");return I.useEffect(()=>{c||u("twitch")},[c]),l("twitch")?_.jsx(O4,{broadcaster:t,platform:"twitch",staticPosition:!0}):_.jsx(U5,{staticPosition:!0,message:"Key verified! Loading Twitch data...",items:[{message:"Loading broadcaster...",status:e},{message:"Loading badges...",status:r},{message:"Loading channel emotes...",status:n},{message:"Loading channel point rewards...",status:i},{message:"Loading cheermotes...",status:s},{message:"Loading pronouns...",status:o},{message:"Loading third party emotes...",status:a}]})}function Ot(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function OP(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Ot(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let Om;function Ar(){return Om||(Om=OP("keyval-store","keyval")),Om}function F8(t,e=Ar()){return e("readonly",r=>Ot(r.get(t)))}function q8(t,e,r=Ar()){return r("readwrite",n=>(n.put(e,t),Ot(n.transaction)))}function H8(t,e=Ar()){return e("readwrite",r=>(t.forEach(n=>r.put(n[1],n[0])),Ot(r.transaction)))}function z8(t,e=Ar()){return e("readonly",r=>Promise.all(t.map(n=>Ot(r.get(n)))))}function W8(t,e,r=Ar()){return r("readwrite",n=>new Promise((i,s)=>{n.get(t).onsuccess=function(){try{n.put(e(this.result),t),i(Ot(n.transaction))}catch(o){s(o)}}}))}function G8(t,e=Ar()){return e("readwrite",r=>(r.delete(t),Ot(r.transaction)))}function V8(t,e=Ar()){return e("readwrite",r=>(t.forEach(n=>r.delete(n)),Ot(r.transaction)))}function Q8(t=Ar()){return t("readwrite",e=>(e.clear(),Ot(e.transaction)))}function pw(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ot(t.transaction)}function K8(t=Ar()){return t("readonly",e=>{if(e.getAllKeys)return Ot(e.getAllKeys());const r=[];return pw(e,n=>r.push(n.key)).then(()=>r)})}function Y8(t=Ar()){return t("readonly",e=>{if(e.getAll)return Ot(e.getAll());const r=[];return pw(e,n=>r.push(n.value)).then(()=>r)})}function X8(t=Ar()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Ot(e.getAllKeys()),Ot(e.getAll())]).then(([n,i])=>n.map((s,o)=>[s,i[o]]));const r=[];return t("readonly",n=>pw(n,i=>r.push([i.key,i.value])).then(()=>r))})}class J8{constructor(e){Mr(this,"_store");e&&this._createStore(e)}use(e){if(!e)throw new eL;this._createStore(`widget-${e}`)}get(e){return this._throwIfStoreMissing(),F8(e,this._store)}getMany(e){return this._throwIfStoreMissing(),z8(e,this._store)}set(e,r){return this._throwIfStoreMissing(),q8(e,r,this._store)}setMany(e){return this._throwIfStoreMissing(),H8(e,this._store)}update(e,r){return this._throwIfStoreMissing(),W8(e,r,this._store)}del(e){return this._throwIfStoreMissing(),G8(e,this._store)}delMany(e){return this._throwIfStoreMissing(),V8(e,this._store)}clear(){return this._throwIfStoreMissing(),Q8(this._store)}keys(){return this._throwIfStoreMissing(),K8(this._store)}values(){return this._throwIfStoreMissing(),Y8(this._store)}entries(){return this._throwIfStoreMissing(),X8(this._store)}_createStore(e){this._store=OP(`slime2-${e}-db`,`slime2-${e}-store`)}_throwIfStoreMissing(){if(!this._store)throw new tL}}const Z8=new J8;class eL extends Error{constructor(){const e="Parameters missing from slime2.storage.create()";super(e),this.name="CreateStorageError"}}class tL extends Error{constructor(){const e="Storage must be created using slime2.storage.create('storage-name') before use.";super(e),this.name="MissingStorageError"}}function rL(){const{status:t,error:e}=dw("twitch"),r=I.useRef(!1),n=I.useRef(null),{onEvent:i,setKey:s,setPlatform:o,setMaxEvents:a,setEventDelay:l,setEventExpiration:u,createWidgetSettings:c}=eR(),{loadValues:f}=xf(),d=Ev(),{platforms:y}=wn(),v=I.useCallback((w,p)=>{if(!Array.isArray(w))return d;const m=Ri(d,w);return typeof p!="string"?m:(m==null?void 0:m[p])||null},[d]);if(I.useEffect(()=>{r.current||(globalThis.slime2={onEvent:i,setKey:s,setMaxEvents:a,setEventDelay:l,setEventExpiration:u,storage:Z8,color:ll,random:qe,cloneTemplate:KO,widget:{loadSettings:(w,p)=>(c(w,p),new Promise(m=>{n.current=m})),loadPlatform:o,setData:w=>{f(w)},getData:v}},dispatchEvent(new CustomEvent("slime2:ready")),r.current=!0)},[]),I.useEffect(()=>{if(Object.keys(d).length){const w=n.current;w&&(globalThis.slime2.widget.getData=v,w(),dispatchEvent(new CustomEvent("slime2:widget-data-update")))}},[d,v]),y.includes("twitch")){if(e instanceof _P)return _.jsx(k1,{message:"Twitch key not found."});if(e instanceof bP)return _.jsx(k1,{message:"Twitch key expired."})}return!!y.length&&[t].some(w=>w==="pending")?_.jsx(U5,{message:"Verifying Key..."}):_.jsx("div",{className:"absolute inset-x-0",children:t==="success"&&_.jsx(U8,{})})}var RP={exports:{}},Rm={exports:{}},jx;function nL(){return jx||(jx=1,function(t){(function(e,r){t.exports?t.exports=r():e.EvEmitter=r()})(typeof window<"u"?window:tf,function(){function e(){}let r=e.prototype;return r.on=function(n,i){if(!n||!i)return this;let s=this._events=this._events||{},o=s[n]=s[n]||[];return o.includes(i)||o.push(i),this},r.once=function(n,i){if(!n||!i)return this;this.on(n,i);let s=this._onceEvents=this._onceEvents||{},o=s[n]=s[n]||{};return o[i]=!0,this},r.off=function(n,i){let s=this._events&&this._events[n];if(!s||!s.length)return this;let o=s.indexOf(i);return o!=-1&&s.splice(o,1),this},r.emitEvent=function(n,i){let s=this._events&&this._events[n];if(!s||!s.length)return this;s=s.slice(0),i=i||[];let o=this._onceEvents&&this._onceEvents[n];for(let a of s)o&&o[a]&&(this.off(n,a),delete o[a]),a.apply(this,i);return this},r.allOff=function(){return delete this._events,delete this._onceEvents,this},e})}(Rm)),Rm.exports}/*! +`):" "+hx(s[0]):"as no adapter specified";throw new me("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:yy};function km(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new uu(null,t)}function px(t){return km(t),t.headers=fn.from(t.headers),t.data=Tm.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),gP.getAdapter(t.adapter||lw.adapter)(t).then(function(n){return km(t),n.data=Tm.call(t,t.transformResponse,n),n.headers=fn.from(n.headers),n},function(n){return pP(n)||(km(t),n&&n.response&&(n.response.data=Tm.call(t,t.transformResponse,n.response),n.response.headers=fn.from(n.response.headers))),Promise.reject(n)})}const mx=t=>t instanceof fn?t.toJSON():t;function jo(t,e){e=e||{};const r={};function n(u,c,f){return N.isPlainObject(u)&&N.isPlainObject(c)?N.merge.call({caseless:f},u,c):N.isPlainObject(c)?N.merge({},c):N.isArray(c)?c.slice():c}function i(u,c,f){if(N.isUndefined(c)){if(!N.isUndefined(u))return n(void 0,u,f)}else return n(u,c,f)}function s(u,c){if(!N.isUndefined(c))return n(void 0,c)}function o(u,c){if(N.isUndefined(c)){if(!N.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function a(u,c,f){if(f in e)return n(u,c);if(f in t)return n(void 0,u)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials: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:a,headers:(u,c)=>i(mx(u),mx(c),!0)};return N.forEach(Object.keys(Object.assign({},t,e)),function(c){const f=l[c]||i,d=f(t[c],e[c],c);N.isUndefined(d)&&f!==a||(r[c]=d)}),r}const yP="1.5.1",uw={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{uw[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const gx={};uw.transitional=function(e,r,n){function i(s,o){return"[Axios v"+yP+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new me(i(o," has been removed"+(r?" in "+r:"")),me.ERR_DEPRECATED);return r&&!gx[o]&&(gx[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function kj(t,e,r){if(typeof t!="object")throw new me("options must be an object",me.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],l=a===void 0||o(a,s,t);if(l!==!0)throw new me("option "+s+" must be "+l,me.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new me("Unknown option "+s,me.ERR_BAD_OPTION)}}const vy={assertOptions:kj,validators:uw},Rn=vy.validators;class md{constructor(e){this.defaults=e,this.interceptors={request:new cx,response:new cx}}request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=jo(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&vy.assertOptions(n,{silentJSONParsing:Rn.transitional(Rn.boolean),forcedJSONParsing:Rn.transitional(Rn.boolean),clarifyTimeoutError:Rn.transitional(Rn.boolean)},!1),i!=null&&(N.isFunction(i)?r.paramsSerializer={serialize:i}:vy.assertOptions(i,{encode:Rn.function,serialize:Rn.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&N.merge(s.common,s[r.method]);s&&N.forEach(["delete","get","head","post","put","patch","common"],v=>{delete s[v]}),r.headers=fn.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(r)===!1||(l=l&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let c,f=0,d;if(!l){const v=[px.bind(this),void 0];for(v.unshift.apply(v,a),v.push.apply(v,u),d=v.length,c=Promise.resolve(r);f{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new uu(s,o,a),r(n.reason))})}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;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new cw(function(i){e=i}),cancel:e}}}const Pj=cw;function Aj(t){return function(r){return t.apply(null,r)}}function Ij(t){return N.isObject(t)&&t.isAxiosError===!0}const wy={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(wy).forEach(([t,e])=>{wy[e]=t});const Oj=wy;function vP(t){const e=new wc(t),r=Zk(wc.prototype.request,e);return N.extend(r,wc.prototype,e,{allOwnKeys:!0}),N.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return vP(jo(t,i))},r}const Ve=vP(lw);Ve.Axios=wc;Ve.CanceledError=uu;Ve.CancelToken=Pj;Ve.isCancel=pP;Ve.VERSION=yP;Ve.toFormData=Hf;Ve.AxiosError=me;Ve.Cancel=Ve.CanceledError;Ve.all=function(e){return Promise.all(e)};Ve.spread=Aj;Ve.isAxiosError=Ij;Ve.mergeConfig=jo;Ve.AxiosHeaders=fn;Ve.formToJSON=t=>hP(N.isHTMLForm(t)?new FormData(t):t);Ve.getAdapter=gP.getAdapter;Ve.HttpStatusCode=Oj;Ve.default=Ve;const Wf=Ve,Rj=Wf.create({baseURL:"https://slime2.stream/api"});function dw(t){const{keys:e,platforms:r}=wn(),n=e[t],[i,s]=I.useState(!1),o=t==="google"?"youtube":t,a=r.includes(o);return I.useEffect(()=>{function l(){s(!0)}return addEventListener("slime2:ready",l),()=>{removeEventListener("slime2:ready",l)}},[]),xi({enabled:i,queryKey:[t,a,"accessToken",n||null],queryFn:async()=>{if(!a)throw Error("Not an actual error");return wP(t,n)},...ys})}async function wP(t,e){if(!e)throw new _P(`Key not found for platform ${t}`);return Rj.get(`/auth/${t}/token`,{headers:{Authorization:`Bearer ${e}`}}).then(r=>r.data.token).catch(r=>{const n=`Invalid key for platform ${t}, download a new one from https://slime2.stream/account`;throw console.error(n,r),new bP(`Invalid key for platform ${t}, download a new one from https://slime2.stream/account`,{cause:r})})}class _P extends Error{constructor(e,r){super(e,r),this.name="KeyNotFoundError"}}class bP extends Error{constructor(e,r){super(e,r),this.name="KeyInvalidError"}}class Mj extends Zr{}class Nj extends qv{async doRequest({options:e,clientId:r,accessToken:n,authorizationType:i,fetchOptions:s}){return await jf(e,r,n,i,s)}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){const{headers:r}=e;return{limit:+r.get("ratelimit-limit"),remaining:+r.get("ratelimit-remaining"),resetsAt:+r.get("ratelimit-reset")*1e3}}}var xP={};function pr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,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))}var Dj=pr;pr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};pr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};pr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};pr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};pr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};pr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};pr.prototype.start=pr.prototype.try;pr.prototype.errors=function(){return this._errors};pr.prototype.attempts=function(){return this._attempts};pr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n=r&&(e=i,r=o)}return e};(function(t){var e=Dj;t.operation=function(r){var n=t.timeouts(r);return new e(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(r){if(r instanceof Array)return[].concat(r);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var i in r)n[i]=r[i];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],o=0;onew gd(e,this._client))}get totalCount(){return this[h].total}};C([K(!1)],pl.prototype,"_client",void 0);C([Se()],pl.prototype,"entries",null);pl=C([au,B("api","HelixBitsLeaderboard")],pl);let _y=class extends Z{constructor(e){super(IE(e,r=>r.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,r,n){e=e.toLowerCase();const{background:i,state:s,scale:o}=n,{tiers:a}=this[h][e],l=a.sort((u,c)=>c.min_bits-u.min_bits).find(u=>u.min_bits<=r);if(!l)throw new wi(`Cheermote "${e}" does not have an applicable tier for ${r} bits`);return{url:l.images[i][s][o],color:l.color}}getPossibleNames(){return Object.keys(this[h])}};_y=C([B("api","HelixCheermoteList")],_y);let by=class extends Ae{async getLeaderboard(e,r={}){const n=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:E(e),scopes:["bits:read"],query:Lj(r)});return new pl(n,this._client)}async getCheermotes(e){const r=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:Xr(e,E),query:Xr(e,_e)});return new _y(r.data)}};by=C([B("api","HelixBitsApi")],by);function Bj(t){var e;return{game_id:t.gameId,broadcaster_language:t.language,title:t.title,delay:(e=t.delay)===null||e===void 0?void 0:e.toString(),tags:t.tags,content_classification_labels:t.contentClassificationLabels,is_branded_content:t.isBrandedContent}}function $j(t,e){return{broadcaster_id:E(t),length:e}}function yx(t,e){return{broadcaster_id:E(t),user_id:E(e)}}function Pm(t,e){return{broadcaster_id:E(t),user_id:Xr(e,E)}}function vx(t,e){return{broadcaster_id:Xr(e,E),user_id:E(t)}}function He(t,e){return{[t]:e}}function wx(t){return{user_id:E(t)}}function SP(t,e){return{broadcaster_id:t,moderator_id:e}}function Gf(t,e){return{broadcaster_id:E(t),id:e}}function CP(t,e){return{broadcaster_id:E(t),user_id:e.map(E)}}let ns=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].user_id}get name(){return this[h].user_login}get displayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],ns.prototype,"_client",void 0);ns=C([B("api","HelixUserRelation","id")],ns);class ur{constructor(e,r,n,i,s,o=100){this._callOptions=e,this._queryParamName=r,this._matchKey=n,this._mapper=s,this._limitPerRequest=o,this._requestedIds=[],this._requestResolversById=new Map,this._waitTimer=null,this._client=i,this._delay=i._batchDelay}async request(e){const{promise:r,resolve:n,reject:i}=ul();return this._requestedIds.includes(e)||this._requestedIds.push(e),this._requestResolversById.has(e)?this._requestResolversById.get(e).push({resolve:n,reject:i}):this._requestResolversById.set(e,[{resolve:n,reject:i}]),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 r}async _handleBatch(e){var r;try{const{data:n}=await this._doRequest(e),i=IE(n,this._matchKey);for(const s of e){for(const o of(r=this._requestResolversById.get(s))!==null&&r!==void 0?r:[])Object.prototype.hasOwnProperty.call(i,s)?o.resolve(this._mapper(i[s])):o.resolve(null);this._requestResolversById.delete(s)}}catch{await Promise.all(e.map(async i=>{var s,o;try{const a=await this._doRequest([i]);for(const l of(s=this._requestResolversById.get(i))!==null&&s!==void 0?s:[])l.resolve(a.data.length?this._mapper(a.data[0]):null)}catch(a){for(const l of(o=this._requestResolversById.get(i))!==null&&o!==void 0?o:[])l.reject(a)}this._requestResolversById.delete(i)}))}}async _doRequest(e){return await this._client.callApi({type:"helix",...this._callOptions,query:{...this._callOptions.query,[this._queryParamName]:e}})}}C([K(!1)],ur.prototype,"_client",void 0);var Am;Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(Am=Symbol.asyncIterator)!==null&&Am!==void 0?Am:Symbol.for("Symbol.asyncIterator"));let Me=class{constructor(e,r,n,i=100){this._callOptions=e,this._mapper=n,this._limitPerPage=i,this._isFinished=!1,this._client=r}get current(){var e;return(e=this._currentData)===null||e===void 0?void 0:e.data}async getNext(){var e;if(this._isFinished)return[];const r=await this._fetchData();return!((e=r.data)===null||e===void 0)&&e.length?this._processResult(r):(this._isFinished=!0,[])}async getAll(){this.reset();const e=[];do{const r=await this.getNext();if(!r.length)break;e.push(...r)}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();;){const 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){return this._currentCursor=e.pagination?e.pagination.cursor:void 0,this._currentCursor===void 0&&(this._isFinished=!0),this._currentData=e,e.data.reduce((r,n)=>{const i=this._mapper(n);return Array.isArray(i)?[...r,...i]:[...r,i]},[])}};C([K(!1)],Me.prototype,"_client",void 0);Me=C([B("api","HelixPaginatedRequest")],Me);let hs=class extends Me{async getTotalCount(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total}};hs=C([B("api","HelixPaginatedRequestWithTotal")],hs);function Ge(t,e,r){var n;let i;return{get data(){var s,o;return i??(i=(o=(s=t.data)===null||s===void 0?void 0:s.map(a=>new e(a,r)))!==null&&o!==void 0?o:[])},cursor:(n=t.pagination)===null||n===void 0?void 0:n.cursor}}function ei(t,e,r){let n;return{get data(){var i,s;return n??(n=(s=(i=t.data)===null||i===void 0?void 0:i.map(o=>new e(o,r)))!==null&&s!==void 0?s:[])},cursor:t.pagination.cursor,total:t.total}}function ve({after:t,before:e,limit:r}={}){return{after:t,before:e,first:r==null?void 0:r.toString()}}let uo=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].broadcaster_id}get name(){return this[h].broadcaster_login}get displayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get language(){return this[h].broadcaster_language}get gameId(){return this[h].game_id}get gameName(){return this[h].game_name}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get title(){return this[h].title}get delay(){return this[h].delay}get tags(){return this[h].tags}get contentClassificationLabels(){return this[h].content_classification_labels}get isBrandedContent(){return this[h].is_branded_content}};C([K(!1)],uo.prototype,"_client",void 0);uo=C([B("api","HelixChannel","id")],uo);let yd=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get creationDate(){return new Date(this[h].created_at)}};C([K(!1)],yd.prototype,"_client",void 0);yd=C([B("api","HelixChannelEditor","userId")],yd);let ml=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get followDate(){return new Date(this[h].followed_at)}};C([K(!1)],ml.prototype,"_client",void 0);ml=C([B("api","HelixChannelFollower","userId")],ml);let gl=class extends Z{constructor(e,r){super(e),this._client=r}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get followDate(){return new Date(this[h].followed_at)}};C([K(!1)],gl.prototype,"_client",void 0);gl=C([B("api","HelixFollowedChannel","broadcasterId")],gl);let vd=class extends Ae{constructor(){super(...arguments),this._getChannelByIdBatcher=new ur({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new uo(e,this._client))}async getChannelInfoById(e){const r=E(e),n=await this._client.callApi({type:"helix",url:"channels",userId:r,query:_e(r)});return hr(n.data[0],i=>new uo(i,this._client))}async getChannelInfoByIdBatched(e){return await this._getChannelByIdBatcher.request(E(e))}async getChannelInfoByIds(e){const r=e.map(E);return(await this._client.callApi({type:"helix",url:"channels",query:He("broadcaster_id",r)})).data.map(i=>new uo(i,this._client))}async updateChannelInfo(e,r){await this._client.callApi({type:"helix",url:"channels",method:"PATCH",userId:E(e),scopes:["channel:manage:broadcast"],query:_e(e),jsonBody:Bj(r)})}async startChannelCommercial(e,r){await this._client.callApi({type:"helix",url:"channels/commercial",method:"POST",userId:E(e),scopes:["channel:edit:commercial"],jsonBody:$j(e,r)})}async getChannelEditors(e){return(await this._client.callApi({type:"helix",url:"channels/editors",userId:E(e),scopes:["channel:read:editors"],query:_e(e)})).data.map(n=>new yd(n,this._client))}async getVips(e,r){const n=await this._client.callApi({type:"helix",url:"channels/vips",userId:E(e),scopes:["channel:read:vips","channel:manage:vips"],query:{..._e(e),...ve(r)}});return Ge(n,ns,this._client)}getVipsPaginated(e){return new Me({url:"channels/vips",userId:E(e),scopes:["channel:read:vips","channel:manage:vips"],query:_e(e)},this._client,r=>new ns(r,this._client))}async checkVipForUsers(e,r){return(await this._client.callApi({type:"helix",url:"channels/vips",userId:E(e),scopes:["channel:read:vips","channel:manage:vips"],query:CP(e,r)})).data.map(i=>new ns(i,this._client))}async checkVipForUser(e,r){const n=E(r);return(await this.checkVipForUsers(e,[n])).some(s=>s.id===n)}async addVip(e,r){await this._client.callApi({type:"helix",url:"channels/vips",method:"POST",userId:E(e),scopes:["channel:manage:vips"],query:yx(e,r)})}async removeVip(e,r){await this._client.callApi({type:"helix",url:"channels/vips",method:"DELETE",userId:E(e),scopes:["channel:manage:vips"],query:yx(e,r)})}async getChannelFollowerCount(e){return(await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:E(e),query:{...Pm(e),...ve({limit:1})}})).total}async getChannelFollowers(e,r,n){const i=await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:E(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:{...Pm(e,r),...ve(n)}});return ei(i,ml,this._client)}getChannelFollowersPaginated(e){return new hs({url:"channels/followers",method:"GET",userId:E(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:Pm(e)},this._client,r=>new ml(r,this._client))}async getFollowedChannels(e,r,n){const i=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:E(e),scopes:["user:read:follows"],query:{...vx(e,r),...ve(n)}});return ei(i,gl,this._client)}getFollowedChannelsPaginated(e,r){return new hs({url:"channels/followed",method:"GET",userId:E(e),scopes:["user:read:follows"],query:vx(e,r)},this._client,n=>new gl(n,this._client))}};C([K(!1)],vd.prototype,"_getChannelByIdBatcher",void 0);vd=C([B("api","HelixChannelApi")],vd);function Uj(t,e){return{broadcaster_id:E(t),only_manageable_rewards:e==null?void 0:e.toString()}}function _x(t,e){return{broadcaster_id:E(t),id:e}}function bx(t){var e,r,n;const i={title:t.title,cost:t.cost,prompt:t.prompt,background_color:t.backgroundColor,is_enabled:t.isEnabled,is_user_input_required:t.userInputRequired,should_redemptions_skip_request_queue:t.autoFulfill};return t.maxRedemptionsPerStream!==void 0&&(i.is_max_per_stream_enabled=!!t.maxRedemptionsPerStream,i.max_per_stream=(e=t.maxRedemptionsPerStream)!==null&&e!==void 0?e:0),t.maxRedemptionsPerUserPerStream!==void 0&&(i.is_max_per_user_per_stream_enabled=!!t.maxRedemptionsPerUserPerStream,i.max_per_user_per_stream=(r=t.maxRedemptionsPerUserPerStream)!==null&&r!==void 0?r:0),t.globalCooldown!==void 0&&(i.is_global_cooldown_enabled=!!t.globalCooldown,i.global_cooldown_seconds=(n=t.globalCooldown)!==null&&n!==void 0?n:0),"isPaused"in t&&(i.is_paused=t.isPaused),i}function xx(t,e,r){return{broadcaster_id:E(t),reward_id:e,id:r}}function Sx(t,e,r,n){return{broadcaster_id:E(t),reward_id:e,status:r,sort:n.newestFirst?"NEWEST":"OLDEST"}}let Bi=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}getImageUrl(e){var r,n;const i=`url_${e}x`;return(n=(r=this[h].image)===null||r===void 0?void 0:r[i])!==null&&n!==void 0?n:this[h].default_image[i]}get backgroundColor(){return this[h].background_color}get isEnabled(){return this[h].is_enabled}get cost(){return this[h].cost}get title(){return this[h].title}get prompt(){return this[h].prompt}get userInputRequired(){return this[h].is_user_input_required}get maxRedemptionsPerStream(){return this[h].max_per_stream_setting.is_enabled?this[h].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[h].max_per_user_per_stream_setting.is_enabled?this[h].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[h].global_cooldown_setting.is_enabled?this[h].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[h].is_paused}get isInStock(){return this[h].is_in_stock}get redemptionsThisStream(){return this[h].redemptions_redeemed_current_stream}get autoFulfill(){return this[h].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[h].cooldown_expires_at?new Date(this[h].cooldown_expires_at):null}};C([K(!1)],Bi.prototype,"_client",void 0);Bi=C([B("api","HelixCustomReward","id")],Bi);let $i=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get userInput(){return this[h].user_input}get isFulfilled(){return this[h].status==="FULFILLED"}get isCanceled(){return this[h].status==="CANCELED"}get redemptionDate(){return new Date(this[h].redeemed_at)}get rewardId(){return this[h].reward.id}get rewardTitle(){return this[h].reward.title}get rewardPrompt(){return this[h].reward.prompt}get rewardCost(){return this[h].reward.cost}async getReward(){return ne(await this._client.channelPoints.getCustomRewardById(this[h].broadcaster_id,this[h].reward.id))}async updateStatus(e){return(await this._client.channelPoints.updateRedemptionStatusByIds(this[h].broadcaster_id,this[h].reward.id,[this[h].id],e))[0]}};C([K(!1)],$i.prototype,"_client",void 0);$i=C([B("api","HelixCustomRewardRedemption","id")],$i);let xy=class extends Ae{async getCustomRewards(e,r){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:Uj(e,r)})).data.map(i=>new Bi(i,this._client))}async getCustomRewardsByIds(e,r){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:Gf(e,r)})).data.map(i=>new Bi(i,this._client)):[]}async getCustomRewardById(e,r){const n=await this.getCustomRewardsByIds(e,[r]);return n.length?n[0]:null}async createCustomReward(e,r){const n=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"POST",userId:E(e),scopes:["channel:manage:redemptions"],query:_e(e),jsonBody:bx(r)});return new Bi(n.data[0],this._client)}async updateCustomReward(e,r,n){const i=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"PATCH",userId:E(e),scopes:["channel:manage:redemptions"],query:_x(e,r),jsonBody:bx(n)});return new Bi(i.data[0],this._client)}async deleteCustomReward(e,r){await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"DELETE",userId:E(e),scopes:["channel:manage:redemptions"],query:_x(e,r)})}async getRedemptionsByIds(e,r,n){return n.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:xx(e,r,n)})).data.map(s=>new $i(s,this._client)):[]}async getRedemptionById(e,r,n){const i=await this.getRedemptionsByIds(e,r,[n]);return i.length?i[0]:null}async getRedemptionsForBroadcaster(e,r,n,i){const s=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...Sx(e,r,n,i),...ve(i)}});return Ge(s,$i,this._client)}getRedemptionsForBroadcasterPaginated(e,r,n,i){return new Me({url:"channel_points/custom_rewards/redemptions",userId:E(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:Sx(e,r,n,i)},this._client,s=>new $i(s,this._client),50)}async updateRedemptionStatusByIds(e,r,n,i){return n.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",method:"PATCH",userId:E(e),scopes:["channel:manage:redemptions"],query:xx(e,r,n),jsonBody:{status:i}})).data.map(o=>new $i(o,this._client)):[]}};xy=C([B("api","HelixChannelPointsApi")],xy);let yl=class extends Z{get value(){return this[h].value}get decimalPlaces(){return this[h].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[h].currency}};yl=C([B("api","HelixCharityCampaignAmount")],yl);let wd=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get charityName(){return this[h].charity_name}get charityDescription(){return this[h].charity_description}get charityLogo(){return this[h].charity_logo}get charityWebsite(){return this[h].charity_website}get currentAmount(){return new yl(this[h].current_amount)}get targetAmount(){return new yl(this[h].target_amount)}};C([K(!1)],wd.prototype,"_client",void 0);wd=C([B("api","HelixCharityCampaign","id")],wd);let _d=class extends Z{constructor(e,r){super(e),this._client=r}get campaignId(){return this[h].campaign_id}get donorId(){return this[h].user_id}get donorName(){return this[h].user_login}get donorDisplayName(){return this[h].user_name}async getDonor(){return ne(await this._client.users.getUserById(this[h].user_id))}get amount(){return new yl(this[h].amount)}};C([K(!1)],_d.prototype,"_client",void 0);_d=C([B("api","HelixCharityCampaignDonation")],_d);let Sy=class extends Ae{async getCharityCampaign(e){const r=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:E(e),scopes:["channel:read:charity"],query:_e(e)});return new wd(r.data[0],this._client)}async getCharityCampaignDonations(e,r){const n=await this._client.callApi({type:"helix",url:"charity/donations",userId:E(e),scopes:["channel:read:charity"],query:{..._e(e),...ve(r)}});return Ge(n,_d,this._client)}};Sy=C([B("api","HelixCharityApi")],Sy);function Fj(t){return{slow_mode:t.slowModeEnabled,slow_mode_wait_time:t.slowModeDelay,follower_mode:t.followerOnlyModeEnabled,follower_mode_duration:t.followerOnlyModeDelay,subscriber_mode:t.subscriberOnlyModeEnabled,emote_mode:t.emoteOnlyModeEnabled,unique_chat_mode:t.uniqueChatModeEnabled,non_moderator_chat_delay:t.nonModeratorChatDelayEnabled,non_moderator_chat_delay_duration:t.nonModeratorChatDelay}}function qj(t,e){return{user_id:E(t),color:e}}function Hj(t,e,r){return{from_broadcaster_id:E(t),to_broadcaster_id:E(e),moderator_id:r}}let vl=class extends Z{get id(){return this[h].id}get name(){return this[h].name}get formats(){return this[h].format}get scales(){return this[h].scale}get themeModes(){return this[h].theme_mode}getImageUrl(e){return this[h].images[`url_${e}x`]}getStaticImageUrl(e="1.0",r="light"){return this[h].format.includes("static")&&this[h].scale.includes(e)?this.getFormattedImageUrl(e,"static",r):null}getAnimatedImageUrl(e="1.0",r="light"){return this[h].format.includes("animated")&&this[h].scale.includes(e)?this.getFormattedImageUrl(e,"animated",r):null}getFormattedImageUrl(e="1.0",r="static",n="light"){return`https://static-cdn.jtvnw.net/emoticons/v2/${this[h].id}/${r}/${n}/${e}`}};vl=C([B("api","HelixEmote","id")],vl);let bd=class extends vl{constructor(e,r){super(e),this._client=r}get tier(){return this[h].tier||null}get type(){return this[h].emote_type}get emoteSetId(){return this[h].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[h].emote_set_id])}};C([K(!1)],bd.prototype,"_client",void 0);bd=C([B("api","HelixChannelEmote","id")],bd);let Cy=class extends Z{get id(){return this[h].id}getImageUrl(e){return this[h][`image_url_${e}x`]}get title(){return this[h].title}get description(){return this[h].description}get clickAction(){return this[h].click_action}get clickUrl(){return this[h].click_url}};Cy=C([B("api","HelixChatBadgeVersion","id")],Cy);let wl=class extends Z{get id(){return this[h].set_id}get versions(){return this[h].versions.map(e=>new Cy(e))}getVersion(e){var r;return(r=this.versions.find(n=>n.id===e))!==null&&r!==void 0?r:null}};C([Se()],wl.prototype,"versions",null);wl=C([au,B("api","HelixChatBadgeSet","id")],wl);let _l=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],_l.prototype,"_client",void 0);_l=C([B("api","HelixChatChatter")],_l);let xd=class extends Z{get broadcasterId(){return this[h].broadcaster_id}get slowModeEnabled(){return this[h].slow_mode}get slowModeDelay(){return this[h].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[h].follower_mode}get followerOnlyModeDelay(){return this[h].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[h].subscriber_mode}get emoteOnlyModeEnabled(){return this[h].emote_mode}get uniqueChatModeEnabled(){return this[h].unique_chat_mode}};xd=C([B("api","HelixChatSettings","broadcasterId")],xd);let Sd=class extends vl{constructor(e,r){super(e),this._client=r}get type(){return this[h].emote_type}get emoteSetId(){return this[h].emote_set_id}get ownerId(){switch(this[h].owner_id){case"0":case"twitch":return null;default:return this[h].owner_id}}async getOwner(){switch(this[h].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[h].owner_id)}}};C([K(!1)],Sd.prototype,"_client",void 0);Sd=C([B("api","HelixEmoteFromSet","id")],Sd);let Cd=class extends xd{get nonModeratorChatDelayEnabled(){return this[h].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[h].non_moderator_chat_delay_duration}};Cd=C([B("api","HelixPrivilegedChatSettings","broadcasterId")],Cd);let Ey=class extends Ae{async getChatters(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"chat/chatters",userId:n,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:{...this._createModeratorActionQuery(n),...ve(r)}});return ei(i,_l,this._client)}getChattersPaginated(e){const r=E(e);return new hs({url:"chat/chatters",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(r)},this._client,n=>new _l(n,this._client))}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(r=>new wl(r))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:E(e),query:_e(e)})).data.map(n=>new wl(n))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(r=>new vl(r))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:E(e),query:_e(e)})).data.map(n=>new bd(n,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:He("emote_set_id",e)})).data.map(n=>new Sd(n,this._client))}async getSettings(e){const r=await this._client.callApi({type:"helix",url:"chat/settings",userId:E(e),query:_e(e)});return new xd(r.data[0])}async getSettingsPrivileged(e){const r=E(e),n=await this._client.callApi({type:"helix",url:"chat/settings",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:read:chat_settings"],query:this._createModeratorActionQuery(r)});return new Cd(n.data[0])}async updateSettings(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"chat/settings",method:"PATCH",userId:n,canOverrideScopedUserContext:!0,scopes:["moderator:manage:chat_settings"],query:this._createModeratorActionQuery(n),jsonBody:Fj(r)});return new Cd(i.data[0])}async sendAnnouncement(e,r){const n=E(e);await this._client.callApi({type:"helix",url:"chat/announcements",method:"POST",userId:n,canOverrideScopedUserContext:!0,scopes:["moderator:manage:announcements"],query:this._createModeratorActionQuery(n),jsonBody:{message:r.message,color:r.color}})}async getColorsForUsers(e){const r=await this._client.callApi({type:"helix",url:"chat/color",query:He("user_id",e.map(E))});return new Map(r.data.map(n=>[n.user_id,n.color||null]))}async getColorForUser(e){const r=await this._client.callApi({type:"helix",url:"chat/color",userId:E(e),query:He("user_id",E(e))});if(r.data.length)return r.data[0].color||null}async setColorForUser(e,r){await this._client.callApi({type:"helix",url:"chat/color",method:"PUT",userId:E(e),scopes:["user:manage:chat_color"],query:qj(e,r)})}async shoutoutUser(e,r){const n=E(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:n,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:Hj(e,r,this._getUserContextIdWithDefault(n))})}_createModeratorActionQuery(e){return SP(e,this._getUserContextIdWithDefault(e))}};Ey=C([B("api","HelixChatApi")],Ey);function zj(t,e){return{broadcaster_id:E(t),has_delay:e.toString()}}function Cx(t){const{filterType:e,ids:r,startDate:n,endDate:i,isFeatured:s}=t;return{[e]:r,started_at:n,ended_at:i,is_featured:s==null?void 0:s.toString()}}let co=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get url(){return this[h].url}get embedUrl(){return this[h].embed_url}get broadcasterId(){return this[h].broadcaster_id}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get creatorId(){return this[h].creator_id}get creatorDisplayName(){return this[h].creator_name}async getCreator(){return ne(await this._client.users.getUserById(this[h].creator_id))}get videoId(){return this[h].video_id}async getVideo(){return ne(await this._client.videos.getVideoById(this[h].video_id))}get gameId(){return this[h].game_id}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get language(){return this[h].language}get title(){return this[h].title}get views(){return this[h].view_count}get creationDate(){return new Date(this[h].created_at)}get thumbnailUrl(){return this[h].thumbnail_url}get duration(){return this[h].duration}get vodOffset(){return this[h].vod_offset}get isFeatured(){return this[h].is_featured}};C([K(!1)],co.prototype,"_client",void 0);co=C([B("api","HelixClip","id")],co);let Ed=class extends Ae{constructor(){super(...arguments),this._getClipByIdBatcher=new ur({url:"clips"},"id","id",this._client,e=>new co(e,this._client))}async getClipsForBroadcaster(e,r={}){return await this._getClips({...r,filterType:"broadcaster_id",ids:E(e),userId:E(e)})}getClipsForBroadcasterPaginated(e,r={}){return this._getClipsPaginated({...r,filterType:"broadcaster_id",ids:E(e),userId:E(e)})}async getClipsForGame(e,r={}){return await this._getClips({...r,filterType:"game_id",ids:e})}getClipsForGamePaginated(e,r={}){return this._getClipsPaginated({...r,filterType:"game_id",ids:e})}async getClipsByIds(e){return(await this._getClips({filterType:"id",ids:e})).data}async getClipById(e){const r=await this.getClipsByIds([e]);return r.length?r[0]:null}async getClipByIdBatched(e){return await this._getClipByIdBatcher.request(e)}async createClip(e){const{channel:r,createAfterDelay:n=!1}=e;return(await this._client.callApi({type:"helix",url:"clips",method:"POST",userId:E(r),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:zj(r,n)})).data[0].id}async _getClips(e){if(!e.ids.length)return{data:[]};const r=await this._client.callApi({type:"helix",url:"clips",userId:e.userId,query:{...Cx(e),...ve(e)}});return Ge(r,co,this._client)}_getClipsPaginated(e){return new Me({url:"clips",userId:e.userId,query:Cx(e)},this._client,r=>new co(r,this._client))}};C([K(!1)],Ed.prototype,"_getClipByIdBatcher",void 0);Ed=C([B("api","HelixClipApi")],Ed);class Wj extends Z{get id(){return this[h].id}get name(){return this[h].name}get description(){return this[h].description}}let Ty=class extends Ae{async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(n=>new Wj(n))}};Ty=C([B("api","HelixContentClassificationLabelApi")],Ty);function Ex(t,e){return{user_id:e?Xr(t.user,E):void 0,game_id:t.gameId,fulfillment_status:t.fulfillmentStatus}}function Gj(t,e){return{fulfillment_status:e,entitlement_ids:t}}let Ui=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get rewardId(){return this[h].benefit_id}get grantDate(){return new Date(this[h].timestamp)}get userId(){return this[h].user_id}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get gameId(){return this[h].game_id}async getGame(){return ne(await this._client.games.getGameById(this[h].game_id))}get fulfillmentStatus(){return this[h].fulfillment_status}get updateDate(){return new Date(this[h].last_updated)}};C([K(!1)],Ui.prototype,"_client",void 0);Ui=C([B("api","HelixDropsEntitlement")],Ui);let Td=class extends Ae{constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new ur({url:"entitlements/drops"},"id","id",this._client,e=>new Ui(e,this._client))}async getDropsEntitlements(e,r=!1){const n=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:Xr(e.user,E),forceType:e.user&&r?"app":void 0,query:{...Ex(e,r),...ve(e)}});return Ge(n,Ui,this._client)}getDropsEntitlementsPaginated(e,r=!1){return new Me({url:"entitlements/drops",userId:Xr(e.user,E),forceType:e.user&&r?"app":void 0,query:Ex(e,r)},this._client,n=>new Ui(n,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(n=>new Ui(n,this._client))}async getDropsEntitlementById(e){var r;return(r=(await this.getDropsEntitlementsByIds([e]))[0])!==null&&r!==void 0?r:null}async getDropsEntitlementByIdBatched(e){return await this._getDropsEntitlementByIdBatcher.request(e)}async updateDropsEntitlements(e,r){const n=await this._client.callApi({type:"helix",url:"entitlements/drops",method:"PATCH",jsonBody:Gj(e,r)});return new Map(n.data.flatMap(i=>i.ids.map(s=>[s,i.status])))}};C([K(!1)],Td.prototype,"_getDropsEntitlementByIdBatcher",void 0);Td=C([B("api","HelixEntitlementApi")],Td);function pe(t){return{broadcaster_user_id:E(t)}}function Wu(t,e){return{broadcaster_user_id:E(t),reward_id:e}}function ca(t,e){return{broadcaster_user_id:t,moderator_user_id:e}}function Vj(t){return{organization_id:t.organizationId,category_id:t.categoryId,campaign_id:t.campaignId}}let ln=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get status(){return this[h].status}get type(){return this[h].type}get cost(){return this[h].cost}get condition(){return this[h].condition}get creationDate(){return new Date(this[h].created_at)}async unsubscribe(){await this._client.eventSub.deleteSubscription(this[h].id)}get _transport(){return this[h].transport}set _status(e){this[h].status=e}};C([K(!1)],ln.prototype,"_client",void 0);ln=C([B("api","HelixEventSubSubscription","id")],ln);let Qs=class extends hs{constructor(e,r,n){super({url:"eventsub/subscriptions",userId:r,query:e},n,i=>new ln(i,n))}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}};Qs=C([B("api","HelixPaginatedEventSubSubscriptionsRequest")],Qs);let ky=class extends Ae{async getSubscriptions(e){const r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:ve(e)});return{...ei(r,ln,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsPaginated(){return new Qs({},void 0,this._client)}async getSubscriptionsForStatus(e,r){const n=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...ve(r),status:e}});return{...ei(n,ln,this._client),totalCost:n.total_cost,maxTotalCost:n.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new Qs({status:e},void 0,this._client)}async getSubscriptionsForType(e,r){const n=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...ve(r),type:e}});return{...ei(n,ln,this._client),totalCost:n.total_cost,maxTotalCost:n.max_total_cost}}getSubscriptionsForTypePaginated(e){return new Qs({type:e},void 0,this._client)}async getSubscriptionsForUser(e,r){const n=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:E(e),query:{...He("user_id",E(e)),...ve(r)}});return{...ei(n,ln,this._client),totalCost:n.total_cost,maxTotalCost:n.max_total_cost}}getSubscriptionsForUserPaginated(e){const r=E(e);return new Qs(He("user_id",r),r,this._client)}async createSubscription(e,r,n,i,s,o,a,l){const u=i.method==="webhook",c=u?void 0:o;if(!u&&!s)throw new Error(`Transport ${i.method} can only handle subscriptions with user context`);const f={type:e,version:r,condition:n,transport:i};l&&(f.is_batching_enabled=!0);const d=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:c,userId:Xr(s,E),forceType:u?"app":"user",jsonBody:f});return new ln(d.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,r){return await this.createSubscription("stream.online","1",pe(e),r,e)}async subscribeToStreamOfflineEvents(e,r){return await this.createSubscription("stream.offline","1",pe(e),r,e)}async subscribeToChannelUpdateEvents(e,r){return await this.createSubscription("channel.update","1",pe(e),r,e)}async subscribeToChannelFollowEvents(e,r){const n=E(e);return await this.createSubscription("channel.follow","2",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:followers"],!0)}async subscribeToChannelSubscriptionEvents(e,r){return await this.createSubscription("channel.subscribe","1",pe(e),r,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionGiftEvents(e,r){return await this.createSubscription("channel.subscription.gift","1",pe(e),r,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionMessageEvents(e,r){return await this.createSubscription("channel.subscription.message","1",pe(e),r,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionEndEvents(e,r){return await this.createSubscription("channel.subscription.end","1",pe(e),r,e,["channel:read:subscriptions"])}async subscribeToChannelCheerEvents(e,r){return await this.createSubscription("channel.cheer","1",pe(e),r,e,["bits:read"])}async subscribeToChannelCharityCampaignStartEvents(e,r){return await this.createSubscription("channel.charity_campaign.start","1",pe(e),r,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignStopEvents(e,r){return await this.createSubscription("channel.charity_campaign.stop","1",pe(e),r,e,["channel:read:charity"])}async subscribeToChannelCharityDonationEvents(e,r){return await this.createSubscription("channel.charity_campaign.donate","1",pe(e),r,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignProgressEvents(e,r){return await this.createSubscription("channel.charity_campaign.progress","1",pe(e),r,e,["channel:read:charity"])}async subscribeToChannelBanEvents(e,r){return await this.createSubscription("channel.ban","1",pe(e),r,e,["channel:moderate"])}async subscribeToChannelUnbanEvents(e,r){return await this.createSubscription("channel.unban","1",pe(e),r,e,["channel:moderate"])}async subscribeToChannelShieldModeBeginEvents(e,r){const n=E(e);return await this.createSubscription("channel.shield_mode.begin","1",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,r){const n=E(e);return await this.createSubscription("channel.shield_mode.end","1",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelModeratorAddEvents(e,r){return await this.createSubscription("channel.moderator.add","1",pe(e),r,e,["moderation:read"])}async subscribeToChannelModeratorRemoveEvents(e,r){return await this.createSubscription("channel.moderator.remove","1",pe(e),r,e,["moderation:read"])}async subscribeToChannelRaidEventsFrom(e,r){return await this.createSubscription("channel.raid","1",He("from_broadcaster_user_id",E(e)),r,e)}async subscribeToChannelRaidEventsTo(e,r){return await this.createSubscription("channel.raid","1",He("to_broadcaster_user_id",E(e)),r,e)}async subscribeToChannelRewardAddEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward.add","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward.update","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEventsForReward(e,r,n){return await this.createSubscription("channel.channel_points_custom_reward.update","1",Wu(e,r),n,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEventsForReward(e,r,n){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",Wu(e,r),n,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEventsForReward(e,r,n){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",Wu(e,r),n,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEvents(e,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",pe(e),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEventsForReward(e,r,n){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",Wu(e,r),n,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelPollBeginEvents(e,r){return await this.createSubscription("channel.poll.begin","1",pe(e),r,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollProgressEvents(e,r){return await this.createSubscription("channel.poll.progress","1",pe(e),r,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollEndEvents(e,r){return await this.createSubscription("channel.poll.end","1",pe(e),r,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPredictionBeginEvents(e,r){return await this.createSubscription("channel.prediction.begin","1",pe(e),r,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionProgressEvents(e,r){return await this.createSubscription("channel.prediction.progress","1",pe(e),r,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionLockEvents(e,r){return await this.createSubscription("channel.prediction.lock","1",pe(e),r,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionEndEvents(e,r){return await this.createSubscription("channel.prediction.end","1",pe(e),r,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelGoalBeginEvents(e,r){return await this.createSubscription("channel.goal.begin","1",pe(e),r,e,["channel:read:goals"])}async subscribeToChannelGoalProgressEvents(e,r){return await this.createSubscription("channel.goal.progress","1",pe(e),r,e,["channel:read:goals"])}async subscribeToChannelGoalEndEvents(e,r){return await this.createSubscription("channel.goal.end","1",pe(e),r,e,["channel:read:goals"])}async subscribeToChannelHypeTrainBeginEvents(e,r){return await this.createSubscription("channel.hype_train.begin","1",pe(e),r,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressEvents(e,r){return await this.createSubscription("channel.hype_train.progress","1",pe(e),r,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndEvents(e,r){return await this.createSubscription("channel.hype_train.end","1",pe(e),r,e,["channel:read:hype_train"])}async subscribeToChannelShoutoutCreateEvents(e,r){const n=E(e);return await this.createSubscription("channel.shoutout.create","1",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,r){const n=E(e);return await this.createSubscription("channel.shoutout.receive","1",ca(n,this._getUserContextIdWithDefault(n)),r,n,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToExtensionBitsTransactionCreateEvents(e,r){return await this.createSubscription("extension.bits_transaction.create","1",He("extension_client_id",e),r)}async subscribeToUserAuthorizationGrantEvents(e,r){return await this.createSubscription("user.authorization.grant","1",He("client_id",e),r)}async subscribeToUserAuthorizationRevokeEvents(e,r){return await this.createSubscription("user.authorization.revoke","1",He("client_id",e),r)}async subscribeToUserUpdateEvents(e,r,n){return await this.createSubscription("user.update","1",He("user_id",E(e)),r,e,n?["user:read:email"]:void 0)}async subscribeToDropEntitlementGrantEvents(e,r){return await this.createSubscription("drop.entitlement.grant","1",Vj(e),r,void 0,void 0,!1,!0)}async _deleteSubscriptionsWithCondition(e){const r=this.getSubscriptionsPaginated();for await(const n of r)(!e||e(n))&&await n.unsubscribe()}};ky=C([B("api","HelixEventSubApi")],ky);function Qj(t,e){return{extension_id:t,extension_version:e}}function Kj(t){return{sku:t.sku,cost:{amount:t.cost,type:"bits"},display_name:t.displayName,in_development:t.inDevelopment,expiration:t.expirationDate,is_broadcast:t.broadcast}}function Tx(t,e){return{extension_id:t,id:e.transactionIds}}let bl=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].broadcaster_id}get displayName(){return this[h].broadcaster_name}async getChannel(){return ne(await this._client.channels.getChannelInfoById(this[h].broadcaster_id))}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get gameId(){return this[h].game_id}get gameName(){return this[h].game_name}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get title(){return this[h].title}};C([K(!1)],bl.prototype,"_client",void 0);bl=C([B("api","HelixChannelReference","id")],bl);let kd=class extends Z{get sku(){return this[h].sku}get cost(){return this[h].cost.amount}get displayName(){return this[h].display_name}get inDevelopment(){return this[h].in_development}get isBroadcast(){return this[h].is_broadcast}get expirationDate(){return hr(this[h].expiration,e=>new Date(e))}};kd=C([B("api","HelixExtensionBitsProduct","sku")],kd);let xl=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get transactionDate(){return new Date(this[h].timestamp)}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_name}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get productType(){return this[h].product_type}get productSku(){return this[h].product_data.sku}get productCost(){return this[h].product_data.cost.amount}get productDisplayName(){return this[h].product_data.displayName}get productInDevelopment(){return this[h].product_data.inDevelopment}};C([K(!1)],xl.prototype,"_client",void 0);xl=C([B("api","HelixExtensionTransaction","id")],xl);let Py=class extends Ae{async getReleasedExtension(e,r){const n=await this._client.callApi({type:"helix",url:"extensions/released",query:Qj(e,r)});return new uy(n.data[0])}async getLiveChannelsWithExtension(e,r){const n=await this._client.callApi({type:"helix",url:"extensions/live",query:{...He("extension_id",e),...ve(r)}});return Ge(n,bl,this._client)}getLiveChannelsWithExtensionPaginated(e){return new Me({url:"extensions/live",query:He("extension_id",e)},this._client,r=>new bl(r,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:He("should_include_all",e==null?void 0:e.toString())})).data.map(n=>new kd(n))}async putExtensionBitsProduct(e){const r=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:Kj(e)});return new kd(r.data[0])}async getExtensionTransactions(e,r={}){const n=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...Tx(e,r),...ve(r)}});return Ge(n,xl,this._client)}getExtensionTransactionsPaginated(e,r={}){return new Me({url:"extensions/transactions",forceType:"app",query:Tx(e,r)},this._client,n=>new xl(n,this._client))}};Py=C([B("api","HelixExtensionsApi")],Py);let Sr=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get name(){return this[h].name}get boxArtUrl(){return this[h].box_art_url}get igdbId(){return this[h].igdb_id||null}getBoxArtUrl(e,r){return this[h].box_art_url.replace("{width}",e.toString()).replace("{height}",r.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[h].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[h].id})}};C([K(!1)],Sr.prototype,"_client",void 0);Sr=C([B("api","HelixGame","id")],Sr);let Lo=class extends Ae{constructor(){super(...arguments),this._getGameByIdBatcher=new ur({url:"games"},"id","id",this._client,e=>new Sr(e,this._client)),this._getGameByNameBatcher=new ur({url:"games"},"name","name",this._client,e=>new Sr(e,this._client)),this._getGameByIgdbIdBatcher=new ur({url:"games"},"igdb_id","igdb_id",this._client,e=>new Sr(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 r;return(r=(await this._getGames("id",[e]))[0])!==null&&r!==void 0?r:null}async getGameByName(e){var r;return(r=(await this._getGames("name",[e]))[0])!==null&&r!==void 0?r:null}async getGameByIgdbId(e){var r;return(r=(await this._getGames("igdb_id",[e]))[0])!==null&&r!==void 0?r: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){const r=await this._client.callApi({type:"helix",url:"games/top",query:ve(e)});return Ge(r,Sr,this._client)}getTopGamesPaginated(){return new Me({url:"games/top"},this._client,e=>new Sr(e,this._client))}async _getGames(e,r){return r.length?(await this._client.callApi({type:"helix",url:"games",query:{[e]:r}})).data.map(i=>new Sr(i,this._client)):[]}};C([K(!1)],Lo.prototype,"_getGameByIdBatcher",void 0);C([K(!1)],Lo.prototype,"_getGameByNameBatcher",void 0);C([K(!1)],Lo.prototype,"_getGameByIgdbIdBatcher",void 0);Lo=C([B("api","HelixGameApi")],Lo);let Pd=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterDisplayName(){return this[h].broadcaster_name}get broadcasterName(){return this[h].broadcaster_login}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get type(){return this[h].type}get description(){return this[h].description}get currentAmount(){return this[h].current_amount}get targetAmount(){return this[h].target_amount}get creationDate(){return this[h].created_at}};C([K(!1)],Pd.prototype,"_client",void 0);Pd=C([B("api","HelixGoal","id")],Pd);let Ay=class extends Ae{async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:E(e),scopes:["channel:read:goals"],query:_e(e)})).data.map(n=>new Pd(n,this._client))}};Ay=C([B("api","HelixGoalApi")],Ay);let Sl=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user}async getUser(){return ne(await this._client.users.getUserById(this[h].user))}get type(){return this[h].type}get total(){return this[h].total}};C([K(!1)],Sl.prototype,"_client",void 0);Sl=C([B("api","HelixHypeTrainContribution","userId")],Sl);let Cl=class extends Z{constructor(e,r){super(e),this._client=r}get eventId(){return this[h].id}get eventType(){return this[h].event_type}get eventDate(){return new Date(this[h].event_timestamp)}get eventVersion(){return this[h].version}get id(){return this[h].event_data.id}get broadcasterId(){return this[h].event_data.broadcaster_id}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].event_data.broadcaster_id))}get level(){return this[h].event_data.level}get startDate(){return new Date(this[h].event_data.started_at)}get expiryDate(){return new Date(this[h].event_data.expires_at)}get cooldownDate(){return new Date(this[h].event_data.cooldown_end_time)}get total(){return this[h].event_data.total}get goal(){return this[h].event_data.goal}get lastContribution(){return new Sl(this[h].event_data.last_contribution,this._client)}get topContributions(){return this[h].event_data.top_contributions.map(e=>new Sl(e,this._client))}};C([K(!1)],Cl.prototype,"_client",void 0);Cl=C([B("api","HelixHypeTrainEvent","id")],Cl);class Yj extends Ae{async getHypeTrainEventsForBroadcaster(e,r){const n=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:E(e),scopes:["channel:read:hype_train"],query:{..._e(e),...ve(r)}});return Ge(n,Cl,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new Me({url:"hypetrain/events",userId:E(e),scopes:["channel:read:hype_train"],query:_e(e)},this._client,r=>new Cl(r,this._client))}}function kx(t,e){return{broadcaster_id:E(t),user_id:e==null?void 0:e.userId}}function Px(t,e){return{broadcaster_id:E(t),user_id:E(e)}}function Xj(t,e,r){return{user_id:E(t),msg_id:e,action:r?"ALLOW":"DENY"}}function Jj(t){return{overall_level:t.overallLevel,aggression:t.aggression,bullying:t.bullying,disability:t.disability,misogyny:t.misogyny,race_ethnicity_or_religion:t.raceEthnicityOrReligion,sex_based_terms:t.sexBasedTerms,sexuality_sex_or_gender:t.sexualitySexOrGender,swearing:t.swearing}}function Zj(t){return{data:{duration:t.duration,reason:t.reason,user_id:E(t.user)}}}function e8(t){return{is_active:t}}let Ad=class extends Z{get broadcasterId(){return this[h].broadcaster_id}get moderatorId(){return this[h].moderator_id}get overallLevel(){return this[h].overall_level?this[h].overall_level:null}get disability(){return this[h].disability}get aggression(){return this[h].aggression}get sexualitySexOrGender(){return this[h].sexuality_sex_or_gender}get misogyny(){return this[h].misogyny}get bullying(){return this[h].bullying}get swearing(){return this[h].swearing}get raceEthnicityOrReligion(){return this[h].race_ethnicity_or_religion}get sexBasedTerms(){return this[h].sex_based_terms}};Ad=C([B("api","HelixAutoModSettings","broadcasterId")],Ad);let Iy=class extends Z{get messageId(){return this[h].msg_id}get isPermitted(){return this[h].is_permitted}};Iy=C([B("api","HelixAutoModStatus","messageId")],Iy);let Bo=class extends Z{constructor(e,r,n){super(e),this._expiryTimestamp=r,this._client=n}get creationDate(){return new Date(this[h].created_at)}get expiryDate(){return hr(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[h].moderator_id}async getModerator(){return ne(await this._client.users.getUserById(this[h].moderator_id))}get userId(){return this[h].user_id}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],Bo.prototype,"_client",void 0);C([K(!1)],Bo.prototype,"_expiryTimestamp",void 0);Bo=C([B("api","HelixBanUser","userId")],Bo);let Id=class extends Bo{constructor(e,r){super(e,e.expires_at||null,r)}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}get moderatorName(){return this[h].moderator_login}get moderatorDisplayName(){return this[h].moderator_name}get reason(){return this[h].reason||null}};Id=C([B("api","HelixBan","userId")],Id);let Od=class extends Z{get broadcasterId(){return this[h].broadcaster_id}get creationDate(){return new Date(this[h].created_at)}get expirationDate(){return this[h].expires_at?new Date(this[h].expires_at):null}get id(){return this[h].id}get moderatorId(){return this[h].moderator_id}get text(){return this[h].text}get updatedDate(){return new Date(this[h].updated_at)}};Od=C([B("api","HelixBlockedTerm","id")],Od);let El=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],El.prototype,"_client",void 0);El=C([B("api","HelixModerator","userId")],El);let Tl=class extends Z{constructor(e,r){super(e),this._client=r}get isActive(){return this[h].is_active}get moderatorId(){return this[h].moderator_id}get moderatorName(){return this[h].moderator_login}get moderatorDisplayName(){return this[h].moderator_name}async getModerator(){return ne(await this._client.users.getUserById(this[h].moderator_id))}get lastActivationDate(){return this[h].last_activated_at===""?null:new Date(this[h].last_activated_at)}};C([K(!1)],Tl.prototype,"_client",void 0);Tl=C([B("api","HelixShieldModeStatus")],Tl);let Oy=class extends Ae{async getBannedUsers(e,r){const n=await this._client.callApi({type:"helix",url:"moderation/banned",userId:E(e),scopes:["moderation:read"],query:{...kx(e,r),...ve(r)}});return Ge(n,Id,this._client)}getBannedUsersPaginated(e){return new Me({url:"moderation/banned",userId:E(e),scopes:["moderation:read"],query:_e(e)},this._client,r=>new Id(r,this._client),50)}async checkUserBan(e,r){const n=E(r);return(await this.getBannedUsers(e,{userId:n})).data.some(s=>s.userId===n)}async getModerators(e,r){const n=await this._client.callApi({type:"helix",url:"moderation/moderators",userId:E(e),scopes:["moderation:read","channel:manage:moderators"],query:{...kx(e,r),...ve(r)}});return Ge(n,El,this._client)}getModeratorsPaginated(e){return new Me({url:"moderation/moderators",userId:E(e),scopes:["moderation:read","channel:manage:moderators"],query:_e(e)},this._client,r=>new El(r,this._client))}async checkUserMod(e,r){const n=E(r);return(await this.getModerators(e,{userId:n})).data.some(s=>s.userId===n)}async addModerator(e,r){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"POST",userId:E(e),scopes:["channel:manage:moderators"],query:Px(e,r)})}async removeModerator(e,r){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"DELETE",userId:E(e),scopes:["channel:manage:moderators"],query:Px(e,r)})}async checkAutoModStatus(e,r){return(await this._client.callApi({type:"helix",url:"moderation/enforcements/status",method:"POST",userId:E(e),scopes:["moderation:read"],query:_e(e),jsonBody:{data:r}})).data.map(i=>new Iy(i))}async processHeldAutoModMessage(e,r,n){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:E(e),scopes:["moderator:manage:automod"],jsonBody:Xj(e,r,n)})}async getAutoModSettings(e){const r=E(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",userId:r,scopes:["moderator:read:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r)})).data.map(i=>new Ad(i))}async updateAutoModSettings(e,r){const n=E(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",method:"PUT",userId:n,scopes:["moderator:manage:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(n),jsonBody:Jj(r)})).data.map(s=>new Ad(s))}async banUser(e,r){const n=E(e);return(await this._client.callApi({type:"helix",url:"moderation/bans",method:"POST",userId:n,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(n),jsonBody:Zj(r)})).data.map(s=>new Bo(s,s.end_time,this._client))}async unbanUser(e,r){const n=E(e);await this._client.callApi({type:"helix",url:"moderation/bans",method:"DELETE",userId:n,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(n),...He("user_id",E(r))}})}async getBlockedTerms(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"moderation/blocked_terms",userId:n,scopes:["moderator:read:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(n),...ve(r)}});return Ge(i,Od,this._client)}async addBlockedTerm(e,r){const n=E(e);return(await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"POST",userId:n,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(n),jsonBody:{text:r}})).data.map(s=>new Od(s))}async removeBlockedTerm(e,r,n){const i=E(e);await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"DELETE",userId:i,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(i),id:n}})}async deleteChatMessages(e,r){const n=E(e);await this._client.callApi({type:"helix",url:"moderation/chat",method:"DELETE",userId:n,scopes:["moderator:manage:chat_messages"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(n),...He("message_id",r)}})}async getShieldModeStatus(e){const r=E(e),n=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"GET",userId:r,scopes:["moderator:read:shield_mode","moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r)});return new Tl(n.data[0],this._client)}async updateShieldModeStatus(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"PUT",userId:n,scopes:["moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(n),jsonBody:e8(r)});return new Tl(i.data[0],this._client)}_createModeratorActionQuery(e){return SP(e,this._getUserContextIdWithDefault(e))}};Oy=C([B("api","HelixModerationApi")],Oy);function t8(t,e){var r;return{broadcaster_id:E(t),title:e.title,choices:e.choices.map(n=>({title:n})),duration:e.duration,channel_points_voting_enabled:e.channelPointsPerVote!=null,channel_points_per_vote:(r=e.channelPointsPerVote)!==null&&r!==void 0?r:0}}function r8(t,e,r){return{broadcaster_id:E(t),id:e,status:r?"TERMINATED":"ARCHIVED"}}let Ry=class extends Z{get id(){return this[h].id}get title(){return this[h].title}get totalVotes(){return this[h].votes}get channelPointsVotes(){return this[h].channel_points_votes}};Ry=C([B("api","HelixPollChoice","id")],Ry);let qn=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get title(){return this[h].title}get isChannelPointsVotingEnabled(){return this[h].channel_points_voting_enabled}get channelPointsPerVote(){return this[h].channel_points_per_vote}get status(){return this[h].status}get durationInSeconds(){return this[h].duration}get startDate(){return new Date(this[h].started_at)}get endDate(){return new Date(this.startDate.getTime()+this[h].duration*1e3)}get choices(){return this[h].choices.map(e=>new Ry(e))}};C([K(!1)],qn.prototype,"_client",void 0);qn=C([B("api","HelixPoll","id")],qn);let My=class extends Ae{async getPolls(e,r){const n=await this._client.callApi({type:"helix",url:"polls",userId:E(e),scopes:["channel:read:polls"],query:{..._e(e),...ve(r)}});return Ge(n,qn,this._client)}getPollsPaginated(e){return new Me({url:"polls",userId:E(e),scopes:["channel:read:polls"],query:_e(e)},this._client,r=>new qn(r,this._client),20)}async getPollsByIds(e,r){return r.length?(await this._client.callApi({type:"helix",url:"polls",userId:E(e),scopes:["channel:read:polls"],query:Gf(e,r)})).data.map(i=>new qn(i,this._client)):[]}async getPollById(e,r){const n=await this.getPollsByIds(e,[r]);return n.length?n[0]:null}async createPoll(e,r){const n=await this._client.callApi({type:"helix",url:"polls",method:"POST",userId:E(e),scopes:["channel:manage:polls"],jsonBody:t8(e,r)});return new qn(n.data[0],this._client)}async endPoll(e,r,n=!0){const i=await this._client.callApi({type:"helix",url:"polls",method:"PATCH",userId:E(e),scopes:["channel:manage:polls"],jsonBody:r8(e,r,n)});return new qn(i.data[0],this._client)}};My=C([B("api","HelixPollApi")],My);function n8(t,e){return{broadcaster_id:E(t),title:e.title,outcomes:e.outcomes.map(r=>({title:r})),prediction_window:e.autoLockAfter}}function i8(t,e,r,n){return{broadcaster_id:E(t),id:e,status:r,winning_outcome_id:n}}let Rd=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].id}get userName(){return this[h].login}get userDisplayName(){return this[h].name}async getUser(){return await this._client.users.getUserById(this[h].id)}get channelPointsUsed(){return this[h].channel_points_used}get channelPointsWon(){return this[h].channel_points_won}};C([K(!1)],Rd.prototype,"_client",void 0);Rd=C([B("api","HelixPredictor","userId")],Rd);let kl=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get title(){return this[h].title}get users(){return this[h].users}get totalChannelPoints(){return this[h].channel_points}get color(){return this[h].color}get topPredictors(){var e,r;return(r=(e=this[h].top_predictors)===null||e===void 0?void 0:e.map(n=>new Rd(n,this._client)))!==null&&r!==void 0?r:[]}};C([K(!1)],kl.prototype,"_client",void 0);kl=C([B("api","HelixPredictionOutcome","id")],kl);let Hn=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get title(){return this[h].title}get status(){return this[h].status}get autoLockAfter(){return this[h].prediction_window}get creationDate(){return new Date(this[h].created_at)}get endDate(){return this[h].ended_at?new Date(this[h].ended_at):null}get lockDate(){return this[h].locked_at?new Date(this[h].locked_at):null}get outcomes(){return this[h].outcomes.map(e=>new kl(e,this._client))}get winningOutcomeId(){return this[h].winning_outcome_id||null}get winningOutcome(){if(!this[h].winning_outcome_id)return null;const e=this[h].outcomes.find(r=>r.id===this[h].winning_outcome_id);if(!e)throw new wi("Winning outcome not found in outcomes array");return new kl(e,this._client)}};C([K(!1)],Hn.prototype,"_client",void 0);Hn=C([B("api","HelixPrediction","id")],Hn);let Ny=class extends Ae{async getPredictions(e,r){const n=await this._client.callApi({type:"helix",url:"predictions",userId:E(e),scopes:["channel:read:predictions"],query:{..._e(e),...ve(r)}});return Ge(n,Hn,this._client)}getPredictionsPaginated(e){return new Me({url:"predictions",userId:E(e),scopes:["channel:read:predictions"],query:_e(e)},this._client,r=>new Hn(r,this._client),20)}async getPredictionsByIds(e,r){return r.length?(await this._client.callApi({type:"helix",url:"predictions",userId:E(e),scopes:["channel:read:predictions"],query:Gf(e,r)})).data.map(i=>new Hn(i,this._client)):[]}async getPredictionById(e,r){const n=await this.getPredictionsByIds(e,[r]);return n.length?n[0]:null}async createPrediction(e,r){const n=await this._client.callApi({type:"helix",url:"predictions",method:"POST",userId:E(e),scopes:["channel:manage:predictions"],jsonBody:n8(e,r)});return new Hn(n.data[0],this._client)}async lockPrediction(e,r){return await this._endPrediction(e,r,"LOCKED")}async resolvePrediction(e,r,n){return await this._endPrediction(e,r,"RESOLVED",n)}async cancelPrediction(e,r){return await this._endPrediction(e,r,"CANCELED")}async _endPrediction(e,r,n,i){const s=await this._client.callApi({type:"helix",url:"predictions",method:"PATCH",userId:E(e),scopes:["channel:manage:predictions"],jsonBody:i8(e,r,n,i)});return new Hn(s.data[0],this._client)}};Ny=C([B("api","HelixPredictionApi")],Ny);function s8(t,e){return{from_broadcaster_id:E(t),to_broadcaster_id:E(e)}}let Dy=class extends Z{get creationDate(){return new Date(this[h].created_at)}get targetIsMature(){return this[h].is_mature}};Dy=C([B("api","HelixRaid")],Dy);let jy=class extends Ae{async startRaid(e,r){const n=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:E(e),scopes:["channel:manage:raids"],query:s8(e,r)});return new Dy(n.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:E(e),scopes:["channel:manage:raids"],query:_e(e)})}};jy=C([B("api","HelixRaidApi")],jy);function EP(t,e){var r;return{broadcaster_id:E(t),start_time:e==null?void 0:e.startDate,utc_offset:(r=e==null?void 0:e.utcOffset)===null||r===void 0?void 0:r.toString()}}function o8(t,e){return e.vacation?{broadcaster_id:E(t),is_vacation_enabled:"true",vacation_start_time:e.vacation.startDate,vacation_end_time:e.vacation.endDate,timezone:e.vacation.timezone}:{broadcaster_id:E(t),is_vacation_enabled:"false"}}function a8(t){return{start_time:t.startDate,timezone:t.timezone,is_recurring:t.isRecurring,duration:t.duration,category_id:t.categoryId,title:t.title}}function Ax(t,e){return{broadcaster_id:E(t),id:e}}function l8(t){return{start_time:t.startDate,timezone:t.timezone,is_canceled:t.isCanceled,duration:t.duration,category_id:t.categoryId,title:t.title}}let di=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get startDate(){return new Date(this[h].start_time)}get endDate(){return new Date(this[h].end_time)}get title(){return this[h].title}get cancelEndDate(){return hr(this[h].canceled_until,e=>new Date(e))}get categoryId(){var e,r;return(r=(e=this[h].category)===null||e===void 0?void 0:e.id)!==null&&r!==void 0?r:null}get categoryName(){var e,r;return(r=(e=this[h].category)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:null}async getCategory(){var e;const r=(e=this[h].category)===null||e===void 0?void 0:e.id;return r?await this._client.games.getGameById(r):null}get isRecurring(){return this[h].is_recurring}};C([K(!1)],di.prototype,"_client",void 0);di=C([B("api","HelixScheduleSegment","id")],di);let Ly=class extends Me{constructor(e,r,n){super({url:"schedule",query:EP(e,n)},r,i=>new di(i,r),25)}async _fetchData(e={}){var r;const n=await super._fetchData(e);return{data:(r=n.data.segments)!==null&&r!==void 0?r:[],pagination:n.pagination}}};Ly=C([B("api","HelixPaginatedScheduleSegmentRequest")],Ly);let Md=class extends Z{constructor(e,r){super(e),this._client=r}get segments(){var e,r;return(r=(e=this[h].segments)===null||e===void 0?void 0:e.map(n=>new di(n,this._client)))!==null&&r!==void 0?r:[]}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get vacationStartDate(){var e;const r=(e=this[h].vacation)===null||e===void 0?void 0:e.start_time;return r?new Date(r):null}get vacationEndDate(){var e;const r=(e=this[h].vacation)===null||e===void 0?void 0:e.end_time;return r?new Date(r):null}};C([K(!1)],Md.prototype,"_client",void 0);Md=C([B("api","HelixSchedule","broadcasterId")],Md);class u8 extends Ae{async getSchedule(e,r){const n=await this._client.callApi({type:"helix",url:"schedule",userId:E(e),query:{...EP(e,r),...ve(r)}});return{data:new Md(n.data,this._client),cursor:n.pagination.cursor}}getScheduleSegmentsPaginated(e,r){return new Ly(e,this._client,r)}async getScheduleSegmentsByIds(e,r){var n,i;return(i=(n=(await this._client.callApi({type:"helix",url:"schedule",userId:E(e),query:Gf(e,r)})).data.segments)===null||n===void 0?void 0:n.map(o=>new di(o,this._client)))!==null&&i!==void 0?i:[]}async getScheduleSegmentById(e,r){const n=await this.getScheduleSegmentsByIds(e,[r]);return n.length?n[0]:null}async getScheduleAsIcal(e){return await this._client.callApi({type:"helix",url:"schedule/icalendar",query:_e(e)})}async updateScheduleSettings(e,r){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:E(e),scopes:["channel:manage:schedule"],query:o8(e,r)})}async createScheduleSegment(e,r){const n=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:E(e),scopes:["channel:manage:schedule"],query:_e(e),jsonBody:a8(r)});return new di(n.data.segments[0],this._client)}async updateScheduleSegment(e,r,n){const i=await this._client.callApi({type:"helix",url:"schedule/segment",method:"PATCH",userId:E(e),scopes:["channel:manage:schedule"],query:Ax(e,r),jsonBody:l8(n)});return new di(i.data.segments[0],this._client)}async deleteScheduleSegment(e,r){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:E(e),scopes:["channel:manage:schedule"],query:Ax(e,r)})}}function Ix(t,e){var r;return{query:t,live_only:(r=e.liveOnly)===null||r===void 0?void 0:r.toString()}}let Pl=class extends Z{constructor(e,r){super(e),this._client=r}get language(){return this[h].broadcaster_language}get id(){return this[h].id}get name(){return this[h].broadcaster_login}get displayName(){return this[h].display_name}async getUser(){return ne(await this._client.users.getUserById(this[h].id))}get gameId(){return this[h].game_id}get gameName(){return this[h].game_name}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get isLive(){return this[h].is_live}get tags(){return this[h].tags}get thumbnailUrl(){return this[h].thumbnail_url}get startDate(){return this[h].is_live?new Date(this[h].started_at):null}};C([K(!1)],Pl.prototype,"_client",void 0);Pl=C([B("api","HelixChannelSearchResult","id")],Pl);let By=class extends Ae{async searchCategories(e,r){const n=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...ve(r)}});return Ge(n,Sr,this._client)}searchCategoriesPaginated(e){return new Me({url:"search/categories",query:{query:e}},this._client,r=>new Sr(r,this._client))}async searchChannels(e,r={}){const n=await this._client.callApi({type:"helix",url:"search/channels",query:{...Ix(e,r),...ve(r)}});return Ge(n,Pl,this._client)}searchChannelsPaginated(e,r={}){return new Me({url:"search/channels",query:Ix(e,r)},this._client,n=>new Pl(n,this._client))}};By=C([B("api","HelixSearchApi")],By);class c8 extends Zr{constructor(e){super("Your stream needs to be live to do this",e)}}function Im(t){return{game_id:t.game,language:t.language,type:t.type,user_id:t.userId,user_login:t.userName}}function d8(t,e){return{user_id:E(t),description:e}}function Ox(t){return{video_id:t}}let Ur=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get gameId(){return this[h].game_id}get gameName(){return this[h].game_name}async getGame(){return this[h].game_id?ne(await this._client.games.getGameById(this[h].game_id)):null}get type(){return this[h].type}get title(){return this[h].title}get viewers(){return this[h].viewer_count}get startDate(){return new Date(this[h].started_at)}get language(){return this[h].language}get thumbnailUrl(){return this[h].thumbnail_url}getThumbnailUrl(e,r){return this[h].thumbnail_url.replace("{width}",e.toString()).replace("{height}",r.toString())}get tags(){return this[h].tags}get isMature(){return this[h].is_mature}};C([K(!1)],Ur.prototype,"_client",void 0);Ur=C([B("api","HelixStream","id")],Ur);let Al=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get creationDate(){return new Date(this[h].created_at)}get description(){return this[h].description}get positionInSeconds(){return this[h].position_seconds}};C([K(!1)],Al.prototype,"_client",void 0);Al=C([B("api","HelixStreamMarker","id")],Al);let $y=class extends Al{constructor(e,r,n){super(e,n),this._videoId=r}get url(){return this[h].URL}get videoId(){return this._videoId}async getVideo(){return ne(await this._client.videos.getVideoById(this._videoId))}};$y=C([B("api","HelixStreamMarkerWithVideo","id")],$y);var Ms;let Il=Ms=class extends Ae{constructor(){super(...arguments),this._getStreamByUserIdBatcher=new ur({url:"streams"},"user_id","user_id",this._client,e=>new Ur(e,this._client)),this._getStreamByUserNameBatcher=new ur({url:"streams"},"user_login","user_login",this._client,e=>new Ur(e,this._client))}async getStreams(e={}){const r=await this._client.callApi({url:"streams",type:"helix",query:{...Im(e),...ve(e)}});return Ge(r,Ur,this._client)}getStreamsPaginated(e={}){return new Me({url:"streams",query:Im(e)},this._client,r=>new Ur(r,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(Oa)})).data}async getStreamByUserName(e){var r;return(r=(await this.getStreamsByUserNames([e]))[0])!==null&&r!==void 0?r:null}async getStreamByUserNameBatched(e){return await this._getStreamByUserNameBatcher.request(Oa(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(E)})).data}async getStreamByUserId(e){const r=E(e),n=await this._client.callApi({url:"streams",type:"helix",userId:r,query:Im({userId:r})});return hr(n.data[0],i=>new Ur(i,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request(E(e))}async getStreamMarkersForUser(e,r){var n;const i=await this._client.callApi({url:"streams/markers",type:"helix",query:{...wx(e),...ve(r)},userId:E(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:ab(i.data.map(s=>Ms._mapGetStreamMarkersResult(s,this._client))),cursor:(n=i.pagination)===null||n===void 0?void 0:n.cursor}}getStreamMarkersForUserPaginated(e){return new Me({url:"streams/markers",query:wx(e),userId:E(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,r=>Ms._mapGetStreamMarkersResult(r,this._client))}async getStreamMarkersForVideo(e,r,n){var i;const s=await this._client.callApi({url:"streams/markers",type:"helix",query:{...Ox(r),...ve(n)},userId:E(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:ab(s.data.map(o=>Ms._mapGetStreamMarkersResult(o,this._client))),cursor:(i=s.pagination)===null||i===void 0?void 0:i.cursor}}getStreamMarkersForVideoPaginated(e,r){return new Me({url:"streams/markers",query:Ox(r),userId:E(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,n=>Ms._mapGetStreamMarkersResult(n,this._client))}async createStreamMarker(e,r){try{const n=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:E(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:d8(e,r)});return new Al(n.data[0],this._client)}catch(n){throw n instanceof ds&&n.statusCode===404?new c8({cause:n}):n}}async getStreamKey(e){const r=E(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:r,scopes:["channel:read:stream_key"],query:_e(e)})).data[0].stream_key}async getFollowedStreams(e,r){const n=E(e),i=await this._client.callApi({type:"helix",url:"streams/followed",userId:n,scopes:["user:read:follows"],query:{...He("user_id",n),...ve(r)}});return Ge(i,Ur,this._client)}getFollowedStreamsPaginated(e){const r=E(e);return new Me({url:"streams/followed",userId:r,scopes:["user:read:follows"],query:He("user_id",r)},this._client,n=>new Ur(n,this._client))}static _mapGetStreamMarkersResult(e,r){return e.videos.reduce((n,i)=>[...n,...i.markers.map(s=>new $y(s,i.video_id,r))],[])}};C([K(!1)],Il.prototype,"_getStreamByUserIdBatcher",void 0);C([K(!1)],Il.prototype,"_getStreamByUserNameBatcher",void 0);Il=Ms=C([B("api","HelixStreamApi")],Il);function f8(t,e){return{broadcaster_id:E(t),user_id:E(e)}}let Ol=class extends Z{constructor(e,r){super(e),this._client=r}get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[h].broadcaster_id)}get isGift(){return this[h].is_gift}get tier(){return this[h].tier}};C([K(!1)],Ol.prototype,"_client",void 0);Ol=C([B("api","HelixUserSubscription","broadcasterId")],Ol);let Rl=class extends Ol{get broadcasterId(){return this[h].broadcaster_id}get broadcasterName(){return this[h].broadcaster_login}get broadcasterDisplayName(){return this[h].broadcaster_name}async getBroadcaster(){return ne(await this._client.users.getUserById(this[h].broadcaster_id))}get gifterId(){return this[h].is_gift?this[h].gifter_id:null}get gifterName(){return this[h].is_gift?this[h].gifter_login:null}get gifterDisplayName(){return this[h].is_gift?this[h].gifter_name:null}async getGifter(){return this[h].is_gift?ne(await this._client.users.getUserById(this[h].gifter_id)):null}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};Rl=C([B("api","HelixSubscription","userId")],Rl);let Uy=class extends hs{constructor(e,r){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:E(e),query:_e(e)},r,n=>new Rl(n,r))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};Uy=C([B("api","HelixPaginatedSubscriptionsRequest")],Uy);let Fy=class extends Ae{async getSubscriptions(e,r){const n=await this._client.callApi({url:"subscriptions",scopes:["channel:read:subscriptions"],type:"helix",userId:E(e),query:{..._e(e),...ve(r)}});return{...ei(n,Rl,this._client),points:n.points}}getSubscriptionsPaginated(e){return new Uy(e,this._client)}async getSubscriptionsForUsers(e,r){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:E(e),scopes:["channel:read:subscriptions"],query:CP(e,r)})).data.map(i=>new Rl(i,this._client))}async getSubscriptionForUser(e,r){const n=await this.getSubscriptionsForUsers(e,[r]);return n.length?n[0]:null}async checkUserSubscription(e,r){try{const n=await this._client.callApi({type:"helix",url:"subscriptions/user",userId:E(e),scopes:["user:read:subscriptions"],query:f8(r,e)});return new Ol(n.data[0],this._client)}catch(n){if(n instanceof ds&&n.statusCode===404)return null;throw n}}};Fy=C([B("api","HelixSubscriptionApi")],Fy);let Ml=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get name(){return this[h].team_name}get displayName(){return this[h].team_display_name}get backgroundImageUrl(){return this[h].background_image_url}get bannerUrl(){return this[h].banner}get creationDate(){return new Date(this[h].created_at)}get updateDate(){return new Date(this[h].updated_at)}get info(){return this[h].info}get logoThumbnailUrl(){return this[h].thumbnail_url}async getUserRelations(){return(await this._client.teams.getTeamById(this.id)).userRelations}};C([K(!1)],Ml.prototype,"_client",void 0);Ml=C([B("api","HelixTeam","id")],Ml);let Nd=class extends Ml{get userRelations(){return this[h].users.map(e=>new ns(e,this._client))}};Nd=C([B("api","HelixTeamWithUsers","id")],Nd);let qy=class extends Ae{async getTeamsForBroadcaster(e){var r,n;return(n=(r=(await this._client.callApi({type:"helix",url:"teams/channel",userId:E(e),query:_e(e)})).data)===null||r===void 0?void 0:r.map(s=>new Ml(s,this._client)))!==null&&n!==void 0?n:[]}async getTeamById(e){try{const r=await this._client.callApi({type:"helix",url:"teams",query:{id:e}});return new Nd(r.data[0],this._client)}catch(r){if(r instanceof ds&&r.statusCode===500)return null;throw r}}async getTeamByName(e){try{const r=await this._client.callApi({type:"helix",url:"teams",query:{name:e}});return new Nd(r.data[0],this._client)}catch(r){if(r instanceof ds&&r.statusCode===404)return null;throw r}}};qy=C([B("api","HelixTeamApi")],qy);function h8(t,e){return{target_user_id:E(t),source_context:e.sourceContext,reason:e.reason}}function p8(t){return{target_user_id:E(t)}}class TP extends Z{get id(){return this[h].id}get version(){return this[h].version}get name(){return this[h].name}}let Na=class extends TP{constructor(e,r,n){super(n),this._slotType=e,this._slotId=r}get slotType(){return this._slotType}get slotId(){return this._slotId}};Na=C([B("api","HelixInstalledExtension","id")],Na);let Dd=class extends Z{getExtensionAtSlot(e,r){const n=this[h][e][r];return n.active?new Na(e,r,n):null}getExtensionsForSlotType(e){return[...Object.entries(this[h][e])].filter(r=>r[1].active).map(([r,n])=>new Na(e,r,n))}getAllExtensions(){return[...Object.entries(this[h])].flatMap(([e,r])=>[...Object.entries(r)].filter(n=>n[1].active).map(([n,i])=>new Na(e,n,i)))}};Dd=C([B("api","HelixInstalledExtensionList")],Dd);let Hy=class extends TP{get canActivate(){return this[h].can_activate}get types(){return this[h].type}};Hy=C([B("api","HelixUserExtension","id")],Hy);let ti=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get name(){return this[h].login}get displayName(){return this[h].display_name}get description(){return this[h].description}get type(){return this[h].type}get broadcasterType(){return this[h].broadcaster_type}get profilePictureUrl(){return this[h].profile_image_url}get offlinePlaceholderUrl(){return this[h].offline_image_url}get creationDate(){return new Date(this[h].created_at)}async getStream(){return await this._client.streams.getStreamByUserId(this)}async getFollowedChannels(){return await this._client.channels.getFollowedChannels(this)}async getFollowedChannel(e){var r;return(r=(await this._client.channels.getFollowedChannels(this,e)).data[0])!==null&&r!==void 0?r:null}async follows(e){return await this.getFollowedChannel(e)!==null}async getChannelFollowers(){return await this._client.channels.getChannelFollowers(this)}async getChannelFollower(e){var r;return(r=(await this._client.channels.getChannelFollowers(this,e)).data[0])!==null&&r!==void 0?r: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}};C([K(!1)],ti.prototype,"_client",void 0);ti=C([B("api","HelixUser","id")],ti);let jd=class extends ti{get email(){return this[h].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};jd=C([B("api","HelixPrivilegedUser","id")],jd);let Nl=class extends Z{constructor(e,r){super(e),this._client=r}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].display_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}};C([K(!1)],Nl.prototype,"_client",void 0);Nl=C([B("api","HelixUserBlock","userId")],Nl);let Dl=class extends Ae{constructor(){super(...arguments),this._getUserByIdBatcher=new ur({url:"users"},"id","id",this._client,e=>new ti(e,this._client)),this._getUserByNameBatcher=new ur({url:"users"},"login","login",this._client,e=>new ti(e,this._client))}async getUsersByIds(e){return await this._getUsers("id",e.map(E))}async getUsersByNames(e){return await this._getUsers("login",e.map(Oa))}async getUserById(e){const r=E(e),n=await this._client.callApi({type:"helix",url:"users",userId:r,query:{id:r}});return hr(n.data[0],i=>new ti(i,this._client))}async getUserByIdBatched(e){return await this._getUserByIdBatcher.request(E(e))}async getUserByName(e){const r=await this._getUsers("login",[Oa(e)]);return r.length?r[0]:null}async getUserByNameBatched(e){return await this._getUserByNameBatcher.request(Oa(e))}async getAuthenticatedUser(e,r=!1){var n;const i=await this._client.callApi({type:"helix",url:"users",forceType:"user",userId:E(e),scopes:r?["user:read:email"]:void 0});if(!(!((n=i.data)===null||n===void 0)&&n.length))throw new wi("Could not get authenticated user");return new jd(i.data[0],this._client)}async updateAuthenticatedUser(e,r){const n=await this._client.callApi({type:"helix",url:"users",method:"PUT",userId:E(e),scopes:["user:edit"],query:{description:r.description}});return new jd(n.data[0],this._client)}async getBlocks(e,r){const n=await this._client.callApi({type:"helix",url:"users/blocks",userId:E(e),scopes:["user:read:blocked_users"],query:{..._e(e),...ve(r)}});return Ge(n,Nl,this._client)}getBlocksPaginated(e){return new Me({url:"users/blocks",userId:E(e),scopes:["user:read:blocked_users"],query:_e(e)},this._client,r=>new Nl(r,this._client))}async createBlock(e,r,n={}){await this._client.callApi({type:"helix",url:"users/blocks",method:"PUT",userId:E(e),scopes:["user:manage:blocked_users"],query:h8(r,n)})}async deleteBlock(e,r){await this._client.callApi({type:"helix",url:"users/blocks",method:"DELETE",userId:E(e),scopes:["user:manage:blocked_users"],query:p8(r)})}async getExtensionsForAuthenticatedUser(e,r=!1){return(await this._client.callApi({type:"helix",url:"users/extensions/list",userId:E(e),scopes:r?["user:edit:broadcast"]:["user:read:broadcast","user:edit:broadcast"]})).data.map(i=>new Hy(i))}async getActiveExtensions(e,r=!1){const n=E(e),i=await this._client.callApi({type:"helix",url:"users/extensions",userId:n,scopes:r?["user:read:broadcast","user:edit:broadcast"]:void 0,query:He("user_id",n)});return new Dd(i.data)}async updateActiveExtensionsForAuthenticatedUser(e,r){const n=await this._client.callApi({type:"helix",url:"users/extensions",method:"PUT",userId:E(e),scopes:["user:edit:broadcast"],jsonBody:{data:r}});return new Dd(n.data)}async _getUsers(e,r){if(r.length===0)return[];const n={[e]:r};return(await this._client.callApi({type:"helix",url:"users",query:n})).data.map(s=>new ti(s,this._client))}};C([K(!1)],Dl.prototype,"_getUserByIdBatcher",void 0);C([K(!1)],Dl.prototype,"_getUserByNameBatcher",void 0);Dl=C([B("api","HelixUserApi")],Dl);let is=class extends Z{constructor(e,r){super(e),this._client=r}get id(){return this[h].id}get userId(){return this[h].user_id}get userName(){return this[h].user_login}get userDisplayName(){return this[h].user_name}async getUser(){return ne(await this._client.users.getUserById(this[h].user_id))}get title(){return this[h].title}get description(){return this[h].description}get creationDate(){return new Date(this[h].created_at)}get publishDate(){return new Date(this[h].published_at)}get url(){return this[h].url}get thumbnailUrl(){return this[h].thumbnail_url}getThumbnailUrl(e,r){return this[h].thumbnail_url.replace("%{width}",e.toString()).replace("%{height}",r.toString())}get isPublic(){return this[h].viewable==="public"}get views(){return this[h].view_count}get language(){return this[h].language}get type(){return this[h].type}get duration(){return this[h].duration}get durationInSeconds(){const e=this[h].duration.match(/\d+[hms]/g);if(!e)throw new wi(`Could not parse duration string: ${this[h].duration}`);return e.map(r=>{const n=/(\d+)([hms])/.exec(r);if(!n)throw new wi(`Could not parse partial duration string: ${r}`);const[,i,s]=n;return parseInt(i,10)*{h:3600,m:60,s:1}[s]}).reduce((r,n)=>r+n)}get streamId(){return this[h].stream_id}get mutedSegmentData(){var e,r;return(r=(e=this[h].muted_segments)===null||e===void 0?void 0:e.slice())!==null&&r!==void 0?r:[]}isMutedAt(e,r,n=!1){if(this[h].muted_segments===null)return!1;if(r==null)return this[h].muted_segments.some(s=>s.offset<=e&&e<=s.offset+s.duration);const i=e+r;return n?this[h].muted_segments.some(s=>{const o=s.offset+s.duration;return e{const o=s.offset+s.duration;return s.offset<=e&&i<=o})}};C([K(!1)],is.prototype,"_client",void 0);C([Se()],is.prototype,"durationInSeconds",null);is=C([au,B("api","HelixVideo","id")],is);var _c;let Ld=_c=class extends Ae{constructor(){super(...arguments),this._getVideoByIdBatcher=new ur({url:"videos"},"id","id",this._client,e=>new is(e,this._client))}async getVideosByIds(e){return(await this._getVideos("id",e)).data}async getVideoById(e){const r=await this.getVideosByIds([e]);return r.length?r[0]:null}async getVideoByIdBatched(e){return await this._getVideoByIdBatcher.request(e)}async getVideosByUser(e,r={}){const n=E(e);return await this._getVideos("user_id",[n],r)}getVideosByUserPaginated(e,r={}){const n=E(e);return this._getVideosPaginated("user_id",[n],r)}async getVideosByGame(e,r={}){return await this._getVideos("game_id",[e],r)}getVideosByGamePaginated(e,r={}){return this._getVideosPaginated("game_id",[e],r)}async deleteVideosByIds(e,r){await this._client.callApi({type:"helix",url:"videos",method:"DELETE",scopes:["channel:manage:videos"],userId:E(e),query:{id:r}})}async _getVideos(e,r,n={}){if(!r.length)return{data:[]};const i=await this._client.callApi({type:"helix",url:"videos",userId:e==="user_id"?r[0]:void 0,query:{..._c._makeVideosQuery(e,r,n),...ve(n)}});return Ge(i,is,this._client)}_getVideosPaginated(e,r,n={}){return new Me({url:"videos",userId:e==="user_id"?r[0]:void 0,query:_c._makeVideosQuery(e,r,n)},this._client,i=>new is(i,this._client))}static _makeVideosQuery(e,r,n={}){const{language:i,period:s,orderBy:o,type:a}=n;return{[e]:r,language:i,period:s,sort:o,type:a}}};C([K(!1)],Ld.prototype,"_getVideoByIdBatcher",void 0);Ld=_c=C([B("api","HelixVideoApi")],Ld);function m8(t,e){return{from_user_id:E(t),to_user_id:E(e)}}let zy=class extends Ae{async sendWhisper(e,r,n){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:E(e),scopes:["user:manage:whispers"],query:m8(e,r),jsonBody:{message:n}})}};zy=C([B("api","HelixWhisperApi")],zy);class g8{constructor(e,r,n){this._options=e,this._httpStatus=r,this._resolvedUserId=n}get options(){return this._options}get httpStatus(){return this._httpStatus}get resolvedUserId(){return this._resolvedUserId}}let xe=class extends Vo{constructor(e,r,n){super(),this.onRequest=this.registerEvent(),this._config=e,this._logger=r,this._rateLimiter=n}async requestScopesForUser(e,r){await this._config.authProvider.getAccessTokenForUser(e,...r.map(n=>[n]))}async getTokenInfo(){try{const e=await this.callApi({type:"auth",url:"validate"});return new ad(e)}catch(e){throw e instanceof ds&&e.statusCode===401?new rs({cause:e}):e}}async callApi(e){var r;const{authProvider:n}=this._config;if(!((r=e.auth)!==null&&r!==void 0?r:!0))return await su(e,n.clientId,void 0,void 0,this._config.fetchOptions);let s=!1;if(e.forceType)switch(e.forceType){case"app":{if(!n.getAppAccessToken)throw new Error("Tried to make an API call that requires an app access token but your auth provider does not support that");const l=await n.getAppAccessToken();return await this._callApiUsingInitialToken(e,l)}case"user":{s=!0;break}default:throw new wi(`Unknown forced token type: ${e.forceType}`)}if(e.scopes&&(s=!0),s){const l=e.canOverrideScopedUserContext?this._getUserIdFromRequestContext(e.userId):e.userId;if(!l)throw new Error("Tried to make an API call with a user context but no context user ID");const u=await n.getAccessTokenForUser(l,e.scopes);if(!u)throw new Error(`Tried to make an API call with a user context for user ID ${l} but no token was found`);if(oo(u)&&n.refreshAccessTokenForUser){const c=await n.refreshAccessTokenForUser(l);return await this._callApiUsingInitialToken(e,c,!0)}return await this._callApiUsingInitialToken(e,u)}const o=this._getUserIdFromRequestContext(e.userId),a=o===null?await n.getAnyAccessToken():await n.getAnyAccessToken(o??e.userId);if(oo(a)&&a.userId&&n.refreshAccessTokenForUser){const l=await n.refreshAccessTokenForUser(a.userId);return await this._callApiUsingInitialToken(e,l,!0)}return await this._callApiUsingInitialToken(e,a)}get bits(){return new by(this)}get channels(){return new vd(this)}get channelPoints(){return new xy(this)}get charity(){return new Sy(this)}get chat(){return new Ey(this)}get clips(){return new Ed(this)}get contentClassificationLabels(){return new Ty(this)}get entitlements(){return new Td(this)}get eventSub(){return new ky(this)}get extensions(){return new Py(this)}get games(){return new Lo(this)}get hypeTrain(){return new Yj(this)}get goals(){return new Ay(this)}get moderation(){return new Oy(this)}get polls(){return new My(this)}get predictions(){return new Ny(this)}get raids(){return new jy(this)}get schedule(){return new u8(this)}get search(){return new By(this)}get streams(){return new Il(this)}get subscriptions(){return new Fy(this)}get teams(){return new qy(this)}get users(){return new Dl(this)}get videos(){return new Ld(this)}get whispers(){return new zy(this)}get rateLimiterStats(){return this._rateLimiter instanceof qv?this._rateLimiter.stats:null}get _authProvider(){return this._config.authProvider}get _batchDelay(){var e;return(e=this._config.batchDelay)!==null&&e!==void 0?e:0}_getUserIdFromRequestContext(e){return e}async _callApiUsingInitialToken(e,r,n=!1){var i;const{authProvider:s}=this._config,{authorizationType:o}=s;let a=await this._callApiInternal(e,s.clientId,r.accessToken,o);if(a.status===401&&!n){if(r.userId){if(s.refreshAccessTokenForUser){const l=await s.refreshAccessTokenForUser(r.userId);a=await this._callApiInternal(e,s.clientId,l.accessToken,o)}}else if(s.getAppAccessToken){const l=await s.getAppAccessToken(!0);a=await this._callApiInternal(e,s.clientId,l.accessToken,o)}}return this.emit(this.onRequest,new g8(e,a.status,(i=r.userId)!==null&&i!==void 0?i:null)),await cy(a,e),await wT(a)}async _callApiInternal(e,r,n,i){var s,o,a;const{fetchOptions:l}=this._config,u=(s=e.type)!==null&&s!==void 0?s:"helix";this._logger.debug(`Calling ${u} 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)}`);const c=jj.operation({retries:3,minTimeout:500,factor:2}),{promise:f,resolve:d,reject:g}=ul();c.attempt(async()=>{try{const b=u==="helix"?await this._rateLimiter.request({options:e,clientId:r,accessToken:n,authorizationType:i,fetchOptions:l}):await jf(e,r,n,i,l);!b.ok&&b.status>=500&&b.status<600&&await cy(b,e),d(b)}catch(b){if(c.retry(b))return;g(c.mainError())}});const v=await f;return this._logger.debug(`Called ${u} API: ${(a=e.method)!==null&&a!==void 0?a:"GET"} ${e.url} - result: ${v.status}`),v}};C([Se()],xe.prototype,"bits",null);C([Se()],xe.prototype,"channels",null);C([Se()],xe.prototype,"channelPoints",null);C([Se()],xe.prototype,"charity",null);C([Se()],xe.prototype,"chat",null);C([Se()],xe.prototype,"clips",null);C([Se()],xe.prototype,"contentClassificationLabels",null);C([Se()],xe.prototype,"entitlements",null);C([Se()],xe.prototype,"eventSub",null);C([Se()],xe.prototype,"extensions",null);C([Se()],xe.prototype,"games",null);C([Se()],xe.prototype,"hypeTrain",null);C([Se()],xe.prototype,"goals",null);C([Se()],xe.prototype,"moderation",null);C([Se()],xe.prototype,"polls",null);C([Se()],xe.prototype,"predictions",null);C([Se()],xe.prototype,"raids",null);C([Se()],xe.prototype,"schedule",null);C([Se()],xe.prototype,"search",null);C([Se()],xe.prototype,"streams",null);C([Se()],xe.prototype,"subscriptions",null);C([Se()],xe.prototype,"teams",null);C([Se()],xe.prototype,"users",null);C([Se()],xe.prototype,"videos",null);C([Se()],xe.prototype,"whispers",null);xe=C([au,B("api","ApiClient")],xe);let Wy=class extends xe{_getUserIdFromRequestContext(){return null}};Wy=C([B("api","ApiClient")],Wy);let Bd=class extends xe{constructor(e,r,n,i){super(e,r,n),this._userId=i}_getUserIdFromRequestContext(){return this._userId}};Bd=C([B("api","ApiClient")],Bd);let Gy=class extends xe{constructor(e){if(!e.authProvider)throw new Mj("No auth provider given. Please supply the `authProvider` option.");const r={name:"twurple:api:rate-limiter",...e.logger};super(e,Wo({name:"twurple:api:client",...e.logger}),kf?new XN({getPartitionKey:n=>{var i;return(i=n.userId)!==null&&i!==void 0?i:null},createChild:()=>new Nj({logger:r})}):new pT({logger:r,bucketSize:800,timeFrame:64e3,doRequest:async({options:n,clientId:i,accessToken:s,authorizationType:o,fetchOptions:a})=>await jf(n,i,s,o,a),getPartitionKey:n=>{var i;return(i=n.userId)!==null&&i!==void 0?i:null}}))}async asUser(e,r){const n=new Bd(this._config,this._logger,this._rateLimiter,E(e));return await r(n)}async asIntent(e,r){if(!this._authProvider.getAccessTokenForIntent)throw new Error("Trying to use intents with an auth provider that does not support them");for(const n of e){const i=await this._authProvider.getAccessTokenForIntent(n);if(i){const s=new Bd(this._config,this._logger,this._rateLimiter,i.userId);return await r(s)}}throw new Error(`Intents [${e.join(", ")}] not found in auth provider`)}async withoutUser(e){const r=new Wy(this._config,this._logger,this._rateLimiter);return await e(r)}};Gy=C([B("api","ApiClient")],Gy);class y8{constructor(e="",r=""){Mr(this,"_clientId",py.twitch.clientId);Mr(this,"_scopes",py.twitch.scopes);Mr(this,"_accessToken");Mr(this,"_key");this._accessToken={accessToken:e,refreshToken:null,scope:this._scopes,expiresIn:null,obtainmentTimestamp:Date.now()},this._key=r}setAccessToken(e=""){e&&!this._accessToken.accessToken&&(this._accessToken.accessToken=e)}setKey(e=""){e&&!this._key&&(this._key=e)}get clientId(){return this._clientId}getCurrentScopesForUser(){return this._scopes}async getAccessTokenForUser(e,...r){return this._getAccessToken(r)}async getAnyAccessToken(){return this._getAccessToken()}async refreshAccessTokenForUser(){console.info("Refreshing authorization...");const e=await wP("twitch",this._key);return this._accessToken.accessToken=e,this._accessToken.obtainmentTimestamp=Date.now(),console.info("Reauthorized!"),this._getAccessToken()}async _getAccessToken(e){try{this._checkScopes(e);const{[h]:{expires_in:r},userId:n}=await fs(this._accessToken.accessToken,this._clientId);return this._accessToken.expiresIn=r||null,{...this._accessToken,userId:n}}catch{return await this.refreshAccessTokenForUser()}}_checkScopes(e){if(e!=null&&e.length){const r=new Set(this._scopes);e.forEach(n=>{if(!(!n||!n.length)&&n.every(i=>!r.has(i)))throw new v8(n)})}}}class v8 extends Error{constructor(e){const r=`This token does not have one of the requested scopes: [${e.join(", ")}]`;super(r),this.name="MissingScopesError"}}const Vy=new y8,w8=new Gy({authProvider:Vy});function Ko(){const{data:t}=dw("twitch"),{keys:e}=wn();return Vy.setAccessToken(t),Vy.setKey(e.twitch),w8}function ki(){const{data:t}=dw("twitch"),e=Ko();return xi({enabled:!!t,queryKey:["twitch","broadcaster",t||null],queryFn:async()=>{const{clientId:r}=py.twitch,{userId:n}=await fs(t,r);if(!n)throw Error("Twitch broadcaster not found");const i=await e.users.getUserById(n);if(!i)throw Error("Twitch broadcaster not found");return{id:i.id,userName:i.name,displayName:i.displayName,image:i.profilePictureUrl,url:`https://www.twitch.tv/${i.name}`}},...ys})}function kP(){const{data:t}=ki(),e=Ko();return xi({enabled:!!t,queryKey:["twitch","channelPointRewards",t==null?void 0:t.id],queryFn:async()=>{const r=new Map;return(await e.channelPoints.getCustomRewards(t.id).catch(()=>[])).forEach(i=>{r.set(i.id,i)}),r},...ys})}function Vf(){const{data:t}=ki(),e=Ko();return xi({enabled:!!t,queryKey:["twitch","cheermotes",t==null?void 0:t.id],queryFn:async()=>{const r=await e.bits.getCheermotes(t.id);return new _8(r)},...ys})}class _8{constructor(e){Mr(this,"cheermoteList");this.cheermoteList=e}getAllNames(){return this.cheermoteList.getPossibleNames()}get(e,r){return{name:e,amount:r,color:this.cheerColor(e,r),images:{default:this.buildCheermoteUrls(e,r),static:this.buildCheermoteUrls(e,r,!0)}}}cheerColor(e,r){return this.cheermoteList.getCheermoteDisplayInfo(e,r,{background:"light",scale:"1",state:"static"}).color}buildCheermoteUrls(e,r,n=!1){const i=this.cheermoteList;function s(o){return i.getCheermoteDisplayInfo(e,r,{background:"light",scale:o,state:n?"static":"animated"}).url}return{x1:s("1"),x2:s("2"),x4:s("4")}}}function b8(){const{data:t}=Vf();function e(r,n){const{name:i,amount:s,position:o,length:a}=r;return{type:"cheer",text:n.slice(o,o+a),cheer:t.get(i,s)}}return e}const x8=Wf.create({baseURL:"https://api.betterttv.net/3/cached"});async function S8(t,e){const r=new Map,n=await x8.get(`/users/${t}/${e}`).then(a=>a.data).catch(()=>null);if(!n)return r;const{channelEmotes:i,sharedEmotes:s}=n;if(!i||!s)return r;function o(a){a.forEach(l=>{r.set(l.code,{id:l.id,name:l.code,images:{default:Rx(l.id),static:Rx(l.id,!0)},source:"betterttv"})})}return o(i),o(s),r}function Rx(t,e=!1){function r(n){return`https://cdn.betterttv.net/emote/${t}${e?"/static":""}/${n}x`}return{x1:r(1),x2:r(2),x4:r(3)}}const C8=Wf.create({baseURL:"https://api.frankerfacez.com/v1"});async function E8(t,e){const r=new Map,n=await C8.get(`/room/${T8(t)}/${e}`).then(s=>s.data).catch(()=>null);if(!n)return r;const{sets:i}=n;return i&&Object.keys(i).forEach(s=>{i[s].emoticons.forEach(o=>{r.set(o.name,{id:o.id.toString(),name:o.name,images:{default:Mx(o),static:Mx(o,!0)},source:"frankerfacez"})})}),r}function Mx(t,e=!1){let r=t.urls[1],n=t.urls[2]||r,i=t.urls[4]||n;return!e&&t.animated&&(r=t.animated[1],n=t.animated[2]||r,i=t.animated[4]||n),{x1:r,x2:n,x4:i}}function T8(t){switch(t){case"twitch":return"id";case"youtube":return"yt";default:throw Error(`Unhandled platform "${t}" in FFZ Platform URL Transformer`)}}function Qf(){const{data:t}=ki();return xi({enabled:!!t,queryKey:["twitch","thirdPartyEmotes",t==null?void 0:t.id],queryFn:async()=>{const e=new Map;return(await Promise.all([S8("twitch",t.id),E8("twitch",t.id)])).forEach(n=>{n.forEach((i,s)=>{e.set(s,i)})}),e},retry:1,retryOnMount:!1,gcTime:1/0,staleTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1})}function k8(){const{data:t}=Qf();function e(r,n){const{position:i,length:s,id:o,name:a}=r,l=n.slice(i,i+s),u=t.get(l);return u?{type:"emote",text:l,emote:u}:{type:"emote",text:l,emote:{id:o,name:a,images:{default:Nx(o),static:Nx(o,!0)},source:"twitch"}}}return e}function Nx(t,e=!1){function r(n){return Jk(t,{animationSettings:e?"static":"default",backgroundType:"light",size:n})}return{x1:r("1.0"),x2:r("2.0"),x4:r("3.0")}}function P8(){const{data:t}=Qf();function e(r){const n=[],{text:i}=r,s=A8(Array.from(t.keys()));return i.split(s).forEach(o=>{if(o==="")return;const a=t.get(o);a?n.push({type:"emote",text:o,emote:a}):n.push({type:"text",text:o})}),n}return e}function A8(t){const e=t.map(I8).join("|"),r=String.raw`(?<=\s|[.,!]|^)(${e})(?=\s|[.,!]|$)`;return new RegExp(r,"g")}function I8(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function O8(){const{data:t}=Vf(),e=P8(),r=b8(),n=k8();function i(s,o,a=!1){if(!s)return[];const l=gD(s,o,a?t.getAllNames():void 0),u=[];return l.forEach(c=>{switch(c.type){default:case"text":u.push(...e(c));break;case"cheer":u.push(r(c,s));break;case"emote":u.push(n(c,s));break}}),u}return i}function fw(){const{data:t}=ki(),e=Ko();return xi({enabled:!!t,queryKey:["twitch","badges",t==null?void 0:t.id],queryFn:async()=>{const[r,n]=await Promise.all([e.chat.getGlobalBadges(),e.chat.getChannelBadges(t.id)]);return new R8(r,n)},...ys})}class R8{constructor(e,r){Mr(this,"badgeMap",new Map);this.set(e),this.set(r)}transform(e){const r=[];return e.forEach((n,i)=>{const s=this.get(i,n);s&&r.push(s)}),r}get(e,r=e==="subscriber"||e==="founder"?"0":"1"){var i,s;const n=(s=(i=this.badgeMap.get(e))==null?void 0:i.get(r))==null?void 0:s.getImageUrl(4);if(n)return{id:e,image:n}}set(e){e.forEach(r=>{const n=new Map;r.versions.forEach(i=>{n.set(i.id,i)}),this.badgeMap.set(r.id,n)})}}function M8(){const{data:t}=ki(),e=Ko(),r=sf();async function n(i){return t?await r.fetchQuery({queryKey:["twitch","followDate",i],queryFn:async()=>{if(i===t.id)return new Date(0);const s=await e.channels.getChannelFollowers(t.id,i),[o]=s.data;return o?o.followDate:null},staleTime:1*60*60*1e3,gcTime:2*60*60*1e3,retry:1}):null}return{getFollowDate:n}}function N8(){const{data:t}=hw(),e=sf();async function r(n){return t?await e.fetchQuery({queryKey:["twitch","pronouns","user",n],queryFn:async()=>{const i=await D8(n);if(!i)return null;const[s,o]=i;return AP(t[s],o?t[o]:null)},staleTime:5*60*1e3,gcTime:1*60*60*1e3,retry:0}):null}return{getPronouns:r}}function hw(){return xi({queryKey:["twitch","pronouns","all"],queryFn:async()=>j8(),...ys})}const PP=Wf.create({baseURL:"https://api.pronouns.alejo.io/v1"});async function D8(t){const e=await PP.get(`/users/${t}`).then(r=>r.data).catch(()=>null);return e?[e.pronoun_id,e.alt_pronoun_id]:null}async function j8(){return await PP.get("/pronouns").then(e=>e.data).catch(()=>null)}function AP(t,e){return e?`${t.subject}/${e.object}`:t.singular?t.subject:`${t.subject}/${t.object}`}class Be{static number(e,r){return Math.random()*(r-e)+e}static integer(e,r){return Math.floor(Math.random()*(r-e+1))+e}static chance(e){return Math.random()n||Be.item(L8),staleTime:1/0,gcTime:1/0})}return e}const L8=["red","blue","green","firebrick","coral","yellowgreen","orangered","seagreen","goldenrod","chocolate","cadetblue","dodgerblue","hotpink","blueviolet","springgreen"];function B8(){const{getPronouns:t}=N8(),{getFollowDate:e}=M8(),{data:r}=fw(),n=IP();async function i(s){const{userId:o,userName:a,displayName:l,badges:u,color:c,isBroadcaster:f,isMod:d,isArtist:g,isVip:v,isFounder:b,isSubscriber:w}=s;return{id:o,userName:a,displayName:l,pronouns:await t(a),badges:r.transform(u),color:await n(o,c),roles:{broadcaster:f,moderator:d,artist:g,vip:v,founder:b,subscriber:w},followDate:await e(o)}}return i}function $8(){const{data:t}=kP(),e=O8(),r=B8();async function n(i,s,o){if(s instanceof $f&&(o=s.text),!o)return;const{type:a}=i,l={id:s.id,first:s.tags.get("first-msg")==="1",date:s.date,text:o,parts:e(o,s.emoteOffsets,a==="cheer"),user:await r(s.userInfo),tags:s.tags,...i};if(a!=="basic")return l;if(s.tags.get("msg-id")==="highlighted-message")return{...l,type:"highlight"};const u=s.tags.get("custom-reward-id");if(u){const d=t.get(u);if(d){const g={id:d.id,name:d.title,cost:d.cost,image:d.getImageUrl(4),color:d.backgroundColor};return{...l,type:"redeem",redeem:g}}}function c(d){return s.tags.get(`reply-parent-${d}`)||""}const f=c("msg-id");if(f){const d={id:f,text:c("msg-body"),user:{id:c("user-id"),userName:c("user-login"),displayName:c("display-name")}};return{...l,type:"reply",reply:d}}return l}return n}const Gu="twitch";function U8(){const{data:t}=ki(),{isPlatformReady:e}=Tf(),r=wn(),{addEvent:n,removeEvent:i,removeUser:s,removeMessages:o}=Iv(),a=$8(),l=I.useRef(new pd),u=e("twitch");I.useEffect(()=>{if(!u)return;const c=l.current;!c.isConnected&&!c.isConnecting&&(c.onConnect(()=>{c.join(t.userName)}),c.connect());function f(w){w&&n({type:"message",id:w.id,userId:w.user.id,message:w,source:Gu})}function d(w){i("message",w),r.sendEvent({type:"remove-message",messageId:w,source:Gu})}function g(){o(),r.sendEvent({type:"clear-messages",source:Gu})}function v(w){w&&(s(w),r.sendEvent({type:"remove-user",userId:w,source:Gu}))}const b=[];return b.push(c.onMessage(async(w,p,m,y)=>{const{bits:x}=y,k=await a(x?{type:"cheer",cheer:{amount:x}}:{type:"basic"},y,m);f(k)}),c.onAction(async(w,p,m,y)=>{const x=await a({type:"action"},y,m);f(x)}),c.onResub(async(w,p,m,y)=>{const x={type:"resub",resub:{months:m.months,tier:m.plan}},S=await a(x,y);f(S)}),c.onAnnouncement(async(w,p,m,y)=>{const x={type:"announcement",announcement:{color:m.color}},S=await a(x,y);f(S)}),c.onChatClear(()=>{g()}),c.onTimeout((w,p,m,y)=>{v(y.targetUserId)}),c.onBan((w,p,m)=>{v(m.targetUserId)}),c.onMessageRemove((w,p)=>{d(p)})),()=>{b.forEach(w=>{w&&c.removeListener(w)})}},[u,r,n,i,s,o,a,t])}function OP(){const{data:t}=ki(),e=Ko();return xi({enabled:!!t,queryKey:["twitch","channelEmotes",t==null?void 0:t.id],queryFn:async()=>(await e.chat.getChannelEmotes(t.id)).map(n=>{const{id:i,name:s}=n;return{id:i,name:s,images:{default:Dx(i),static:Dx(i,!0)},source:"twitch"}}),...ys})}function Dx(t,e=!1){function r(n){return Jk(t,{animationSettings:e?"static":"default",backgroundType:"light",size:n})}return{x1:r("1.0"),x2:r("2.0"),x4:r("3.0")}}function F8(){const{data:t,status:e}=ki(),{status:r}=fw(),{status:n}=OP(),{status:i}=kP(),{status:s}=Vf(),{status:o}=hw(),{status:a}=Qf(),{isPlatformReady:l}=Tf(),{setPlatformReady:u}=N4();U8();const c=[e,r,n,i,s,o,a].some(f=>f==="pending");return I.useEffect(()=>{c||u("twitch")},[c]),l("twitch")?_.jsx(R4,{broadcaster:t,platform:"twitch",staticPosition:!0}):_.jsx(U5,{staticPosition:!0,message:"Key verified! Loading Twitch data...",items:[{message:"Loading broadcaster...",status:e},{message:"Loading badges...",status:r},{message:"Loading channel emotes...",status:n},{message:"Loading channel point rewards...",status:i},{message:"Loading cheermotes...",status:s},{message:"Loading pronouns...",status:o},{message:"Loading third party emotes...",status:a}]})}function Ot(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function RP(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Ot(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let Om;function Ar(){return Om||(Om=RP("keyval-store","keyval")),Om}function q8(t,e=Ar()){return e("readonly",r=>Ot(r.get(t)))}function H8(t,e,r=Ar()){return r("readwrite",n=>(n.put(e,t),Ot(n.transaction)))}function z8(t,e=Ar()){return e("readwrite",r=>(t.forEach(n=>r.put(n[1],n[0])),Ot(r.transaction)))}function W8(t,e=Ar()){return e("readonly",r=>Promise.all(t.map(n=>Ot(r.get(n)))))}function G8(t,e,r=Ar()){return r("readwrite",n=>new Promise((i,s)=>{n.get(t).onsuccess=function(){try{n.put(e(this.result),t),i(Ot(n.transaction))}catch(o){s(o)}}}))}function V8(t,e=Ar()){return e("readwrite",r=>(r.delete(t),Ot(r.transaction)))}function Q8(t,e=Ar()){return e("readwrite",r=>(t.forEach(n=>r.delete(n)),Ot(r.transaction)))}function K8(t=Ar()){return t("readwrite",e=>(e.clear(),Ot(e.transaction)))}function pw(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ot(t.transaction)}function Y8(t=Ar()){return t("readonly",e=>{if(e.getAllKeys)return Ot(e.getAllKeys());const r=[];return pw(e,n=>r.push(n.key)).then(()=>r)})}function X8(t=Ar()){return t("readonly",e=>{if(e.getAll)return Ot(e.getAll());const r=[];return pw(e,n=>r.push(n.value)).then(()=>r)})}function J8(t=Ar()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Ot(e.getAllKeys()),Ot(e.getAll())]).then(([n,i])=>n.map((s,o)=>[s,i[o]]));const r=[];return t("readonly",n=>pw(n,i=>r.push([i.key,i.value])).then(()=>r))})}class Z8{constructor(e){Mr(this,"_store");e&&this._createStore(e)}use(e){if(!e)throw new tL;this._createStore(`widget-${e}`)}get(e){return this._throwIfStoreMissing(),q8(e,this._store)}getMany(e){return this._throwIfStoreMissing(),W8(e,this._store)}set(e,r){return this._throwIfStoreMissing(),H8(e,r,this._store)}setMany(e){return this._throwIfStoreMissing(),z8(e,this._store)}update(e,r){return this._throwIfStoreMissing(),G8(e,r,this._store)}del(e){return this._throwIfStoreMissing(),V8(e,this._store)}delMany(e){return this._throwIfStoreMissing(),Q8(e,this._store)}clear(){return this._throwIfStoreMissing(),K8(this._store)}keys(){return this._throwIfStoreMissing(),Y8(this._store)}values(){return this._throwIfStoreMissing(),X8(this._store)}entries(){return this._throwIfStoreMissing(),J8(this._store)}_createStore(e){this._store=RP(`slime2-${e}-db`,`slime2-${e}-store`)}_throwIfStoreMissing(){if(!this._store)throw new rL}}const eL=new Z8;class tL extends Error{constructor(){const e="Parameters missing from slime2.storage.create()";super(e),this.name="CreateStorageError"}}class rL extends Error{constructor(){const e="Storage must be created using slime2.storage.create('storage-name') before use.";super(e),this.name="MissingStorageError"}}function nL(){const{status:t,error:e}=dw("twitch"),r=I.useRef(!1),n=I.useRef(null),{onEvent:i,setKey:s,setPlatform:o,setMaxEvents:a,setEventDelay:l,setEventExpiration:u,createWidgetSettings:c}=tR(),{loadValues:f}=xf(),d=Ev(),{platforms:g}=wn(),v=I.useCallback((w,p)=>{if(!Array.isArray(w))return d;const m=Ri(d,w);return typeof p!="string"?m:(m==null?void 0:m[p])||null},[d]);if(I.useEffect(()=>{r.current||(globalThis.slime2={onEvent:i,setKey:s,setMaxEvents:a,setEventDelay:l,setEventExpiration:u,storage:eL,color:ll,random:Be,cloneTemplate:YO,widget:{loadSettings:(w,p)=>(c(w,p),new Promise(m=>{n.current=m})),loadPlatform:o,setData:w=>{f(w)},getData:v}},dispatchEvent(new CustomEvent("slime2:ready")),r.current=!0)},[]),I.useEffect(()=>{if(Object.keys(d).length){const w=n.current;w&&(globalThis.slime2.widget.getData=v,w(),dispatchEvent(new CustomEvent("slime2:widget-data-update")))}},[d,v]),g.includes("twitch")){if(e instanceof _P)return _.jsx(k1,{message:"Twitch key not found."});if(e instanceof bP)return _.jsx(k1,{message:"Twitch key expired."})}return!!g.length&&[t].some(w=>w==="pending")?_.jsx(U5,{message:"Verifying Key..."}):_.jsx("div",{className:"absolute inset-x-0",children:t==="success"&&_.jsx(F8,{})})}var MP={exports:{}},Rm={exports:{}},jx;function iL(){return jx||(jx=1,function(t){(function(e,r){t.exports?t.exports=r():e.EvEmitter=r()})(typeof window<"u"?window:tf,function(){function e(){}let r=e.prototype;return r.on=function(n,i){if(!n||!i)return this;let s=this._events=this._events||{},o=s[n]=s[n]||[];return o.includes(i)||o.push(i),this},r.once=function(n,i){if(!n||!i)return this;this.on(n,i);let s=this._onceEvents=this._onceEvents||{},o=s[n]=s[n]||{};return o[i]=!0,this},r.off=function(n,i){let s=this._events&&this._events[n];if(!s||!s.length)return this;let o=s.indexOf(i);return o!=-1&&s.splice(o,1),this},r.emitEvent=function(n,i){let s=this._events&&this._events[n];if(!s||!s.length)return this;s=s.slice(0),i=i||[];let o=this._onceEvents&&this._onceEvents[n];for(let a of s)o&&o[a]&&(this.off(n,a),delete o[a]),a.apply(this,i);return this},r.allOff=function(){return delete this._events,delete this._onceEvents,this},e})}(Rm)),Rm.exports}/*! * imagesLoaded v5.0.0 * JavaScript is all like "You images are done yet or what?" * MIT License - */(function(t){(function(e,r){t.exports?t.exports=r(e,nL()):e.imagesLoaded=r(e,e.EvEmitter)})(typeof window<"u"?window:tf,function(r,n){let i=r.jQuery,s=r.console;function o(d){return Array.isArray(d)?d:typeof d=="object"&&typeof d.length=="number"?[...d]:[d]}function a(d,y,v){if(!(this instanceof a))return new a(d,y,v);let b=d;if(typeof d=="string"&&(b=document.querySelectorAll(d)),!b){s.error(`Bad element for imagesLoaded ${b||d}`);return}this.elements=o(b),this.options={},typeof y=="function"?v=y:Object.assign(this.options,y),v&&this.on("always",v),this.getImages(),i&&(this.jqDeferred=new i.Deferred),setTimeout(this.check.bind(this))}a.prototype=Object.create(n.prototype),a.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)};const l=[1,9,11];a.prototype.addElementImages=function(d){d.nodeName==="IMG"&&this.addImage(d),this.options.background===!0&&this.addElementBackgroundImages(d);let{nodeType:y}=d;if(!y||!l.includes(y))return;let v=d.querySelectorAll("img");for(let b of v)this.addImage(b);if(typeof this.options.background=="string"){let b=d.querySelectorAll(this.options.background);for(let w of b)this.addElementBackgroundImages(w)}};const u=/url\((['"])?(.*?)\1\)/gi;a.prototype.addElementBackgroundImages=function(d){let y=getComputedStyle(d);if(!y)return;let v=u.exec(y.backgroundImage);for(;v!==null;){let b=v&&v[2];b&&this.addBackground(b,d),v=u.exec(y.backgroundImage)}},a.prototype.addImage=function(d){let y=new c(d);this.images.push(y)},a.prototype.addBackground=function(d,y){let v=new f(d,y);this.images.push(v)},a.prototype.check=function(){if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length){this.complete();return}let d=(y,v,b)=>{setTimeout(()=>{this.progress(y,v,b)})};this.images.forEach(function(y){y.once("progress",d),y.check()})},a.prototype.progress=function(d,y,v){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!d.isLoaded,this.emitEvent("progress",[this,d,y]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,d),this.progressedCount===this.images.length&&this.complete(),this.options.debug&&s&&s.log(`progress: ${v}`,d,y)},a.prototype.complete=function(){let d=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(d,[this]),this.emitEvent("always",[this]),this.jqDeferred){let y=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[y](this)}};function c(d){this.img=d}c.prototype=Object.create(n.prototype),c.prototype.check=function(){if(this.getIsImageComplete()){this.confirm(this.img.naturalWidth!==0,"naturalWidth");return}this.proxyImage=new Image,this.img.crossOrigin&&(this.proxyImage.crossOrigin=this.img.crossOrigin),this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.currentSrc||this.img.src},c.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},c.prototype.confirm=function(d,y){this.isLoaded=d;let{parentNode:v}=this.img,b=v.nodeName==="PICTURE"?v:this.img;this.emitEvent("progress",[this,b,y])},c.prototype.handleEvent=function(d){let y="on"+d.type;this[y]&&this[y](d)},c.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},c.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},c.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)};function f(d,y){this.url=d,this.element=y,this.img=new Image}return f.prototype=Object.create(c.prototype),f.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(this.img.naturalWidth!==0,"naturalWidth"),this.unbindEvents())},f.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},f.prototype.confirm=function(d,y){this.isLoaded=d,this.emitEvent("progress",[this,this.element,y])},a.makeJQueryPlugin=function(d){d=d||r.jQuery,d&&(i=d,i.fn.imagesLoaded=function(y,v){return new a(this,y,v).jqDeferred.promise(i(this))})},a.makeJQueryPlugin(),a})})(RP);var iL=RP.exports;const sL=yn(iL);function oL(t){const e=wn(),{removeEvent:r}=Iv(),n=I.useRef(null),i=I.useRef(),s=I.useRef(!1),[o,a]=I.useState(),[l,u]=I.useState({});function c(){r(t.type,t.id)}if(I.useEffect(()=>{if(s.current)return;async function y(){s.current=!0;const v=await e.sendEvent({...t});i.current=v||{};const{fragment:b,parentProps:w}=i.current;w&&u(w),a(b?QO(b):"")}y()},[]),I.useEffect(()=>{if(!n.current||!i.current||!o)return;const y=n.current.firstElementChild,{callback:v}=i.current;function b(w,p){setTimeout(()=>{if(!p||!p.animationTime)c();else{const{animationTime:m,animationClass:g,animationFunction:x}=p;g&&y.classList.add(g),x&&x(y),setTimeout(c,m)}},w)}sL(y,()=>{v&&v(y);const{eventExpiration:w,eventExpirationOptions:p}=e;w&&b(w,p)})},[o]),o===""&&c(),!o)return null;const{className:f,...d}=l;return _.jsx("div",{className:ie("slime2-event",f),"data-event-id":t.id,"data-event-type":t.type,"data-event-user-id":t.userId,"data-event-source":t.source,dangerouslySetInnerHTML:{__html:o},ref:n,...d})}const aL=I.memo(oL);function lL(){const t=CE();function e(){return t.map(r=>{const n=`${r.type}-${r.id}`;return _.jsx(aL,{...r},n)})}return _.jsx("div",{id:"slime2-event-list",children:e()})}function uL(){return I.useContext(MP)}function cu(){const t=I.useContext(NP),{getMousePosition:e}=cL();function r(s,o){t({type:"add",window:{...s,initialMousePosition:o||e()}}),t({type:"top",id:s.id})}function n(s){t({type:"remove",id:s})}function i(s){t({type:"top",id:s})}return{openWindow:r,closeWindow:n,sendWindowToTop:i}}function cL(){const[t,e]=I.useState({x:0,y:0});I.useEffect(()=>{function n(i){e({x:i.clientX,y:i.clientY})}return addEventListener("mousemove",n),()=>{removeEventListener("mousemove",n)}},[]);function r(){return t}return{getMousePosition:r}}const dL=[],MP=I.createContext(dL),NP=I.createContext(vs);function fL(t,e){switch(e.type){case"add":return!!t.find(n=>n.id===e.window.id)?t:[...t,e.window];case"remove":return t.filter(r=>r.id!==e.id);case"top":{const r=t.findIndex(n=>n.id===e.id);return r===-1||r===t.length-1?t:[...t.filter(n=>n.id!==e.id),t[r]]}}}var Kf={exports:{}},DP={},jP={exports:{}},hL="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",pL=hL,mL=pL;function LP(){}function BP(){}BP.resetWarningCache=LP;var gL=function(){function t(n,i,s,o,a,l){if(l!==mL){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:BP,resetWarningCache:LP};return r.PropTypes=r,r};jP.exports=gL();var mw=jP.exports;const z=yn(mw);function $P(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const r=(t=window.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.style;if(!r||e in r)return"";for(let n=0;ne===r.identifier)||t.changedTouches&&(0,zt.findInArray)(t.changedTouches,r=>e===r.identifier)}function BL(t){if(t.targetTouches&&t.targetTouches[0])return t.targetTouches[0].identifier;if(t.changedTouches&&t.changedTouches[0])return t.changedTouches[0].identifier}function $L(t){if(!t)return;let e=t.getElementById("react-draggable-style-el");e||(e=t.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} + */(function(t){(function(e,r){t.exports?t.exports=r(e,iL()):e.imagesLoaded=r(e,e.EvEmitter)})(typeof window<"u"?window:tf,function(r,n){let i=r.jQuery,s=r.console;function o(d){return Array.isArray(d)?d:typeof d=="object"&&typeof d.length=="number"?[...d]:[d]}function a(d,g,v){if(!(this instanceof a))return new a(d,g,v);let b=d;if(typeof d=="string"&&(b=document.querySelectorAll(d)),!b){s.error(`Bad element for imagesLoaded ${b||d}`);return}this.elements=o(b),this.options={},typeof g=="function"?v=g:Object.assign(this.options,g),v&&this.on("always",v),this.getImages(),i&&(this.jqDeferred=new i.Deferred),setTimeout(this.check.bind(this))}a.prototype=Object.create(n.prototype),a.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)};const l=[1,9,11];a.prototype.addElementImages=function(d){d.nodeName==="IMG"&&this.addImage(d),this.options.background===!0&&this.addElementBackgroundImages(d);let{nodeType:g}=d;if(!g||!l.includes(g))return;let v=d.querySelectorAll("img");for(let b of v)this.addImage(b);if(typeof this.options.background=="string"){let b=d.querySelectorAll(this.options.background);for(let w of b)this.addElementBackgroundImages(w)}};const u=/url\((['"])?(.*?)\1\)/gi;a.prototype.addElementBackgroundImages=function(d){let g=getComputedStyle(d);if(!g)return;let v=u.exec(g.backgroundImage);for(;v!==null;){let b=v&&v[2];b&&this.addBackground(b,d),v=u.exec(g.backgroundImage)}},a.prototype.addImage=function(d){let g=new c(d);this.images.push(g)},a.prototype.addBackground=function(d,g){let v=new f(d,g);this.images.push(v)},a.prototype.check=function(){if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length){this.complete();return}let d=(g,v,b)=>{setTimeout(()=>{this.progress(g,v,b)})};this.images.forEach(function(g){g.once("progress",d),g.check()})},a.prototype.progress=function(d,g,v){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!d.isLoaded,this.emitEvent("progress",[this,d,g]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,d),this.progressedCount===this.images.length&&this.complete(),this.options.debug&&s&&s.log(`progress: ${v}`,d,g)},a.prototype.complete=function(){let d=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(d,[this]),this.emitEvent("always",[this]),this.jqDeferred){let g=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[g](this)}};function c(d){this.img=d}c.prototype=Object.create(n.prototype),c.prototype.check=function(){if(this.getIsImageComplete()){this.confirm(this.img.naturalWidth!==0,"naturalWidth");return}this.proxyImage=new Image,this.img.crossOrigin&&(this.proxyImage.crossOrigin=this.img.crossOrigin),this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.currentSrc||this.img.src},c.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},c.prototype.confirm=function(d,g){this.isLoaded=d;let{parentNode:v}=this.img,b=v.nodeName==="PICTURE"?v:this.img;this.emitEvent("progress",[this,b,g])},c.prototype.handleEvent=function(d){let g="on"+d.type;this[g]&&this[g](d)},c.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},c.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},c.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)};function f(d,g){this.url=d,this.element=g,this.img=new Image}return f.prototype=Object.create(c.prototype),f.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(this.img.naturalWidth!==0,"naturalWidth"),this.unbindEvents())},f.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},f.prototype.confirm=function(d,g){this.isLoaded=d,this.emitEvent("progress",[this,this.element,g])},a.makeJQueryPlugin=function(d){d=d||r.jQuery,d&&(i=d,i.fn.imagesLoaded=function(g,v){return new a(this,g,v).jqDeferred.promise(i(this))})},a.makeJQueryPlugin(),a})})(MP);var sL=MP.exports;const oL=yn(sL);function aL(t){const e=wn(),{removeEvent:r}=Iv(),n=I.useRef(null),i=I.useRef(),s=I.useRef(!1),[o,a]=I.useState(),[l,u]=I.useState({});function c(){r(t.type,t.id)}if(I.useEffect(()=>{if(s.current)return;async function g(){s.current=!0;const v=await e.sendEvent({...t});i.current=v||{};const{fragment:b,parentProps:w}=i.current;w&&u(w),a(b?KO(b):"")}g()},[]),I.useEffect(()=>{if(!n.current||!i.current||!o)return;const g=n.current.firstElementChild,{callback:v}=i.current;function b(w,p){setTimeout(()=>{if(!p||!p.animationTime)c();else{const{animationTime:m,animationClass:y,animationFunction:x}=p;y&&g.classList.add(y),x&&x(g),setTimeout(c,m)}},w)}oL(g,()=>{v&&v(g);const{eventExpiration:w,eventExpirationOptions:p}=e;w&&b(w,p)})},[o]),o===""&&c(),!o)return null;const{className:f,...d}=l;return _.jsx("div",{className:ie("slime2-event",f),"data-event-id":t.id,"data-event-type":t.type,"data-event-user-id":t.userId,"data-event-source":t.source,dangerouslySetInnerHTML:{__html:o},ref:n,...d})}const lL=I.memo(aL);function uL(){const t=CE();function e(){return t.map(r=>{const n=`${r.type}-${r.id}`;return _.jsx(lL,{...r},n)})}return _.jsx("div",{id:"slime2-event-list",children:e()})}function cL(){return I.useContext(NP)}function cu(){const t=I.useContext(DP),{getMousePosition:e}=dL();function r(s,o){t({type:"add",window:{...s,initialMousePosition:o||e()}}),t({type:"top",id:s.id})}function n(s){t({type:"remove",id:s})}function i(s){t({type:"top",id:s})}return{openWindow:r,closeWindow:n,sendWindowToTop:i}}function dL(){const[t,e]=I.useState({x:0,y:0});I.useEffect(()=>{function n(i){e({x:i.clientX,y:i.clientY})}return addEventListener("mousemove",n),()=>{removeEventListener("mousemove",n)}},[]);function r(){return t}return{getMousePosition:r}}const fL=[],NP=I.createContext(fL),DP=I.createContext(vs);function hL(t,e){switch(e.type){case"add":return!!t.find(n=>n.id===e.window.id)?t:[...t,e.window];case"remove":return t.filter(r=>r.id!==e.id);case"top":{const r=t.findIndex(n=>n.id===e.id);return r===-1||r===t.length-1?t:[...t.filter(n=>n.id!==e.id),t[r]]}}}var Kf={exports:{}},jP={},LP={exports:{}},pL="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",mL=pL,gL=mL;function BP(){}function $P(){}$P.resetWarningCache=BP;var yL=function(){function t(n,i,s,o,a,l){if(l!==gL){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:$P,resetWarningCache:BP};return r.PropTypes=r,r};LP.exports=yL();var mw=LP.exports;const z=yn(mw);function UP(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const r=(t=window.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.style;if(!r||e in r)return"";for(let n=0;ne===r.identifier)||t.changedTouches&&(0,zt.findInArray)(t.changedTouches,r=>e===r.identifier)}function $L(t){if(t.targetTouches&&t.targetTouches[0])return t.targetTouches[0].identifier;if(t.changedTouches&&t.changedTouches[0])return t.changedTouches[0].identifier}function UL(t){if(!t)return;let e=t.getElementById("react-draggable-style-el");e||(e=t.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} `,e.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;} -`,t.getElementsByTagName("head")[0].appendChild(e)),t.body&&zP(t.body,"react-draggable-transparent-selection")}function UL(t){if(t)try{if(t.body&&WP(t.body,"react-draggable-transparent-selection"),t.selection)t.selection.empty();else{const e=(t.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function zP(t,e){t.classList?t.classList.add(e):t.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(t.className+=" ".concat(e))}function WP(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var rn={};Object.defineProperty(rn,"__esModule",{value:!0});rn.canDragX=HL;rn.canDragY=zL;rn.createCoreData=GL;rn.createDraggableData=VL;rn.getBoundPosition=FL;rn.getControlPosition=WL;rn.snapToGrid=qL;var jt=tn,Ks=$e;function FL(t,e,r){if(!t.props.bounds)return[e,r];let{bounds:n}=t.props;n=typeof n=="string"?n:QL(n);const i=yw(t);if(typeof n=="string"){const{ownerDocument:s}=i,o=s.defaultView;let a;if(n==="parent"?a=i.parentNode:a=s.querySelector(n),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+n+'" could not find an element.');const l=a,u=o.getComputedStyle(i),c=o.getComputedStyle(l);n={left:-i.offsetLeft+(0,jt.int)(c.paddingLeft)+(0,jt.int)(u.marginLeft),top:-i.offsetTop+(0,jt.int)(c.paddingTop)+(0,jt.int)(u.marginTop),right:(0,Ks.innerWidth)(l)-(0,Ks.outerWidth)(i)-i.offsetLeft+(0,jt.int)(c.paddingRight)-(0,jt.int)(u.marginRight),bottom:(0,Ks.innerHeight)(l)-(0,Ks.outerHeight)(i)-i.offsetTop+(0,jt.int)(c.paddingBottom)-(0,jt.int)(u.marginBottom)}}return(0,jt.isNum)(n.right)&&(e=Math.min(e,n.right)),(0,jt.isNum)(n.bottom)&&(r=Math.min(r,n.bottom)),(0,jt.isNum)(n.left)&&(e=Math.max(e,n.left)),(0,jt.isNum)(n.top)&&(r=Math.max(r,n.top)),[e,r]}function qL(t,e,r){const n=Math.round(e/t[0])*t[0],i=Math.round(r/t[1])*t[1];return[n,i]}function HL(t){return t.props.axis==="both"||t.props.axis==="x"}function zL(t){return t.props.axis==="both"||t.props.axis==="y"}function WL(t,e,r){const n=typeof e=="number"?(0,Ks.getTouch)(t,e):null;if(typeof e=="number"&&!n)return null;const i=yw(r),s=r.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,Ks.offsetXYFromParent)(n||t,s,r.props.scale)}function GL(t,e,r){const n=!(0,jt.isNum)(t.lastX),i=yw(t);return n?{node:i,deltaX:0,deltaY:0,lastX:e,lastY:r,x:e,y:r}:{node:i,deltaX:e-t.lastX,deltaY:r-t.lastY,lastX:t.lastX,lastY:t.lastY,x:e,y:r}}function VL(t,e){const r=t.props.scale;return{node:e.node,x:t.state.x+e.deltaX/r,y:t.state.y+e.deltaY/r,deltaX:e.deltaX/r,deltaY:e.deltaY/r,lastX:t.state.x,lastY:t.state.y}}function QL(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}function yw(t){const e=t.findDOMNode();if(!e)throw new Error(": Unmounted during event!");return e}var Yf={},Xf={};Object.defineProperty(Xf,"__esModule",{value:!0});Xf.default=KL;function KL(){}Object.defineProperty(Yf,"__esModule",{value:!0});Yf.default=void 0;var Nm=XL(I),Ct=vw(mw),YL=vw(xv),dt=$e,Mn=rn,Dm=tn,da=vw(Xf);function vw(t){return t&&t.__esModule?t:{default:t}}function GP(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(GP=function(n){return n?r:e})(t)}function XL(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=GP(e);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&Object.prototype.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function yt(t,e,r){return e=JL(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function JL(t){var e=ZL(t,"string");return typeof e=="symbol"?e:String(e)}function ZL(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const vr={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Nn=vr.mouse,Jf=class extends Nm.Component{constructor(){super(...arguments),yt(this,"dragging",!1),yt(this,"lastX",NaN),yt(this,"lastY",NaN),yt(this,"touchIdentifier",null),yt(this,"mounted",!1),yt(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const r=this.findDOMNode();if(!r||!r.ownerDocument||!r.ownerDocument.body)throw new Error(" not mounted on DragStart!");const{ownerDocument:n}=r;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!(0,dt.matchesSelectorAndParentsTo)(e.target,this.props.handle,r)||this.props.cancel&&(0,dt.matchesSelectorAndParentsTo)(e.target,this.props.cancel,r))return;e.type==="touchstart"&&e.preventDefault();const i=(0,dt.getTouchIdentifier)(e);this.touchIdentifier=i;const s=(0,Mn.getControlPosition)(e,i,this);if(s==null)return;const{x:o,y:a}=s,l=(0,Mn.createCoreData)(this,o,a);(0,da.default)("DraggableCore: handleDragStart: %j",l),(0,da.default)("calling",this.props.onStart),!(this.props.onStart(e,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,dt.addUserSelectStyles)(n),this.dragging=!0,this.lastX=o,this.lastY=a,(0,dt.addEvent)(n,Nn.move,this.handleDrag),(0,dt.addEvent)(n,Nn.stop,this.handleDragStop))}),yt(this,"handleDrag",e=>{const r=(0,Mn.getControlPosition)(e,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let a=n-this.lastX,l=i-this.lastY;if([a,l]=(0,Mn.snapToGrid)(this.props.grid,a,l),!a&&!l)return;n=this.lastX+a,i=this.lastY+l}const s=(0,Mn.createCoreData)(this,n,i);if((0,da.default)("DraggableCore: handleDrag: %j",s),this.props.onDrag(e,s)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=n,this.lastY=i}),yt(this,"handleDragStop",e=>{if(!this.dragging)return;const r=(0,Mn.getControlPosition)(e,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let l=n-this.lastX||0,u=i-this.lastY||0;[l,u]=(0,Mn.snapToGrid)(this.props.grid,l,u),n=this.lastX+l,i=this.lastY+u}const s=(0,Mn.createCoreData)(this,n,i);if(this.props.onStop(e,s)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,dt.removeUserSelectStyles)(a.ownerDocument),(0,da.default)("DraggableCore: handleDragStop: %j",s),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,da.default)("DraggableCore: Removing handlers"),(0,dt.removeEvent)(a.ownerDocument,Nn.move,this.handleDrag),(0,dt.removeEvent)(a.ownerDocument,Nn.stop,this.handleDragStop))}),yt(this,"onMouseDown",e=>(Nn=vr.mouse,this.handleDragStart(e))),yt(this,"onMouseUp",e=>(Nn=vr.mouse,this.handleDragStop(e))),yt(this,"onTouchStart",e=>(Nn=vr.touch,this.handleDragStart(e))),yt(this,"onTouchEnd",e=>(Nn=vr.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,dt.addEvent)(e,vr.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:r}=e;(0,dt.removeEvent)(r,vr.mouse.move,this.handleDrag),(0,dt.removeEvent)(r,vr.touch.move,this.handleDrag),(0,dt.removeEvent)(r,vr.mouse.stop,this.handleDragStop),(0,dt.removeEvent)(r,vr.touch.stop,this.handleDragStop),(0,dt.removeEvent)(e,vr.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,dt.removeUserSelectStyles)(r)}}findDOMNode(){var e,r;return(e=this.props)!==null&&e!==void 0&&e.nodeRef?(r=this.props)===null||r===void 0||(r=r.nodeRef)===null||r===void 0?void 0:r.current:YL.default.findDOMNode(this)}render(){return Nm.cloneElement(Nm.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Yf.default=Jf;yt(Jf,"displayName","DraggableCore");yt(Jf,"propTypes",{allowAnyClick:Ct.default.bool,children:Ct.default.node.isRequired,disabled:Ct.default.bool,enableUserSelectHack:Ct.default.bool,offsetParent:function(t,e){if(t[e]&&t[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ct.default.arrayOf(Ct.default.number),handle:Ct.default.string,cancel:Ct.default.string,nodeRef:Ct.default.object,onStart:Ct.default.func,onDrag:Ct.default.func,onStop:Ct.default.func,onMouseDown:Ct.default.func,scale:Ct.default.number,className:Dm.dontSetMe,style:Dm.dontSetMe,transform:Dm.dontSetMe});yt(Jf,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),t.default=void 0;var e=d(I),r=c(mw),n=c(xv),i=c(vL),s=$e,o=rn,a=tn,l=c(Yf),u=c(Xf);function c(m){return m&&m.__esModule?m:{default:m}}function f(m){if(typeof WeakMap!="function")return null;var g=new WeakMap,x=new WeakMap;return(f=function(S){return S?x:g})(m)}function d(m,g){if(!g&&m&&m.__esModule)return m;if(m===null||typeof m!="object"&&typeof m!="function")return{default:m};var x=f(g);if(x&&x.has(m))return x.get(m);var S={},k=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var R in m)if(R!=="default"&&Object.prototype.hasOwnProperty.call(m,R)){var O=k?Object.getOwnPropertyDescriptor(m,R):null;O&&(O.get||O.set)?Object.defineProperty(S,R,O):S[R]=m[R]}return S.default=m,x&&x.set(m,S),S}function y(){return y=Object.assign?Object.assign.bind():function(m){for(var g=1;g{if((0,u.default)("Draggable: onDragStart: %j",S),this.props.onStart(x,(0,o.createDraggableData)(this,S))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),v(this,"onDrag",(x,S)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",S);const k=(0,o.createDraggableData)(this,S),R={x:k.x,y:k.y,slackX:0,slackY:0};if(this.props.bounds){const{x:$,y:G}=R;R.x+=this.state.slackX,R.y+=this.state.slackY;const[ee,fe]=(0,o.getBoundPosition)(this,R.x,R.y);R.x=ee,R.y=fe,R.slackX=this.state.slackX+($-R.x),R.slackY=this.state.slackY+(G-R.y),k.x=R.x,k.y=R.y,k.deltaX=R.x-this.state.x,k.deltaY=R.y-this.state.y}if(this.props.onDrag(x,k)===!1)return!1;this.setState(R)}),v(this,"onDragStop",(x,S)=>{if(!this.state.dragging||this.props.onStop(x,(0,o.createDraggableData)(this,S))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",S);const R={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:$,y:G}=this.props.position;R.x=$,R.y=G}this.setState(R)}),this.state={dragging:!1,dragged:!1,x:g.position?g.position.x:g.defaultPosition.x,y:g.position?g.position.y:g.defaultPosition.y,prevPropsPosition:{...g.position},slackX:0,slackY:0,isElementSVG:!1},g.position&&!(g.onDrag||g.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var g,x;return(g=(x=this.props)===null||x===void 0||(x=x.nodeRef)===null||x===void 0?void 0:x.current)!==null&&g!==void 0?g:n.default.findDOMNode(this)}render(){const{axis:g,bounds:x,children:S,defaultPosition:k,defaultClassName:R,defaultClassNameDragging:O,defaultClassNameDragged:$,position:G,positionOffset:ee,scale:fe,...he}=this.props;let P={},j=null;const le=!!!G||this.state.dragging,B=G||k,H={x:(0,o.canDragX)(this)&&le?this.state.x:B.x,y:(0,o.canDragY)(this)&&le?this.state.y:B.y};this.state.isElementSVG?j=(0,s.createSVGTransform)(H,ee):P=(0,s.createCSSTransform)(H,ee);const Y=(0,i.default)(S.props.className||"",R,{[O]:this.state.dragging,[$]:this.state.dragged});return e.createElement(l.default,y({},he,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(S),{className:Y,style:{...S.props.style,...P},transform:j}))}}t.default=p,v(p,"displayName","Draggable"),v(p,"propTypes",{...l.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),v(p,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(DP);const{default:VP,DraggableCore:eB}=DP;Kf.exports=VP;Kf.exports.default=VP;Kf.exports.DraggableCore=eB;var tB=Kf.exports;const rB=yn(tB);function Qy(){return Qy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function iB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var ww=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=nB(t,["color","size"]);return q.createElement("svg",Qy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),q.createElement("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),q.createElement("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"}))});ww.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};ww.displayName="AlertTriangle";const sB=ww;function Ky(){return Ky=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function aB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var _w=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=oB(t,["color","size"]);return q.createElement("svg",Ky({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),q.createElement("polyline",{points:"19 12 12 19 5 12"}))});_w.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};_w.displayName="ArrowDown";const lB=_w;function Yy(){return Yy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function cB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var bw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=uB(t,["color","size"]);return q.createElement("svg",Yy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),q.createElement("polyline",{points:"5 12 12 5 19 12"}))});bw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};bw.displayName="ArrowUp";const dB=bw;function Xy(){return Xy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function hB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var xw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=fB(t,["color","size"]);return q.createElement("svg",Xy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polyline",{points:"20 6 9 17 4 12"}))});xw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};xw.displayName="Check";const pB=xw;function Jy(){return Jy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Sw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=mB(t,["color","size"]);return q.createElement("svg",Jy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polyline",{points:"9 18 15 12 9 6"}))});Sw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Sw.displayName="ChevronRight";const QP=Sw;function Zy(){return Zy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function vB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Cw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=yB(t,["color","size"]);return q.createElement("svg",Zy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polyline",{points:"13 17 18 12 13 7"}),q.createElement("polyline",{points:"6 17 11 12 6 7"}))});Cw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Cw.displayName="ChevronsRight";const wB=Cw;function e0(){return e0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function bB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Ew=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=_B(t,["color","size"]);return q.createElement("svg",e0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),q.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}))});Ew.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Ew.displayName="Copy";const xB=Ew;function t0(){return t0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function CB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Tw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=SB(t,["color","size"]);return q.createElement("svg",t0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),q.createElement("polyline",{points:"7 10 12 15 17 10"}),q.createElement("line",{x1:"12",y1:"15",x2:"12",y2:"3"}))});Tw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Tw.displayName="Download";const EB=Tw;function r0(){return r0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function kB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var kw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=TB(t,["color","size"]);return q.createElement("svg",r0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z"}))});kw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};kw.displayName="Droplet";const PB=kw;function n0(){return n0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function IB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Pw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=AB(t,["color","size"]);return q.createElement("svg",n0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),q.createElement("polyline",{points:"14 2 14 8 20 8"}),q.createElement("line",{x1:"9",y1:"15",x2:"15",y2:"15"}))});Pw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Pw.displayName="FileMinus";const OB=Pw;function i0(){return i0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function MB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Aw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=RB(t,["color","size"]);return q.createElement("svg",i0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),q.createElement("polyline",{points:"14 2 14 8 20 8"}),q.createElement("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),q.createElement("line",{x1:"9",y1:"15",x2:"15",y2:"15"}))});Aw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Aw.displayName="FilePlus";const NB=Aw;function s0(){return s0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function jB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Iw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=DB(t,["color","size"]);return q.createElement("svg",s0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),q.createElement("polyline",{points:"14 2 14 8 20 8"}),q.createElement("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),q.createElement("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),q.createElement("polyline",{points:"10 9 9 9 8 9"}))});Iw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Iw.displayName="FileText";const LB=Iw;function o0(){return o0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function $B(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Ow=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=BB(t,["color","size"]);return q.createElement("svg",o0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),q.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),q.createElement("rect",{x:"14",y:"14",width:"7",height:"7"}),q.createElement("rect",{x:"3",y:"14",width:"7",height:"7"}))});Ow.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Ow.displayName="Grid";const Rw=Ow;function a0(){return a0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function FB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Mw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=UB(t,["color","size"]);return q.createElement("svg",a0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),q.createElement("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),q.createElement("polyline",{points:"21 15 16 10 5 21"}))});Mw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Mw.displayName="Image";const qB=Mw;function l0(){return l0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function zB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Nw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=HB(t,["color","size"]);return q.createElement("svg",l0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M9 18V5l12-2v13"}),q.createElement("circle",{cx:"6",cy:"18",r:"3"}),q.createElement("circle",{cx:"18",cy:"16",r:"3"}))});Nw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Nw.displayName="Music";const WB=Nw;function u0(){return u0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function VB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Dw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=GB(t,["color","size"]);return q.createElement("svg",u0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polygon",{points:"5 3 19 12 5 21 5 3"}))});Dw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Dw.displayName="Play";const KP=Dw;function c0(){return c0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function KB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var jw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=QB(t,["color","size"]);return q.createElement("svg",c0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("circle",{cx:"12",cy:"12",r:"3"}),q.createElement("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"}))});jw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};jw.displayName="Settings";const YB=jw;function d0(){return d0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function JB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Lw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=XB(t,["color","size"]);return q.createElement("svg",d0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"}))});Lw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Lw.displayName="Tool";const ZB=Lw;function f0(){return f0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function t$(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Bw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=e$(t,["color","size"]);return q.createElement("svg",f0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polygon",{points:"23 7 16 12 23 17 23 7"}),q.createElement("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"}))});Bw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Bw.displayName="Video";const r$=Bw;function h0(){return h0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function i$(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var $w=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=n$(t,["color","size"]);return q.createElement("svg",h0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))});$w.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};$w.displayName="X";const Yo=$w;function s$({id:t,title:e,children:r,header:n,footer:i,className:s,initialMousePosition:o,icon:a}){const{closeWindow:l,sendWindowToTop:u}=cu(),c=I.useRef(null),f=I.useRef(null),d=o?{x:Math.floor(Math.min(o.x+20,window.innerWidth*.5)),y:Math.floor(Math.min(o.y-100,window.innerHeight*.2))}:{x:40,y:40};function y(){l(t)}function v(){var w;const b=(w=f.current)==null?void 0:w.scrollTop;u(t),setTimeout(()=>{var p;b&&((p=f.current)==null||p.scrollTo(0,b))},0)}return _.jsx(rB,{handle:".draggable-handle",cancel:".draggable-cancel",defaultPosition:d,nodeRef:c,onStart:v,bounds:"parent",children:_.jsxs("div",{id:t,ref:c,onClick:v,className:ie("slime2-window-shadow pointer-events-auto !fixed z-[999] flex max-h-[80%] min-h-[100px] min-w-[350px] max-w-[90%] flex-col overflow-hidden rounded-md border-2 border-emerald-800 bg-lime-100 font-fredoka text-sm opacity-90 last:opacity-100 only:opacity-100 hover:opacity-100",s),children:[_.jsx(o$,{icon:a,close:o?y:void 0,children:e}),n,_.jsx(a$,{ref:f,children:r}),i]})})}function o$({icon:t,children:e,close:r}){return _.jsxs("div",{className:"title-shadow-i pointer-events-none flex divide-x divide-emerald-800 rounded-t-sm",children:[_.jsx("div",{className:"draggable-handle pointer-events-auto flex-1 cursor-move items-center gap-2 rounded-tl-sm bg-gradient-to-b from-lime-600 to-emerald-700 py-1 pl-[8px] pr-1 text-lime-100",children:_.jsxs("p",{className:"-mt-0.5 font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:[t&&_.jsx(t,{className:"-mt-0.5 mr-1 inline drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",size:24}),e]})}),r&&_.jsx("button",{className:"draggable-cancel pointer-events-auto flex items-center justify-center border-l border-l-emerald-800 bg-gradient-to-b from-lime-600 to-emerald-700 px-[8px] py-px text-white hover:from-rose-600 hover:to-red-900 focus:from-rose-600 focus:to-red-900 focus:outline-none",onClick:n=>{r(),n.stopPropagation()},children:_.jsx(Yo,{size:24,strokeWidth:3,className:"drop-shadow drop-shadow-c-black/75 drop-shadow-y-px"})})]})}const a$=I.forwardRef(function(e,r){return _.jsx("div",{...e,className:ie("draggable-cancel m-1 flex-1 overflow-auto font-radiocanada scrollbar-thin scrollbar-track-emerald-800/25 scrollbar-thumb-emerald-800 scrollbar-track-rounded-full scrollbar-thumb-rounded-full hover:scrollbar-thumb-emerald-700 active:scrollbar-thumb-emerald-600",e.className),ref:r})});function l$(){const[t,e]=I.useState(),r=uL();return I.useEffect(()=>{let n;function i(){clearTimeout(n),e(!1)}function s(){clearTimeout(n),n=setTimeout(()=>{e(!0)},1e3)}return document.addEventListener("mousemove",i),document.addEventListener("mouseleave",s),()=>{clearTimeout(n),document.removeEventListener("mousemove",i),document.removeEventListener("mouseleave",s)}},[]),t===void 0?null:_.jsx("div",{id:"slime2-windows",className:ie(t?"slime2-window-exit":"slime2-window-enter","pointer-events-none absolute left-0 top-0 z-[9999] h-screen w-screen p-2"),children:r.map(n=>I.createElement(s$,{...n,key:n.id}))})}function u$({children:t}){const[e,r]=I.useReducer(tR,W5);return _.jsx(G5.Provider,{value:e,children:_.jsx(V5.Provider,{value:r,children:t})})}function c$({children:t}){const[e,r]=I.useReducer(D4,EE);return _.jsx(TE.Provider,{value:e,children:_.jsx(kE.Provider,{value:r,children:t})})}function d$({children:t}){const[e,r]=I.useReducer(N4,bE);return _.jsx(xE.Provider,{value:e,children:_.jsx(SE.Provider,{value:r,children:t})})}function f$({children:t}){const[e,r]=I.useState(!1);return _.jsx(F5.Provider,{value:{unsavedChanges:e,setUnsavedChanges:r},children:t})}function h$({children:t}){const[e,r]=I.useReducer(XO,q5);return _.jsx(H5.Provider,{value:e,children:_.jsx(z5.Provider,{value:r,children:t})})}function p$(){const{addEvent:t}=Iv(),{data:e}=Qf(),{data:r}=IP(),{data:n}=Vf(),{data:i}=fw(),{data:s}=hw(),{isPlatformReady:o}=Tf(),a=AP();async function l(){if(!o("twitch"))return;const u=Array.from(s.values()),c=[...r,...Array.from(e.values())],f=new Date,d=qe.chance(5),y="test message",v=`long test message${" long test message".repeat(5)}`,b="LongTestMessage".repeat(7);let w=y;qe.chance(5)&&(w=v),qe.chance(5)&&(w=b),w=`${w}${qe.item(_$)}`;let p=w;d&&(w=`${w} (first time chat)`);const m=[],g={id:`test-user-${f.getTime()}`,userName:"testuser",displayName:"testUser",pronouns:qe.boolean()?null:qe.item(u),badges:[],color:await a("testuser"),roles:{broadcaster:!1,moderator:!1,artist:!1,vip:!1,founder:!1,subscriber:!1},followDate:new Date(0)},x=qe.boolean()?"user":qe.item(m$),S=i.get(x==="artist"?"artist-badge":x);x!=="user"&&S&&(g.badges=[S],g.roles[x]=!0,(x==="founder"||x==="broadcaster")&&(g.roles.subscriber=!0),g.userName=`test${x}`,g.displayName=`test${x.charAt(0).toUpperCase()}${x.slice(1)}`,g.color=await a(g.userName));let k={type:"basic"};if(qe.boolean()){const O=qe.item(g$);switch(O){case"action":w=`${w} (/me action message)`,p=w,k={type:O};break;case"highlight":w=`${w} (highlighted message)`,p=w,k={type:O};break;case"cheer":{const $=qe.item(w$),G="Cheer";k={type:O,cheer:{amount:$}};const ee=`${G}${$}`;p=`${w} (cheer message)`,w=`${ee} ${p}`,m.unshift({type:"text",text:" "}),m.unshift({type:"cheer",text:ee,cheer:n.get(G,$)})}break;case"reply":k={type:O,reply:{id:`test-reply-${f.getTime()}`,text:"test message being replied to",user:{id:`test-user-reply-${f.getTime()}`,userName:"testreplyuser",displayName:"testReplyUser"}}},w=`${w} (reply message)`,p=w;break;case"redeem":k={type:O,redeem:{id:`test-redeem-${f.getTime()}`,name:"Test Redeem",image:"https://static-cdn.jtvnw.net/custom-reward-images/default-4.png",color:"#FFC6FF",cost:qe.integer(1,1e4)}},w=`${w} (channel point redemption requiring text)`,p=w;break;case"resub":k={type:O,resub:{months:qe.integer(1,24),tier:qe.item(y$)}},w=`${w} (resub message)`,p=w;break;case"announcement":(x==="broadcaster"||x==="moderator")&&(k={type:O,announcement:{color:qe.item(v$)}},w=`${w} (announcement message)`,p=w);break}}if(qe.boolean()&&c.length){const O=qe.item(c);m.unshift({type:"text",text:" "}),m.unshift({type:"emote",emote:O,text:O.name}),w=`${O.name} ${w}`}k.type==="basic"&&qe.chance(20)&&(w="hi",p=w),m.push({type:"text",text:p});const R={...k,id:`test-message-${f.getTime()}`,first:d,date:f,user:g,text:w,parts:m,tags:new Map([["test","1"]])};t({type:"message",id:R.id,userId:R.user.id,message:R,source:"twitch",emulated:!0})}return l}const m$=["broadcaster","moderator","artist","vip","founder","subscriber"],g$=["action","highlight","cheer","reply","redeem","resub","announcement"],y$=["1000","2000","3000","Prime"],v$=["PRIMARY","BLUE","GREEN","ORANGE","PURPLE"],w$=[1,5,10,50,100,500,1e3,5e3,1e4],_$=["",".","...","!","?","!!","!?","?!"];function bn(t){return _.jsx("button",{...t,type:"button",className:ie("btn-shadow-i flex items-center gap-2 rounded-md border-2 border-emerald-800 bg-gradient-to-b from-lime-600 to-emerald-700 px-3 py-1 text-center hover:from-lime-400 hover:to-emerald-600 focus:from-lime-400 focus:to-emerald-600 focus:outline-none active:from-lime-400/90 active:to-emerald-600/90",t.className)})}function xn(t){return _.jsx("span",{...t,className:ie("font-display font-semibold text-lime-100 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",t.className)})}function Jr(t){return _.jsx("span",{...t,className:ie("-mb-px font-grandstander text-base font-semibold text-lime-100 text-shadow text-shadow-c-black/75 text-shadow-y-px",t.className)})}function b$(){const t=p$(),{isPlatformReady:e}=Tf(),r=e("twitch");return r?_.jsxs(bn,{onClick:t,className:"justify-center",disabled:!r,children:[_.jsx(xn,{children:_.jsx(KP,{strokeWidth:3,size:24,className:"-mt-0.5"})}),_.jsx(Jr,{children:"Send Test Message"})]}):_.jsx("div",{className:"flex items-center justify-center",children:_.jsx("p",{children:"Loading Twitch Tools..."})})}function YP(){const{setUnsavedChanges:t}=bf(),e=Ev(),{widgetDataFileName:r}=wn(),{closeWindow:n}=cu(),[i,s]=I.useState(!1);function o(){s(!0),setTimeout(()=>{t(!1)},2e3),n("slime2window.unsavedChanges");const a=`slime2.widget.setData(${JSON.stringify(e,null,2)})`,l=new Blob([a],{type:"text/javascript"}),u=document.createElement("a");u.href=URL.createObjectURL(l),u.download=r,u.style.display="none",document.body.appendChild(u),u.click(),document.body.removeChild(u)}return _.jsx(bn,{onClick:o,className:"w-full justify-center outline outline-2 outline-lime-100 focus:outline focus:outline-2 focus:outline-offset-0 focus:outline-lime-100",disabled:i,children:i?_.jsx(Jr,{children:"Saved!"}):_.jsxs(_.Fragment,{children:[_.jsx(Jr,{children:"Save Widget Data"}),_.jsx(xn,{children:_.jsx(EB,{strokeWidth:3,size:28})})]})})}function XP(){return I.useContext(JP)}const JP=I.createContext([]);function it(){var c;const t=I.useContext(ZP),e=XP(),r=Ev(),{update:n}=xf(),s=`${e.reduce((f,{id:d,index:y})=>`${f}.${d}${y===void 0?"":`[${y}]`}`,"slime2widget")}.${t==null?void 0:t.id}`,o=t&&"description"in t&&t.description?`${s}.description`:void 0;let a=null;t&&(a=(c=Ri(r,e))==null?void 0:c[t.id]);const l=a===null||typeof a=="boolean"||typeof a=="string"||typeof a=="number"||Array.isArray(a)?a:null;function u(f){t&&n(e,t.id,f)}return{setting:t,idString:s,descriptionIdString:o,value:l,setValue:u,groupId:e}}const ZP=I.createContext(null);function Zf({value:t,children:e}){return _.jsx(ZP.Provider,{value:t,children:e})}function Uw(t){return _.jsx("div",{...t,className:ie("slime2-group-shadow overflow-hidden rounded border-2 border-emerald-800 bg-green-700 focus-within:border-emerald-600 focus-within:bg-emerald-600 focus-within:ring-2 focus-within:ring-emerald-600",t.className)})}const x$="aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",S$="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5تصالات6رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",ps=(t,e)=>{for(const r in e)t[r]=e[r];return t},p0="numeric",m0="ascii",g0="alpha",bc="asciinumeric",Qu="alphanumeric",y0="domain",eA="emoji",C$="scheme",E$="slashscheme",$x="whitespace";function T$(t,e){return t in e||(e[t]=[]),e[t]}function Fi(t,e,r){e[p0]&&(e[bc]=!0,e[Qu]=!0),e[m0]&&(e[bc]=!0,e[g0]=!0),e[bc]&&(e[Qu]=!0),e[g0]&&(e[Qu]=!0),e[Qu]&&(e[y0]=!0),e[eA]&&(e[y0]=!0);for(const n in e){const i=T$(n,r);i.indexOf(t)<0&&i.push(t)}}function k$(t,e){const r={};for(const n in e)e[n].indexOf(t)>=0&&(r[n]=!0);return r}function Ut(t){t===void 0&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}Ut.groups={};Ut.prototype={accepts(){return!!this.t},go(t){const e=this,r=e.j[t];if(r)return r;for(let n=0;nt.ta(e,r,n,i),Qt=(t,e,r,n,i)=>t.tr(e,r,n,i),Ux=(t,e,r,n,i)=>t.ts(e,r,n,i),F=(t,e,r,n,i)=>t.tt(e,r,n,i),sn="WORD",v0="UWORD",jl="LOCALHOST",w0="TLD",_0="UTLD",xc="SCHEME",Ns="SLASH_SCHEME",Fw="NUM",tA="WS",qw="NL",Ys="OPENBRACE",Da="OPENBRACKET",ja="OPENANGLEBRACKET",La="OPENPAREN",Mi="CLOSEBRACE",Xs="CLOSEBRACKET",Js="CLOSEANGLEBRACKET",Ni="CLOSEPAREN",$d="AMPERSAND",Ud="APOSTROPHE",Fd="ASTERISK",$n="AT",qd="BACKSLASH",Hd="BACKTICK",zd="CARET",zn="COLON",Hw="COMMA",Wd="DOLLAR",Lr="DOT",Gd="EQUALS",zw="EXCLAMATION",Br="HYPHEN",Vd="PERCENT",Qd="PIPE",Kd="PLUS",Yd="POUND",Xd="QUERY",Ww="QUOTE",Gw="SEMI",$r="SLASH",Ba="TILDE",Jd="UNDERSCORE",rA="EMOJI",Zd="SYM";var nA=Object.freeze({__proto__:null,WORD:sn,UWORD:v0,LOCALHOST:jl,TLD:w0,UTLD:_0,SCHEME:xc,SLASH_SCHEME:Ns,NUM:Fw,WS:tA,NL:qw,OPENBRACE:Ys,OPENBRACKET:Da,OPENANGLEBRACKET:ja,OPENPAREN:La,CLOSEBRACE:Mi,CLOSEBRACKET:Xs,CLOSEANGLEBRACKET:Js,CLOSEPAREN:Ni,AMPERSAND:$d,APOSTROPHE:Ud,ASTERISK:Fd,AT:$n,BACKSLASH:qd,BACKTICK:Hd,CARET:zd,COLON:zn,COMMA:Hw,DOLLAR:Wd,DOT:Lr,EQUALS:Gd,EXCLAMATION:zw,HYPHEN:Br,PERCENT:Vd,PIPE:Qd,PLUS:Kd,POUND:Yd,QUERY:Xd,QUOTE:Ww,SEMI:Gw,SLASH:$r,TILDE:Ba,UNDERSCORE:Jd,EMOJI:rA,SYM:Zd});const As=/[a-z]/,jm=/\p{L}/u,Lm=/\p{Emoji}/u,Bm=/\d/,Fx=/\s/,qx=` -`,P$="️",A$="‍";let Ku=null,Yu=null;function I$(t){t===void 0&&(t=[]);const e={};Ut.groups=e;const r=new Ut;Ku==null&&(Ku=Hx(x$)),Yu==null&&(Yu=Hx(S$)),F(r,"'",Ud),F(r,"{",Ys),F(r,"[",Da),F(r,"<",ja),F(r,"(",La),F(r,"}",Mi),F(r,"]",Xs),F(r,">",Js),F(r,")",Ni),F(r,"&",$d),F(r,"*",Fd),F(r,"@",$n),F(r,"`",Hd),F(r,"^",zd),F(r,":",zn),F(r,",",Hw),F(r,"$",Wd),F(r,".",Lr),F(r,"=",Gd),F(r,"!",zw),F(r,"-",Br),F(r,"%",Vd),F(r,"|",Qd),F(r,"+",Kd),F(r,"#",Yd),F(r,"?",Xd),F(r,'"',Ww),F(r,"/",$r),F(r,";",Gw),F(r,"~",Ba),F(r,"_",Jd),F(r,"\\",qd);const n=Qt(r,Bm,Fw,{[p0]:!0});Qt(n,Bm,n);const i=Qt(r,As,sn,{[m0]:!0});Qt(i,As,i);const s=Qt(r,jm,v0,{[g0]:!0});Qt(s,As),Qt(s,jm,s);const o=Qt(r,Fx,tA,{[$x]:!0});F(r,qx,qw,{[$x]:!0}),F(o,qx),Qt(o,Fx,o);const a=Qt(r,Lm,rA,{[eA]:!0});Qt(a,Lm,a),F(a,P$,a);const l=F(a,A$);Qt(l,Lm,a);const u=[[As,i]],c=[[As,null],[jm,s]];for(let f=0;ff[0]>d[0]?1:-1);for(let f=0;f=0?v[y0]=!0:As.test(d)?Bm.test(d)?v[bc]=!0:v[m0]=!0:v[p0]=!0,Ux(r,d,d,v)}return Ux(r,"localhost",jl,{ascii:!0}),r.jd=new Ut(Zd),{start:r,tokens:ps({groups:e},nA)}}function O$(t,e){const r=R$(e.replace(/[A-Z]/g,a=>a.toLowerCase())),n=r.length,i=[];let s=0,o=0;for(;o=0&&(f+=r[o].length,d++),u+=r[o].length,s+=r[o].length,o++;s-=f,o-=d,u-=f,i.push({t:c.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}function R$(t){const e=[],r=t.length;let n=0;for(;n56319||n+1===r||(s=t.charCodeAt(n+1))<56320||s>57343?t[n]:t.slice(n,n+2);e.push(o),n+=o.length}return e}function Dn(t,e,r,n,i){let s;const o=e.length;for(let a=0;a=0;)s++;if(s>0){e.push(r.join(""));for(let o=parseInt(t.substring(n,n+s),10);o>0;o--)r.pop();n+=s}else r.push(t[n]),n++}return e}const $o={defaultProtocol:"http",events:null,format:zx,formatHref:zx,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function eh(t,e){e===void 0&&(e=null);let r=ps({},$o);t&&(r=ps(r,t instanceof eh?t.o:t));const n=r.ignoreTags,i=[];for(let s=0;sr?n.substring(0,r)+"…":n},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return t===void 0&&(t=$o.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,r=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",r,this),i=t.get("tagName",r,e),s=this.toFormattedString(t),o={},a=t.get("className",r,e),l=t.get("target",r,e),u=t.get("rel",r,e),c=t.getObj("attributes",r,e),f=t.getObj("events",r,e);return o.href=n,a&&(o.class=a),l&&(o.target=l),u&&(o.rel=u),c&&ps(o,c),{tagName:i,attributes:o,content:s,eventListeners:f}}};function th(t,e){class r extends sA{constructor(i,s){super(i,s),this.t=t}}for(const n in e)r.prototype[n]=e[n];return r.t=t,r}const Wx=th("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Gx=th("text"),M$=th("nl"),Ai=th("url",{isLink:!0,toHref(t){return t===void 0&&(t=$o.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==jl&&t[1].t===zn}}),Je=t=>new Ut(t);function N$(t){let{groups:e}=t;const r=e.domain.concat([$d,Fd,$n,qd,Hd,zd,Wd,Gd,Br,Fw,Vd,Qd,Kd,Yd,$r,Zd,Ba,Jd]),n=[Ud,Js,Mi,Xs,Ni,zn,Hw,Lr,zw,ja,Ys,Da,La,Xd,Ww,Gw],i=[$d,Ud,Fd,qd,Hd,zd,Mi,Wd,Gd,Br,Ys,Vd,Qd,Kd,Yd,Xd,$r,Zd,Ba,Jd],s=Je(),o=F(s,Ba);J(o,i,o),J(o,e.domain,o);const a=Je(),l=Je(),u=Je();J(s,e.domain,a),J(s,e.scheme,l),J(s,e.slashscheme,u),J(a,i,o),J(a,e.domain,a);const c=F(a,$n);F(o,$n,c),F(l,$n,c),F(u,$n,c);const f=F(o,Lr);J(f,i,o),J(f,e.domain,o);const d=Je();J(c,e.domain,d),J(d,e.domain,d);const y=F(d,Lr);J(y,e.domain,d);const v=Je(Wx);J(y,e.tld,v),J(y,e.utld,v),F(c,jl,v);const b=F(d,Br);J(b,e.domain,d),J(v,e.domain,d),F(v,Lr,y),F(v,Br,b);const w=F(v,zn);J(w,e.numeric,Wx);const p=F(a,Br),m=F(a,Lr);J(p,e.domain,a),J(m,i,o),J(m,e.domain,a);const g=Je(Ai);J(m,e.tld,g),J(m,e.utld,g),J(g,e.domain,a),J(g,i,o),F(g,Lr,m),F(g,Br,p),F(g,$n,c);const x=F(g,zn),S=Je(Ai);J(x,e.numeric,S);const k=Je(Ai),R=Je();J(k,r,k),J(k,n,R),J(R,r,k),J(R,n,R),F(g,$r,k),F(S,$r,k);const O=F(l,zn),$=F(u,zn),G=F($,$r),ee=F(G,$r);J(l,e.domain,a),F(l,Lr,m),F(l,Br,p),J(u,e.domain,a),F(u,Lr,m),F(u,Br,p),J(O,e.domain,k),F(O,$r,k),J(ee,e.domain,k),J(ee,r,k),F(ee,$r,k);const fe=F(k,Ys),he=F(k,Da),P=F(k,ja),j=F(k,La);F(R,Ys,fe),F(R,Da,he),F(R,ja,P),F(R,La,j),F(fe,Mi,k),F(he,Xs,k),F(P,Js,k),F(j,Ni,k),F(fe,Mi,k);const Q=Je(Ai),le=Je(Ai),B=Je(Ai),H=Je(Ai);J(fe,r,Q),J(he,r,le),J(P,r,B),J(j,r,H);const Y=Je(),se=Je(),ye=Je(),Mt=Je();return J(fe,n),J(he,n),J(P,n),J(j,n),J(Q,r,Q),J(le,r,le),J(B,r,B),J(H,r,H),J(Q,n,Q),J(le,n,le),J(B,n,B),J(H,n,H),J(Y,r,Y),J(se,r,le),J(ye,r,B),J(Mt,r,H),J(Y,n,Y),J(se,n,se),J(ye,n,ye),J(Mt,n,Mt),F(le,Xs,k),F(B,Js,k),F(H,Ni,k),F(Q,Mi,k),F(se,Xs,k),F(ye,Js,k),F(Mt,Ni,k),F(Y,Ni,k),F(s,jl,g),F(s,qw,M$),{start:s,tokens:nA}}function D$(t,e,r){let n=r.length,i=0,s=[],o=[];for(;i=0&&d++,i++,c++;if(d<0)i-=c,i0&&(s.push($m(Gx,e,o)),o=[]),i-=d,c-=d;const y=f.t,v=r.slice(i-c,i);s.push($m(y,e,v))}}return o.length>0&&s.push($m(Gx,e,o)),s}function $m(t,e,r){const n=r[0].s,i=r[r.length-1].e,s=e.slice(n,i);return new t(s,r)}const vt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function j$(){vt.scanner=I$(vt.customSchemes);for(let t=0;t{typeof o=="string"?n.push.apply(n,B$(o,e,r)):I.isValidElement(o)?typeof o.type=="string"&&e.ignoreTags.indexOf(o.type.toUpperCase())>=0?n.push(o):n.push(oA(o,e,r)):n.push(o)});const i=`__linkify-el-${r.elementId++}`,s=iA.assign({key:i},t.props);return I.cloneElement(t,s,n)}const $$=t=>{let e=0;const r=l=>{let{tagName:u,attributes:c,content:f}=l;return c.key=`__linkify-lnk-${e++}`,c.class&&(c.className=c.class,delete c.class),I.createElement(u,c,f)},n={key:"__linkify-wrapper"};for(const l in t)l!=="options"&&l!=="as"&&l!=="tagName"&&l!=="children"&&(n[l]=t[l]);const i=new eh(t.options,r),s=t.as||t.tagName||I.Fragment||"span",o=t.children,a=I.createElement(s,n,o);return oA(a,i,{elementId:0})};function aA(t){const{linkClassName:e,...r}=t;return _.jsx($$,{...r,className:ie("break-words",t.className),as:"p",options:{target:"_blank",className:ie("inline rounded-[2px] underline outline-none focus:border-none focus:ring-2",e),nl2br:!0}})}function Vw(t){if(t.children)return _.jsx(aA,{...t,className:ie("border-t border-emerald-800 bg-emerald-50 px-2 py-0.5 text-xs text-emerald-700",t.className),linkClassName:"text-emerald-500 focus:ring-emerald-500 focus:ring-offset-2 focus:ring-offset-white"})}function lA(t){return t.children?_.jsx("label",{...t,className:ie("-mt-0.5 block w-full px-2 py-0.5 font-medium text-white text-shadow text-shadow-c-black/75 text-shadow-y-px",t.className)}):null}function Ir({children:t}){const{setting:e,idString:r,descriptionIdString:n}=it();if(!e)return null;switch(e.type){case"text-input":case"number-input":case"boolean-input":case"font-input":case"color-input":case"select-input":case"dropdown-input":case"image-input":case"video-input":case"audio-input":return _.jsxs(Uw,{children:[_.jsx(lA,{htmlFor:r,children:e.label}),t,_.jsx(Vw,{id:n,children:e.description})]});default:return null}}function U$(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it(),s=I.useRef(null);if(!t||t.type!=="audio-input")return null;function o(d){if(!(!t||!d))if("multiple"in t&&t.multiple){const y=Array.isArray(n)?n:[],v=d.filter(b=>!y.includes(b));v.length&&i([...y,...v])}else i(d[0])}function a(d){if(!(!t||!d))if("multiple"in t&&t.multiple){const y=Array.isArray(n)?n:[];i(y.filter(v=>v!==d))}else i(null)}function l(d){const{files:y}=d.target;if(!y||!y.length)return;const v=[];for(const b of y)v.push(`assets/${b.name}`);o(v),d.target.value=""}function u(){return t?"multiple"in t&&t.multiple?(Array.isArray(n)?n:[]).map(y=>_.jsx(Vx,{src:y,onRemove:a},y)):typeof f!="string"?null:[f].map(d=>_.jsx(Vx,{src:d,onRemove:a},d)):null}function c(){var d;(d=s.current)==null||d.click()}const f="multiple"in t&&t.multiple?Array.isArray(n)?n:[]:typeof n=="string"?n:null;return _.jsx(Ir,{children:_.jsxs("div",{className:"bg-white",children:[_.jsx("div",{className:"border-b border-emerald-800 p-2",children:_.jsxs(bn,{className:"w-full justify-center !px-1 !py-3",onClick:c,children:[_.jsx(Jr,{className:"text-xs",children:`Choose ${Array.isArray(n)?"Sounds":"a Sound"} from the Widget Assets Folder`}),_.jsx(xn,{children:Array.isArray(n)?_.jsx(Rw,{size:22,strokeWidth:2.5,className:"-mt-0.5"}):_.jsx(WB,{size:22,strokeWidth:2.5,className:"-mt-0.5"})})]})}),_.jsx("input",{className:"hidden",id:`${e}.chooseFile`,type:"file",multiple:"multiple"in t&&t.multiple,accept:"audio/*",onChange:l,ref:s,"aria-describedby":r}),(Array.isArray(n)&&n.length||typeof n=="string")&&_.jsx("div",{className:ie("grid grid-cols-1 gap-2 border-t border-emerald-800 bg-white p-2"),children:u()})]})})}function Vx({onRemove:t,...e}){var r;return _.jsxs("div",{className:"slime2-group-shadow overflow-hidden rounded border-2 border-emerald-800",children:[_.jsxs("div",{className:"title-shadow-i pointer-events-none flex rounded-t-sm font-fredoka text-white",children:[_.jsx("p",{className:"-mt-0.5 flex-1 overflow-hidden text-ellipsis whitespace-nowrap bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-0.5 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:(r=e.src)==null?void 0:r.split("/").pop()}),_.jsx("button",{className:"pointer-events-auto rounded-tr-sm bg-rose-700 p-0.5 text-white hover:bg-rose-500 focus:bg-rose-500 focus:outline-none",onClick:()=>t(e.src),children:_.jsx(Yo,{className:"drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",size:20,strokeWidth:3})})]}),_.jsx("div",{className:"flex max-h-32 flex-col items-center justify-center bg-white",children:_.jsx(F$,{...e})})]})}function F$(t){const[e,r]=I.useState(!1);return e?_.jsx("div",{className:"flex items-center justify-center p-1 pr-3",children:_.jsx("p",{className:"text-xs font-bold",children:"Sound not found in assets folder!"})}):_.jsx("audio",{controls:!0,className:"w-full rounded-none",...t,onError:()=>r(!0),onLoad:()=>r(!1)})}function q$(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="boolean-input")return null;function s(o){i(o.target.checked)}return _.jsxs(Uw,{className:ie(!n&&"border-slate-700 bg-slate-300 focus-within:border-slate-400 focus-within:bg-slate-300 focus-within:ring-slate-400"),children:[_.jsxs(lA,{htmlFor:e,className:ie("flex items-center justify-between py-1 pr-1"),children:[_.jsx("span",{className:ie("flex-1 pr-2",!n&&"text-shadow-none text-slate-600"),children:t.label}),_.jsx("input",{id:e,name:e,className:"appearance-none",type:"checkbox",onChange:s,checked:!!n,"aria-describedby":r}),_.jsx("div",{className:ie("mt-0.5 flex items-center justify-center rounded-sm bg-white px-px",!n&&"bg-slate-100"),children:n?_.jsx(pB,{size:30,strokeWidth:3,className:"text-emerald-600"}):_.jsx(Yo,{size:30,strokeWidth:3,className:"text-slate-300"})})]}),_.jsx(Vw,{className:ie(!n&&"border-slate-400 bg-slate-100 text-slate-600"),id:r,children:t.description})]})}function Qw({groupId:t=[],children:e}){return _.jsx(JP.Provider,{value:t,children:e})}function rh(){return(rh=Object.assign||function(t){for(var e=1;e=0||(i[r]=t[r]);return i}function b0(t){var e=I.useRef(t),r=I.useRef(function(n){e.current&&e.current(n)});return e.current=t,r.current}var Uo=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t0:w.buttons>0)&&i.current?s(Qx(i.current,w,a.current)):b(!1)},v=function(){return b(!1)};function b(w){var p=l.current,m=x0(i.current),g=w?m.addEventListener:m.removeEventListener;g(p?"touchmove":"mousemove",y),g(p?"touchend":"mouseup",v)}return[function(w){var p=w.nativeEvent,m=i.current;if(m&&(Kx(p),!function(x,S){return S&&!$a(x)}(p,l.current)&&m)){if($a(p)){l.current=!0;var g=p.changedTouches||[];g.length&&(a.current=g[0].identifier)}m.focus(),s(Qx(m,p,a.current)),b(!0)}},function(w){var p=w.which||w.keyCode;p<37||p>40||(w.preventDefault(),o({left:p===39?.05:p===37?-.05:0,top:p===40?.05:p===38?-.05:0}))},b]},[o,s]),c=u[0],f=u[1],d=u[2];return I.useEffect(function(){return d},[d]),q.createElement("div",rh({},n,{onTouchStart:c,onMouseDown:c,className:"react-colorful__interactive",ref:i,onKeyDown:f,tabIndex:0,role:"slider"}))}),nh=function(t){return t.filter(Boolean).join(" ")},Yw=function(t){var e=t.color,r=t.left,n=t.top,i=n===void 0?.5:n,s=nh(["react-colorful__pointer",t.className]);return q.createElement("div",{className:s,style:{top:100*i+"%",left:100*r+"%"}},q.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},rt=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r},H$=function(t){return V$(S0(t))},S0=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?rt(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?rt(parseInt(t.substring(6,8),16)/255,2):1}},z$=function(t){return G$(W$(t))},cA=function(t){var e=t.s,r=t.v,n=t.a,i=(200-e)*r/100;return{h:rt(t.h),s:rt(i>0&&i<200?e*r/100/(i<=100?i:200-i)*100:0),l:rt(i/2),a:rt(n,2)}},C0=function(t){var e=cA(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Um=function(t){var e=cA(t);return"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"},W$=function(t){var e=t.h,r=t.s,n=t.v,i=t.a;e=e/360*6,r/=100,n/=100;var s=Math.floor(e),o=n*(1-r),a=n*(1-(e-s)*r),l=n*(1-(1-e+s)*r),u=s%6;return{r:rt(255*[n,a,o,o,l,n][u]),g:rt(255*[l,n,n,a,o,o][u]),b:rt(255*[o,o,l,n,n,a][u]),a:rt(i,2)}},Xu=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},G$=function(t){var e=t.r,r=t.g,n=t.b,i=t.a,s=i<1?Xu(rt(255*i)):"";return"#"+Xu(e)+Xu(r)+Xu(n)+s},V$=function(t){var e=t.r,r=t.g,n=t.b,i=t.a,s=Math.max(e,r,n),o=s-Math.min(e,r,n),a=o?s===e?(r-n)/o:s===r?2+(n-e)/o:4+(e-r)/o:0;return{h:rt(60*(a<0?a+6:a)),s:rt(s?o/s*100:0),v:rt(s/255*100),a:i}},Q$=q.memo(function(t){var e=t.hue,r=t.onChange,n=nh(["react-colorful__hue",t.className]);return q.createElement("div",{className:n},q.createElement(Kw,{onMove:function(i){r({h:360*i.left})},onKey:function(i){r({h:Uo(e+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":rt(e),"aria-valuemax":"360","aria-valuemin":"0"},q.createElement(Yw,{className:"react-colorful__hue-pointer",left:e/360,color:C0({h:e,s:100,v:100,a:1})})))}),K$=q.memo(function(t){var e=t.hsva,r=t.onChange,n={backgroundColor:C0({h:e.h,s:100,v:100,a:1})};return q.createElement("div",{className:"react-colorful__saturation",style:n},q.createElement(Kw,{onMove:function(i){r({s:100*i.left,v:100-100*i.top})},onKey:function(i){r({s:Uo(e.s+100*i.left,0,100),v:Uo(e.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+rt(e.s)+"%, Brightness "+rt(e.v)+"%"},q.createElement(Yw,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:C0(e)})))}),dA=function(t,e){if(t===e)return!0;for(var r in t)if(t[r]!==e[r])return!1;return!0},Y$=function(t,e){return t.toLowerCase()===e.toLowerCase()||dA(S0(t),S0(e))};function X$(t,e,r){var n=b0(r),i=I.useState(function(){return t.toHsva(e)}),s=i[0],o=i[1],a=I.useRef({color:e,hsva:s});I.useEffect(function(){if(!t.equal(e,a.current.color)){var u=t.toHsva(e);a.current={hsva:u,color:e},o(u)}},[e,t]),I.useEffect(function(){var u;dA(s,a.current.hsva)||t.equal(u=t.fromHsva(s),a.current.color)||(a.current={hsva:s,color:u},n(u))},[s,t,n]);var l=I.useCallback(function(u){o(function(c){return Object.assign({},c,u)})},[]);return[s,l]}var J$=typeof window<"u"?I.useLayoutEffect:I.useEffect,Z$=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Yx=new Map,e9=function(t){J$(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!Yx.has(e)){var r=e.createElement("style");r.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Yx.set(e,r);var n=Z$();n&&r.setAttribute("nonce",n),e.head.appendChild(r)}},[])},t9=function(t){var e=t.className,r=t.hsva,n=t.onChange,i={backgroundImage:"linear-gradient(90deg, "+Um(Object.assign({},r,{a:0}))+", "+Um(Object.assign({},r,{a:1}))+")"},s=nh(["react-colorful__alpha",e]),o=rt(100*r.a);return q.createElement("div",{className:s},q.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),q.createElement(Kw,{onMove:function(a){n({a:a.left})},onKey:function(a){n({a:Uo(r.a+a.left)})},"aria-label":"Alpha","aria-valuetext":o+"%","aria-valuenow":o,"aria-valuemin":"0","aria-valuemax":"100"},q.createElement(Yw,{className:"react-colorful__alpha-pointer",left:r.a,color:Um(r)})))},r9=function(t){var e=t.className,r=t.colorModel,n=t.color,i=n===void 0?r.defaultColor:n,s=t.onChange,o=uA(t,["className","colorModel","color","onChange"]),a=I.useRef(null);e9(a);var l=X$(r,i,s),u=l[0],c=l[1],f=nh(["react-colorful",e]);return q.createElement("div",rh({},o,{ref:a,className:f}),q.createElement(K$,{hsva:u,onChange:c}),q.createElement(Q$,{hue:u.h,onChange:c}),q.createElement(t9,{hsva:u,onChange:c,className:"react-colorful__last-control"}))},n9={defaultColor:"0001",toHsva:H$,fromHsva:z$,equal:Y$},i9=function(t){return q.createElement(r9,rh({},t,{colorModel:n9}))};const cr="block w-full bg-white px-2 py-0.5 outline-none font-radiocanada text-xs";function s9(){const{setting:t,value:e,setValue:r}=it();if(!t||t.type!=="color-input")return null;function n(a){r(a.target.value)}const i=typeof e=="string"?e:"",s=a9(i),o=o9(i);return _.jsx("div",{className:"slime2-group-shadow m-2 overflow-hidden rounded border-2 border-emerald-800 bg-white",children:_.jsxs("div",{className:"flex flex-col justify-center gap-2 divide-y divide-black pt-2",style:{backgroundColor:s},children:[_.jsx(i9,{color:s,className:"self-center drop-shadow drop-shadow-c-black/25 drop-shadow-x-0.5 drop-shadow-y-0.5",onChange:a=>r(a)}),_.jsx("div",{className:"slime2-alpha-background",children:_.jsx("input",{className:ie(cr,"text-center font-bold"),style:{backgroundColor:s,color:o},placeholder:t.placeholder,type:"text",value:i,onChange:n})})]})})}function o9(t){try{return new ll(t).alpha<.5?"black":ll.accessibleForeground(t||"white")}catch{return"black"}}function a9(t){try{return new ll(t).toString({format:"hex"})}catch{return"#00000000"}}function l9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i,groupId:s}=it(),{openWindow:o}=cu();if(!t||t.type!=="color-input")return null;function a(u){i(u.target.value)}const l=typeof n=="string"?n:"";return _.jsx(Ir,{children:_.jsxs("div",{className:"flex bg-white",children:[_.jsx("input",{id:e,name:e,className:ie(cr,"flex-1"),placeholder:t.placeholder,type:"text",value:l,"aria-describedby":r,onChange:a}),_.jsx("button",{className:"flex w-44 items-stretch p-0.5",title:"Open Color Picker",onClick:u=>{o({id:`slime2window.${e}`,title:"Color Picker",icon:PB,children:_.jsx(Qw,{groupId:s,children:_.jsx(Zf,{value:t,children:_.jsx(s9,{})})})}),u.stopPropagation()},children:_.jsx("div",{className:"slime2-alpha-background flex-1 rounded-sm border-2 border-black",children:_.jsx("div",{className:"btn-shadow-i h-full w-full",style:{backgroundColor:u9(l)},children:_.jsx("span",{className:"sr-only",children:"Open Color Picker"})})})})]})})}function u9(t){try{return new ll(t).toString({format:"hex"})}catch{return"#00000000"}}function c9(){var a;const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="dropdown-input")return null;function s(l){if(!t||t.type!=="dropdown-input")return null;const u=t.options.find(c=>c.label===l.target.value);i(u?u.value:null)}const o=(a=t.options.find(l=>l.value===n))==null?void 0:a.label;return _.jsx(Ir,{children:_.jsx("div",{className:"bg-white px-1",children:_.jsxs("select",{id:e,"aria-describedby":r,value:o,name:e,onChange:s,className:ie(cr,"pl-0",!n&&"text-gray-400"),children:[_.jsx("option",{value:"",className:"text-gray-400",children:t.placeholder?t.placeholder:"Choose an option"}),t.options.map(l=>{const{label:u}=l;return _.jsx("option",{value:u,className:"text-black",children:u},u)})]})})})}function E0(){return E0=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(r[i]=t[i]);return r}var f9=I.useLayoutEffect,h9=function(e){var r=I.useRef(e);return f9(function(){r.current=e}),r},Xx=function(e,r){if(typeof e=="function"){e(r);return}e.current=r},p9=function(e,r){var n=I.useRef();return I.useCallback(function(i){e.current=i,n.current&&Xx(n.current,null),n.current=r,r&&Xx(r,i)},[r])},Jx={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},m9=function(e){Object.keys(Jx).forEach(function(r){e.style.setProperty(r,Jx[r],"important")})},Zx=m9,gt=null,eS=function(e,r){var n=e.scrollHeight;return r.sizingStyle.boxSizing==="border-box"?n+r.borderSize:n-r.paddingSize};function g9(t,e,r,n){r===void 0&&(r=1),n===void 0&&(n=1/0),gt||(gt=document.createElement("textarea"),gt.setAttribute("tabindex","-1"),gt.setAttribute("aria-hidden","true"),Zx(gt)),gt.parentNode===null&&document.body.appendChild(gt);var i=t.paddingSize,s=t.borderSize,o=t.sizingStyle,a=o.boxSizing;Object.keys(o).forEach(function(d){var y=d;gt.style[y]=o[y]}),Zx(gt),gt.value=e;var l=eS(gt,t);gt.value=e,l=eS(gt,t),gt.value="x";var u=gt.scrollHeight-i,c=u*r;a==="border-box"&&(c=c+i+s),l=Math.max(c,l);var f=u*n;return a==="border-box"&&(f=f+i+s),l=Math.min(f,l),[l,u]}var tS=function(){},y9=function(e,r){return e.reduce(function(n,i){return n[i]=r[i],n},{})},v9=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],w9=!!document.documentElement.currentStyle,_9=function(e){var r=window.getComputedStyle(e);if(r===null)return null;var n=y9(v9,r),i=n.boxSizing;if(i==="")return null;w9&&i==="border-box"&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px");var s=parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),o=parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth);return{sizingStyle:n,paddingSize:s,borderSize:o}},b9=_9;function fA(t,e,r){var n=h9(r);I.useLayoutEffect(function(){var i=function(o){return n.current(o)};if(t)return t.addEventListener(e,i),function(){return t.removeEventListener(e,i)}},[])}var x9=function(e){fA(window,"resize",e)},S9=function(e){fA(document.fonts,"loadingdone",e)},C9=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],E9=function(e,r){var n=e.cacheMeasurements,i=e.maxRows,s=e.minRows,o=e.onChange,a=o===void 0?tS:o,l=e.onHeightChange,u=l===void 0?tS:l,c=d9(e,C9),f=c.value!==void 0,d=I.useRef(null),y=p9(d,r),v=I.useRef(0),b=I.useRef(),w=function(){var g=d.current,x=n&&b.current?b.current:b9(g);if(x){b.current=x;var S=g9(x,g.value||g.placeholder||"x",s,i),k=S[0],R=S[1];v.current!==k&&(v.current=k,g.style.setProperty("height",k+"px","important"),u(k,{rowHeight:R}))}},p=function(g){f||w(),a(g)};return I.useLayoutEffect(w),x9(w),S9(w),I.createElement("textarea",E0({},c,{onChange:p,ref:y}))},hA=I.forwardRef(E9);function T9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it(),[s,o]=I.useState("");if(!t||t.type!=="font-input")return null;function a(u){i(u.target.value)}const l=typeof n=="string"?n:"";return _.jsx(Ir,{children:_.jsxs("div",{className:"flex flex-col divide-y divide-emerald-800 bg-white",children:[_.jsxs("div",{className:"flex divide-x divide-emerald-800 ",children:[_.jsx("input",{type:"text",id:e,name:e,className:ie(cr,"flex-1"),placeholder:"Type in a font name","aria-describedby":r,value:l,onChange:a}),_.jsx("div",{className:"flex-1 pl-1",children:_.jsxs("select",{className:ie(cr,"!px-0 text-[16px]",(!s||!Fm.includes(l))&&"text-gray-400"),onChange:u=>{o(u.target.value),i(u.target.value)},value:l,style:{fontFamily:Fm.includes(l)?l:"Radio Canada"},children:[_.jsx("option",{value:"",className:"font-radiocanada text-gray-400",children:"Font Selector"}),Fm.map(u=>_.jsx("option",{value:u,className:"text-base text-black",style:{fontFamily:u},children:u},u))]})})]}),_.jsx(hA,{className:ie(cr,"resize-none overflow-auto scrollbar-thin scrollbar-track-emerald-800/25 scrollbar-thumb-emerald-800 scrollbar-track-rounded-none scrollbar-thumb-rounded-none hover:scrollbar-thumb-emerald-700 active:scrollbar-thumb-emerald-600"),defaultValue:"Font Preview: The quick brown fox jumps over the lazy dog",style:{fontFamily:l}})]})})}const Fm=["Al Bayan","American Typewriter","Andalé Mono","Apple Casual","Apple Chancery","Apple Garamond","Apple Gothic","Apple LiGothic","Apple LiSung","Apple Myungjo","AquaKana","Arial","Arial Black","Arial Hebrew","Avant Garde","Ayuthaya","Baghdad","Bahnschrift","Baskerville","Beijing","BiauKai","Bookman","Big Caslon","Browallia New","BrowalliaUPC","Brush Script","Calibri","Cambria","Cambria Math","Candara","Cascadia Code","Cascadia Mono","Century Gothic","Chalkboard","Chalkduster","Charcoal","Charcoal CY","Chicago","Cochin","Comic Sans","Comic Sans MS","Consolas","Constantia","Cooper","Copperplate","Corbel","Corsiva Hebrew","Courier","Courier New","DecoType Naskh","Devanagari","Didot","Ebrima","Euphemia UCAS","Franklin Gothic Medium","Futura","Gabriola","Gadget","Gadugi","Garamond","Geeza Pro","Geezah","Geneva","Geneva CY","Georgia","Gill Sans","Gujarati","Gung Seoche","Gurmukhi","Hangangche","HeadlineA","Hei","Helvetica","Helvetica CY","Helvetica Neue","Herculanum","Hiragino Kaku Gothic Pro","Hiragino Kaku Gothic ProN","Hiragino Kaku Gothic Std","Hiragino Kaku Gothic StdN","Hiragino Maru Gothic Pro","Hiragino Maru Gothic ProN","Hiragino Mincho Pro","Hiragino Mincho ProN","Hoefler Text","Inai Mathi","Impact","Ink Free","Javanese Text","Jung Gothic","Kai","Keyboard","Krungthep","KufiStandard GK","Kuenstler Script","LastResort","Leelawadee UI","LiHei Pro","LiSong Pro","Lucida","Lucida Console","Lucida Grande","Lucida Sans","Lucida Sans Unicode","Malgun Gothic","Marker Felt","Menlo","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Sans Serif","Microsoft Tai Le","Microsoft YaHei","Microsoft Yi Baiti","MingLiU-ExtB","Monaco","Monaco CY","Mongolian Baiti","MS Gothic","MS Serif","Mshtakan","MV Boli","Myanmar Text","Nadeem","New Peninim","New York","Nirmala UI","NISC GB18030","Noto Sans","Optima","Osaka","Palatino","Palatino Linotype","Papyrus","PC Myungjo","Pilgiche","Plantagenet Cherokee","Raanana","Rockwell","San Francisco","Sand","Sathu","Segoe Print","Segoe Script","Segoe UI","Seoul","SimSun","Sitka","Shin Myungjo Neue","Silom","Skia","Snell Roundhand","ST FangSong","ST FangSong 2","ST Heiti","ST Kaiti","ST Song","Sylfaen","Tae Graphic","Tahoma","Taipei","Techno","Textile","Thonburi","Times","Times CY","Times New Roman","Trebuchet MS","Verdana","Yu Gothic","Zapf Chancery","Zapfino"];function pA(){const{setting:t,idString:e}=it();return!t||t.type!=="text-display"||!t.label?null:_.jsx("div",{className:"slime2-group-shadow -mx-1 rounded border-2 border-emerald-800 bg-green-700 px-2 py-1 font-medium text-white text-shadow text-shadow-c-black/75 text-shadow-y-px",children:_.jsx(aA,{id:e,linkClassName:"text-lime-200 focus:ring-lime-200 focus:ring-offset-2 focus:ring-offset-green-700",children:t.label})})}function k9(){const{setting:t,value:e,groupId:r}=it(),{addGroupMultiple:n,copyGroupMultiple:i,removeGroupMultiple:s,moveGroupMultiple:o}=xf(),a=I.useRef();function l(){return a.current||(a.current=new Map),a.current}function u(c,f){const y=l().get(e[c].__id),v=y==null?void 0:y.getElementsByClassName(f).item(0);v==null||v.focus()}return!t||t.type!=="group"||!("multiple"in t&&t.multiple)||!Array.isArray(e)?null:_.jsxs("div",{className:"flex flex-col gap-3 p-2",children:[t.description&&_.jsx(Zf,{value:{type:"text-display",id:`${t.id}.description`,label:t.description},children:_.jsx(pA,{})}),e.map((c,f)=>{const d=f===0,y=f===e.length-1,{__id:v}=c;return _.jsxs("div",{className:"slime2-group-shadow rounded border-2 border-green-700 bg-lime-200",ref:b=>{const w=l();b?w.set(v,b):w.delete(v)},children:[_.jsxs("div",{className:"title-shadow-i pointer-events-none flex justify-between overflow-hidden rounded-t-sm font-fredoka text-white",children:[_.jsxs("button",{className:"pointer-events-auto flex items-center gap-1 border-r border-r-emerald-800 bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px] hover:from-lime-400 hover:to-emerald-600 focus:from-lime-400 focus:to-emerald-600 focus:outline-none active:from-lime-500/90 active:to-emerald-600/90",onClick:()=>{i(r,t.id,f)},children:[_.jsx(xB,{size:20,strokeWidth:2.5,className:"-mt-0.5 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px"}),_.jsx("p",{className:"-mt-1 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:"Copy"})]}),_.jsx("div",{className:"flex-1 bg-gradient-to-b from-lime-600 to-emerald-700"}),_.jsx("button",{className:ie(!d&&"pointer-events-auto border-x border-x-emerald-800 hover:from-lime-400 hover:to-emerald-600 focus:from-lime-400 focus:to-emerald-600 active:from-lime-500/90 active:to-emerald-600/90","slime2-move-up flex items-center gap-1 bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px] focus:outline-none"),disabled:d,onClick:()=>{o(r,t.id,f,f-1),u(f-1,"slime2-move-up")},children:_.jsx(dB,{size:20,strokeWidth:2.5,className:ie("-mt-0.5 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",d&&"opacity-0")})}),_.jsx("div",{className:"flex items-center bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px]",children:_.jsx("p",{className:ie("-mt-1 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",e.length<2&&"opacity-0"),children:"Move"})}),_.jsx("button",{className:ie(!y&&"pointer-events-auto border-x border-x-emerald-800 hover:from-lime-400 hover:to-emerald-600 focus:from-lime-400 focus:to-emerald-600 active:from-lime-500/90 active:to-emerald-600/90","slime2-move-down flex items-center gap-1 bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px] focus:outline-none"),disabled:y,onClick:()=>{o(r,t.id,f,f+1),u(f+1,"slime2-move-down")},children:_.jsx(lB,{size:20,strokeWidth:2.5,className:ie("-mt-0.5 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",y&&"opacity-0")})}),_.jsx("div",{className:"flex-1 bg-gradient-to-b from-lime-600 to-emerald-700"}),_.jsxs("button",{className:"pointer-events-auto flex items-center gap-1 border-l border-l-emerald-800 bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px] hover:from-rose-600 hover:to-red-900 focus:from-rose-600 focus:to-red-900 focus:outline-none",onClick:()=>{confirm("Are you sure you want to delete this?")&&s(r,t.id,f)},children:[_.jsx("p",{className:"-mt-1 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:"Delete"}),_.jsx(OB,{size:20,strokeWidth:2.5,className:"-mt-0.5 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px"})]})]}),_.jsx(Qw,{groupId:[...r,{id:t.id,index:f}],children:_.jsx(Xw,{settings:t.settings})})]},v)}),_.jsxs(bn,{onClick:()=>{n(r,t.id,t.settings)},className:"justify-center",children:[_.jsx(Jr,{children:"Add New"}),_.jsx(xn,{children:_.jsx(NB,{className:"-mt-0.5"})})]})]})}function P9(){const t=XP(),{openWindow:e}=cu(),{setting:r,idString:n}=it();if(!r||r.type!=="group")return null;const i="multiple"in r&&r.multiple,s={strokeWidth:3,size:30,className:"-mt-0.5"};return _.jsxs(bn,{id:n,className:"-my-0.5 w-full justify-between py-2",onClick:o=>{e({id:`slime2window.${n}`,icon:LB,title:r.label||"",className:"w-96",children:_.jsx(Qw,{groupId:i?t:[...t,{id:r.id}],children:i?_.jsx(Zf,{value:r,children:_.jsx(k9,{})}):_.jsx(Xw,{settings:r.settings})})}),o.stopPropagation()},children:[_.jsx(Jr,{children:r.label}),_.jsx(xn,{children:i?_.jsx(wB,{...s}):_.jsx(QP,{...s})})]})}function mA(t){const[e,r]=I.useState(!1);if(e){const n=!t.src||t.src.startsWith("http://")||t.src.startsWith("https://");return _.jsx("div",{className:"flex items-center justify-center p-1 pr-3",children:_.jsx("p",{className:"text-xs font-bold",children:n?"Image failed to load!":"Image not found in assets folder!"})})}return _.jsx("img",{...t,onError:()=>r(!0),onLoad:()=>r(!1)})}function A9(){const{setting:t,idString:e,descriptionIdString:r}=it();return!t||t.type!=="image-display"||!t.url?null:_.jsxs("div",{className:"slime2-group-shadow flex flex-col items-center justify-center overflow-hidden rounded border-2 border-emerald-800 bg-white",children:[t.label&&_.jsx("p",{id:r,className:"-mt-0.5 block w-full bg-green-700 px-2 py-0.5 font-medium text-white text-shadow text-shadow-c-black/75 text-shadow-y-px",children:t.label}),_.jsx(mA,{className:"max-h-96",src:t.url,alt:t.alt,title:t.alt,id:e,"aria-describedby":r})]})}function I9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it(),[s,o]=I.useState(""),a=I.useRef(null);if(!t||t.type!=="image-input")return null;function l(){t&&s&&(o(""),u([s.trim()]))}function u(p){if(!t||!p)return;const m=p.map(g=>g.startsWith("http://")||g.startsWith("https://")?g:`assets/${g}`);if("multiple"in t&&t.multiple){const g=Array.isArray(n)?n:[],x=m.filter(S=>!g.includes(S));x.length&&i([...g,...x])}else m[0]&&i(m[0])}function c(p){if(!(!t||!p))if("multiple"in t&&t.multiple){const m=Array.isArray(n)?n:[];i(m.filter(g=>g!==p))}else i(null)}function f(p){p.nativeEvent.isComposing||p.keyCode===229||p.key==="Enter"&&l()}function d(p){o(p.target.value)}function y(p){const{files:m}=p.target;if(!m||!m.length)return;const g=[];for(const x of m)g.push(x.name);u(g),p.target.value=""}function v(){return t?"multiple"in t&&t.multiple?(Array.isArray(n)?n:[]).map(m=>_.jsx(rS,{src:m,onRemove:c},m)):typeof w!="string"?null:[w].map(p=>_.jsx(rS,{src:p,onRemove:c},p)):null}function b(){var p;(p=a.current)==null||p.click()}const w="multiple"in t&&t.multiple?Array.isArray(n)?n:[]:typeof n=="string"?n:null;return _.jsx(Ir,{children:_.jsxs("div",{className:"bg-white",children:[_.jsx("div",{className:"border-b border-emerald-800 p-2",children:_.jsxs(bn,{className:"w-full justify-center !px-1 !py-3",onClick:b,children:[_.jsx(Jr,{className:"text-xs",children:`Choose ${Array.isArray(n)?"Images":"an Image"} from the Widget Assets Folder`}),_.jsx(xn,{children:Array.isArray(n)?_.jsx(Rw,{size:22,strokeWidth:2.5,className:"-mt-0.5"}):_.jsx(qB,{size:22,strokeWidth:2.5,className:"-mt-0.5"})})]})}),_.jsx("input",{id:e,value:s,className:ie(cr,"text-center"),"aria-describedby":r,placeholder:"...or paste in a remote image URL and press enter",type:"text",onChange:d,onKeyDown:f}),_.jsx("input",{className:"hidden",id:`${e}.chooseFile`,type:"file",multiple:"multiple"in t&&t.multiple,accept:"image/*",onChange:y,ref:a}),(Array.isArray(n)&&n.length||typeof n=="string")&&_.jsx("div",{className:ie("grid grid-cols-1 gap-2 border-t border-emerald-800 bg-white p-2",Array.isArray(n)&&{"grid-cols-3":n.length>2,"grid-cols-2":n.length===2}),children:v()})]})})}function rS({onRemove:t,...e}){var r;return _.jsxs("div",{className:"slime2-group-shadow flex flex-col overflow-hidden rounded border-2 border-emerald-800",children:[_.jsxs("div",{className:"title-shadow-i pointer-events-none flex rounded-t-sm font-fredoka text-white",children:[_.jsx("p",{className:"-mt-0.5 flex-1 overflow-hidden text-ellipsis whitespace-nowrap bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-0.5 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:(r=e.src)==null?void 0:r.split("/").pop()}),_.jsx("button",{className:"pointer-events-auto rounded-tr-sm bg-rose-700 p-0.5 text-white hover:bg-rose-500 focus:bg-rose-500 focus:outline-none",onClick:()=>t(e.src),children:_.jsx(Yo,{className:"drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",size:20,strokeWidth:3})})]}),_.jsx("div",{className:"flex flex-1 flex-col items-center justify-center bg-white",children:_.jsx(mA,{...e,className:"max-h-32"})})]})}function O9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="number-input")return null;function s(o){const a=Number.parseInt(o.target.value);i(Number.isNaN(a)?null:a)}return t.slider?_.jsx(R9,{}):_.jsx(Ir,{children:_.jsx("input",{id:e,name:e,className:cr,type:"number",onChange:s,value:typeof n=="number"?n.toString():"",min:t.min,max:t.max,step:t.step,placeholder:t.placeholder,"aria-describedby":r})})}function R9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="number-input")return null;function s(u){const c=Number.parseFloat(u.target.value);i(Number.isNaN(c)?null:c)}const o=typeof n=="number"?n:"",a=typeof t.min=="number"?t.min:0,l=typeof t.max=="number"?t.max:100;return _.jsx(Ir,{children:_.jsxs("div",{className:"flex divide-x divide-emerald-800",children:[_.jsxs("div",{className:ie(cr,"flex flex-1 py-1"),children:[_.jsx("p",{children:a}),_.jsx("input",{id:e,name:e,className:"mx-1 flex-1 focus:outline-offset-2 focus:outline-emerald-600",type:"range",onChange:s,value:o.toString(),min:a,max:l,step:t.step,"aria-describedby":r}),_.jsx("p",{children:l})]}),_.jsx("input",{id:`${e}.numberSliderOutput`,name:`${e}.numberSliderOutput`,className:ie(cr,"!w-16 pr-0.5 text-center"),type:"number",onChange:s,value:o.toString(),min:a,max:l,step:t.step,placeholder:t.placeholder,"aria-describedby":r})]})})}function M9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="select-input")return null;function s(o){if(!t||t.type!=="select-input")return null;const a=t.options.find(l=>l.label===o.target.value);if(a)if("multiple"in t&&t.multiple){const l=Array.isArray(n)?n:[];o.target.checked?l.includes(a.value)||i([...l,a.value]):i(l.filter(u=>u!==a.value))}else i(a.value)}return _.jsxs(Uw,{children:[_.jsxs("fieldset",{"aria-describedby":r,children:[_.jsx("legend",{className:ie("-mt-0.5 block w-full px-2 py-0.5 font-medium text-white text-shadow text-shadow-c-black/75 text-shadow-y-px"),children:t.label}),_.jsx("div",{className:ie(cr,"pb-0 pt-2"),children:t.options.map(o=>{const a=`${e}.${o.label}`,l="multiple"in t&&t.multiple?(Array.isArray(n)?n:[]).includes(o.value):n===o.value;return _.jsxs("label",{htmlFor:a,className:"",children:[_.jsx("input",{id:a,value:o.label,name:e,onChange:s,className:"peer appearance-none",checked:l,type:"multiple"in t&&t.multiple?"checkbox":"radio"}),_.jsx("span",{className:ie(" mb-2 mr-2 inline-block rounded border-2 p-1 peer-focus:outline peer-focus:outline-2 peer-focus:outline-offset-2 peer-focus:outline-emerald-800 hover:outline hover:outline-2 hover:outline-offset-2 hover:outline-emerald-800",!l&&"border-slate-400 text-slate-500",l&&"slime2-tag-shadow border-emerald-800 bg-green-700 text-white"),children:o.label})]},a)})})]}),_.jsx(Vw,{id:r,children:t.description})]})}function N9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="text-input")return null;function s(l){i(l.target.value)}const o={id:e,name:e,className:cr,onChange:s,placeholder:t.placeholder,"aria-describedby":r},a=typeof n=="string"?n:"";return"multiple"in t&&t.multiple?_.jsx(j9,{...o,value:Array.isArray(n)?n:[],setValue:i}):t.multiline?_.jsx(D9,{...o,value:a}):_.jsx(Ir,{children:_.jsx("input",{...o,type:"text",value:a})})}function D9(t){const{style:e,ref:r,className:n,...i}=t;return _.jsx(Ir,{children:_.jsx(hA,{...i,className:ie("resize-none overflow-auto border-none scrollbar-thin scrollbar-track-emerald-800/25 scrollbar-thumb-emerald-800 scrollbar-track-rounded-none scrollbar-thumb-rounded-none hover:scrollbar-thumb-emerald-700 active:scrollbar-thumb-emerald-600",n),minRows:4})})}function j9(t){const{value:e,setValue:r,...n}=t,i=Array.isArray(e)?e:[],[s,o]=I.useState("");function a(){if(s&&!i.includes(s)){o("");const f=s.trim();f&&r([...e,f])}}function l(f){r(e.filter(d=>d!==f))}function u(f){f.nativeEvent.isComposing||f.keyCode===229||f.key==="Enter"&&a()}function c(f){o(f.target.value)}return _.jsx(Ir,{children:_.jsxs("div",{className:"bg-white",children:[_.jsx("input",{...n,type:"text",onKeyDown:u,onBlur:a,value:s,onChange:c}),_.jsx("div",{className:ie("flex flex-wrap gap-1 border-t border-emerald-800 p-1 text-[16px] font-semibold",!i.length&&"hidden"),children:i.map(f=>_.jsxs("div",{className:"slime2-tag-shadow flex items-center gap-1 rounded-sm border-2 border-emerald-800 bg-green-700 px-1 text-white text-shadow text-shadow-c-black/75 text-shadow-y-px",children:[_.jsx("p",{children:f}),_.jsx("button",{className:"my-1 rounded-sm bg-green-500/50 hover:bg-rose-500 focus:bg-rose-500 focus:outline-none",onClick:()=>l(f),children:_.jsx(Yo,{className:"drop-shadow drop-shadow-c-black/50 drop-shadow-y-px",size:18,strokeWidth:3})})]},f))})]})})}function L9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it(),s=I.useRef(null);if(!t||t.type!=="video-input")return null;function o(d){if(!(!t||!d))if("multiple"in t&&t.multiple){const y=Array.isArray(n)?n:[],v=d.filter(b=>!y.includes(b));v.length&&i([...y,...v])}else i(d[0])}function a(d){if(!(!t||!d))if("multiple"in t&&t.multiple){const y=Array.isArray(n)?n:[];i(y.filter(v=>v!==d))}else i(null)}function l(d){const{files:y}=d.target;if(!y||!y.length)return;const v=[];for(const b of y)v.push(`assets/${b.name}`);o(v),d.target.value=""}function u(){return t?"multiple"in t&&t.multiple?(Array.isArray(n)?n:[]).map(y=>_.jsx(nS,{src:y,onRemove:a},y)):typeof f!="string"?null:[f].map(d=>_.jsx(nS,{src:d,onRemove:a},d)):null}function c(){var d;(d=s.current)==null||d.click()}const f="multiple"in t&&t.multiple?Array.isArray(n)?n:[]:typeof n=="string"?n:null;return _.jsx(Ir,{children:_.jsxs("div",{className:"bg-white",children:[_.jsx("div",{className:"border-b border-emerald-800 p-2",children:_.jsxs(bn,{className:"w-full justify-center !px-1 !py-3",onClick:c,children:[_.jsx(Jr,{className:"text-xs",children:`Choose ${Array.isArray(n)?"Videos":"a Video"} from the Widget Assets Folder`}),_.jsx(xn,{children:Array.isArray(n)?_.jsx(Rw,{size:22,strokeWidth:2.5,className:"-mt-0.5"}):_.jsx(r$,{size:22,strokeWidth:2.5,className:"-mt-0.5"})})]})}),_.jsx("input",{className:"hidden",id:`${e}.chooseFile`,type:"file",multiple:"multiple"in t&&t.multiple,accept:"video/*",onChange:l,ref:s,"aria-describedby":r}),(Array.isArray(n)&&n.length||typeof n=="string")&&_.jsx("div",{className:ie("grid grid-cols-1 gap-2 border-t border-emerald-800 bg-white p-2",Array.isArray(n)&&{"grid-cols-2":n.length>1}),children:u()})]})})}function nS({onRemove:t,...e}){var r;return _.jsxs("div",{className:"slime2-group-shadow flex flex-col overflow-hidden rounded border-2 border-emerald-800",children:[_.jsxs("div",{className:"title-shadow-i pointer-events-none flex rounded-t-sm font-fredoka text-white",children:[_.jsx("p",{className:"-mt-0.5 flex-1 overflow-hidden text-ellipsis whitespace-nowrap bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-0.5 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:(r=e.src)==null?void 0:r.split("/").pop()}),_.jsx("button",{className:"pointer-events-auto rounded-tr-sm bg-rose-700 p-0.5 text-white hover:bg-rose-500 focus:bg-rose-500 focus:outline-none",onClick:()=>t(e.src),children:_.jsx(Yo,{className:"drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",size:20,strokeWidth:3})})]}),_.jsx("div",{className:"flex flex-1 flex-col items-center justify-center",children:_.jsx(B9,{...e})})]})}function B9(t){const[e,r]=I.useState(!1);return e?_.jsx("div",{className:"flex items-center justify-center p-1 pr-3",children:_.jsx("p",{className:"text-xs font-bold",children:"Video not found in assets folder!"})}):_.jsx("video",{controls:!0,className:"max-h-60",children:_.jsx("source",{...t,onError:()=>r(!0),onLoad:()=>r(!1)})})}function $9(){const{setting:t,idString:e,groupId:r}=it();return!t||t.type!=="button"?null:_.jsxs(bn,{id:e,onClick:()=>t.onClick(r,t.id),className:"justify-center",children:[_.jsx(xn,{children:_.jsx(KP,{strokeWidth:3,size:24,className:"-mt-0.5"})}),_.jsx(Jr,{children:t.label})]})}function U9(t){function e(){switch(t.type){case"group":return _.jsx(P9,{});case"button":return _.jsx($9,{});case"text-input":return _.jsx(N9,{});case"number-input":return _.jsx(O9,{});case"boolean-input":return _.jsx(q$,{});case"color-input":return _.jsx(l9,{});case"font-input":return _.jsx(T9,{});case"image-input":return _.jsx(I9,{});case"video-input":return _.jsx(L9,{});case"audio-input":return _.jsx(U$,{});case"select-input":return _.jsx(M9,{});case"dropdown-input":return _.jsx(c9,{});case"text-display":return _.jsx(pA,{});case"image-display":return _.jsx(A9,{});default:return null}}return _.jsx(Zf,{value:t,children:e()})}function Xw({settings:t}){return _.jsx("div",{className:"flex flex-col gap-2 p-2",children:t.map(e=>_.jsx(U9,{...e},e.id))})}function F9(){const{unsavedChanges:t}=bf();return t?_.jsxs("div",{className:"flex flex-col items-center gap-2 border-t-2 border-t-emerald-800 bg-green-700 p-2",children:[_.jsx("p",{className:"font-radiocanada text-xs font-semibold text-white",children:"You have some unsaved changes."}),_.jsx(YP,{})]}):null}function q9(){const{openWindow:t}=cu(),{unsavedChanges:e}=bf(),{widgetSettings:r}=wn();return I.useEffect(()=>{function n(i){e&&(i.preventDefault(),i.returnValue=!0,t({id:"slime2window.unsavedChanges",icon:sB,title:"You have unsaved changes!",className:"w-80",children:_.jsxs("div",{className:"flex flex-col gap-3 p-2",children:[_.jsxs("p",{className:"font-radiocanada text-sm",children:["To see your changes in ",_.jsx("span",{className:"font-bold",children:"OBS"})," ","(or other streaming software),"," ",_.jsx("span",{className:"font-bold",children:"download and save your widget data!"})]}),_.jsx(YP,{})]})},{x:window.innerWidth/3,y:window.innerHeight/2}))}return addEventListener("beforeunload",n),()=>{removeEventListener("beforeunload",n)}},[e,t]),!r||!r.length?null:_.jsxs(bn,{onClick:n=>{t({id:"widget-settings",icon:YB,title:"Widget Settings",className:"w-96",children:_.jsx(Xw,{settings:r}),footer:_.jsx(F9,{})}),n.stopPropagation()},className:"justify-between",children:[_.jsx(Jr,{children:"Widget Settings"}),_.jsx(xn,{children:_.jsx(QP,{strokeWidth:3,size:30,className:"-mt-0.5"})})]})}function H9(){const{platforms:t}=wn();return _.jsxs("div",{className:"flex flex-col justify-center gap-2 p-3",children:[_.jsx(q9,{}),t.includes("twitch")&&_.jsx(b$,{})]})}function z9({children:t}){const e=[{id:"slime2window.tools",icon:ZB,title:"Tools",children:_.jsx(H9,{})}],[r,n]=I.useReducer(fL,e);return _.jsx(MP.Provider,{value:r,children:_.jsx(NP.Provider,{value:n,children:t})})}const W9=eg.createRoot(document.getElementById("slime2-root")),G9=new yI;W9.render(_.jsx(q.StrictMode,{children:_.jsx(u$,{children:_.jsx(bI,{client:G9,children:_.jsx(h$,{children:_.jsx(z9,{children:_.jsx(f$,{children:_.jsx(d$,{children:_.jsxs(c$,{children:[_.jsx(lL,{}),_.jsx(rL,{}),_.jsx(l$,{})]})})})})})})})})); +`,t.getElementsByTagName("head")[0].appendChild(e)),t.body&&WP(t.body,"react-draggable-transparent-selection")}function FL(t){if(t)try{if(t.body&&GP(t.body,"react-draggable-transparent-selection"),t.selection)t.selection.empty();else{const e=(t.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function WP(t,e){t.classList?t.classList.add(e):t.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(t.className+=" ".concat(e))}function GP(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var rn={};Object.defineProperty(rn,"__esModule",{value:!0});rn.canDragX=zL;rn.canDragY=WL;rn.createCoreData=VL;rn.createDraggableData=QL;rn.getBoundPosition=qL;rn.getControlPosition=GL;rn.snapToGrid=HL;var jt=tn,Ks=Ue;function qL(t,e,r){if(!t.props.bounds)return[e,r];let{bounds:n}=t.props;n=typeof n=="string"?n:KL(n);const i=yw(t);if(typeof n=="string"){const{ownerDocument:s}=i,o=s.defaultView;let a;if(n==="parent"?a=i.parentNode:a=s.querySelector(n),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+n+'" could not find an element.');const l=a,u=o.getComputedStyle(i),c=o.getComputedStyle(l);n={left:-i.offsetLeft+(0,jt.int)(c.paddingLeft)+(0,jt.int)(u.marginLeft),top:-i.offsetTop+(0,jt.int)(c.paddingTop)+(0,jt.int)(u.marginTop),right:(0,Ks.innerWidth)(l)-(0,Ks.outerWidth)(i)-i.offsetLeft+(0,jt.int)(c.paddingRight)-(0,jt.int)(u.marginRight),bottom:(0,Ks.innerHeight)(l)-(0,Ks.outerHeight)(i)-i.offsetTop+(0,jt.int)(c.paddingBottom)-(0,jt.int)(u.marginBottom)}}return(0,jt.isNum)(n.right)&&(e=Math.min(e,n.right)),(0,jt.isNum)(n.bottom)&&(r=Math.min(r,n.bottom)),(0,jt.isNum)(n.left)&&(e=Math.max(e,n.left)),(0,jt.isNum)(n.top)&&(r=Math.max(r,n.top)),[e,r]}function HL(t,e,r){const n=Math.round(e/t[0])*t[0],i=Math.round(r/t[1])*t[1];return[n,i]}function zL(t){return t.props.axis==="both"||t.props.axis==="x"}function WL(t){return t.props.axis==="both"||t.props.axis==="y"}function GL(t,e,r){const n=typeof e=="number"?(0,Ks.getTouch)(t,e):null;if(typeof e=="number"&&!n)return null;const i=yw(r),s=r.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,Ks.offsetXYFromParent)(n||t,s,r.props.scale)}function VL(t,e,r){const n=!(0,jt.isNum)(t.lastX),i=yw(t);return n?{node:i,deltaX:0,deltaY:0,lastX:e,lastY:r,x:e,y:r}:{node:i,deltaX:e-t.lastX,deltaY:r-t.lastY,lastX:t.lastX,lastY:t.lastY,x:e,y:r}}function QL(t,e){const r=t.props.scale;return{node:e.node,x:t.state.x+e.deltaX/r,y:t.state.y+e.deltaY/r,deltaX:e.deltaX/r,deltaY:e.deltaY/r,lastX:t.state.x,lastY:t.state.y}}function KL(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}function yw(t){const e=t.findDOMNode();if(!e)throw new Error(": Unmounted during event!");return e}var Yf={},Xf={};Object.defineProperty(Xf,"__esModule",{value:!0});Xf.default=YL;function YL(){}Object.defineProperty(Yf,"__esModule",{value:!0});Yf.default=void 0;var Nm=JL(I),Ct=vw(mw),XL=vw(xv),dt=Ue,Mn=rn,Dm=tn,da=vw(Xf);function vw(t){return t&&t.__esModule?t:{default:t}}function VP(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(VP=function(n){return n?r:e})(t)}function JL(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=VP(e);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&Object.prototype.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function yt(t,e,r){return e=ZL(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ZL(t){var e=eB(t,"string");return typeof e=="symbol"?e:String(e)}function eB(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const vr={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Nn=vr.mouse,Jf=class extends Nm.Component{constructor(){super(...arguments),yt(this,"dragging",!1),yt(this,"lastX",NaN),yt(this,"lastY",NaN),yt(this,"touchIdentifier",null),yt(this,"mounted",!1),yt(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const r=this.findDOMNode();if(!r||!r.ownerDocument||!r.ownerDocument.body)throw new Error(" not mounted on DragStart!");const{ownerDocument:n}=r;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!(0,dt.matchesSelectorAndParentsTo)(e.target,this.props.handle,r)||this.props.cancel&&(0,dt.matchesSelectorAndParentsTo)(e.target,this.props.cancel,r))return;e.type==="touchstart"&&e.preventDefault();const i=(0,dt.getTouchIdentifier)(e);this.touchIdentifier=i;const s=(0,Mn.getControlPosition)(e,i,this);if(s==null)return;const{x:o,y:a}=s,l=(0,Mn.createCoreData)(this,o,a);(0,da.default)("DraggableCore: handleDragStart: %j",l),(0,da.default)("calling",this.props.onStart),!(this.props.onStart(e,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,dt.addUserSelectStyles)(n),this.dragging=!0,this.lastX=o,this.lastY=a,(0,dt.addEvent)(n,Nn.move,this.handleDrag),(0,dt.addEvent)(n,Nn.stop,this.handleDragStop))}),yt(this,"handleDrag",e=>{const r=(0,Mn.getControlPosition)(e,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let a=n-this.lastX,l=i-this.lastY;if([a,l]=(0,Mn.snapToGrid)(this.props.grid,a,l),!a&&!l)return;n=this.lastX+a,i=this.lastY+l}const s=(0,Mn.createCoreData)(this,n,i);if((0,da.default)("DraggableCore: handleDrag: %j",s),this.props.onDrag(e,s)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=n,this.lastY=i}),yt(this,"handleDragStop",e=>{if(!this.dragging)return;const r=(0,Mn.getControlPosition)(e,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let l=n-this.lastX||0,u=i-this.lastY||0;[l,u]=(0,Mn.snapToGrid)(this.props.grid,l,u),n=this.lastX+l,i=this.lastY+u}const s=(0,Mn.createCoreData)(this,n,i);if(this.props.onStop(e,s)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,dt.removeUserSelectStyles)(a.ownerDocument),(0,da.default)("DraggableCore: handleDragStop: %j",s),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,da.default)("DraggableCore: Removing handlers"),(0,dt.removeEvent)(a.ownerDocument,Nn.move,this.handleDrag),(0,dt.removeEvent)(a.ownerDocument,Nn.stop,this.handleDragStop))}),yt(this,"onMouseDown",e=>(Nn=vr.mouse,this.handleDragStart(e))),yt(this,"onMouseUp",e=>(Nn=vr.mouse,this.handleDragStop(e))),yt(this,"onTouchStart",e=>(Nn=vr.touch,this.handleDragStart(e))),yt(this,"onTouchEnd",e=>(Nn=vr.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,dt.addEvent)(e,vr.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:r}=e;(0,dt.removeEvent)(r,vr.mouse.move,this.handleDrag),(0,dt.removeEvent)(r,vr.touch.move,this.handleDrag),(0,dt.removeEvent)(r,vr.mouse.stop,this.handleDragStop),(0,dt.removeEvent)(r,vr.touch.stop,this.handleDragStop),(0,dt.removeEvent)(e,vr.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,dt.removeUserSelectStyles)(r)}}findDOMNode(){var e,r;return(e=this.props)!==null&&e!==void 0&&e.nodeRef?(r=this.props)===null||r===void 0||(r=r.nodeRef)===null||r===void 0?void 0:r.current:XL.default.findDOMNode(this)}render(){return Nm.cloneElement(Nm.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Yf.default=Jf;yt(Jf,"displayName","DraggableCore");yt(Jf,"propTypes",{allowAnyClick:Ct.default.bool,children:Ct.default.node.isRequired,disabled:Ct.default.bool,enableUserSelectHack:Ct.default.bool,offsetParent:function(t,e){if(t[e]&&t[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ct.default.arrayOf(Ct.default.number),handle:Ct.default.string,cancel:Ct.default.string,nodeRef:Ct.default.object,onStart:Ct.default.func,onDrag:Ct.default.func,onStop:Ct.default.func,onMouseDown:Ct.default.func,scale:Ct.default.number,className:Dm.dontSetMe,style:Dm.dontSetMe,transform:Dm.dontSetMe});yt(Jf,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),t.default=void 0;var e=d(I),r=c(mw),n=c(xv),i=c(wL),s=Ue,o=rn,a=tn,l=c(Yf),u=c(Xf);function c(m){return m&&m.__esModule?m:{default:m}}function f(m){if(typeof WeakMap!="function")return null;var y=new WeakMap,x=new WeakMap;return(f=function(S){return S?x:y})(m)}function d(m,y){if(!y&&m&&m.__esModule)return m;if(m===null||typeof m!="object"&&typeof m!="function")return{default:m};var x=f(y);if(x&&x.has(m))return x.get(m);var S={},k=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in m)if(O!=="default"&&Object.prototype.hasOwnProperty.call(m,O)){var M=k?Object.getOwnPropertyDescriptor(m,O):null;M&&(M.get||M.set)?Object.defineProperty(S,O,M):S[O]=m[O]}return S.default=m,x&&x.set(m,S),S}function g(){return g=Object.assign?Object.assign.bind():function(m){for(var y=1;y{if((0,u.default)("Draggable: onDragStart: %j",S),this.props.onStart(x,(0,o.createDraggableData)(this,S))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),v(this,"onDrag",(x,S)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",S);const k=(0,o.createDraggableData)(this,S),O={x:k.x,y:k.y,slackX:0,slackY:0};if(this.props.bounds){const{x:L,y:W}=O;O.x+=this.state.slackX,O.y+=this.state.slackY;const[ee,le]=(0,o.getBoundPosition)(this,O.x,O.y);O.x=ee,O.y=le,O.slackX=this.state.slackX+(L-O.x),O.slackY=this.state.slackY+(W-O.y),k.x=O.x,k.y=O.y,k.deltaX=O.x-this.state.x,k.deltaY=O.y-this.state.y}if(this.props.onDrag(x,k)===!1)return!1;this.setState(O)}),v(this,"onDragStop",(x,S)=>{if(!this.state.dragging||this.props.onStop(x,(0,o.createDraggableData)(this,S))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",S);const O={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:L,y:W}=this.props.position;O.x=L,O.y=W}this.setState(O)}),this.state={dragging:!1,dragged:!1,x:y.position?y.position.x:y.defaultPosition.x,y:y.position?y.position.y:y.defaultPosition.y,prevPropsPosition:{...y.position},slackX:0,slackY:0,isElementSVG:!1},y.position&&!(y.onDrag||y.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var y,x;return(y=(x=this.props)===null||x===void 0||(x=x.nodeRef)===null||x===void 0?void 0:x.current)!==null&&y!==void 0?y:n.default.findDOMNode(this)}render(){const{axis:y,bounds:x,children:S,defaultPosition:k,defaultClassName:O,defaultClassNameDragging:M,defaultClassNameDragged:L,position:W,positionOffset:ee,scale:le,...he}=this.props;let P={},j=null;const ue=!!!W||this.state.dragging,$=W||k,H={x:(0,o.canDragX)(this)&&ue?this.state.x:$.x,y:(0,o.canDragY)(this)&&ue?this.state.y:$.y};this.state.isElementSVG?j=(0,s.createSVGTransform)(H,ee):P=(0,s.createCSSTransform)(H,ee);const Y=(0,i.default)(S.props.className||"",O,{[M]:this.state.dragging,[L]:this.state.dragged});return e.createElement(l.default,g({},he,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(S),{className:Y,style:{...S.props.style,...P},transform:j}))}}t.default=p,v(p,"displayName","Draggable"),v(p,"propTypes",{...l.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),v(p,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(jP);const{default:QP,DraggableCore:tB}=jP;Kf.exports=QP;Kf.exports.default=QP;Kf.exports.DraggableCore=tB;var rB=Kf.exports;const nB=yn(rB);function Qy(){return Qy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function sB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var ww=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=iB(t,["color","size"]);return q.createElement("svg",Qy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),q.createElement("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),q.createElement("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"}))});ww.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};ww.displayName="AlertTriangle";const oB=ww;function Ky(){return Ky=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function lB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var _w=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=aB(t,["color","size"]);return q.createElement("svg",Ky({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),q.createElement("polyline",{points:"19 12 12 19 5 12"}))});_w.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};_w.displayName="ArrowDown";const uB=_w;function Yy(){return Yy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function dB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var bw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=cB(t,["color","size"]);return q.createElement("svg",Yy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),q.createElement("polyline",{points:"5 12 12 5 19 12"}))});bw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};bw.displayName="ArrowUp";const fB=bw;function Xy(){return Xy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function pB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var xw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=hB(t,["color","size"]);return q.createElement("svg",Xy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polyline",{points:"20 6 9 17 4 12"}))});xw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};xw.displayName="Check";const mB=xw;function Jy(){return Jy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function yB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Sw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=gB(t,["color","size"]);return q.createElement("svg",Jy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polyline",{points:"9 18 15 12 9 6"}))});Sw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Sw.displayName="ChevronRight";const KP=Sw;function Zy(){return Zy=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function wB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Cw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=vB(t,["color","size"]);return q.createElement("svg",Zy({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polyline",{points:"13 17 18 12 13 7"}),q.createElement("polyline",{points:"6 17 11 12 6 7"}))});Cw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Cw.displayName="ChevronsRight";const _B=Cw;function e0(){return e0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function xB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Ew=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=bB(t,["color","size"]);return q.createElement("svg",e0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),q.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}))});Ew.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Ew.displayName="Copy";const SB=Ew;function t0(){return t0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function EB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Tw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=CB(t,["color","size"]);return q.createElement("svg",t0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),q.createElement("polyline",{points:"7 10 12 15 17 10"}),q.createElement("line",{x1:"12",y1:"15",x2:"12",y2:"3"}))});Tw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Tw.displayName="Download";const TB=Tw;function r0(){return r0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function PB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var kw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=kB(t,["color","size"]);return q.createElement("svg",r0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z"}))});kw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};kw.displayName="Droplet";const AB=kw;function n0(){return n0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function OB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Pw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=IB(t,["color","size"]);return q.createElement("svg",n0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),q.createElement("polyline",{points:"14 2 14 8 20 8"}),q.createElement("line",{x1:"9",y1:"15",x2:"15",y2:"15"}))});Pw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Pw.displayName="FileMinus";const RB=Pw;function i0(){return i0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function NB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Aw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=MB(t,["color","size"]);return q.createElement("svg",i0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),q.createElement("polyline",{points:"14 2 14 8 20 8"}),q.createElement("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),q.createElement("line",{x1:"9",y1:"15",x2:"15",y2:"15"}))});Aw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Aw.displayName="FilePlus";const DB=Aw;function s0(){return s0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function LB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Iw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=jB(t,["color","size"]);return q.createElement("svg",s0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),q.createElement("polyline",{points:"14 2 14 8 20 8"}),q.createElement("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),q.createElement("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),q.createElement("polyline",{points:"10 9 9 9 8 9"}))});Iw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Iw.displayName="FileText";const BB=Iw;function o0(){return o0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function UB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Ow=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=$B(t,["color","size"]);return q.createElement("svg",o0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),q.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),q.createElement("rect",{x:"14",y:"14",width:"7",height:"7"}),q.createElement("rect",{x:"3",y:"14",width:"7",height:"7"}))});Ow.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Ow.displayName="Grid";const Rw=Ow;function a0(){return a0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function qB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Mw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=FB(t,["color","size"]);return q.createElement("svg",a0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),q.createElement("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),q.createElement("polyline",{points:"21 15 16 10 5 21"}))});Mw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Mw.displayName="Image";const HB=Mw;function l0(){return l0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function WB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Nw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=zB(t,["color","size"]);return q.createElement("svg",l0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M9 18V5l12-2v13"}),q.createElement("circle",{cx:"6",cy:"18",r:"3"}),q.createElement("circle",{cx:"18",cy:"16",r:"3"}))});Nw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Nw.displayName="Music";const GB=Nw;function u0(){return u0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function QB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Dw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=VB(t,["color","size"]);return q.createElement("svg",u0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polygon",{points:"5 3 19 12 5 21 5 3"}))});Dw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Dw.displayName="Play";const YP=Dw;function c0(){return c0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function YB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var jw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=KB(t,["color","size"]);return q.createElement("svg",c0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("circle",{cx:"12",cy:"12",r:"3"}),q.createElement("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"}))});jw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};jw.displayName="Settings";const XB=jw;function d0(){return d0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function ZB(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Lw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=JB(t,["color","size"]);return q.createElement("svg",d0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"}))});Lw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Lw.displayName="Tool";const e$=Lw;function f0(){return f0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function r$(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var Bw=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=t$(t,["color","size"]);return q.createElement("svg",f0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("polygon",{points:"23 7 16 12 23 17 23 7"}),q.createElement("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"}))});Bw.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};Bw.displayName="Video";const n$=Bw;function h0(){return h0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function s$(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var $w=I.forwardRef(function(t,e){var r=t.color,n=r===void 0?"currentColor":r,i=t.size,s=i===void 0?24:i,o=i$(t,["color","size"]);return q.createElement("svg",h0({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))});$w.propTypes={color:z.string,size:z.oneOfType([z.string,z.number])};$w.displayName="X";const Yo=$w;function o$({id:t,title:e,children:r,header:n,footer:i,className:s,initialMousePosition:o,icon:a}){const{closeWindow:l,sendWindowToTop:u}=cu(),c=I.useRef(null),f=I.useRef(null),d=o?{x:Math.floor(Math.min(o.x+20,window.innerWidth*.5)),y:Math.floor(Math.min(o.y-100,window.innerHeight*.2))}:{x:40,y:40};function g(){l(t)}function v(){var w;const b=(w=f.current)==null?void 0:w.scrollTop;u(t),setTimeout(()=>{var p;b&&((p=f.current)==null||p.scrollTo(0,b))},0)}return _.jsx(nB,{handle:".draggable-handle",cancel:".draggable-cancel",defaultPosition:d,nodeRef:c,onStart:v,bounds:"parent",children:_.jsxs("div",{id:t,ref:c,onClick:v,className:ie("slime2-window-shadow pointer-events-auto !fixed z-[999] flex max-h-[80%] min-h-[100px] min-w-[350px] max-w-[90%] flex-col overflow-hidden rounded-md border-2 border-emerald-800 bg-lime-100 font-fredoka text-sm opacity-90 last:opacity-100 only:opacity-100 hover:opacity-100",s),children:[_.jsx(a$,{icon:a,close:o?g:void 0,children:e}),n,_.jsx(l$,{ref:f,children:r}),i]})})}function a$({icon:t,children:e,close:r}){return _.jsxs("div",{className:"title-shadow-i pointer-events-none flex divide-x divide-emerald-800 rounded-t-sm",children:[_.jsx("div",{className:"draggable-handle pointer-events-auto flex-1 cursor-move items-center gap-2 rounded-tl-sm bg-gradient-to-b from-lime-600 to-emerald-700 py-1 pl-[8px] pr-1 text-lime-100",children:_.jsxs("p",{className:"-mt-0.5 font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:[t&&_.jsx(t,{className:"-mt-0.5 mr-1 inline drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",size:24}),e]})}),r&&_.jsx("button",{className:"draggable-cancel pointer-events-auto flex items-center justify-center border-l border-l-emerald-800 bg-gradient-to-b from-lime-600 to-emerald-700 px-[8px] py-px text-white hover:from-rose-600 hover:to-red-900 focus:from-rose-600 focus:to-red-900 focus:outline-none",onClick:n=>{r(),n.stopPropagation()},children:_.jsx(Yo,{size:24,strokeWidth:3,className:"drop-shadow drop-shadow-c-black/75 drop-shadow-y-px"})})]})}const l$=I.forwardRef(function(e,r){return _.jsx("div",{...e,className:ie("draggable-cancel m-1 flex-1 overflow-auto font-radiocanada scrollbar-thin scrollbar-track-emerald-800/25 scrollbar-thumb-emerald-800 scrollbar-track-rounded-full scrollbar-thumb-rounded-full hover:scrollbar-thumb-emerald-700 active:scrollbar-thumb-emerald-600",e.className),ref:r})});function u$(){const[t,e]=I.useState(),r=cL();return I.useEffect(()=>{let n;function i(){clearTimeout(n),e(!1)}function s(){clearTimeout(n),n=setTimeout(()=>{e(!0)},1e3)}return document.addEventListener("mousemove",i),document.addEventListener("mouseleave",s),()=>{clearTimeout(n),document.removeEventListener("mousemove",i),document.removeEventListener("mouseleave",s)}},[]),t===void 0?null:_.jsx("div",{id:"slime2-windows",className:ie(t?"slime2-window-exit":"slime2-window-enter","pointer-events-none absolute left-0 top-0 z-[9999] h-screen w-screen p-2"),children:r.map(n=>I.createElement(o$,{...n,key:n.id}))})}function c$({children:t}){const[e,r]=I.useReducer(rR,W5);return _.jsx(G5.Provider,{value:e,children:_.jsx(V5.Provider,{value:r,children:t})})}function d$({children:t}){const[e,r]=I.useReducer(j4,EE);return _.jsx(TE.Provider,{value:e,children:_.jsx(kE.Provider,{value:r,children:t})})}function f$({children:t}){const[e,r]=I.useReducer(D4,bE);return _.jsx(xE.Provider,{value:e,children:_.jsx(SE.Provider,{value:r,children:t})})}function h$({children:t}){const[e,r]=I.useState(!1);return _.jsx(F5.Provider,{value:{unsavedChanges:e,setUnsavedChanges:r},children:t})}function p$({children:t}){const[e,r]=I.useReducer(JO,q5);return _.jsx(H5.Provider,{value:e,children:_.jsx(z5.Provider,{value:r,children:t})})}function m$(){const{addEvent:t}=Iv(),{data:e}=Qf(),{data:r}=OP(),{data:n}=Vf(),{data:i}=fw(),{data:s}=hw(),{isPlatformReady:o}=Tf(),a=IP();async function l(){if(!o("twitch"))return;const u=Object.values(s||{});let c=null;if(Be.boolean()&&u.length){const L=Be.item(u),W=Be.boolean()?Be.item(u):null;c=AP(L,W&&L.name===W.name?null:W)}const f=[...r,...Array.from(e.values())],d=new Date,g=Be.chance(5),v="test message",b=`long test message${" long test message".repeat(5)}`,w="LongTestMessage".repeat(7);let p=v;Be.chance(5)&&(p=b),Be.chance(5)&&(p=w),p=`${p}${Be.item(b$)}`;let m=p;g&&(p=`${p} (first time chat)`);const y=[],x={id:`test-user-${d.getTime()}`,userName:"testuser",displayName:"testUser",pronouns:c,badges:[],color:await a("testuser"),roles:{broadcaster:!1,moderator:!1,artist:!1,vip:!1,founder:!1,subscriber:!1},followDate:new Date(0)},S=Be.boolean()?"user":Be.item(g$),k=i.get(S==="artist"?"artist-badge":S);S!=="user"&&k&&(x.badges=[k],x.roles[S]=!0,(S==="founder"||S==="broadcaster")&&(x.roles.subscriber=!0),x.userName=`test${S}`,x.displayName=`test${S.charAt(0).toUpperCase()}${S.slice(1)}`,x.color=await a(x.userName));let O={type:"basic"};if(Be.boolean()){const L=Be.item(y$);switch(L){case"action":p=`${p} (/me action message)`,m=p,O={type:L};break;case"highlight":p=`${p} (highlighted message)`,m=p,O={type:L};break;case"cheer":{const W=Be.item(_$),ee="Cheer";O={type:L,cheer:{amount:W}};const le=`${ee}${W}`;m=`${p} (cheer message)`,p=`${le} ${m}`,y.unshift({type:"text",text:" "}),y.unshift({type:"cheer",text:le,cheer:n.get(ee,W)})}break;case"reply":O={type:L,reply:{id:`test-reply-${d.getTime()}`,text:"test message being replied to",user:{id:`test-user-reply-${d.getTime()}`,userName:"testreplyuser",displayName:"testReplyUser"}}},p=`${p} (reply message)`,m=p;break;case"redeem":O={type:L,redeem:{id:`test-redeem-${d.getTime()}`,name:"Test Redeem",image:"https://static-cdn.jtvnw.net/custom-reward-images/default-4.png",color:"#FFC6FF",cost:Be.integer(1,1e4)}},p=`${p} (channel point redemption requiring text)`,m=p;break;case"resub":O={type:L,resub:{months:Be.integer(1,24),tier:Be.item(v$)}},p=`${p} (resub message)`,m=p;break;case"announcement":(S==="broadcaster"||S==="moderator")&&(O={type:L,announcement:{color:Be.item(w$)}},p=`${p} (announcement message)`,m=p);break}}if(Be.boolean()&&f.length){const L=Be.item(f);y.unshift({type:"text",text:" "}),y.unshift({type:"emote",emote:L,text:L.name}),p=`${L.name} ${p}`}O.type==="basic"&&Be.chance(20)&&(p="hi",m=p),y.push({type:"text",text:m});const M={...O,id:`test-message-${d.getTime()}`,first:g,date:d,user:x,text:p,parts:y,tags:new Map([["test","1"]])};t({type:"message",id:M.id,userId:M.user.id,message:M,source:"twitch",emulated:!0})}return l}const g$=["broadcaster","moderator","artist","vip","founder","subscriber"],y$=["action","highlight","cheer","reply","redeem","resub","announcement"],v$=["1000","2000","3000","Prime"],w$=["PRIMARY","BLUE","GREEN","ORANGE","PURPLE"],_$=[1,5,10,50,100,500,1e3,5e3,1e4],b$=["",".","...","!","?","!!","!?","?!"];function bn(t){return _.jsx("button",{...t,type:"button",className:ie("btn-shadow-i flex items-center gap-2 rounded-md border-2 border-emerald-800 bg-gradient-to-b from-lime-600 to-emerald-700 px-3 py-1 text-center hover:from-lime-400 hover:to-emerald-600 focus:from-lime-400 focus:to-emerald-600 focus:outline-none active:from-lime-400/90 active:to-emerald-600/90",t.className)})}function xn(t){return _.jsx("span",{...t,className:ie("font-display font-semibold text-lime-100 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",t.className)})}function Jr(t){return _.jsx("span",{...t,className:ie("-mb-px font-grandstander text-base font-semibold text-lime-100 text-shadow text-shadow-c-black/75 text-shadow-y-px",t.className)})}function x$(){const t=m$(),{isPlatformReady:e}=Tf(),r=e("twitch");return r?_.jsxs(bn,{onClick:t,className:"justify-center",disabled:!r,children:[_.jsx(xn,{children:_.jsx(YP,{strokeWidth:3,size:24,className:"-mt-0.5"})}),_.jsx(Jr,{children:"Send Test Message"})]}):_.jsx("div",{className:"flex items-center justify-center",children:_.jsx("p",{children:"Loading Twitch Tools..."})})}function XP(){const{setUnsavedChanges:t}=bf(),e=Ev(),{widgetDataFileName:r}=wn(),{closeWindow:n}=cu(),[i,s]=I.useState(!1);function o(){s(!0),setTimeout(()=>{t(!1)},2e3),n("slime2window.unsavedChanges");const a=`slime2.widget.setData(${JSON.stringify(e,null,2)})`,l=new Blob([a],{type:"text/javascript"}),u=document.createElement("a");u.href=URL.createObjectURL(l),u.download=r,u.style.display="none",document.body.appendChild(u),u.click(),document.body.removeChild(u)}return _.jsx(bn,{onClick:o,className:"w-full justify-center outline outline-2 outline-lime-100 focus:outline focus:outline-2 focus:outline-offset-0 focus:outline-lime-100",disabled:i,children:i?_.jsx(Jr,{children:"Saved!"}):_.jsxs(_.Fragment,{children:[_.jsx(Jr,{children:"Save Widget Data"}),_.jsx(xn,{children:_.jsx(TB,{strokeWidth:3,size:28})})]})})}function JP(){return I.useContext(ZP)}const ZP=I.createContext([]);function it(){var c;const t=I.useContext(eA),e=JP(),r=Ev(),{update:n}=xf(),s=`${e.reduce((f,{id:d,index:g})=>`${f}.${d}${g===void 0?"":`[${g}]`}`,"slime2widget")}.${t==null?void 0:t.id}`,o=t&&"description"in t&&t.description?`${s}.description`:void 0;let a=null;t&&(a=(c=Ri(r,e))==null?void 0:c[t.id]);const l=a===null||typeof a=="boolean"||typeof a=="string"||typeof a=="number"||Array.isArray(a)?a:null;function u(f){t&&n(e,t.id,f)}return{setting:t,idString:s,descriptionIdString:o,value:l,setValue:u,groupId:e}}const eA=I.createContext(null);function Zf({value:t,children:e}){return _.jsx(eA.Provider,{value:t,children:e})}function Uw(t){return _.jsx("div",{...t,className:ie("slime2-group-shadow overflow-hidden rounded border-2 border-emerald-800 bg-green-700 focus-within:border-emerald-600 focus-within:bg-emerald-600 focus-within:ring-2 focus-within:ring-emerald-600",t.className)})}const S$="aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",C$="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5تصالات6رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",ps=(t,e)=>{for(const r in e)t[r]=e[r];return t},p0="numeric",m0="ascii",g0="alpha",bc="asciinumeric",Qu="alphanumeric",y0="domain",tA="emoji",E$="scheme",T$="slashscheme",$x="whitespace";function k$(t,e){return t in e||(e[t]=[]),e[t]}function Fi(t,e,r){e[p0]&&(e[bc]=!0,e[Qu]=!0),e[m0]&&(e[bc]=!0,e[g0]=!0),e[bc]&&(e[Qu]=!0),e[g0]&&(e[Qu]=!0),e[Qu]&&(e[y0]=!0),e[tA]&&(e[y0]=!0);for(const n in e){const i=k$(n,r);i.indexOf(t)<0&&i.push(t)}}function P$(t,e){const r={};for(const n in e)e[n].indexOf(t)>=0&&(r[n]=!0);return r}function Ut(t){t===void 0&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}Ut.groups={};Ut.prototype={accepts(){return!!this.t},go(t){const e=this,r=e.j[t];if(r)return r;for(let n=0;nt.ta(e,r,n,i),Qt=(t,e,r,n,i)=>t.tr(e,r,n,i),Ux=(t,e,r,n,i)=>t.ts(e,r,n,i),F=(t,e,r,n,i)=>t.tt(e,r,n,i),sn="WORD",v0="UWORD",jl="LOCALHOST",w0="TLD",_0="UTLD",xc="SCHEME",Ns="SLASH_SCHEME",Fw="NUM",rA="WS",qw="NL",Ys="OPENBRACE",Da="OPENBRACKET",ja="OPENANGLEBRACKET",La="OPENPAREN",Mi="CLOSEBRACE",Xs="CLOSEBRACKET",Js="CLOSEANGLEBRACKET",Ni="CLOSEPAREN",$d="AMPERSAND",Ud="APOSTROPHE",Fd="ASTERISK",$n="AT",qd="BACKSLASH",Hd="BACKTICK",zd="CARET",zn="COLON",Hw="COMMA",Wd="DOLLAR",Lr="DOT",Gd="EQUALS",zw="EXCLAMATION",Br="HYPHEN",Vd="PERCENT",Qd="PIPE",Kd="PLUS",Yd="POUND",Xd="QUERY",Ww="QUOTE",Gw="SEMI",$r="SLASH",Ba="TILDE",Jd="UNDERSCORE",nA="EMOJI",Zd="SYM";var iA=Object.freeze({__proto__:null,WORD:sn,UWORD:v0,LOCALHOST:jl,TLD:w0,UTLD:_0,SCHEME:xc,SLASH_SCHEME:Ns,NUM:Fw,WS:rA,NL:qw,OPENBRACE:Ys,OPENBRACKET:Da,OPENANGLEBRACKET:ja,OPENPAREN:La,CLOSEBRACE:Mi,CLOSEBRACKET:Xs,CLOSEANGLEBRACKET:Js,CLOSEPAREN:Ni,AMPERSAND:$d,APOSTROPHE:Ud,ASTERISK:Fd,AT:$n,BACKSLASH:qd,BACKTICK:Hd,CARET:zd,COLON:zn,COMMA:Hw,DOLLAR:Wd,DOT:Lr,EQUALS:Gd,EXCLAMATION:zw,HYPHEN:Br,PERCENT:Vd,PIPE:Qd,PLUS:Kd,POUND:Yd,QUERY:Xd,QUOTE:Ww,SEMI:Gw,SLASH:$r,TILDE:Ba,UNDERSCORE:Jd,EMOJI:nA,SYM:Zd});const As=/[a-z]/,jm=/\p{L}/u,Lm=/\p{Emoji}/u,Bm=/\d/,Fx=/\s/,qx=` +`,A$="️",I$="‍";let Ku=null,Yu=null;function O$(t){t===void 0&&(t=[]);const e={};Ut.groups=e;const r=new Ut;Ku==null&&(Ku=Hx(S$)),Yu==null&&(Yu=Hx(C$)),F(r,"'",Ud),F(r,"{",Ys),F(r,"[",Da),F(r,"<",ja),F(r,"(",La),F(r,"}",Mi),F(r,"]",Xs),F(r,">",Js),F(r,")",Ni),F(r,"&",$d),F(r,"*",Fd),F(r,"@",$n),F(r,"`",Hd),F(r,"^",zd),F(r,":",zn),F(r,",",Hw),F(r,"$",Wd),F(r,".",Lr),F(r,"=",Gd),F(r,"!",zw),F(r,"-",Br),F(r,"%",Vd),F(r,"|",Qd),F(r,"+",Kd),F(r,"#",Yd),F(r,"?",Xd),F(r,'"',Ww),F(r,"/",$r),F(r,";",Gw),F(r,"~",Ba),F(r,"_",Jd),F(r,"\\",qd);const n=Qt(r,Bm,Fw,{[p0]:!0});Qt(n,Bm,n);const i=Qt(r,As,sn,{[m0]:!0});Qt(i,As,i);const s=Qt(r,jm,v0,{[g0]:!0});Qt(s,As),Qt(s,jm,s);const o=Qt(r,Fx,rA,{[$x]:!0});F(r,qx,qw,{[$x]:!0}),F(o,qx),Qt(o,Fx,o);const a=Qt(r,Lm,nA,{[tA]:!0});Qt(a,Lm,a),F(a,A$,a);const l=F(a,I$);Qt(l,Lm,a);const u=[[As,i]],c=[[As,null],[jm,s]];for(let f=0;ff[0]>d[0]?1:-1);for(let f=0;f=0?v[y0]=!0:As.test(d)?Bm.test(d)?v[bc]=!0:v[m0]=!0:v[p0]=!0,Ux(r,d,d,v)}return Ux(r,"localhost",jl,{ascii:!0}),r.jd=new Ut(Zd),{start:r,tokens:ps({groups:e},iA)}}function R$(t,e){const r=M$(e.replace(/[A-Z]/g,a=>a.toLowerCase())),n=r.length,i=[];let s=0,o=0;for(;o=0&&(f+=r[o].length,d++),u+=r[o].length,s+=r[o].length,o++;s-=f,o-=d,u-=f,i.push({t:c.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}function M$(t){const e=[],r=t.length;let n=0;for(;n56319||n+1===r||(s=t.charCodeAt(n+1))<56320||s>57343?t[n]:t.slice(n,n+2);e.push(o),n+=o.length}return e}function Dn(t,e,r,n,i){let s;const o=e.length;for(let a=0;a=0;)s++;if(s>0){e.push(r.join(""));for(let o=parseInt(t.substring(n,n+s),10);o>0;o--)r.pop();n+=s}else r.push(t[n]),n++}return e}const $o={defaultProtocol:"http",events:null,format:zx,formatHref:zx,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function eh(t,e){e===void 0&&(e=null);let r=ps({},$o);t&&(r=ps(r,t instanceof eh?t.o:t));const n=r.ignoreTags,i=[];for(let s=0;sr?n.substring(0,r)+"…":n},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return t===void 0&&(t=$o.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,r=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",r,this),i=t.get("tagName",r,e),s=this.toFormattedString(t),o={},a=t.get("className",r,e),l=t.get("target",r,e),u=t.get("rel",r,e),c=t.getObj("attributes",r,e),f=t.getObj("events",r,e);return o.href=n,a&&(o.class=a),l&&(o.target=l),u&&(o.rel=u),c&&ps(o,c),{tagName:i,attributes:o,content:s,eventListeners:f}}};function th(t,e){class r extends oA{constructor(i,s){super(i,s),this.t=t}}for(const n in e)r.prototype[n]=e[n];return r.t=t,r}const Wx=th("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Gx=th("text"),N$=th("nl"),Ai=th("url",{isLink:!0,toHref(t){return t===void 0&&(t=$o.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==jl&&t[1].t===zn}}),Je=t=>new Ut(t);function D$(t){let{groups:e}=t;const r=e.domain.concat([$d,Fd,$n,qd,Hd,zd,Wd,Gd,Br,Fw,Vd,Qd,Kd,Yd,$r,Zd,Ba,Jd]),n=[Ud,Js,Mi,Xs,Ni,zn,Hw,Lr,zw,ja,Ys,Da,La,Xd,Ww,Gw],i=[$d,Ud,Fd,qd,Hd,zd,Mi,Wd,Gd,Br,Ys,Vd,Qd,Kd,Yd,Xd,$r,Zd,Ba,Jd],s=Je(),o=F(s,Ba);J(o,i,o),J(o,e.domain,o);const a=Je(),l=Je(),u=Je();J(s,e.domain,a),J(s,e.scheme,l),J(s,e.slashscheme,u),J(a,i,o),J(a,e.domain,a);const c=F(a,$n);F(o,$n,c),F(l,$n,c),F(u,$n,c);const f=F(o,Lr);J(f,i,o),J(f,e.domain,o);const d=Je();J(c,e.domain,d),J(d,e.domain,d);const g=F(d,Lr);J(g,e.domain,d);const v=Je(Wx);J(g,e.tld,v),J(g,e.utld,v),F(c,jl,v);const b=F(d,Br);J(b,e.domain,d),J(v,e.domain,d),F(v,Lr,g),F(v,Br,b);const w=F(v,zn);J(w,e.numeric,Wx);const p=F(a,Br),m=F(a,Lr);J(p,e.domain,a),J(m,i,o),J(m,e.domain,a);const y=Je(Ai);J(m,e.tld,y),J(m,e.utld,y),J(y,e.domain,a),J(y,i,o),F(y,Lr,m),F(y,Br,p),F(y,$n,c);const x=F(y,zn),S=Je(Ai);J(x,e.numeric,S);const k=Je(Ai),O=Je();J(k,r,k),J(k,n,O),J(O,r,k),J(O,n,O),F(y,$r,k),F(S,$r,k);const M=F(l,zn),L=F(u,zn),W=F(L,$r),ee=F(W,$r);J(l,e.domain,a),F(l,Lr,m),F(l,Br,p),J(u,e.domain,a),F(u,Lr,m),F(u,Br,p),J(M,e.domain,k),F(M,$r,k),J(ee,e.domain,k),J(ee,r,k),F(ee,$r,k);const le=F(k,Ys),he=F(k,Da),P=F(k,ja),j=F(k,La);F(O,Ys,le),F(O,Da,he),F(O,ja,P),F(O,La,j),F(le,Mi,k),F(he,Xs,k),F(P,Js,k),F(j,Ni,k),F(le,Mi,k);const Q=Je(Ai),ue=Je(Ai),$=Je(Ai),H=Je(Ai);J(le,r,Q),J(he,r,ue),J(P,r,$),J(j,r,H);const Y=Je(),se=Je(),ye=Je(),Mt=Je();return J(le,n),J(he,n),J(P,n),J(j,n),J(Q,r,Q),J(ue,r,ue),J($,r,$),J(H,r,H),J(Q,n,Q),J(ue,n,ue),J($,n,$),J(H,n,H),J(Y,r,Y),J(se,r,ue),J(ye,r,$),J(Mt,r,H),J(Y,n,Y),J(se,n,se),J(ye,n,ye),J(Mt,n,Mt),F(ue,Xs,k),F($,Js,k),F(H,Ni,k),F(Q,Mi,k),F(se,Xs,k),F(ye,Js,k),F(Mt,Ni,k),F(Y,Ni,k),F(s,jl,y),F(s,qw,N$),{start:s,tokens:iA}}function j$(t,e,r){let n=r.length,i=0,s=[],o=[];for(;i=0&&d++,i++,c++;if(d<0)i-=c,i0&&(s.push($m(Gx,e,o)),o=[]),i-=d,c-=d;const g=f.t,v=r.slice(i-c,i);s.push($m(g,e,v))}}return o.length>0&&s.push($m(Gx,e,o)),s}function $m(t,e,r){const n=r[0].s,i=r[r.length-1].e,s=e.slice(n,i);return new t(s,r)}const vt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function L$(){vt.scanner=O$(vt.customSchemes);for(let t=0;t{typeof o=="string"?n.push.apply(n,$$(o,e,r)):I.isValidElement(o)?typeof o.type=="string"&&e.ignoreTags.indexOf(o.type.toUpperCase())>=0?n.push(o):n.push(aA(o,e,r)):n.push(o)});const i=`__linkify-el-${r.elementId++}`,s=sA.assign({key:i},t.props);return I.cloneElement(t,s,n)}const U$=t=>{let e=0;const r=l=>{let{tagName:u,attributes:c,content:f}=l;return c.key=`__linkify-lnk-${e++}`,c.class&&(c.className=c.class,delete c.class),I.createElement(u,c,f)},n={key:"__linkify-wrapper"};for(const l in t)l!=="options"&&l!=="as"&&l!=="tagName"&&l!=="children"&&(n[l]=t[l]);const i=new eh(t.options,r),s=t.as||t.tagName||I.Fragment||"span",o=t.children,a=I.createElement(s,n,o);return aA(a,i,{elementId:0})};function lA(t){const{linkClassName:e,...r}=t;return _.jsx(U$,{...r,className:ie("break-words",t.className),as:"p",options:{target:"_blank",className:ie("inline rounded-[2px] underline outline-none focus:border-none focus:ring-2",e),nl2br:!0}})}function Vw(t){if(t.children)return _.jsx(lA,{...t,className:ie("border-t border-emerald-800 bg-emerald-50 px-2 py-0.5 text-xs text-emerald-700",t.className),linkClassName:"text-emerald-500 focus:ring-emerald-500 focus:ring-offset-2 focus:ring-offset-white"})}function uA(t){return t.children?_.jsx("label",{...t,className:ie("-mt-0.5 block w-full px-2 py-0.5 font-medium text-white text-shadow text-shadow-c-black/75 text-shadow-y-px",t.className)}):null}function Ir({children:t}){const{setting:e,idString:r,descriptionIdString:n}=it();if(!e)return null;switch(e.type){case"text-input":case"number-input":case"boolean-input":case"font-input":case"color-input":case"select-input":case"dropdown-input":case"image-input":case"video-input":case"audio-input":return _.jsxs(Uw,{children:[_.jsx(uA,{htmlFor:r,children:e.label}),t,_.jsx(Vw,{id:n,children:e.description})]});default:return null}}function F$(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it(),s=I.useRef(null);if(!t||t.type!=="audio-input")return null;function o(d){if(!(!t||!d))if("multiple"in t&&t.multiple){const g=Array.isArray(n)?n:[],v=d.filter(b=>!g.includes(b));v.length&&i([...g,...v])}else i(d[0])}function a(d){if(!(!t||!d))if("multiple"in t&&t.multiple){const g=Array.isArray(n)?n:[];i(g.filter(v=>v!==d))}else i(null)}function l(d){const{files:g}=d.target;if(!g||!g.length)return;const v=[];for(const b of g)v.push(`assets/${b.name}`);o(v),d.target.value=""}function u(){return t?"multiple"in t&&t.multiple?(Array.isArray(n)?n:[]).map(g=>_.jsx(Vx,{src:g,onRemove:a},g)):typeof f!="string"?null:[f].map(d=>_.jsx(Vx,{src:d,onRemove:a},d)):null}function c(){var d;(d=s.current)==null||d.click()}const f="multiple"in t&&t.multiple?Array.isArray(n)?n:[]:typeof n=="string"?n:null;return _.jsx(Ir,{children:_.jsxs("div",{className:"bg-white",children:[_.jsx("div",{className:"border-b border-emerald-800 p-2",children:_.jsxs(bn,{className:"w-full justify-center !px-1 !py-3",onClick:c,children:[_.jsx(Jr,{className:"text-xs",children:`Choose ${Array.isArray(n)?"Sounds":"a Sound"} from the Widget Assets Folder`}),_.jsx(xn,{children:Array.isArray(n)?_.jsx(Rw,{size:22,strokeWidth:2.5,className:"-mt-0.5"}):_.jsx(GB,{size:22,strokeWidth:2.5,className:"-mt-0.5"})})]})}),_.jsx("input",{className:"hidden",id:`${e}.chooseFile`,type:"file",multiple:"multiple"in t&&t.multiple,accept:"audio/*",onChange:l,ref:s,"aria-describedby":r}),(Array.isArray(n)&&n.length||typeof n=="string")&&_.jsx("div",{className:ie("grid grid-cols-1 gap-2 border-t border-emerald-800 bg-white p-2"),children:u()})]})})}function Vx({onRemove:t,...e}){var r;return _.jsxs("div",{className:"slime2-group-shadow overflow-hidden rounded border-2 border-emerald-800",children:[_.jsxs("div",{className:"title-shadow-i pointer-events-none flex rounded-t-sm font-fredoka text-white",children:[_.jsx("p",{className:"-mt-0.5 flex-1 overflow-hidden text-ellipsis whitespace-nowrap bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-0.5 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:(r=e.src)==null?void 0:r.split("/").pop()}),_.jsx("button",{className:"pointer-events-auto rounded-tr-sm bg-rose-700 p-0.5 text-white hover:bg-rose-500 focus:bg-rose-500 focus:outline-none",onClick:()=>t(e.src),children:_.jsx(Yo,{className:"drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",size:20,strokeWidth:3})})]}),_.jsx("div",{className:"flex max-h-32 flex-col items-center justify-center bg-white",children:_.jsx(q$,{...e})})]})}function q$(t){const[e,r]=I.useState(!1);return e?_.jsx("div",{className:"flex items-center justify-center p-1 pr-3",children:_.jsx("p",{className:"text-xs font-bold",children:"Sound not found in assets folder!"})}):_.jsx("audio",{controls:!0,className:"w-full rounded-none",...t,onError:()=>r(!0),onLoad:()=>r(!1)})}function H$(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="boolean-input")return null;function s(o){i(o.target.checked)}return _.jsxs(Uw,{className:ie(!n&&"border-slate-700 bg-slate-300 focus-within:border-slate-400 focus-within:bg-slate-300 focus-within:ring-slate-400"),children:[_.jsxs(uA,{htmlFor:e,className:ie("flex items-center justify-between py-1 pr-1"),children:[_.jsx("span",{className:ie("flex-1 pr-2",!n&&"text-shadow-none text-slate-600"),children:t.label}),_.jsx("input",{id:e,name:e,className:"appearance-none",type:"checkbox",onChange:s,checked:!!n,"aria-describedby":r}),_.jsx("div",{className:ie("mt-0.5 flex items-center justify-center rounded-sm bg-white px-px",!n&&"bg-slate-100"),children:n?_.jsx(mB,{size:30,strokeWidth:3,className:"text-emerald-600"}):_.jsx(Yo,{size:30,strokeWidth:3,className:"text-slate-300"})})]}),_.jsx(Vw,{className:ie(!n&&"border-slate-400 bg-slate-100 text-slate-600"),id:r,children:t.description})]})}function Qw({groupId:t=[],children:e}){return _.jsx(ZP.Provider,{value:t,children:e})}function rh(){return(rh=Object.assign||function(t){for(var e=1;e=0||(i[r]=t[r]);return i}function b0(t){var e=I.useRef(t),r=I.useRef(function(n){e.current&&e.current(n)});return e.current=t,r.current}var Uo=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t0:w.buttons>0)&&i.current?s(Qx(i.current,w,a.current)):b(!1)},v=function(){return b(!1)};function b(w){var p=l.current,m=x0(i.current),y=w?m.addEventListener:m.removeEventListener;y(p?"touchmove":"mousemove",g),y(p?"touchend":"mouseup",v)}return[function(w){var p=w.nativeEvent,m=i.current;if(m&&(Kx(p),!function(x,S){return S&&!$a(x)}(p,l.current)&&m)){if($a(p)){l.current=!0;var y=p.changedTouches||[];y.length&&(a.current=y[0].identifier)}m.focus(),s(Qx(m,p,a.current)),b(!0)}},function(w){var p=w.which||w.keyCode;p<37||p>40||(w.preventDefault(),o({left:p===39?.05:p===37?-.05:0,top:p===40?.05:p===38?-.05:0}))},b]},[o,s]),c=u[0],f=u[1],d=u[2];return I.useEffect(function(){return d},[d]),q.createElement("div",rh({},n,{onTouchStart:c,onMouseDown:c,className:"react-colorful__interactive",ref:i,onKeyDown:f,tabIndex:0,role:"slider"}))}),nh=function(t){return t.filter(Boolean).join(" ")},Yw=function(t){var e=t.color,r=t.left,n=t.top,i=n===void 0?.5:n,s=nh(["react-colorful__pointer",t.className]);return q.createElement("div",{className:s,style:{top:100*i+"%",left:100*r+"%"}},q.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},rt=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r},z$=function(t){return Q$(S0(t))},S0=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?rt(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?rt(parseInt(t.substring(6,8),16)/255,2):1}},W$=function(t){return V$(G$(t))},dA=function(t){var e=t.s,r=t.v,n=t.a,i=(200-e)*r/100;return{h:rt(t.h),s:rt(i>0&&i<200?e*r/100/(i<=100?i:200-i)*100:0),l:rt(i/2),a:rt(n,2)}},C0=function(t){var e=dA(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Um=function(t){var e=dA(t);return"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"},G$=function(t){var e=t.h,r=t.s,n=t.v,i=t.a;e=e/360*6,r/=100,n/=100;var s=Math.floor(e),o=n*(1-r),a=n*(1-(e-s)*r),l=n*(1-(1-e+s)*r),u=s%6;return{r:rt(255*[n,a,o,o,l,n][u]),g:rt(255*[l,n,n,a,o,o][u]),b:rt(255*[o,o,l,n,n,a][u]),a:rt(i,2)}},Xu=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},V$=function(t){var e=t.r,r=t.g,n=t.b,i=t.a,s=i<1?Xu(rt(255*i)):"";return"#"+Xu(e)+Xu(r)+Xu(n)+s},Q$=function(t){var e=t.r,r=t.g,n=t.b,i=t.a,s=Math.max(e,r,n),o=s-Math.min(e,r,n),a=o?s===e?(r-n)/o:s===r?2+(n-e)/o:4+(e-r)/o:0;return{h:rt(60*(a<0?a+6:a)),s:rt(s?o/s*100:0),v:rt(s/255*100),a:i}},K$=q.memo(function(t){var e=t.hue,r=t.onChange,n=nh(["react-colorful__hue",t.className]);return q.createElement("div",{className:n},q.createElement(Kw,{onMove:function(i){r({h:360*i.left})},onKey:function(i){r({h:Uo(e+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":rt(e),"aria-valuemax":"360","aria-valuemin":"0"},q.createElement(Yw,{className:"react-colorful__hue-pointer",left:e/360,color:C0({h:e,s:100,v:100,a:1})})))}),Y$=q.memo(function(t){var e=t.hsva,r=t.onChange,n={backgroundColor:C0({h:e.h,s:100,v:100,a:1})};return q.createElement("div",{className:"react-colorful__saturation",style:n},q.createElement(Kw,{onMove:function(i){r({s:100*i.left,v:100-100*i.top})},onKey:function(i){r({s:Uo(e.s+100*i.left,0,100),v:Uo(e.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+rt(e.s)+"%, Brightness "+rt(e.v)+"%"},q.createElement(Yw,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:C0(e)})))}),fA=function(t,e){if(t===e)return!0;for(var r in t)if(t[r]!==e[r])return!1;return!0},X$=function(t,e){return t.toLowerCase()===e.toLowerCase()||fA(S0(t),S0(e))};function J$(t,e,r){var n=b0(r),i=I.useState(function(){return t.toHsva(e)}),s=i[0],o=i[1],a=I.useRef({color:e,hsva:s});I.useEffect(function(){if(!t.equal(e,a.current.color)){var u=t.toHsva(e);a.current={hsva:u,color:e},o(u)}},[e,t]),I.useEffect(function(){var u;fA(s,a.current.hsva)||t.equal(u=t.fromHsva(s),a.current.color)||(a.current={hsva:s,color:u},n(u))},[s,t,n]);var l=I.useCallback(function(u){o(function(c){return Object.assign({},c,u)})},[]);return[s,l]}var Z$=typeof window<"u"?I.useLayoutEffect:I.useEffect,e9=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Yx=new Map,t9=function(t){Z$(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!Yx.has(e)){var r=e.createElement("style");r.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Yx.set(e,r);var n=e9();n&&r.setAttribute("nonce",n),e.head.appendChild(r)}},[])},r9=function(t){var e=t.className,r=t.hsva,n=t.onChange,i={backgroundImage:"linear-gradient(90deg, "+Um(Object.assign({},r,{a:0}))+", "+Um(Object.assign({},r,{a:1}))+")"},s=nh(["react-colorful__alpha",e]),o=rt(100*r.a);return q.createElement("div",{className:s},q.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),q.createElement(Kw,{onMove:function(a){n({a:a.left})},onKey:function(a){n({a:Uo(r.a+a.left)})},"aria-label":"Alpha","aria-valuetext":o+"%","aria-valuenow":o,"aria-valuemin":"0","aria-valuemax":"100"},q.createElement(Yw,{className:"react-colorful__alpha-pointer",left:r.a,color:Um(r)})))},n9=function(t){var e=t.className,r=t.colorModel,n=t.color,i=n===void 0?r.defaultColor:n,s=t.onChange,o=cA(t,["className","colorModel","color","onChange"]),a=I.useRef(null);t9(a);var l=J$(r,i,s),u=l[0],c=l[1],f=nh(["react-colorful",e]);return q.createElement("div",rh({},o,{ref:a,className:f}),q.createElement(Y$,{hsva:u,onChange:c}),q.createElement(K$,{hue:u.h,onChange:c}),q.createElement(r9,{hsva:u,onChange:c,className:"react-colorful__last-control"}))},i9={defaultColor:"0001",toHsva:z$,fromHsva:W$,equal:X$},s9=function(t){return q.createElement(n9,rh({},t,{colorModel:i9}))};const cr="block w-full bg-white px-2 py-0.5 outline-none font-radiocanada text-xs";function o9(){const{setting:t,value:e,setValue:r}=it();if(!t||t.type!=="color-input")return null;function n(a){r(a.target.value)}const i=typeof e=="string"?e:"",s=l9(i),o=a9(i);return _.jsx("div",{className:"slime2-group-shadow m-2 overflow-hidden rounded border-2 border-emerald-800 bg-white",children:_.jsxs("div",{className:"flex flex-col justify-center gap-2 divide-y divide-black pt-2",style:{backgroundColor:s},children:[_.jsx(s9,{color:s,className:"self-center drop-shadow drop-shadow-c-black/25 drop-shadow-x-0.5 drop-shadow-y-0.5",onChange:a=>r(a)}),_.jsx("div",{className:"slime2-alpha-background",children:_.jsx("input",{className:ie(cr,"text-center font-bold"),style:{backgroundColor:s,color:o},placeholder:t.placeholder,type:"text",value:i,onChange:n})})]})})}function a9(t){try{return new ll(t).alpha<.5?"black":ll.accessibleForeground(t||"white")}catch{return"black"}}function l9(t){try{return new ll(t).toString({format:"hex"})}catch{return"#00000000"}}function u9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i,groupId:s}=it(),{openWindow:o}=cu();if(!t||t.type!=="color-input")return null;function a(u){i(u.target.value)}const l=typeof n=="string"?n:"";return _.jsx(Ir,{children:_.jsxs("div",{className:"flex bg-white",children:[_.jsx("input",{id:e,name:e,className:ie(cr,"flex-1"),placeholder:t.placeholder,type:"text",value:l,"aria-describedby":r,onChange:a}),_.jsx("button",{className:"flex w-44 items-stretch p-0.5",title:"Open Color Picker",onClick:u=>{o({id:`slime2window.${e}`,title:"Color Picker",icon:AB,children:_.jsx(Qw,{groupId:s,children:_.jsx(Zf,{value:t,children:_.jsx(o9,{})})})}),u.stopPropagation()},children:_.jsx("div",{className:"slime2-alpha-background flex-1 rounded-sm border-2 border-black",children:_.jsx("div",{className:"btn-shadow-i h-full w-full",style:{backgroundColor:c9(l)},children:_.jsx("span",{className:"sr-only",children:"Open Color Picker"})})})})]})})}function c9(t){try{return new ll(t).toString({format:"hex"})}catch{return"#00000000"}}function d9(){var a;const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="dropdown-input")return null;function s(l){if(!t||t.type!=="dropdown-input")return null;const u=t.options.find(c=>c.label===l.target.value);i(u?u.value:null)}const o=(a=t.options.find(l=>l.value===n))==null?void 0:a.label;return _.jsx(Ir,{children:_.jsx("div",{className:"bg-white px-1",children:_.jsxs("select",{id:e,"aria-describedby":r,value:o,name:e,onChange:s,className:ie(cr,"pl-0",!n&&"text-gray-400"),children:[_.jsx("option",{value:"",className:"text-gray-400",children:t.placeholder?t.placeholder:"Choose an option"}),t.options.map(l=>{const{label:u}=l;return _.jsx("option",{value:u,className:"text-black",children:u},u)})]})})})}function E0(){return E0=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(r[i]=t[i]);return r}var h9=I.useLayoutEffect,p9=function(e){var r=I.useRef(e);return h9(function(){r.current=e}),r},Xx=function(e,r){if(typeof e=="function"){e(r);return}e.current=r},m9=function(e,r){var n=I.useRef();return I.useCallback(function(i){e.current=i,n.current&&Xx(n.current,null),n.current=r,r&&Xx(r,i)},[r])},Jx={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},g9=function(e){Object.keys(Jx).forEach(function(r){e.style.setProperty(r,Jx[r],"important")})},Zx=g9,gt=null,eS=function(e,r){var n=e.scrollHeight;return r.sizingStyle.boxSizing==="border-box"?n+r.borderSize:n-r.paddingSize};function y9(t,e,r,n){r===void 0&&(r=1),n===void 0&&(n=1/0),gt||(gt=document.createElement("textarea"),gt.setAttribute("tabindex","-1"),gt.setAttribute("aria-hidden","true"),Zx(gt)),gt.parentNode===null&&document.body.appendChild(gt);var i=t.paddingSize,s=t.borderSize,o=t.sizingStyle,a=o.boxSizing;Object.keys(o).forEach(function(d){var g=d;gt.style[g]=o[g]}),Zx(gt),gt.value=e;var l=eS(gt,t);gt.value=e,l=eS(gt,t),gt.value="x";var u=gt.scrollHeight-i,c=u*r;a==="border-box"&&(c=c+i+s),l=Math.max(c,l);var f=u*n;return a==="border-box"&&(f=f+i+s),l=Math.min(f,l),[l,u]}var tS=function(){},v9=function(e,r){return e.reduce(function(n,i){return n[i]=r[i],n},{})},w9=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],_9=!!document.documentElement.currentStyle,b9=function(e){var r=window.getComputedStyle(e);if(r===null)return null;var n=v9(w9,r),i=n.boxSizing;if(i==="")return null;_9&&i==="border-box"&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px");var s=parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),o=parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth);return{sizingStyle:n,paddingSize:s,borderSize:o}},x9=b9;function hA(t,e,r){var n=p9(r);I.useLayoutEffect(function(){var i=function(o){return n.current(o)};if(t)return t.addEventListener(e,i),function(){return t.removeEventListener(e,i)}},[])}var S9=function(e){hA(window,"resize",e)},C9=function(e){hA(document.fonts,"loadingdone",e)},E9=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],T9=function(e,r){var n=e.cacheMeasurements,i=e.maxRows,s=e.minRows,o=e.onChange,a=o===void 0?tS:o,l=e.onHeightChange,u=l===void 0?tS:l,c=f9(e,E9),f=c.value!==void 0,d=I.useRef(null),g=m9(d,r),v=I.useRef(0),b=I.useRef(),w=function(){var y=d.current,x=n&&b.current?b.current:x9(y);if(x){b.current=x;var S=y9(x,y.value||y.placeholder||"x",s,i),k=S[0],O=S[1];v.current!==k&&(v.current=k,y.style.setProperty("height",k+"px","important"),u(k,{rowHeight:O}))}},p=function(y){f||w(),a(y)};return I.useLayoutEffect(w),S9(w),C9(w),I.createElement("textarea",E0({},c,{onChange:p,ref:g}))},pA=I.forwardRef(T9);function k9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it(),[s,o]=I.useState("");if(!t||t.type!=="font-input")return null;function a(u){i(u.target.value)}const l=typeof n=="string"?n:"";return _.jsx(Ir,{children:_.jsxs("div",{className:"flex flex-col divide-y divide-emerald-800 bg-white",children:[_.jsxs("div",{className:"flex divide-x divide-emerald-800 ",children:[_.jsx("input",{type:"text",id:e,name:e,className:ie(cr,"flex-1"),placeholder:"Type in a font name","aria-describedby":r,value:l,onChange:a}),_.jsx("div",{className:"flex-1 pl-1",children:_.jsxs("select",{className:ie(cr,"!px-0 text-[16px]",(!s||!Fm.includes(l))&&"text-gray-400"),onChange:u=>{o(u.target.value),i(u.target.value)},value:l,style:{fontFamily:Fm.includes(l)?l:"Radio Canada"},children:[_.jsx("option",{value:"",className:"font-radiocanada text-gray-400",children:"Font Selector"}),Fm.map(u=>_.jsx("option",{value:u,className:"text-base text-black",style:{fontFamily:u},children:u},u))]})})]}),_.jsx(pA,{className:ie(cr,"resize-none overflow-auto scrollbar-thin scrollbar-track-emerald-800/25 scrollbar-thumb-emerald-800 scrollbar-track-rounded-none scrollbar-thumb-rounded-none hover:scrollbar-thumb-emerald-700 active:scrollbar-thumb-emerald-600"),defaultValue:"Font Preview: The quick brown fox jumps over the lazy dog",style:{fontFamily:l}})]})})}const Fm=["Al Bayan","American Typewriter","Andalé Mono","Apple Casual","Apple Chancery","Apple Garamond","Apple Gothic","Apple LiGothic","Apple LiSung","Apple Myungjo","AquaKana","Arial","Arial Black","Arial Hebrew","Avant Garde","Ayuthaya","Baghdad","Bahnschrift","Baskerville","Beijing","BiauKai","Bookman","Big Caslon","Browallia New","BrowalliaUPC","Brush Script","Calibri","Cambria","Cambria Math","Candara","Cascadia Code","Cascadia Mono","Century Gothic","Chalkboard","Chalkduster","Charcoal","Charcoal CY","Chicago","Cochin","Comic Sans","Comic Sans MS","Consolas","Constantia","Cooper","Copperplate","Corbel","Corsiva Hebrew","Courier","Courier New","DecoType Naskh","Devanagari","Didot","Ebrima","Euphemia UCAS","Franklin Gothic Medium","Futura","Gabriola","Gadget","Gadugi","Garamond","Geeza Pro","Geezah","Geneva","Geneva CY","Georgia","Gill Sans","Gujarati","Gung Seoche","Gurmukhi","Hangangche","HeadlineA","Hei","Helvetica","Helvetica CY","Helvetica Neue","Herculanum","Hiragino Kaku Gothic Pro","Hiragino Kaku Gothic ProN","Hiragino Kaku Gothic Std","Hiragino Kaku Gothic StdN","Hiragino Maru Gothic Pro","Hiragino Maru Gothic ProN","Hiragino Mincho Pro","Hiragino Mincho ProN","Hoefler Text","Inai Mathi","Impact","Ink Free","Javanese Text","Jung Gothic","Kai","Keyboard","Krungthep","KufiStandard GK","Kuenstler Script","LastResort","Leelawadee UI","LiHei Pro","LiSong Pro","Lucida","Lucida Console","Lucida Grande","Lucida Sans","Lucida Sans Unicode","Malgun Gothic","Marker Felt","Menlo","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Sans Serif","Microsoft Tai Le","Microsoft YaHei","Microsoft Yi Baiti","MingLiU-ExtB","Monaco","Monaco CY","Mongolian Baiti","MS Gothic","MS Serif","Mshtakan","MV Boli","Myanmar Text","Nadeem","New Peninim","New York","Nirmala UI","NISC GB18030","Noto Sans","Optima","Osaka","Palatino","Palatino Linotype","Papyrus","PC Myungjo","Pilgiche","Plantagenet Cherokee","Raanana","Rockwell","San Francisco","Sand","Sathu","Segoe Print","Segoe Script","Segoe UI","Seoul","SimSun","Sitka","Shin Myungjo Neue","Silom","Skia","Snell Roundhand","ST FangSong","ST FangSong 2","ST Heiti","ST Kaiti","ST Song","Sylfaen","Tae Graphic","Tahoma","Taipei","Techno","Textile","Thonburi","Times","Times CY","Times New Roman","Trebuchet MS","Verdana","Yu Gothic","Zapf Chancery","Zapfino"];function mA(){const{setting:t,idString:e}=it();return!t||t.type!=="text-display"||!t.label?null:_.jsx("div",{className:"slime2-group-shadow -mx-1 rounded border-2 border-emerald-800 bg-green-700 px-2 py-1 font-medium text-white text-shadow text-shadow-c-black/75 text-shadow-y-px",children:_.jsx(lA,{id:e,linkClassName:"text-lime-200 focus:ring-lime-200 focus:ring-offset-2 focus:ring-offset-green-700",children:t.label})})}function P9(){const{setting:t,value:e,groupId:r}=it(),{addGroupMultiple:n,copyGroupMultiple:i,removeGroupMultiple:s,moveGroupMultiple:o}=xf(),a=I.useRef();function l(){return a.current||(a.current=new Map),a.current}function u(c,f){const g=l().get(e[c].__id),v=g==null?void 0:g.getElementsByClassName(f).item(0);v==null||v.focus()}return!t||t.type!=="group"||!("multiple"in t&&t.multiple)||!Array.isArray(e)?null:_.jsxs("div",{className:"flex flex-col gap-3 p-2",children:[t.description&&_.jsx(Zf,{value:{type:"text-display",id:`${t.id}.description`,label:t.description},children:_.jsx(mA,{})}),e.map((c,f)=>{const d=f===0,g=f===e.length-1,{__id:v}=c;return _.jsxs("div",{className:"slime2-group-shadow rounded border-2 border-green-700 bg-lime-200",ref:b=>{const w=l();b?w.set(v,b):w.delete(v)},children:[_.jsxs("div",{className:"title-shadow-i pointer-events-none flex justify-between overflow-hidden rounded-t-sm font-fredoka text-white",children:[_.jsxs("button",{className:"pointer-events-auto flex items-center gap-1 border-r border-r-emerald-800 bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px] hover:from-lime-400 hover:to-emerald-600 focus:from-lime-400 focus:to-emerald-600 focus:outline-none active:from-lime-500/90 active:to-emerald-600/90",onClick:()=>{i(r,t.id,f)},children:[_.jsx(SB,{size:20,strokeWidth:2.5,className:"-mt-0.5 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px"}),_.jsx("p",{className:"-mt-1 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:"Copy"})]}),_.jsx("div",{className:"flex-1 bg-gradient-to-b from-lime-600 to-emerald-700"}),_.jsx("button",{className:ie(!d&&"pointer-events-auto border-x border-x-emerald-800 hover:from-lime-400 hover:to-emerald-600 focus:from-lime-400 focus:to-emerald-600 active:from-lime-500/90 active:to-emerald-600/90","slime2-move-up flex items-center gap-1 bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px] focus:outline-none"),disabled:d,onClick:()=>{o(r,t.id,f,f-1),u(f-1,"slime2-move-up")},children:_.jsx(fB,{size:20,strokeWidth:2.5,className:ie("-mt-0.5 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",d&&"opacity-0")})}),_.jsx("div",{className:"flex items-center bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px]",children:_.jsx("p",{className:ie("-mt-1 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",e.length<2&&"opacity-0"),children:"Move"})}),_.jsx("button",{className:ie(!g&&"pointer-events-auto border-x border-x-emerald-800 hover:from-lime-400 hover:to-emerald-600 focus:from-lime-400 focus:to-emerald-600 active:from-lime-500/90 active:to-emerald-600/90","slime2-move-down flex items-center gap-1 bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px] focus:outline-none"),disabled:g,onClick:()=>{o(r,t.id,f,f+1),u(f+1,"slime2-move-down")},children:_.jsx(uB,{size:20,strokeWidth:2.5,className:ie("-mt-0.5 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",g&&"opacity-0")})}),_.jsx("div",{className:"flex-1 bg-gradient-to-b from-lime-600 to-emerald-700"}),_.jsxs("button",{className:"pointer-events-auto flex items-center gap-1 border-l border-l-emerald-800 bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-[8px] hover:from-rose-600 hover:to-red-900 focus:from-rose-600 focus:to-red-900 focus:outline-none",onClick:()=>{confirm("Are you sure you want to delete this?")&&s(r,t.id,f)},children:[_.jsx("p",{className:"-mt-1 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:"Delete"}),_.jsx(RB,{size:20,strokeWidth:2.5,className:"-mt-0.5 drop-shadow drop-shadow-c-black/75 drop-shadow-y-px"})]})]}),_.jsx(Qw,{groupId:[...r,{id:t.id,index:f}],children:_.jsx(Xw,{settings:t.settings})})]},v)}),_.jsxs(bn,{onClick:()=>{n(r,t.id,t.settings)},className:"justify-center",children:[_.jsx(Jr,{children:"Add New"}),_.jsx(xn,{children:_.jsx(DB,{className:"-mt-0.5"})})]})]})}function A9(){const t=JP(),{openWindow:e}=cu(),{setting:r,idString:n}=it();if(!r||r.type!=="group")return null;const i="multiple"in r&&r.multiple,s={strokeWidth:3,size:30,className:"-mt-0.5"};return _.jsxs(bn,{id:n,className:"-my-0.5 w-full justify-between py-2",onClick:o=>{e({id:`slime2window.${n}`,icon:BB,title:r.label||"",className:"w-96",children:_.jsx(Qw,{groupId:i?t:[...t,{id:r.id}],children:i?_.jsx(Zf,{value:r,children:_.jsx(P9,{})}):_.jsx(Xw,{settings:r.settings})})}),o.stopPropagation()},children:[_.jsx(Jr,{children:r.label}),_.jsx(xn,{children:i?_.jsx(_B,{...s}):_.jsx(KP,{...s})})]})}function gA(t){const[e,r]=I.useState(!1);if(e){const n=!t.src||t.src.startsWith("http://")||t.src.startsWith("https://");return _.jsx("div",{className:"flex items-center justify-center p-1 pr-3",children:_.jsx("p",{className:"text-xs font-bold",children:n?"Image failed to load!":"Image not found in assets folder!"})})}return _.jsx("img",{...t,onError:()=>r(!0),onLoad:()=>r(!1)})}function I9(){const{setting:t,idString:e,descriptionIdString:r}=it();return!t||t.type!=="image-display"||!t.url?null:_.jsxs("div",{className:"slime2-group-shadow flex flex-col items-center justify-center overflow-hidden rounded border-2 border-emerald-800 bg-white",children:[t.label&&_.jsx("p",{id:r,className:"-mt-0.5 block w-full bg-green-700 px-2 py-0.5 font-medium text-white text-shadow text-shadow-c-black/75 text-shadow-y-px",children:t.label}),_.jsx(gA,{className:"max-h-96",src:t.url,alt:t.alt,title:t.alt,id:e,"aria-describedby":r})]})}function O9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it(),[s,o]=I.useState(""),a=I.useRef(null);if(!t||t.type!=="image-input")return null;function l(){t&&s&&(o(""),u([s.trim()]))}function u(p){if(!t||!p)return;const m=p.map(y=>y.startsWith("http://")||y.startsWith("https://")?y:`assets/${y}`);if("multiple"in t&&t.multiple){const y=Array.isArray(n)?n:[],x=m.filter(S=>!y.includes(S));x.length&&i([...y,...x])}else m[0]&&i(m[0])}function c(p){if(!(!t||!p))if("multiple"in t&&t.multiple){const m=Array.isArray(n)?n:[];i(m.filter(y=>y!==p))}else i(null)}function f(p){p.nativeEvent.isComposing||p.keyCode===229||p.key==="Enter"&&l()}function d(p){o(p.target.value)}function g(p){const{files:m}=p.target;if(!m||!m.length)return;const y=[];for(const x of m)y.push(x.name);u(y),p.target.value=""}function v(){return t?"multiple"in t&&t.multiple?(Array.isArray(n)?n:[]).map(m=>_.jsx(rS,{src:m,onRemove:c},m)):typeof w!="string"?null:[w].map(p=>_.jsx(rS,{src:p,onRemove:c},p)):null}function b(){var p;(p=a.current)==null||p.click()}const w="multiple"in t&&t.multiple?Array.isArray(n)?n:[]:typeof n=="string"?n:null;return _.jsx(Ir,{children:_.jsxs("div",{className:"bg-white",children:[_.jsx("div",{className:"border-b border-emerald-800 p-2",children:_.jsxs(bn,{className:"w-full justify-center !px-1 !py-3",onClick:b,children:[_.jsx(Jr,{className:"text-xs",children:`Choose ${Array.isArray(n)?"Images":"an Image"} from the Widget Assets Folder`}),_.jsx(xn,{children:Array.isArray(n)?_.jsx(Rw,{size:22,strokeWidth:2.5,className:"-mt-0.5"}):_.jsx(HB,{size:22,strokeWidth:2.5,className:"-mt-0.5"})})]})}),_.jsx("input",{id:e,value:s,className:ie(cr,"text-center"),"aria-describedby":r,placeholder:"...or paste in a remote image URL and press enter",type:"text",onChange:d,onKeyDown:f}),_.jsx("input",{className:"hidden",id:`${e}.chooseFile`,type:"file",multiple:"multiple"in t&&t.multiple,accept:"image/*",onChange:g,ref:a}),(Array.isArray(n)&&n.length||typeof n=="string")&&_.jsx("div",{className:ie("grid grid-cols-1 gap-2 border-t border-emerald-800 bg-white p-2",Array.isArray(n)&&{"grid-cols-3":n.length>2,"grid-cols-2":n.length===2}),children:v()})]})})}function rS({onRemove:t,...e}){var r;return _.jsxs("div",{className:"slime2-group-shadow flex flex-col overflow-hidden rounded border-2 border-emerald-800",children:[_.jsxs("div",{className:"title-shadow-i pointer-events-none flex rounded-t-sm font-fredoka text-white",children:[_.jsx("p",{className:"-mt-0.5 flex-1 overflow-hidden text-ellipsis whitespace-nowrap bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-0.5 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:(r=e.src)==null?void 0:r.split("/").pop()}),_.jsx("button",{className:"pointer-events-auto rounded-tr-sm bg-rose-700 p-0.5 text-white hover:bg-rose-500 focus:bg-rose-500 focus:outline-none",onClick:()=>t(e.src),children:_.jsx(Yo,{className:"drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",size:20,strokeWidth:3})})]}),_.jsx("div",{className:"flex flex-1 flex-col items-center justify-center bg-white",children:_.jsx(gA,{...e,className:"max-h-32"})})]})}function R9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="number-input")return null;function s(o){const a=Number.parseInt(o.target.value);i(Number.isNaN(a)?null:a)}return t.slider?_.jsx(M9,{}):_.jsx(Ir,{children:_.jsx("input",{id:e,name:e,className:cr,type:"number",onChange:s,value:typeof n=="number"?n.toString():"",min:t.min,max:t.max,step:t.step,placeholder:t.placeholder,"aria-describedby":r})})}function M9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="number-input")return null;function s(u){const c=Number.parseFloat(u.target.value);i(Number.isNaN(c)?null:c)}const o=typeof n=="number"?n:"",a=typeof t.min=="number"?t.min:0,l=typeof t.max=="number"?t.max:100;return _.jsx(Ir,{children:_.jsxs("div",{className:"flex divide-x divide-emerald-800",children:[_.jsxs("div",{className:ie(cr,"flex flex-1 py-1"),children:[_.jsx("p",{children:a}),_.jsx("input",{id:e,name:e,className:"mx-1 flex-1 focus:outline-offset-2 focus:outline-emerald-600",type:"range",onChange:s,value:o.toString(),min:a,max:l,step:t.step,"aria-describedby":r}),_.jsx("p",{children:l})]}),_.jsx("input",{id:`${e}.numberSliderOutput`,name:`${e}.numberSliderOutput`,className:ie(cr,"!w-16 pr-0.5 text-center"),type:"number",onChange:s,value:o.toString(),min:a,max:l,step:t.step,placeholder:t.placeholder,"aria-describedby":r})]})})}function N9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="select-input")return null;function s(o){if(!t||t.type!=="select-input")return null;const a=t.options.find(l=>l.label===o.target.value);if(a)if("multiple"in t&&t.multiple){const l=Array.isArray(n)?n:[];o.target.checked?l.includes(a.value)||i([...l,a.value]):i(l.filter(u=>u!==a.value))}else i(a.value)}return _.jsxs(Uw,{children:[_.jsxs("fieldset",{"aria-describedby":r,children:[_.jsx("legend",{className:ie("-mt-0.5 block w-full px-2 py-0.5 font-medium text-white text-shadow text-shadow-c-black/75 text-shadow-y-px"),children:t.label}),_.jsx("div",{className:ie(cr,"pb-0 pt-2"),children:t.options.map(o=>{const a=`${e}.${o.label}`,l="multiple"in t&&t.multiple?(Array.isArray(n)?n:[]).includes(o.value):n===o.value;return _.jsxs("label",{htmlFor:a,className:"",children:[_.jsx("input",{id:a,value:o.label,name:e,onChange:s,className:"peer appearance-none",checked:l,type:"multiple"in t&&t.multiple?"checkbox":"radio"}),_.jsx("span",{className:ie(" mb-2 mr-2 inline-block rounded border-2 p-1 peer-focus:outline peer-focus:outline-2 peer-focus:outline-offset-2 peer-focus:outline-emerald-800 hover:outline hover:outline-2 hover:outline-offset-2 hover:outline-emerald-800",!l&&"border-slate-400 text-slate-500",l&&"slime2-tag-shadow border-emerald-800 bg-green-700 text-white"),children:o.label})]},a)})})]}),_.jsx(Vw,{id:r,children:t.description})]})}function D9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it();if(!t||t.type!=="text-input")return null;function s(l){i(l.target.value)}const o={id:e,name:e,className:cr,onChange:s,placeholder:t.placeholder,"aria-describedby":r},a=typeof n=="string"?n:"";return"multiple"in t&&t.multiple?_.jsx(L9,{...o,value:Array.isArray(n)?n:[],setValue:i}):t.multiline?_.jsx(j9,{...o,value:a}):_.jsx(Ir,{children:_.jsx("input",{...o,type:"text",value:a})})}function j9(t){const{style:e,ref:r,className:n,...i}=t;return _.jsx(Ir,{children:_.jsx(pA,{...i,className:ie("resize-none overflow-auto border-none scrollbar-thin scrollbar-track-emerald-800/25 scrollbar-thumb-emerald-800 scrollbar-track-rounded-none scrollbar-thumb-rounded-none hover:scrollbar-thumb-emerald-700 active:scrollbar-thumb-emerald-600",n),minRows:4})})}function L9(t){const{value:e,setValue:r,...n}=t,i=Array.isArray(e)?e:[],[s,o]=I.useState("");function a(){if(s&&!i.includes(s)){o("");const f=s.trim();f&&r([...e,f])}}function l(f){r(e.filter(d=>d!==f))}function u(f){f.nativeEvent.isComposing||f.keyCode===229||f.key==="Enter"&&a()}function c(f){o(f.target.value)}return _.jsx(Ir,{children:_.jsxs("div",{className:"bg-white",children:[_.jsx("input",{...n,type:"text",onKeyDown:u,onBlur:a,value:s,onChange:c}),_.jsx("div",{className:ie("flex flex-wrap gap-1 border-t border-emerald-800 p-1 text-[16px] font-semibold",!i.length&&"hidden"),children:i.map(f=>_.jsxs("div",{className:"slime2-tag-shadow flex items-center gap-1 rounded-sm border-2 border-emerald-800 bg-green-700 px-1 text-white text-shadow text-shadow-c-black/75 text-shadow-y-px",children:[_.jsx("p",{children:f}),_.jsx("button",{className:"my-1 rounded-sm bg-green-500/50 hover:bg-rose-500 focus:bg-rose-500 focus:outline-none",onClick:()=>l(f),children:_.jsx(Yo,{className:"drop-shadow drop-shadow-c-black/50 drop-shadow-y-px",size:18,strokeWidth:3})})]},f))})]})})}function B9(){const{setting:t,idString:e,descriptionIdString:r,value:n,setValue:i}=it(),s=I.useRef(null);if(!t||t.type!=="video-input")return null;function o(d){if(!(!t||!d))if("multiple"in t&&t.multiple){const g=Array.isArray(n)?n:[],v=d.filter(b=>!g.includes(b));v.length&&i([...g,...v])}else i(d[0])}function a(d){if(!(!t||!d))if("multiple"in t&&t.multiple){const g=Array.isArray(n)?n:[];i(g.filter(v=>v!==d))}else i(null)}function l(d){const{files:g}=d.target;if(!g||!g.length)return;const v=[];for(const b of g)v.push(`assets/${b.name}`);o(v),d.target.value=""}function u(){return t?"multiple"in t&&t.multiple?(Array.isArray(n)?n:[]).map(g=>_.jsx(nS,{src:g,onRemove:a},g)):typeof f!="string"?null:[f].map(d=>_.jsx(nS,{src:d,onRemove:a},d)):null}function c(){var d;(d=s.current)==null||d.click()}const f="multiple"in t&&t.multiple?Array.isArray(n)?n:[]:typeof n=="string"?n:null;return _.jsx(Ir,{children:_.jsxs("div",{className:"bg-white",children:[_.jsx("div",{className:"border-b border-emerald-800 p-2",children:_.jsxs(bn,{className:"w-full justify-center !px-1 !py-3",onClick:c,children:[_.jsx(Jr,{className:"text-xs",children:`Choose ${Array.isArray(n)?"Videos":"a Video"} from the Widget Assets Folder`}),_.jsx(xn,{children:Array.isArray(n)?_.jsx(Rw,{size:22,strokeWidth:2.5,className:"-mt-0.5"}):_.jsx(n$,{size:22,strokeWidth:2.5,className:"-mt-0.5"})})]})}),_.jsx("input",{className:"hidden",id:`${e}.chooseFile`,type:"file",multiple:"multiple"in t&&t.multiple,accept:"video/*",onChange:l,ref:s,"aria-describedby":r}),(Array.isArray(n)&&n.length||typeof n=="string")&&_.jsx("div",{className:ie("grid grid-cols-1 gap-2 border-t border-emerald-800 bg-white p-2",Array.isArray(n)&&{"grid-cols-2":n.length>1}),children:u()})]})})}function nS({onRemove:t,...e}){var r;return _.jsxs("div",{className:"slime2-group-shadow flex flex-col overflow-hidden rounded border-2 border-emerald-800",children:[_.jsxs("div",{className:"title-shadow-i pointer-events-none flex rounded-t-sm font-fredoka text-white",children:[_.jsx("p",{className:"-mt-0.5 flex-1 overflow-hidden text-ellipsis whitespace-nowrap bg-gradient-to-b from-lime-600 to-emerald-700 px-2 py-0.5 text-xs font-medium text-shadow text-shadow-c-black/75 text-shadow-y-px",children:(r=e.src)==null?void 0:r.split("/").pop()}),_.jsx("button",{className:"pointer-events-auto rounded-tr-sm bg-rose-700 p-0.5 text-white hover:bg-rose-500 focus:bg-rose-500 focus:outline-none",onClick:()=>t(e.src),children:_.jsx(Yo,{className:"drop-shadow drop-shadow-c-black/75 drop-shadow-y-px",size:20,strokeWidth:3})})]}),_.jsx("div",{className:"flex flex-1 flex-col items-center justify-center",children:_.jsx($9,{...e})})]})}function $9(t){const[e,r]=I.useState(!1);return e?_.jsx("div",{className:"flex items-center justify-center p-1 pr-3",children:_.jsx("p",{className:"text-xs font-bold",children:"Video not found in assets folder!"})}):_.jsx("video",{controls:!0,className:"max-h-60",children:_.jsx("source",{...t,onError:()=>r(!0),onLoad:()=>r(!1)})})}function U9(){const{setting:t,idString:e,groupId:r}=it();return!t||t.type!=="button"?null:_.jsxs(bn,{id:e,onClick:()=>t.onClick(r,t.id),className:"justify-center",children:[_.jsx(xn,{children:_.jsx(YP,{strokeWidth:3,size:24,className:"-mt-0.5"})}),_.jsx(Jr,{children:t.label})]})}function F9(t){function e(){switch(t.type){case"group":return _.jsx(A9,{});case"button":return _.jsx(U9,{});case"text-input":return _.jsx(D9,{});case"number-input":return _.jsx(R9,{});case"boolean-input":return _.jsx(H$,{});case"color-input":return _.jsx(u9,{});case"font-input":return _.jsx(k9,{});case"image-input":return _.jsx(O9,{});case"video-input":return _.jsx(B9,{});case"audio-input":return _.jsx(F$,{});case"select-input":return _.jsx(N9,{});case"dropdown-input":return _.jsx(d9,{});case"text-display":return _.jsx(mA,{});case"image-display":return _.jsx(I9,{});default:return null}}return _.jsx(Zf,{value:t,children:e()})}function Xw({settings:t}){return _.jsx("div",{className:"flex flex-col gap-2 p-2",children:t.map(e=>_.jsx(F9,{...e},e.id))})}function q9(){const{unsavedChanges:t}=bf();return t?_.jsxs("div",{className:"flex flex-col items-center gap-2 border-t-2 border-t-emerald-800 bg-green-700 p-2",children:[_.jsx("p",{className:"font-radiocanada text-xs font-semibold text-white",children:"You have some unsaved changes."}),_.jsx(XP,{})]}):null}function H9(){const{openWindow:t}=cu(),{unsavedChanges:e}=bf(),{widgetSettings:r}=wn();return I.useEffect(()=>{function n(i){e&&(i.preventDefault(),i.returnValue=!0,t({id:"slime2window.unsavedChanges",icon:oB,title:"You have unsaved changes!",className:"w-80",children:_.jsxs("div",{className:"flex flex-col gap-3 p-2",children:[_.jsxs("p",{className:"font-radiocanada text-sm",children:["To see your changes in ",_.jsx("span",{className:"font-bold",children:"OBS"})," ","(or other streaming software),"," ",_.jsx("span",{className:"font-bold",children:"download and save your widget data!"})]}),_.jsx(XP,{})]})},{x:window.innerWidth/3,y:window.innerHeight/2}))}return addEventListener("beforeunload",n),()=>{removeEventListener("beforeunload",n)}},[e,t]),!r||!r.length?null:_.jsxs(bn,{onClick:n=>{t({id:"widget-settings",icon:XB,title:"Widget Settings",className:"w-96",children:_.jsx(Xw,{settings:r}),footer:_.jsx(q9,{})}),n.stopPropagation()},className:"justify-between",children:[_.jsx(Jr,{children:"Widget Settings"}),_.jsx(xn,{children:_.jsx(KP,{strokeWidth:3,size:30,className:"-mt-0.5"})})]})}function z9(){const{platforms:t}=wn();return _.jsxs("div",{className:"flex flex-col justify-center gap-2 p-3",children:[_.jsx(H9,{}),t.includes("twitch")&&_.jsx(x$,{})]})}function W9({children:t}){const e=[{id:"slime2window.tools",icon:e$,title:"Tools",children:_.jsx(z9,{})}],[r,n]=I.useReducer(hL,e);return _.jsx(NP.Provider,{value:r,children:_.jsx(DP.Provider,{value:n,children:t})})}const G9=eg.createRoot(document.getElementById("slime2-root")),V9=new vI;G9.render(_.jsx(q.StrictMode,{children:_.jsx(c$,{children:_.jsx(xI,{client:V9,children:_.jsx(p$,{children:_.jsx(W9,{children:_.jsx(h$,{children:_.jsx(f$,{children:_.jsxs(d$,{children:[_.jsx(uL,{}),_.jsx(nL,{}),_.jsx(u$,{})]})})})})})})})}));