{"version":3,"sources":["../src/connectors/libs/index.ts","../src/Constants.ts","../package.json","../src/Utils.ts","../src/connectors/Connector.ts","../src/connectors/libs/DiscordJS.ts","../src/connectors/libs/Eris.ts","../src/connectors/libs/OceanicJS.ts","../src/connectors/libs/Seyfert.ts","../src/guild/Connection.ts","../src/guild/Player.ts","../src/node/Node.ts","../src/node/Rest.ts","../src/Shoukaku.ts"],"sourcesContent":["export * from './DiscordJS';\nexport * from './Eris';\nexport * from './OceanicJS';\nexport * from './Seyfert';\n","import Info from '../package.json';\nimport type { NodeOption, ShoukakuOptions } from './Shoukaku';\n\nexport enum State {\n\tCONNECTING,\n\tCONNECTED,\n\tDISCONNECTING,\n\tDISCONNECTED\n}\n\nexport enum VoiceState {\n\tSESSION_READY,\n\tSESSION_ID_MISSING,\n\tSESSION_ENDPOINT_MISSING,\n\tSESSION_FAILED_UPDATE\n}\n\nexport enum OpCodes {\n\tPLAYER_UPDATE = 'playerUpdate',\n\tSTATS = 'stats',\n\tEVENT = 'event',\n\tREADY = 'ready'\n}\n\nexport const Versions = {\n\tREST_VERSION: 4,\n\tWEBSOCKET_VERSION: 4\n};\n\nexport const ShoukakuDefaults: Required<ShoukakuOptions> = {\n\tresume: false,\n\tresumeTimeout: 30,\n\tresumeByLibrary: false,\n\treconnectTries: 3,\n\treconnectInterval: 5,\n\trestTimeout: 60,\n\tmoveOnDisconnect: false,\n\tuserAgent: 'Discord Bot/unknown (https://github.com/shipgirlproject/Shoukaku.git)',\n\tstructures: {},\n\tvoiceConnectionTimeout: 15,\n\tnodeResolver: (nodes) => [ ...nodes.values() ]\n\t\t.filter(node => node.state === State.CONNECTED)\n\t\t.sort((a, b) => a.penalties - b.penalties)\n\t\t.shift()\n};\n\nexport const ShoukakuClientInfo = `${Info.name}/${Info.version} (${Info.repository.url})`;\n\nexport const NodeDefaults: NodeOption = {\n\tname: 'Default',\n\turl: '',\n\tauth: '',\n\tsecure: false,\n\tgroup: undefined\n};\n","{\n  \"name\": \"shoukaku\",\n  \"version\": \"4.3.0\",\n  \"description\": \"A stable and updated wrapper around Lavalink\",\n  \"main\": \"dist/index.js\",\n  \"module\": \"dist/index.mjs\",\n  \"types\": \"dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"import\": \"./dist/index.mjs\",\n      \"require\": \"./dist/index.js\"\n    }\n  },\n  \"scripts\": {\n    \"build\": \"npm run build:ts && npm run build:docs\",\n    \"build:ts\": \"tsup --config tsup-config.json\",\n    \"build:docs\": \"typedoc\",\n    \"lint\": \"eslint .\",\n    \"prepare\": \"npm run build:ts\"\n  },\n  \"keywords\": [\n    \"bot\",\n    \"music\",\n    \"lavalink\",\n    \"api\",\n    \"discord\",\n    \"lavalink.js\",\n    \"discord.js\",\n    \"lavalink-api\",\n    \"weeb-library\"\n  ],\n  \"engines\": {\n    \"node\": \">=18.0.0\",\n    \"npm\": \">=7.0.0\"\n  },\n  \"author\": \"Saya\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/shipgirlproject/Shoukaku.git\"\n  },\n  \"dependencies\": {\n    \"ws\": \"^8.19.0\"\n  },\n  \"devDependencies\": {\n    \"@shipgirl/eslint-config\": \"^0.5.0\",\n    \"@types/node\": \"^25.2.3\",\n    \"@types/ws\": \"^8.18.1\",\n    \"eslint\": \"^9.39.2\",\n    \"tsup\": \"^8.5.1\",\n    \"typedoc\": \"^0.28.17\",\n    \"typescript\": \"^5.9.3\"\n  }\n}\n","import { EventEmitter } from 'node:events';\n\n// https://stackoverflow.com/a/67244127\nexport abstract class TypedEventEmitter<T extends Record<string, unknown[]>> extends EventEmitter {\n\tprotected constructor() {\n\t\tsuper();\n\t}\n\n\ton<K extends Extract<keyof T, string> | symbol>(eventName: K, listener: (...args: T[Extract<K, string>]) => void): this {\n\t\treturn super.on(eventName, listener);\n\t}\n\n\tonce<K extends Extract<keyof T, string> | symbol>(eventName: K, listener: (...args: T[Extract<K, string>]) => void): this {\n\t\treturn super.once(eventName, listener);\n\t}\n\n\toff<K extends Extract<keyof T, string> | symbol>(eventName: K, listener: (...args: T[Extract<K, string>]) => void): this {\n\t\treturn super.off(eventName, listener);\n\t}\n\n\temit<K extends Extract<keyof T, string> | symbol>(eventName: K, ...args: T[Extract<K, string>]): boolean {\n\t\treturn super.emit(eventName, ...args);\n\t}\n}\n\nexport type Constructor<T> = new (...args: unknown[]) => T;\n\n/**\n * Merge the default options to user input\n * @param def Default options\n * @param given User input\n * @returns Merged options\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function mergeDefault<T extends Record<string, any>>(def: T, given: T): Required<T> {\n\tif (!given) return def as Required<T>;\n\tconst defaultKeys: Array<keyof T> = Object.keys(def);\n\tfor (const key in given) {\n\t\tif (defaultKeys.includes(key)) continue;\n\t\tdelete given[key];\n\t}\n\tfor (const key of defaultKeys) {\n\t\tif (def[key] === null || (typeof def[key] === 'string' && def[key].length === 0)) {\n\t\t\tif (!given[key]) throw new Error(`${String(key)} was not found from the given options.`);\n\t\t}\n\t\tgiven[key] ??= def[key];\n\t}\n\treturn given as Required<T>;\n}\n\n/**\n * Wait for a specific amount of time (timeout)\n * @param ms Time to wait in milliseconds\n * @returns A promise that resolves in x seconds\n */\nexport function wait(ms: number): Promise<void> {\n\treturn new Promise(resolve => setTimeout(resolve, ms));\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\nimport { NodeDefaults } from '../Constants';\nimport type { ServerUpdate, StateUpdatePartial } from '../guild/Connection';\nimport type { NodeOption, Shoukaku } from '../Shoukaku';\nimport { mergeDefault } from '../Utils';\n\nexport interface ConnectorMethods {\n\tsendPacket: any;\n\tgetId: any;\n}\n\nexport const AllowedPackets = [ 'VOICE_STATE_UPDATE', 'VOICE_SERVER_UPDATE' ];\n\nexport abstract class Connector {\n\tprotected readonly client: any;\n\tprotected manager: Shoukaku | null;\n\tconstructor(client: any) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tthis.client = client;\n\t\tthis.manager = null;\n\t}\n\n\tpublic set(manager: Shoukaku): Connector {\n\t\tthis.manager = manager;\n\t\treturn this;\n\t}\n\n\tprotected ready(nodes: NodeOption[]): void {\n\t\tthis.manager!.id = this.getId();\n\t\tfor (const node of nodes) this.manager!.addNode(mergeDefault(NodeDefaults, node));\n\t}\n\n\tprotected raw(packet: any): void {\n\t\tif (!AllowedPackets.includes(packet.t as string)) return;\n\t\tconst guildId = packet.d.guild_id as string;\n\t\tconst connection = this.manager!.connections.get(guildId);\n\t\tif (!connection) return;\n\t\tif (packet.t === 'VOICE_SERVER_UPDATE') return connection.setServerUpdate(packet.d as ServerUpdate);\n\t\tconst userId = packet.d.user_id as string;\n\t\tif (userId !== this.manager!.id) return;\n\t\tconnection.setStateUpdate(packet.d as StateUpdatePartial);\n\t}\n\n\tabstract getId(): string;\n\n\tabstract sendPacket(shardId: number, payload: unknown, important: boolean): void;\n\n\tabstract listen(nodes: NodeOption[]): void;\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any */\nimport type { NodeOption } from '../../Shoukaku';\nimport { Connector } from '../Connector';\n\nexport class DiscordJS extends Connector {\n\t// sendPacket is where your library send packets to Discord Gateway\n\tpublic sendPacket(shardId: number, payload: any, important: boolean): void {\n\t\treturn this.client.ws.shards.get(shardId)?.send(payload, important);\n\t}\n\t// getId is a getter where the lib stores the client user (the one logged in as a bot) id\n\tpublic getId(): string {\n\t\treturn this.client.user.id;\n\t}\n\t// Listen attaches the event listener to the library you are using\n\tpublic listen(nodes: NodeOption[]): void {\n\t\t// Only attach to ready event once, refer to your library for its ready event\n\t\tthis.client.once('clientReady', () => this.ready(nodes));\n\t\t// Attach to the raw websocket event, this event must be 1:1 on spec with dapi (most libs implement this)\n\t\tthis.client.on('raw', (packet: any) => this.raw(packet));\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any */\nimport type { NodeOption } from '../../Shoukaku';\nimport { Connector } from '../Connector';\n\nexport class Eris extends Connector {\n\t// sendPacket is where your library send packets to Discord Gateway\n\tpublic sendPacket(shardId: number, payload: any, important: boolean): void {\n\t\treturn this.client.shards.get(shardId)?.sendWS(payload.op, payload.d, important);\n\t}\n\t// getId is a getter where the lib stores the client user (the one logged in as a bot) id\n\tpublic getId(): string {\n\t\treturn this.client.user.id;\n\t}\n\t// Listen attaches the event listener to the library you are using\n\tpublic listen(nodes: NodeOption[]): void {\n\t\t// Only attach to ready event once, refer to your library for its ready event\n\t\tthis.client.once('ready', () => this.ready(nodes));\n\t\t// Attach to the raw websocket event, this event must be 1:1 on spec with dapi (most libs implement this)\n\t\tthis.client.on('rawWS', (packet: any) => this.raw(packet));\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any */\nimport type { NodeOption } from '../../Shoukaku';\nimport { Connector } from '../Connector';\n\nexport class OceanicJS extends Connector {\n\t// sendPacket is where your library send packets to Discord Gateway\n\tpublic sendPacket(shardId: number, payload: any, important: boolean): void {\n\t\treturn this.client.shards.get(shardId)?.send(payload.op, payload.d, important);\n\t}\n\t// getId is a getter where the lib stores the client user (the one logged in as a bot) id\n\tpublic getId(): string {\n\t\treturn this.client.user.id;\n\t}\n\t// Listen attaches the event listener to the library you are using\n\tpublic listen(nodes: NodeOption[]): void {\n\t\t// Only attach to ready event once, refer to your library for its ready event\n\t\tthis.client.once('ready', () => this.ready(nodes));\n\t\t// Attach to the raw websocket event, this event must be 1:1 on spec with dapi (most libs implement this)\n\t\tthis.client.on('packet', (packet: any) => this.raw(packet));\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any */\nimport type { NodeOption } from '../../Shoukaku';\nimport { Connector } from '../Connector';\n\nexport class Seyfert extends Connector {\n\t// sendPacket is where your library send packets to Discord Gateway\n\tpublic sendPacket(shardId: number, payload: unknown, important: boolean): void {\n\t\treturn this.client.gateway.send(shardId, payload);\n\t}\n\t// getId is a getter where the lib stores the client user (the one logged in as a bot) id\n\tpublic getId(): string {\n\t\treturn this.client.botId;\n\t}\n\t// Listen attaches the event listener to the library you are using\n\tpublic listen(nodes: NodeOption[]): void {\n\t\tthis.client.events.values.RAW = {\n\t\t\tdata: { name: 'raw' },\n\t\t\trun: (packet: any) => {\n\t\t\t\t// Only attach to ready event once, refer to your library for its ready event\n\t\t\t\tif (packet.t === 'READY') return this.ready(nodes);\n\t\t\t\t// Attach to the raw websocket event, this event must be 1:1 on spec with dapi (most libs implement this)\n\t\t\t\treturn this.raw(packet);\n\t\t\t}\n\t\t};\n\t}\n}\n","import { EventEmitter, once } from 'node:events';\nimport { State, VoiceState } from '../Constants';\nimport type { Shoukaku, VoiceChannelOptions } from '../Shoukaku';\n\n/**\n * Represents the partial payload from a stateUpdate event\n */\nexport interface StateUpdatePartial {\n\tchannel_id?: string;\n\tsession_id?: string;\n\tself_deaf: boolean;\n\tself_mute: boolean;\n}\n\n/**\n * Represents the payload from a serverUpdate event\n */\nexport interface ServerUpdate {\n\ttoken: string;\n\tguild_id: string;\n\tendpoint: string;\n}\n\n/**\n * Represents a connection to a Discord voice channel\n */\nexport class Connection extends EventEmitter {\n\t/**\n\t * The manager where this connection is on\n\t */\n\tpublic manager: Shoukaku;\n\t/**\n\t * GuildId of the connection that is being managed by this instance\n\t */\n\tpublic guildId: string;\n\t/**\n\t * VoiceChannelId of the connection that is being managed by this instance\n\t */\n\tpublic channelId: string | null;\n\t/**\n\t * ShardId where this connection sends data on\n\t */\n\tpublic shardId: number;\n\t/**\n\t * Mute status in connected voice channel\n\t */\n\tpublic muted: boolean;\n\t/**\n\t * Deafen status in connected voice channel\n\t */\n\tpublic deafened: boolean;\n\t/**\n\t * Id of the voice channel where this instance was connected before the current channelId\n\t */\n\tpublic lastChannelId: string | null;\n\t/**\n\t * Id of the currently active voice channel connection\n\t */\n\tpublic sessionId: string | null;\n\t/**\n\t * Region of connected voice channel\n\t */\n\tpublic region: string | null;\n\t/**\n\t * Last region of the connected voice channel\n\t */\n\tpublic lastRegion: string | null;\n\t/**\n\t * Cached serverUpdate event from Lavalink\n\t */\n\tpublic serverUpdate: ServerUpdate | null;\n\t/**\n\t * Connection state\n\t */\n\tpublic state: State;\n\t/**\n\t * @param manager The manager of this connection\n\t * @param options The options to pass in connection creation\n\t * @param options.guildId GuildId in which voice channel to connect to is located\n\t * @param options.shardId ShardId in which the guild exists\n\t * @param options.channelId ChannelId of voice channel to connect to\n\t * @param options.deaf Optional boolean value to specify whether to deafen the current bot user\n\t * @param options.mute Optional boolean value to specify whether to mute the current bot user\n\t */\n\tconstructor(manager: Shoukaku, options: VoiceChannelOptions) {\n\t\tsuper();\n\t\tthis.manager = manager;\n\t\tthis.guildId = options.guildId;\n\t\tthis.channelId = options.channelId;\n\t\tthis.shardId = options.shardId;\n\t\tthis.muted = options.mute ?? false;\n\t\tthis.deafened = options.deaf ?? false;\n\t\tthis.lastChannelId = null;\n\t\tthis.sessionId = null;\n\t\tthis.region = null;\n\t\tthis.lastRegion = null;\n\t\tthis.serverUpdate = null;\n\t\tthis.state = State.DISCONNECTED;\n\t}\n\n\t/**\n\t * Set the deafen status for the current bot user\n\t * @param deaf Boolean value to indicate whether to deafen or undeafen\n\t * @defaultValue false\n\t */\n\tpublic setDeaf(deaf = false): void {\n\t\tthis.deafened = deaf;\n\t\tthis.sendVoiceUpdate();\n\t}\n\n\t/**\n\t * Set the mute status for the current bot user\n\t * @param mute Boolean value to indicate whether to mute or unmute\n\t * @defaultValue false\n\t */\n\tpublic setMute(mute = false): void {\n\t\tthis.muted = mute;\n\t\tthis.sendVoiceUpdate();\n\t}\n\n\t/**\n\t * Disconnect the current bot user from the connected voice channel\n\t * @internal\n\t */\n\tpublic disconnect(): void {\n\t\tif (this.state === State.DISCONNECTED) return;\n\t\tthis.channelId = null;\n\t\tthis.deafened = false;\n\t\tthis.muted = false;\n\t\tthis.removeAllListeners();\n\t\tthis.sendVoiceUpdate();\n\t\tthis.state = State.DISCONNECTED;\n\t\tthis.debug(`[Voice] -> [Node] & [Discord] : Connection Destroyed | Guild: ${this.guildId}`);\n\t}\n\n\t/**\n\t * Connect the current bot user to a voice channel\n\t * @internal\n\t */\n\tpublic async connect(): Promise<void> {\n\t\tif (this.state === State.CONNECTING || this.state === State.CONNECTED) return;\n\n\t\tthis.state = State.CONNECTING;\n\t\tthis.sendVoiceUpdate();\n\t\tthis.debug(`[Voice] -> [Discord] : Requesting Connection | Guild: ${this.guildId}`);\n\n\t\tconst controller = new AbortController();\n\t\tconst timeout = setTimeout(() => controller.abort(), this.manager.options.voiceConnectionTimeout * 1000);\n\n\t\ttry {\n\t\t\tconst [ status ] = await once(this, 'connectionUpdate', { signal: controller.signal }) as [ VoiceState ];\n\t\t\tif (status !== VoiceState.SESSION_READY) {\n\t\t\t\tswitch (status) {\n\t\t\t\t\tcase VoiceState.SESSION_ID_MISSING: throw new Error('The voice connection is not established due to missing session id');\n\t\t\t\t\tcase VoiceState.SESSION_ENDPOINT_MISSING: throw new Error('The voice connection is not established due to missing connection endpoint');\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.state = State.CONNECTED;\n\t\t} catch (e: unknown) {\n\t\t\tconst error = e as Error;\n\t\t\tthis.debug(`[Voice] </- [Discord] : Request Connection Failed | Guild: ${this.guildId}`);\n\t\t\tif (error.name === 'AbortError')\n\t\t\t\tthrow new Error(`The voice connection is not established in ${this.manager.options.voiceConnectionTimeout} seconds`);\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n\n\t/**\n\t * Updates SessionId, ChannelId, Deafen and Mute data of this instance\n\t * @param options\n\t * @param options.session_id Id of the current session\n\t * @param options.channel_id Id of the connected voice channel\n\t * @param options.self_deaf Boolean that indicates if the current bot user is deafened or not\n\t * @param options.self_mute Boolean that indicates if the current bot user is muted or not\n\t * @internal\n\t */\n\tpublic setStateUpdate({ session_id, channel_id, self_deaf, self_mute }: StateUpdatePartial): void {\n\t\tthis.lastChannelId = this.channelId?.repeat(1) ?? null;\n\t\tthis.channelId = channel_id ?? null;\n\n\t\tif (this.channelId && this.lastChannelId !== this.channelId) {\n\t\t\tthis.debug(`[Voice] <- [Discord] : Channel Moved | Old Channel: ${this.channelId} Guild: ${this.guildId}`);\n\t\t}\n\n\t\tif (!this.channelId) {\n\t\t\tthis.state = State.DISCONNECTED;\n\t\t\tthis.debug(`[Voice] <- [Discord] : Channel Disconnected | Guild: ${this.guildId}`);\n\t\t}\n\n\t\tthis.deafened = self_deaf;\n\t\tthis.muted = self_mute;\n\t\tthis.sessionId = session_id ?? null;\n\t\tthis.debug(`[Voice] <- [Discord] : State Update Received | Channel: ${this.channelId} Session ID: ${session_id} Guild: ${this.guildId}`);\n\t}\n\n\t/**\n\t * Sets the server update data for this connection\n\t * @internal\n\t */\n\tpublic setServerUpdate(data: ServerUpdate): void {\n\t\tif (!data.endpoint) {\n\t\t\tthis.emit('connectionUpdate', VoiceState.SESSION_ENDPOINT_MISSING);\n\t\t\treturn;\n\t\t}\n\t\tif (!this.sessionId) {\n\t\t\tthis.emit('connectionUpdate', VoiceState.SESSION_ID_MISSING);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lastRegion = this.region?.repeat(1) ?? null;\n\t\tthis.region = data.endpoint.split('.').shift()?.replace(/[0-9]/g, '') ?? null;\n\n\t\tif (this.region && this.lastRegion !== this.region) {\n\t\t\tthis.debug(`[Voice] <- [Discord] : Voice Region Moved | Old Region: ${this.lastRegion} New Region: ${this.region} Guild: ${this.guildId}`);\n\t\t}\n\n\t\tthis.serverUpdate = data;\n\t\tthis.emit('connectionUpdate', VoiceState.SESSION_READY);\n\t\tthis.debug(`[Voice] <- [Discord] : Server Update Received | Server: ${this.region} Guild: ${this.guildId}`);\n\t}\n\n\t/**\n\t * Send voice data to discord\n\t * @internal\n\t */\n\tprivate sendVoiceUpdate() {\n\t\tthis.send({ guild_id: this.guildId, channel_id: this.channelId, self_deaf: this.deafened, self_mute: this.muted });\n\t}\n\n\t/**\n\t * Send data to Discord\n\t * @param data The data to send\n\t * @internal\n\t */\n\tprivate send(data: unknown): void {\n\t\tthis.manager.connector.sendPacket(this.shardId, { op: 4, d: data }, false);\n\t}\n\n\t/**\n\t * Emits a debug log\n\t * @internal\n\t */\n\tprivate debug(message: string): void {\n\t\tthis.manager.emit('debug', this.constructor.name, message);\n\t}\n}\n","import { OpCodes, State } from '../Constants';\nimport type { Node } from '../node/Node';\nimport type { Exception, Track, UpdatePlayerInfo, UpdatePlayerOptions } from '../node/Rest';\nimport { TypedEventEmitter } from '../Utils';\nimport { Connection } from './Connection';\n\nexport type TrackEndReason = 'finished' | 'loadFailed' | 'stopped' | 'replaced' | 'cleanup';\nexport type PlayOptions = Omit<UpdatePlayerOptions, 'filters' | 'voice'>;\nexport type ResumeOptions = Omit<UpdatePlayerOptions, 'track' | 'filters' | 'voice'>;\n\nexport enum PlayerEventType {\n\tTRACK_START_EVENT = 'TrackStartEvent',\n\tTRACK_END_EVENT = 'TrackEndEvent',\n\tTRACK_EXCEPTION_EVENT = 'TrackExceptionEvent',\n\tTRACK_STUCK_EVENT = 'TrackStuckEvent',\n\tWEBSOCKET_CLOSED_EVENT = 'WebSocketClosedEvent'\n}\n\nexport interface Band {\n\tband: number;\n\tgain: number;\n}\n\nexport interface KaraokeSettings {\n\tlevel?: number;\n\tmonoLevel?: number;\n\tfilterBand?: number;\n\tfilterWidth?: number;\n}\n\nexport interface TimescaleSettings {\n\tspeed?: number;\n\tpitch?: number;\n\trate?: number;\n}\n\nexport interface FreqSettings {\n\tfrequency?: number;\n\tdepth?: number;\n}\n\nexport interface RotationSettings {\n\trotationHz?: number;\n}\n\nexport interface DistortionSettings {\n\tsinOffset?: number;\n\tsinScale?: number;\n\tcosOffset?: number;\n\tcosScale?: number;\n\ttanOffset?: number;\n\ttanScale?: number;\n\toffset?: number;\n\tscale?: number;\n}\n\nexport interface ChannelMixSettings {\n\tleftToLeft?: number;\n\tleftToRight?: number;\n\trightToLeft?: number;\n\trightToRight?: number;\n}\n\nexport interface LowPassSettings {\n\tsmoothing?: number;\n}\n\nexport interface PlayerEvent {\n\top: OpCodes.EVENT;\n\tguildId: string;\n}\n\nexport interface TrackStartEvent extends PlayerEvent {\n\ttype: PlayerEventType.TRACK_START_EVENT;\n\ttrack: Track;\n}\n\nexport interface TrackEndEvent extends PlayerEvent {\n\ttype: PlayerEventType.TRACK_END_EVENT;\n\ttrack: Track;\n\treason: TrackEndReason;\n}\n\nexport interface TrackStuckEvent extends PlayerEvent {\n\ttype: PlayerEventType.TRACK_STUCK_EVENT;\n\ttrack: Track;\n\tthresholdMs: number;\n}\n\nexport interface TrackExceptionEvent extends PlayerEvent {\n\ttype: PlayerEventType.TRACK_EXCEPTION_EVENT;\n\texception: Exception;\n}\n\nexport interface WebSocketClosedEvent extends PlayerEvent {\n\ttype: PlayerEventType.WEBSOCKET_CLOSED_EVENT;\n\tcode: number;\n\tbyRemote: boolean;\n\treason: string;\n}\n\nexport interface PlayerUpdate {\n\top: OpCodes.PLAYER_UPDATE;\n\tstate: {\n\t\tconnected: boolean;\n\t\tposition: number;\n\t\ttime: number;\n\t\tping: number;\n\t};\n\tguildId: string;\n}\n\nexport interface FilterOptions {\n\tvolume?: number;\n\tequalizer?: Band[];\n\tkaraoke?: KaraokeSettings | null;\n\ttimescale?: TimescaleSettings | null;\n\ttremolo?: FreqSettings | null;\n\tvibrato?: FreqSettings | null;\n\trotation?: RotationSettings | null;\n\tdistortion?: DistortionSettings | null;\n\tchannelMix?: ChannelMixSettings | null;\n\tlowPass?: LowPassSettings | null;\n}\n\n// Interfaces are not final, but types are, and therefore has an index signature\n// https://stackoverflow.com/a/64970740\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type PlayerEvents = {\n\t/**\n\t * Emitted when the current playing track ends\n\t * @eventProperty\n\t */\n\t'end': [reason: TrackEndEvent];\n\t/**\n\t * Emitted when the current playing track gets stuck due to an error\n\t * @eventProperty\n\t */\n\t'stuck': [data: TrackStuckEvent];\n\t/**\n\t * Emitted when the current websocket connection is closed\n\t * @eventProperty\n\t */\n\t'closed': [reason: WebSocketClosedEvent];\n\t/**\n\t * Emitted when a new track starts\n\t * @eventProperty\n\t */\n\t'start': [data: TrackStartEvent];\n\t/**\n\t * Emitted when there is an error caused by the current playing track\n\t * @eventProperty\n\t */\n\t'exception': [reason: TrackExceptionEvent];\n\t/**\n\t * Emitted when the library manages to resume the player\n\t * @eventProperty\n\t */\n\t'resumed': [player: Player];\n\t/**\n\t * Emitted when a playerUpdate even is received from Lavalink\n\t * @eventProperty\n\t */\n\t'update': [data: PlayerUpdate];\n};\n\n/**\n * Wrapper object around Lavalink\n */\nexport class Player extends TypedEventEmitter<PlayerEvents> {\n\t/**\n\t * GuildId of this player\n\t */\n\tpublic readonly guildId: string;\n\t/**\n\t * Lavalink node this player is connected to\n\t */\n\tpublic node: Node;\n\t/**\n\t * Base64 encoded data of the current track\n\t */\n\tpublic track: string | null;\n\t/**\n\t * Global volume of the player\n\t */\n\tpublic volume: number;\n\t/**\n\t * Pause status in current player\n\t */\n\tpublic paused: boolean;\n\t/**\n\t * Ping represents the number of milliseconds between heartbeat and ack. Could be `-1` if not connected\n\t */\n\tpublic ping: number;\n\t/**\n\t * Position in ms of current track\n\t */\n\tpublic position: number;\n\t/**\n\t * Filters on current track\n\t */\n\tpublic filters: FilterOptions;\n\n\tconstructor(guildId: string, node: Node) {\n\t\tsuper();\n\t\tthis.guildId = guildId;\n\t\tthis.node = node;\n\t\tthis.track = null;\n\t\tthis.volume = 100;\n\t\tthis.paused = false;\n\t\tthis.position = 0;\n\t\tthis.ping = 0;\n\t\tthis.filters = {};\n\t}\n\n\tpublic get data(): UpdatePlayerInfo {\n\t\tconst connection = this.node.manager.connections.get(this.guildId)!;\n\t\treturn {\n\t\t\tguildId: this.guildId,\n\t\t\tplayerOptions: {\n\t\t\t\ttrack: {\n\t\t\t\t\tencoded: this.track\n\t\t\t\t},\n\t\t\t\tposition: this.position,\n\t\t\t\tpaused: this.paused,\n\t\t\t\tfilters: this.filters,\n\t\t\t\tvoice: {\n\t\t\t\t\ttoken: connection.serverUpdate!.token,\n\t\t\t\t\tendpoint: connection.serverUpdate!.endpoint,\n\t\t\t\t\tsessionId: connection.sessionId!,\n\t\t\t\t\tchannelId: connection.channelId!\n\t\t\t\t},\n\t\t\t\tvolume: this.volume\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Move player to another node\n\t * @param name Name of node to move to, or the default ideal node\n\t * @returns true if the player was moved, false if not\n\t */\n\tpublic async move(name?: string): Promise<boolean> {\n\t\tconst connection = this.node.manager.connections.get(this.guildId);\n\t\tconst node = this.node.manager.nodes.get(name!) ?? this.node.manager.getIdealNode(connection);\n\n\t\tif (!node && ![ ...this.node.manager.nodes.values() ].some(node => node.state === State.CONNECTED))\n\t\t\tthrow new Error('No available nodes to move to');\n\n\t\tif (!node || node.name === this.node.name || node.state !== State.CONNECTED) return false;\n\n\t\tlet lastNode = this.node.manager.nodes.get(this.node.name);\n\t\tif (lastNode?.state !== State.CONNECTED)\n\t\t\tlastNode = this.node.manager.getIdealNode(connection);\n\n\t\tawait this.destroy();\n\n\t\ttry {\n\t\t\tthis.node = node;\n\t\t\tawait this.resume();\n\t\t\treturn true;\n\t\t} catch {\n\t\t\tthis.node = lastNode!;\n\t\t\tawait this.resume();\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Destroys the player in remote lavalink side\n\t */\n\tpublic async destroy(): Promise<void> {\n\t\tawait this.node.rest.destroyPlayer(this.guildId);\n\t}\n\n\t/**\n\t * Play a new track\n\t */\n\tpublic playTrack(playerOptions: PlayOptions, noReplace = false): Promise<void> {\n\t\treturn this.update(playerOptions, noReplace);\n\t}\n\n\t/**\n\t * Stop the currently playing track\n\t */\n\tpublic stopTrack(): Promise<void> {\n\t\treturn this.update({ track: { encoded: null }, position: 0 });\n\t}\n\n\t/**\n\t * Pause or unpause the currently playing track\n\t * @param paused Boolean value to specify whether to pause or unpause the current bot user\n\t */\n\tpublic setPaused(paused = true): Promise<void> {\n\t\treturn this.update({ paused });\n\t}\n\n\t/**\n\t * Seek to a specific time in the currently playing track\n\t * @param position Position to seek to in milliseconds\n\t */\n\tpublic seekTo(position: number): Promise<void> {\n\t\treturn this.update({ position });\n\t}\n\n\t/**\n\t * Sets the global volume of the player\n\t * @param volume Target volume 0-1000\n\t */\n\tpublic setGlobalVolume(volume: number): Promise<void> {\n\t\treturn this.update({ volume });\n\t}\n\n\t/**\n\t * Sets the filter volume of the player\n\t * @param volume Target volume 0.0-5.0\n\t */\n\tasync setFilterVolume(volume: number): Promise<void> {\n\t\treturn this.setFilters({ volume });\n\t}\n\n\t/**\n\t * Change the equalizer settings applied to the currently playing track\n\t * @param equalizer An array of objects that conforms to the Bands type that define volumes at different frequencies\n\t */\n\tpublic async setEqualizer(equalizer: Band[]): Promise<void> {\n\t\treturn this.setFilters({ equalizer });\n\t}\n\n\t/**\n\t * Change the karaoke settings applied to the currently playing track\n\t * @param karaoke An object that conforms to the KaraokeSettings type that defines a range of frequencies to mute\n\t */\n\tpublic setKaraoke(karaoke?: KaraokeSettings): Promise<void> {\n\t\treturn this.setFilters({ karaoke: karaoke ?? null });\n\t}\n\n\t/**\n\t * Change the timescale settings applied to the currently playing track\n\t * @param timescale An object that conforms to the TimescaleSettings type that defines the time signature to play the audio at\n\t */\n\tpublic setTimescale(timescale?: TimescaleSettings): Promise<void> {\n\t\treturn this.setFilters({ timescale: timescale ?? null });\n\t}\n\n\t/**\n\t * Change the tremolo settings applied to the currently playing track\n\t * @param tremolo An object that conforms to the FreqSettings type that defines an oscillation in volume\n\t */\n\tpublic setTremolo(tremolo?: FreqSettings): Promise<void> {\n\t\treturn this.setFilters({ tremolo: tremolo ?? null });\n\t}\n\n\t/**\n\t * Change the vibrato settings applied to the currently playing track\n\t * @param vibrato An object that conforms to the FreqSettings type that defines an oscillation in pitch\n\t */\n\tpublic setVibrato(vibrato?: FreqSettings): Promise<void> {\n\t\treturn this.setFilters({ vibrato: vibrato ?? null });\n\t}\n\n\t/**\n\t * Change the rotation settings applied to the currently playing track\n\t * @param rotation An object that conforms to the RotationSettings type that defines the frequency of audio rotating round the listener\n\t */\n\tpublic setRotation(rotation?: RotationSettings): Promise<void> {\n\t\treturn this.setFilters({ rotation: rotation ?? null });\n\t}\n\n\t/**\n\t * Change the distortion settings applied to the currently playing track\n\t * @param distortion An object that conforms to DistortionSettings that defines distortions in the audio\n\t * @returns The current player instance\n\t */\n\tpublic setDistortion(distortion?: DistortionSettings): Promise<void> {\n\t\treturn this.setFilters({ distortion: distortion ?? null });\n\t}\n\n\t/**\n\t * Change the channel mix settings applied to the currently playing track\n\t * @param channelMix An object that conforms to ChannelMixSettings that defines how much the left and right channels affect each other (setting all factors to 0.5 causes both channels to get the same audio)\n\t */\n\tpublic setChannelMix(channelMix?: ChannelMixSettings): Promise<void> {\n\t\treturn this.setFilters({ channelMix: channelMix ?? null });\n\t}\n\n\t/**\n\t * Change the low pass settings applied to the currently playing track\n\t * @param lowPass An object that conforms to LowPassSettings that defines the amount of suppression on higher frequencies\n\t */\n\tpublic setLowPass(lowPass?: LowPassSettings): Promise<void> {\n\t\treturn this.setFilters({ lowPass: lowPass ?? null });\n\t}\n\n\t/**\n\t * Change the all filter settings applied to the currently playing track\n\t * @param filters An object that conforms to FilterOptions that defines all filters to apply/modify\n\t */\n\tpublic setFilters(filters: FilterOptions): Promise<void> {\n\t\treturn this.update({ filters });\n\t}\n\n\t/**\n\t * Clear all filters applied to the currently playing track\n\t */\n\tpublic clearFilters(): Promise<void> {\n\t\treturn this.setFilters({\n\t\t\tvolume: 1,\n\t\t\tequalizer: [],\n\t\t\tkaraoke: null,\n\t\t\ttimescale: null,\n\t\t\ttremolo: null,\n\t\t\tvibrato: null,\n\t\t\trotation: null,\n\t\t\tdistortion: null,\n\t\t\tchannelMix: null,\n\t\t\tlowPass: null\n\t\t});\n\t}\n\n\t/**\n\t * Resumes the current track\n\t * @param options An object that conforms to ResumeOptions that specify behavior on resuming\n\t * @param noReplace Set it to true if you don't want to replace the currently playing track\n\t */\n\tpublic async resume(options: ResumeOptions = {}, noReplace = false): Promise<void> {\n\t\tconst data = this.data;\n\n\t\tif (typeof options.position === 'number')\n\t\t\tdata.playerOptions.position = options.position;\n\t\tif (typeof options.endTime === 'number')\n\t\t\tdata.playerOptions.endTime = options.endTime;\n\t\tif (typeof options.paused === 'boolean')\n\t\t\tdata.playerOptions.paused = options.paused;\n\t\tif (typeof options.volume === 'number')\n\t\t\tdata.playerOptions.volume = options.volume;\n\n\t\tawait this.update(data.playerOptions, noReplace);\n\n\t\tthis.emit('resumed', this);\n\t}\n\n\t/**\n\t * If you want to update the whole player yourself, sends raw update player info to lavalink\n\t * @param playerOptions Options to update the player data\n\t * @param noReplace Set it to true if you don't want to replace the currently playing track\n\t */\n\tpublic async update(playerOptions: UpdatePlayerOptions, noReplace = false): Promise<void> {\n\t\tconst data = {\n\t\t\tguildId: this.guildId,\n\t\t\tnoReplace,\n\t\t\tplayerOptions\n\t\t};\n\n\t\tawait this.node.rest.updatePlayer(data);\n\n\t\tif (!noReplace) this.paused = false;\n\n\t\tif (playerOptions.filters) {\n\t\t\tthis.filters = { ...this.filters, ...playerOptions.filters };\n\t\t}\n\n\t\tif (typeof playerOptions.track !== 'undefined')\n\t\t\tthis.track = playerOptions.track.encoded ?? null;\n\t\tif (typeof playerOptions.paused === 'boolean')\n\t\t\tthis.paused = playerOptions.paused;\n\t\tif (typeof playerOptions.volume === 'number')\n\t\t\tthis.volume = playerOptions.volume;\n\t\tif (typeof playerOptions.position === 'number')\n\t\t\tthis.position = playerOptions.position;\n\t}\n\n\t/**\n\t * Cleans this player instance\n\t * @internal\n\t */\n\tpublic clean(): void {\n\t\tthis.removeAllListeners();\n\t\tthis.track = null;\n\t\tthis.volume = 100;\n\t\tthis.position = 0;\n\t\tthis.filters = {};\n\t}\n\n\t/**\n\t * Sends server update to lavalink\n\t * @internal\n\t */\n\tpublic async sendServerUpdate(connection: Connection): Promise<void> {\n\t\tconst playerUpdate = {\n\t\t\tguildId: this.guildId,\n\t\t\tplayerOptions: {\n\t\t\t\tvoice: {\n\t\t\t\t\ttoken: connection.serverUpdate!.token,\n\t\t\t\t\tendpoint: connection.serverUpdate!.endpoint,\n\t\t\t\t\tsessionId: connection.sessionId!,\n\t\t\t\t\tchannelId: connection.channelId!\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tawait this.node.rest.updatePlayer(playerUpdate);\n\t}\n\n\t/**\n\t * Handle player update data\n\t */\n\tpublic onPlayerUpdate(json: PlayerUpdate): void {\n\t\tconst { position, ping } = json.state;\n\t\tthis.position = position;\n\t\tthis.ping = ping;\n\t\tthis.emit('update', json);\n\t}\n\n\t/**\n\t * Handle player events received from Lavalink\n\t * @param json JSON data from Lavalink\n\t * @internal\n\t */\n\tpublic onPlayerEvent(json: TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent): void {\n\t\tswitch (json.type) {\n\t\t\tcase PlayerEventType.TRACK_START_EVENT:\n\t\t\t\tif (this.track) this.track = json.track.encoded;\n\t\t\t\tthis.emit('start', json);\n\t\t\t\tbreak;\n\t\t\tcase PlayerEventType.TRACK_END_EVENT:\n\t\t\t\tthis.emit('end', json);\n\t\t\t\tbreak;\n\t\t\tcase PlayerEventType.TRACK_STUCK_EVENT:\n\t\t\t\tthis.emit('stuck', json);\n\t\t\t\tbreak;\n\t\t\tcase PlayerEventType.TRACK_EXCEPTION_EVENT:\n\t\t\t\tthis.emit('exception', json);\n\t\t\t\tbreak;\n\t\t\tcase PlayerEventType.WEBSOCKET_CLOSED_EVENT:\n\t\t\t\tthis.emit('closed', json);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis.node.manager.emit(\n\t\t\t\t\t'debug',\n\t\t\t\t\tthis.node.name,\n\t\t\t\t\t`[Player] -> [Node] : Unknown Player Event Type, Data => ${JSON.stringify(json)}`\n\t\t\t\t);\n\t\t}\n\t}\n}\n","import { IncomingMessage } from 'http';\nimport Websocket from 'ws';\nimport { OpCodes, ShoukakuClientInfo, State, Versions } from '../Constants';\nimport type {\n\tPlayerUpdate,\n\tTrackEndEvent,\n\tTrackExceptionEvent,\n\tTrackStartEvent,\n\tTrackStuckEvent,\n\tWebSocketClosedEvent\n} from '../guild/Player';\nimport type { NodeOption, Shoukaku, ShoukakuEvents } from '../Shoukaku';\nimport { TypedEventEmitter, wait } from '../Utils';\nimport { Rest } from './Rest';\n\nexport interface Ready {\n\top: OpCodes.READY;\n\tresumed: boolean;\n\tsessionId: string;\n}\n\nexport interface NodeMemory {\n\treservable: number;\n\tused: number;\n\tfree: number;\n\tallocated: number;\n}\n\nexport interface NodeFrameStats {\n\tsent: number;\n\tdeficit: number;\n\tnulled: number;\n}\n\nexport interface NodeCpu {\n\tcores: number;\n\tsystemLoad: number;\n\tlavalinkLoad: number;\n}\n\nexport interface Stats {\n\top: OpCodes.STATS;\n\tplayers: number;\n\tplayingPlayers: number;\n\tmemory: NodeMemory;\n\tframeStats: NodeFrameStats | null;\n\tcpu: NodeCpu;\n\tuptime: number;\n}\n\nexport interface NodeInfoVersion {\n\tsemver: string;\n\tmajor: number;\n\tminor: number;\n\tpatch: number;\n\tpreRelease?: string;\n\tbuild?: string;\n}\n\nexport interface NodeInfoGit {\n\tbranch: string;\n\tcommit: string;\n\tcommitTime: number;\n}\n\nexport interface NodeInfoPlugin {\n\tname: string;\n\tversion: string;\n}\n\nexport interface NodeInfo {\n\tversion: NodeInfoVersion;\n\tbuildTime: number;\n\tgit: NodeInfoGit;\n\tjvm: string;\n\tlavaplayer: string;\n\tsourceManagers: string[];\n\tfilters: string[];\n\tplugins: NodeInfoPlugin[];\n}\n\nexport interface ResumableHeaders {\n\t[key: string]: string;\n\t'Client-Name': string;\n\t'User-Agent': string;\n\t'Authorization': string;\n\t'User-Id': string;\n\t'Session-Id': string;\n}\n\nexport type NonResumableHeaders = Omit<ResumableHeaders, 'Session-Id'>;\n\nexport type NodeEvents = {\n\t[K in keyof ShoukakuEvents]: ShoukakuEvents[K] extends [unknown, ...infer R] ? R : never;\n};\n\n/**\n * Represents a Lavalink node\n */\nexport class Node extends TypedEventEmitter<NodeEvents> {\n\t/**\n     * Shoukaku class\n     */\n\tpublic readonly manager: Shoukaku;\n\t/**\n     * Lavalink rest API\n     */\n\tpublic readonly rest: Rest;\n\t/**\n     * Name of this node\n     */\n\tpublic readonly name: string;\n\t/**\n     * Group in which this node is contained\n     */\n\tpublic readonly group?: string;\n\t/**\n     * URL of Lavalink\n     */\n\tprivate readonly url: string;\n\t/**\n     * Credentials to access Lavalink\n     */\n\tprivate readonly auth: string;\n\t/**\n     * The state of this connection\n     */\n\tpublic state: State;\n\t/**\n\t * The number of reconnects to Lavalink\n\t */\n\tpublic reconnects: number;\n\t/**\n     * Statistics from Lavalink\n     */\n\tpublic stats: Stats | null;\n\t/**\n     * Information about lavalink node\n    */\n\tpublic info: NodeInfo | null;\n\t/**\n     * Websocket instance\n     */\n\tpublic ws: Websocket | null;\n\t/**\n     * SessionId of this Lavalink connection (not to be confused with Discord SessionId)\n     */\n\tpublic sessionId: string | null;\n\n\t/**\n     * @param manager Shoukaku instance\n     * @param options Options on creating this node\n     * @param options.name Name of this node\n     * @param options.url URL of Lavalink\n     * @param options.auth Credentials to access Lavalink\n     * @param options.secure Whether to use secure protocols or not\n     * @param options.group Group of this node\n     */\n\tconstructor(manager: Shoukaku, options: NodeOption) {\n\t\tsuper();\n\t\tthis.manager = manager;\n\t\tthis.rest = new (this.manager.options.structures.rest ?? Rest)(this, options);\n\t\tthis.name = options.name;\n\t\tthis.group = options.group;\n\t\tthis.auth = options.auth;\n\t\tthis.url = `${options.secure ? 'wss' : 'ws'}://${options.url}/v${Versions.WEBSOCKET_VERSION}/websocket`;\n\t\tthis.state = State.DISCONNECTED;\n\t\tthis.reconnects = 0;\n\t\tthis.stats = null;\n\t\tthis.info = null;\n\t\tthis.ws = null;\n\t\tthis.sessionId = null;\n\t}\n\n\t/**\n     * Penalties for load balancing\n     * @returns Penalty score\n     * @internal @readonly\n     */\n\tget penalties(): number {\n\t\tlet penalties = 0;\n\t\tif (!this.stats) return penalties;\n\n\t\tpenalties += this.stats.players;\n\t\tpenalties += Math.round(Math.pow(1.05, 100 * this.stats.cpu.systemLoad) * 10 - 10);\n\n\t\tif (this.stats.frameStats) {\n\t\t\tpenalties += this.stats.frameStats.deficit;\n\t\t\tpenalties += this.stats.frameStats.nulled * 2;\n\t\t}\n\n\t\treturn penalties;\n\t}\n\n\t/**\n     * Connect to Lavalink\n     */\n\tpublic async connect(): Promise<void> {\n\t\tif (!this.manager.id)\n\t\t\tthrow new Error('UserId missing, probably your connector is misconfigured?');\n\n\t\tif (this.state === State.CONNECTED || this.state === State.CONNECTING)\n\t\t\treturn;\n\n\t\tthis.cleanupWebsocket();\n\n\t\tthis.state = State.CONNECTING;\n\n\t\tconst headers: NonResumableHeaders | ResumableHeaders = {\n\t\t\t'Client-Name': ShoukakuClientInfo,\n\t\t\t'User-Agent': this.manager.options.userAgent,\n\t\t\t'Authorization': this.auth,\n\t\t\t'User-Id': this.manager.id\n\t\t};\n\n\t\tif (this.sessionId && this.manager.options.resume) {\n\t\t\theaders['Session-Id'] = this.sessionId;\n\t\t\tthis.emit('debug', `[Socket] -> [${this.name}] : Session-Id is present, attempting to resume`);\n\t\t}\n\n\t\tthis.emit('debug', `[Socket] -> [${this.name}] : Connecting to ${this.url} ...`);\n\n\t\tconst createConnection = () => {\n\t\t\tconst url = new URL(this.url);\n\n\t\t\tconst server = new Websocket(url.toString(), { headers } as Websocket.ClientOptions);\n\n\t\t\tserver.once('upgrade', response => this.open(response));\n\t\t\tserver.on('message', data => void this.message(data).catch(error => this.error(error as Error)));\n\t\t\tserver.on('error', error => this.error(error));\n\n\t\t\treturn new Promise<Websocket>((resolve, reject) => {\n\t\t\t\tconst onOpen = () => {\n\t\t\t\t\tserver.removeListener('close', onClose);\n\t\t\t\t\tresolve(server);\n\t\t\t\t};\n\t\t\t\tconst onClose = () => {\n\t\t\t\t\tserver.removeListener('open', onOpen);\n\t\t\t\t\tserver.removeAllListeners();\n\t\t\t\t\treject(new Error('Websocket closed before a connection was established'));\n\t\t\t\t};\n\t\t\t\tserver.once('open', onOpen);\n\t\t\t\tserver.once('close', onClose);\n\t\t\t});\n\t\t};\n\n\t\tlet connectError: Error | undefined;\n\n\t\tfor (this.reconnects = 0; this.reconnects < this.manager.options.reconnectTries; this.reconnects++) {\n\t\t\ttry {\n\t\t\t\tthis.ws = await createConnection();\n\t\t\t\tbreak;\n\t\t\t} catch (error) {\n\t\t\t\tthis.emit('reconnecting', this.manager.options.reconnectTries - this.reconnects, this.manager.options.reconnectInterval);\n\t\t\t\tthis.emit('debug', `[Socket] -> [${this.name}] : Reconnecting in ${this.manager.options.reconnectInterval} seconds. ${this.manager.options.reconnectTries - this.reconnects} tries left`);\n\t\t\t\tconnectError = error as Error;\n\t\t\t\tawait wait(this.manager.options.reconnectInterval * 1000);\n\t\t\t}\n\t\t}\n\n\t\tif (connectError) {\n\t\t\tthis.state = State.DISCONNECTED;\n\t\t\tthis.cleanupWebsocket();\n\t\t\tlet count = 0;\n\t\t\tif (this.manager.options.moveOnDisconnect) {\n\t\t\t\tcount = await this.movePlayers();\n\t\t\t}\n\t\t\tthis.emit('disconnect', count);\n\t\t\t// Should I throw or not? :confusion:\n\t\t\tthrow connectError;\n\t\t}\n\n\t\tthis.ws!.once('close', (...args) => void this.close(...args));\n\t}\n\n\t/**\n     * Disconnect from Lavalink\n     * @param code Status code\n     * @param reason Reason for disconnect\n     */\n\tpublic disconnect(code: number, reason?: string): void {\n\t\tif (this.state !== State.CONNECTED && this.state !== State.CONNECTING) return;\n\n\t\tthis.state = State.DISCONNECTING;\n\n\t\tif (this.ws)\n\t\t\tthis.ws.close(code, reason);\n\t\telse\n\t\t\tvoid this.close(1000, Buffer.from(reason ?? 'Unknown Reason', 'utf-8'));\n\t}\n\n\t/**\n     * Handle connection open event from Lavalink\n     * @param response Response from Lavalink\n     * @internal\n     */\n\tprivate open(response: IncomingMessage): void {\n\t\tthis.reconnects = 0;\n\n\t\tconst resumed = response.headers['session-resumed'] === 'true';\n\n\t\tif (!resumed) {\n\t\t\tthis.sessionId = null;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n\t\tthis.emit('debug', `[Socket] <-> [${this.name}] : Connection Handshake Done => ${this.url} | Resumed Header Value: ${resumed} | Lavalink Api Version: ${response.headers['lavalink-api-version']}`);\n\t}\n\n\t/**\n     * Handle message from Lavalink\n     * @param message JSON message\n     * @internal\n     */\n\tprivate async message(message: unknown): Promise<void> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst json: Ready | Stats | PlayerUpdate | TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent = JSON.parse(message as string);\n\t\tif (!json) return;\n\t\tthis.emit('raw', json);\n\t\tswitch (json.op) {\n\t\t\tcase OpCodes.STATS:\n\t\t\t\tthis.emit('debug', `[Socket] <- [${this.name}] : Node Status Update | Server Load: ${this.penalties}`);\n\t\t\t\tthis.stats = json;\n\t\t\t\tbreak;\n\t\t\tcase OpCodes.READY: {\n\t\t\t\tthis.state = State.CONNECTED;\n\n\t\t\t\tif (!json.sessionId) {\n\t\t\t\t\tthis.emit('debug', `[Socket] -> [${this.name}] : No session id found from ready op? disconnecting and reconnecting to avoid issues`);\n\t\t\t\t\treturn this.disconnect(1000);\n\t\t\t\t}\n\n\t\t\t\tthis.sessionId = json.sessionId;\n\n\t\t\t\tconst players = [ ...this.manager.players.values() ].filter(player => player.node.name === this.name);\n\n\t\t\t\tlet resumedByLibrary = false;\n\t\t\t\tif (!json.resumed && Boolean(players.length && this.manager.options.resumeByLibrary)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.resumePlayers();\n\t\t\t\t\t\tresumedByLibrary = true;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthis.error(error as Error);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.emit('debug', `[Socket] -> [${this.name}] : Lavalink is ready to communicate !`);\n\t\t\t\tthis.emit('ready', json.resumed, resumedByLibrary);\n\n\t\t\t\tif (this.manager.options.resume) {\n\t\t\t\t\tawait this.rest.updateSession(this.manager.options.resume, this.manager.options.resumeTimeout);\n\t\t\t\t\tthis.emit('debug', `[Socket] -> [${this.name}] : Resuming configured for this Session Id: ${this.sessionId}`);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase OpCodes.EVENT:\n\t\t\tcase OpCodes.PLAYER_UPDATE: {\n\t\t\t\tconst player = this.manager.players.get(json.guildId);\n\t\t\t\tif (!player) return;\n\t\t\t\tif (json.op === OpCodes.EVENT)\n\t\t\t\t\tplayer.onPlayerEvent(json);\n\t\t\t\telse\n\t\t\t\t\tplayer.onPlayerUpdate(json);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthis.emit('debug', `[Player] -> [Node] : Unknown Message Op, Data => ${JSON.stringify(json)}`);\n\t\t}\n\t}\n\n\t/**\n     * Handle closed event from lavalink\n     * @param code Status close\n     * @param reason Reason for connection close\n     */\n\tprivate async close(code: number, reason: Buffer): Promise<void> {\n\t\tthis.emit('close', code, String(reason));\n\t\tthis.emit('debug', `[Socket] <-/-> [${this.name}] : Connection Closed, Code: ${code || 'Unknown Code'}`);\n\n\t\tthis.state = State.DISCONNECTING;\n\n\t\ttry {\n\t\t\tawait this.connect();\n\t\t} catch (error) {\n\t\t\tthis.emit('error', error as Error);\n\t\t}\n\t}\n\n\t/**\n     * To emit error events easily\n     * @param error error message\n     */\n\tpublic error(error: Error): void {\n\t\tthis.emit('error', error);\n\t}\n\n\t/**\n     * Tries to resume the players internally\n     * @internal\n     */\n\tprivate async resumePlayers(): Promise<void> {\n\t\tconst playersWithData = [];\n\t\tconst playersWithoutData = [];\n\n\t\tfor (const player of this.manager.players.values()) {\n\t\t\tconst serverUpdate = this.manager.connections.get(player.guildId)?.serverUpdate;\n\t\t\tif (serverUpdate)\n\t\t\t\tplayersWithData.push(player);\n\t\t\telse\n\t\t\t\tplayersWithoutData.push(player);\n\t\t}\n\n\t\tawait Promise.allSettled([\n\t\t\t...playersWithData.map(player => player.resume()),\n\t\t\t...playersWithoutData.map(player => this.manager.leaveVoiceChannel(player.guildId))\n\t\t]);\n\t}\n\n\t/**\n     * Tries to move the players to another node\n     * @internal\n     */\n\tprivate async movePlayers(): Promise<number> {\n\t\tconst players = [ ...this.manager.players.values() ];\n\t\tconst data = await Promise.allSettled(players.map(player => player.move()));\n\t\treturn data.filter(results => results.status === 'fulfilled').length;\n\t}\n\n\tprivate cleanupWebsocket(): void {\n\t\tthis.ws?.removeAllListeners();\n\t\tthis.ws?.close();\n\t\tthis.ws = null;\n\t}\n}\n","import { Versions } from '../Constants';\nimport type { FilterOptions } from '../guild/Player';\nimport type { NodeOption } from '../Shoukaku';\nimport type { Node, NodeInfo, Stats } from './Node';\n\nexport type Severity = 'common' | 'suspicious' | 'fault';\n\nexport enum LoadType {\n\tTRACK = 'track',\n\tPLAYLIST = 'playlist',\n\tSEARCH = 'search',\n\tEMPTY = 'empty',\n\tERROR = 'error'\n}\n\nexport interface Track {\n\tencoded: string;\n\tinfo: {\n\t\tidentifier: string;\n\t\tisSeekable: boolean;\n\t\tauthor: string;\n\t\tlength: number;\n\t\tisStream: boolean;\n\t\tposition: number;\n\t\ttitle: string;\n\t\turi?: string;\n\t\tartworkUrl?: string;\n\t\tisrc?: string;\n\t\tsourceName: string;\n\t};\n\tpluginInfo: unknown;\n}\n\nexport interface Playlist {\n\tencoded: string;\n\tinfo: {\n\t\tname: string;\n\t\tselectedTrack: number;\n\t};\n\tpluginInfo: unknown;\n\ttracks: Track[];\n}\n\nexport interface Exception {\n\tmessage: string;\n\tseverity: Severity;\n\tcause: string;\n}\n\nexport interface TrackResult {\n\tloadType: LoadType.TRACK;\n\tdata: Track;\n}\n\nexport interface PlaylistResult {\n\tloadType: LoadType.PLAYLIST;\n\tdata: Playlist;\n}\n\nexport interface SearchResult {\n\tloadType: LoadType.SEARCH;\n\tdata: Track[];\n}\n\nexport interface EmptyResult {\n\tloadType: LoadType.EMPTY;\n\tdata: Record<string, never>;\n}\n\nexport interface ErrorResult {\n\tloadType: LoadType.ERROR;\n\tdata: Exception;\n}\n\nexport type LavalinkResponse = TrackResult | PlaylistResult | SearchResult | EmptyResult | ErrorResult;\n\nexport interface Address {\n\taddress: string;\n\tfailingTimestamp: number;\n\tfailingTime: string;\n}\n\nexport interface RoutePlanner {\n\tclass: null | 'RotatingIpRoutePlanner' | 'NanoIpRoutePlanner' | 'RotatingNanoIpRoutePlanner' | 'BalancingIpRoutePlanner';\n\tdetails: null | {\n\t\tipBlock: {\n\t\t\ttype: string;\n\t\t\tsize: string;\n\t\t};\n\t\tfailingAddresses: Address[];\n\t\trotateIndex: string;\n\t\tipIndex: string;\n\t\tcurrentAddress: string;\n\t\tblockIndex: string;\n\t\tcurrentAddressIndex: string;\n\t};\n}\n\nexport interface LavalinkPlayerVoice {\n\ttoken: string;\n\tendpoint: string;\n\tsessionId: string;\n\tchannelId?: string;\n\tconnected?: boolean;\n\tping?: number;\n}\n\nexport type LavalinkPlayerVoiceOptions = Required<Omit<LavalinkPlayerVoice, 'connected' | 'ping'>>;\n\nexport interface LavalinkPlayer {\n\tguildId: string;\n\ttrack?: Track;\n\tvolume: number;\n\tpaused: boolean;\n\tvoice: LavalinkPlayerVoice;\n\tfilters: FilterOptions;\n}\n\nexport interface UpdatePlayerTrackOptions {\n\tencoded?: string | null;\n\tidentifier?: string;\n\tuserData?: unknown;\n}\n\nexport interface UpdatePlayerOptions {\n\ttrack?: UpdatePlayerTrackOptions;\n\tposition?: number;\n\tendTime?: number;\n\tvolume?: number;\n\tpaused?: boolean;\n\tfilters?: FilterOptions;\n\tvoice?: LavalinkPlayerVoiceOptions;\n}\n\nexport interface UpdatePlayerInfo {\n\tguildId: string;\n\tplayerOptions: UpdatePlayerOptions;\n\tnoReplace?: boolean;\n}\n\nexport interface SessionInfo {\n\tresumingKey?: string;\n\ttimeout: number;\n}\n\ninterface FetchOptions {\n\tendpoint: string;\n\toptions: {\n\t\theaders?: Record<string, string>;\n\t\tparams?: Record<string, string>;\n\t\tmethod?: string;\n\t\tbody?: Record<string, unknown>;\n\t\t[key: string]: unknown;\n\t};\n}\n\ninterface FinalFetchOptions {\n\tmethod: string;\n\theaders: Record<string, string>;\n\tsignal: AbortSignal;\n\tbody?: string;\n}\n\n/**\n * Wrapper around Lavalink REST API\n */\nexport class Rest {\n\t/**\n\t * Node that initialized this instance\n\t */\n\tprotected readonly node: Node;\n\t/**\n\t * URL of Lavalink\n\t */\n\tprotected readonly url: string;\n\t/**\n\t * Credentials to access Lavalink\n\t */\n\tprotected readonly auth: string;\n\t/**\n\t * @param node An instance of Node\n\t * @param options The options to initialize this rest class\n\t * @param options.name Name of this node\n\t * @param options.url URL of Lavalink\n\t * @param options.auth Credentials to access Lavalnk\n\t * @param options.secure Weather to use secure protocols or not\n\t * @param options.group Group of this node\n\t */\n\tconstructor(node: Node, options: NodeOption) {\n\t\tthis.node = node;\n\t\tthis.url = `${options.secure ? 'https' : 'http'}://${options.url}/v${Versions.REST_VERSION}`;\n\t\tthis.auth = options.auth;\n\t}\n\n\tprotected get sessionId(): string {\n\t\treturn this.node.sessionId!;\n\t}\n\n\t/**\n\t * Resolve a track\n\t * @param identifier Track ID\n\t * @returns A promise that resolves to a Lavalink response\n\t */\n\tpublic resolve(identifier: string): Promise<LavalinkResponse | undefined> {\n\t\tconst options = {\n\t\t\tendpoint: '/loadtracks',\n\t\t\toptions: { params: { identifier }}\n\t\t};\n\t\treturn this.fetch(options);\n\t}\n\n\t/**\n\t * Decode a track\n\t * @param track Encoded track\n\t * @returns Promise that resolves to a track\n\t */\n\tpublic decode(track: string): Promise<Track | undefined> {\n\t\tconst options = {\n\t\t\tendpoint: '/decodetrack',\n\t\t\toptions: { params: { track }}\n\t\t};\n\t\treturn this.fetch<Track>(options);\n\t}\n\n\t/**\n\t * Gets all the player with the specified sessionId\n\t * @returns Promise that resolves to an array of Lavalink players\n\t */\n\tpublic async getPlayers(): Promise<LavalinkPlayer[]> {\n\t\tconst options = {\n\t\t\tendpoint: `/sessions/${this.sessionId}/players`,\n\t\t\toptions: {}\n\t\t};\n\t\treturn await this.fetch<LavalinkPlayer[]>(options) ?? [];\n\t}\n\n\t/**\n\t * Gets the player with the specified guildId\n\t * @returns Promise that resolves to a Lavalink player\n\t */\n\tpublic getPlayer(guildId: string): Promise<LavalinkPlayer | undefined> {\n\t\tconst options = {\n\t\t\tendpoint: `/sessions/${this.sessionId}/players/${guildId}`,\n\t\t\toptions: {}\n\t\t};\n\t\treturn this.fetch(options);\n\t}\n\n\t/**\n\t * Updates a Lavalink player\n\t * @param data SessionId from Discord\n\t * @returns Promise that resolves to a Lavalink player\n\t */\n\tpublic updatePlayer(data: UpdatePlayerInfo): Promise<LavalinkPlayer | undefined> {\n\t\tconst options = {\n\t\t\tendpoint: `/sessions/${this.sessionId}/players/${data.guildId}`,\n\t\t\toptions: {\n\t\t\t\tmethod: 'PATCH',\n\t\t\t\tparams: { noReplace: data.noReplace?.toString() ?? 'false' },\n\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\tbody: data.playerOptions as Record<string, unknown>\n\t\t\t}\n\t\t};\n\t\treturn this.fetch<LavalinkPlayer>(options);\n\t}\n\n\t/**\n\t * Deletes a Lavalink player\n\t * @param guildId guildId where this player is\n\t */\n\tpublic async destroyPlayer(guildId: string): Promise<void> {\n\t\tconst options = {\n\t\t\tendpoint: `/sessions/${this.sessionId}/players/${guildId}`,\n\t\t\toptions: { method: 'DELETE' }\n\t\t};\n\t\tawait this.fetch(options);\n\t}\n\n\t/**\n\t * Updates the session with a resume boolean and timeout\n\t * @param resuming Whether resuming is enabled for this session or not\n\t * @param timeout Timeout to wait for resuming\n\t * @returns Promise that resolves to a Lavalink player\n\t */\n\tpublic updateSession(resuming?: boolean, timeout?: number): Promise<SessionInfo | undefined> {\n\t\tconst options = {\n\t\t\tendpoint: `/sessions/${this.sessionId}`,\n\t\t\toptions: {\n\t\t\t\tmethod: 'PATCH',\n\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\tbody: { resuming, timeout }\n\t\t\t}\n\t\t};\n\t\treturn this.fetch(options);\n\t}\n\n\t/**\n\t * Gets the status of this node\n\t * @returns Promise that resolves to a node stats response\n\t */\n\tpublic stats(): Promise<Stats | undefined> {\n\t\tconst options = {\n\t\t\tendpoint: '/stats',\n\t\t\toptions: {}\n\t\t};\n\t\treturn this.fetch(options);\n\t}\n\n\t/**\n\t * Get routeplanner status from Lavalink\n\t * @returns Promise that resolves to a routeplanner response\n\t */\n\tpublic getRoutePlannerStatus(): Promise<RoutePlanner | undefined> {\n\t\tconst options = {\n\t\t\tendpoint: '/routeplanner/status',\n\t\t\toptions: {}\n\t\t};\n\t\treturn this.fetch(options);\n\t}\n\n\t/**\n\t * Release blacklisted IP address into pool of IPs\n\t * @param address IP address\n\t */\n\tpublic async unmarkFailedAddress(address: string): Promise<void> {\n\t\tconst options = {\n\t\t\tendpoint: '/routeplanner/free/address',\n\t\t\toptions: {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\tbody: { address }\n\t\t\t}\n\t\t};\n\t\tawait this.fetch(options);\n\t}\n\n\t/**\n\t * Get Lavalink info\n\t */\n\tpublic getLavalinkInfo(): Promise<NodeInfo | undefined> {\n\t\tconst options = {\n\t\t\tendpoint: '/info',\n\t\t\toptions: {\n\t\t\t\theaders: { 'Content-Type': 'application/json' }\n\t\t\t}\n\t\t};\n\t\treturn this.fetch(options);\n\t}\n\n\t/**\n\t * Make a request to Lavalink\n\t * @param fetchOptions.endpoint Lavalink endpoint\n\t * @param fetchOptions.options Options passed to fetch\n\t * @throws `RestError` when encountering a Lavalink error response\n\t * @internal\n\t */\n\tprotected async fetch<T = unknown>(fetchOptions: FetchOptions) {\n\t\tconst { endpoint, options } = fetchOptions;\n\t\tlet headers = {\n\t\t\t'Authorization': this.auth,\n\t\t\t'User-Agent': this.node.manager.options.userAgent\n\t\t};\n\n\t\tif (options.headers) headers = { ...headers, ...options.headers };\n\n\t\tconst url = new URL(`${this.url}${endpoint}`);\n\n\t\tif (options.params) url.search = new URLSearchParams(options.params).toString();\n\n\t\tconst abortController = new AbortController();\n\t\tconst timeout = setTimeout(() => abortController.abort(), this.node.manager.options.restTimeout * 1000);\n\n\t\tconst method = options.method?.toUpperCase() ?? 'GET';\n\n\t\tconst finalFetchOptions: FinalFetchOptions = {\n\t\t\tmethod,\n\t\t\theaders,\n\t\t\tsignal: abortController.signal\n\t\t};\n\n\t\tif (![ 'GET', 'HEAD' ].includes(method) && options.body)\n\t\t\tfinalFetchOptions.body = JSON.stringify(options.body);\n\n\t\tconst request = await fetch(url.toString(), finalFetchOptions)\n\t\t\t.finally(() => clearTimeout(timeout));\n\n\t\tif (!request.ok) {\n\t\t\tconst response = await request\n\t\t\t\t.json()\n\t\t\t\t.catch(() => null) as LavalinkRestError | null;\n\t\t\tthrow new RestError(response ?? {\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\tstatus: request.status,\n\t\t\t\terror: 'Unknown Error',\n\t\t\t\tmessage: 'Unexpected error response from Lavalink server',\n\t\t\t\tpath: endpoint\n\t\t\t});\n\t\t}\n\t\ttry {\n\t\t\treturn await request.json() as T;\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t}\n}\n\ninterface LavalinkRestError {\n\ttimestamp: number;\n\tstatus: number;\n\terror: string;\n\ttrace?: string;\n\tmessage: string;\n\tpath: string;\n}\n\nexport class RestError extends Error {\n\tpublic timestamp: number;\n\tpublic status: number;\n\tpublic error: string;\n\tpublic trace?: string;\n\tpublic path: string;\n\n\tconstructor({ timestamp, status, error, trace, message, path }: LavalinkRestError) {\n\t\tsuper(`Rest request failed with response code: ${status}${message ? ` | message: ${message}` : ''}`);\n\t\tthis.name = 'RestError';\n\t\tthis.timestamp = timestamp;\n\t\tthis.status = status;\n\t\tthis.error = error;\n\t\tthis.trace = trace;\n\t\tthis.message = message;\n\t\tthis.path = path;\n\t\tObject.setPrototypeOf(this, new.target.prototype);\n\t}\n}\n","import { Connector } from './connectors/Connector';\nimport { ShoukakuDefaults, VoiceState } from './Constants';\nimport { Connection } from './guild/Connection';\nimport { Player } from './guild/Player';\nimport { Node } from './node/Node';\nimport { Rest } from './node/Rest';\nimport { Constructor, mergeDefault, TypedEventEmitter } from './Utils';\n\nexport interface Structures {\n\t/**\n     * A custom structure that extends the Rest class\n     */\n\trest?: Constructor<Rest>;\n\t/**\n     * A custom structure that extends the Player class\n     */\n\tplayer?: Constructor<Player>;\n}\n\nexport interface NodeOption {\n\t/**\n     * Name of the Lavalink node\n     */\n\tname: string;\n\t/**\n     * Lavalink node host and port without any prefix\n     */\n\turl: string;\n\t/**\n     * Credentials to access Lavalink\n     */\n\tauth: string;\n\t/**\n     * Whether to use secure protocols or not\n     */\n\tsecure?: boolean;\n\t/**\n     * Name of the Lavalink node group\n     */\n\tgroup?: string;\n}\n\nexport interface ShoukakuOptions {\n\t/**\n     * Whether to resume a connection on disconnect to Lavalink (Server Side) (Note: DOES NOT RESUME WHEN THE LAVALINK SERVER DIES)\n     */\n\tresume?: boolean;\n\t/**\n     * Time to wait before lavalink starts to destroy the players of the disconnected client\n     */\n\tresumeTimeout?: number;\n\t/**\n     * Whether to resume the players by doing it in the library side (Client Side) (Note: TRIES TO RESUME REGARDLESS OF WHAT HAPPENED ON A LAVALINK SERVER)\n     */\n\tresumeByLibrary?: boolean;\n\t/**\n     * Number of times to try and reconnect to Lavalink before giving up\n     */\n\treconnectTries?: number;\n\t/**\n     * Timeout before trying to reconnect\n     */\n\treconnectInterval?: number;\n\t/**\n     * Time to wait for a response from the Lavalink REST API before giving up\n     */\n\trestTimeout?: number;\n\t/**\n     * Whether to move players to a different Lavalink node when a node disconnects\n     */\n\tmoveOnDisconnect?: boolean;\n\t/**\n     * User Agent to use when making requests to Lavalink\n     */\n\tuserAgent?: string;\n\t/**\n     * Custom structures for shoukaku to use\n     */\n\tstructures?: Structures;\n\t/**\n     * Timeout before abort connection\n     */\n\tvoiceConnectionTimeout?: number;\n\t/**\n     * Node Resolver to use if you want to customize it\n     */\n\tnodeResolver?: (nodes: Map<string, Node>, connection?: Connection) => Node | undefined;\n}\n\nexport interface VoiceChannelOptions {\n\tguildId: string;\n\tshardId: number;\n\tchannelId: string;\n\tdeaf?: boolean;\n\tmute?: boolean;\n}\n\n// Interfaces are not final, but types are, and therefore has an index signature\n// https://stackoverflow.com/a/64970740\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type ShoukakuEvents = {\n\t/**\n     * Emitted when reconnect tries are occurring and how many tries are left\n     * @eventProperty\n     */\n\t'reconnecting': [name: string, reconnectsLeft: number, reconnectInterval: number];\n\t/**\n     * Emitted when data useful for debugging is produced\n     * @eventProperty\n     */\n\t'debug': [name: string, info: string];\n\t/**\n     * Emitted when an error occurs\n     * @eventProperty\n     */\n\t'error': [name: string, error: Error];\n\t/**\n     * Emitted when Shoukaku is ready to receive operations\n     * @eventProperty\n     */\n\t'ready': [name: string, lavalinkResume: boolean, libraryResume: boolean];\n\t/**\n     * Emitted when a websocket connection to Lavalink closes\n     * @eventProperty\n     */\n\t'close': [name: string, code: number, reason: string];\n\t/**\n     * Emitted when a websocket connection to Lavalink disconnects\n     * @eventProperty\n     */\n\t'disconnect': [name: string, count: number];\n\t/**\n     * Emitted when a raw message is received from Lavalink\n     * @eventProperty\n     */\n\t'raw': [name: string, json: unknown];\n};\n\n/**\n * Main Shoukaku class\n */\nexport class Shoukaku extends TypedEventEmitter<ShoukakuEvents> {\n\t/**\n     * Discord library connector\n     */\n\tpublic readonly connector: Connector;\n\t/**\n     * Shoukaku options\n     */\n\tpublic readonly options: Required<ShoukakuOptions>;\n\t/**\n     * Connected Lavalink nodes\n     */\n\tpublic readonly nodes: Map<string, Node>;\n\t/**\n     * Voice connections being handled\n     */\n\tpublic readonly connections: Map<string, Connection>;\n\t/**\n     * Players being handled\n     */\n\tpublic readonly players: Map<string, Player>;\n\t/**\n     * Shoukaku instance identifier\n     */\n\tpublic id: string | null;\n\t/**\n     * @param connector A Discord library connector\n     * @param nodes An array that conforms to the NodeOption type that specifies nodes to connect to\n     * @param options Options to pass to create this Shoukaku instance\n     * @param options.resume Whether to resume a connection on disconnect to Lavalink (Server Side) (Note: DOES NOT RESUME WHEN THE LAVALINK SERVER DIES)\n     * @param options.resumeTimeout Time to wait before lavalink starts to destroy the players of the disconnected client\n     * @param options.resumeByLibrary Whether to resume the players by doing it in the library side (Client Side) (Note: TRIES TO RESUME REGARDLESS OF WHAT HAPPENED ON A LAVALINK SERVER)\n     * @param options.reconnectTries Number of times to try and reconnect to Lavalink before giving up\n     * @param options.reconnectInterval Timeout before trying to reconnect\n     * @param options.restTimeout Time to wait for a response from the Lavalink REST API before giving up\n     * @param options.moveOnDisconnect Whether to move players to a different Lavalink node when a node disconnects\n     * @param options.userAgent User Agent to use when making requests to Lavalink\n     * @param options.structures Custom structures for shoukaku to use\n     * @param options.nodeResolver Used if you have custom lavalink node resolving\n     */\n\tconstructor(connector: Connector, nodes: NodeOption[], options: ShoukakuOptions = {}) {\n\t\tsuper();\n\t\tthis.connector = connector.set(this);\n\t\tthis.options = mergeDefault<ShoukakuOptions>(ShoukakuDefaults, options);\n\t\tthis.nodes = new Map();\n\t\tthis.connections = new Map();\n\t\tthis.players = new Map();\n\t\tthis.id = null;\n\t\tthis.connector.listen(nodes);\n\t}\n\n\t/**\n     * Gets an ideal node based on the nodeResolver you provided\n     * @param connection Optional connection class for ideal node selection, if you use it\n     * @returns An ideal node for you to do things with\n     */\n\tpublic getIdealNode(connection?: Connection): Node | undefined {\n\t\treturn this.options.nodeResolver(this.nodes, connection);\n\t}\n\n\t/**\n     * Add a Lavalink node to the pool of available nodes\n     * @param options.name Name of this node\n     * @param options.url URL of Lavalink\n     * @param options.auth Credentials to access Lavalink\n     * @param options.secure Whether to use secure protocols or not\n     * @param options.group Group of this node\n     */\n\tpublic addNode(options: NodeOption): void {\n\t\tconst node = new Node(this, options);\n\t\tnode.on('debug', (...args) => this.emit('debug', node.name, ...args));\n\t\tnode.on('reconnecting', (...args) => this.emit('reconnecting', node.name, ...args));\n\t\tnode.on('error', (...args) => this.emit('error', node.name, ...args));\n\t\tnode.on('close', (...args) => this.emit('close', node.name, ...args));\n\t\tnode.on('ready', (...args) => this.emit('ready', node.name, ...args));\n\t\tnode.on('raw', (...args) => this.emit('raw', node.name, ...args));\n\t\tnode.once('disconnect', () => this.nodes.delete(node.name));\n\t\tnode.connect().catch((error) => this.emit('error', node.name, error as Error));\n\t\tthis.nodes.set(node.name, node);\n\t}\n\n\t/**\n     * Remove a Lavalink node from the pool of available nodes\n     * @param name Name of the node\n     * @param reason Reason of removing the node\n     */\n\tpublic removeNode(name: string, reason = 'Remove node executed'): void {\n\t\tconst node = this.nodes.get(name);\n\t\tif (!node) throw new Error('The node name you specified doesn\\'t exist');\n\t\tnode.disconnect(1000, reason);\n\t\tthis.nodes.delete(name);\n\t}\n\n\t/**\n     * Joins a voice channel\n     * @param options.guildId GuildId in which the ChannelId of the voice channel is located\n     * @param options.shardId ShardId to track where this should send on sharded websockets, put 0 if you are unsharded\n     * @param options.channelId ChannelId of the voice channel you want to connect to\n     * @param options.deaf Optional boolean value to specify whether to deafen or undeafen the current bot user\n     * @param options.mute Optional boolean value to specify whether to mute or unmute the current bot user\n     * @returns The created player\n     */\n\tpublic async joinVoiceChannel(options: VoiceChannelOptions): Promise<Player> {\n\t\tif (this.connections.has(options.guildId))\n\t\t\tthrow new Error('This guild already have an existing connection');\n\t\tconst connection = new Connection(this, options);\n\t\tthis.connections.set(connection.guildId, connection);\n\t\ttry {\n\t\t\tawait connection.connect();\n\t\t} catch (error) {\n\t\t\tthis.connections.delete(options.guildId);\n\t\t\tthrow error;\n\t\t}\n\t\ttry {\n\t\t\tconst node = this.getIdealNode(connection);\n\t\t\tif (!node)\n\t\t\t\tthrow new Error('Can\\'t find any nodes to connect on');\n\t\t\tconst player = this.options.structures.player ? new this.options.structures.player(connection.guildId, node) : new Player(connection.guildId, node);\n\t\t\tconst onUpdate = (state: VoiceState) => {\n\t\t\t\tif (state !== VoiceState.SESSION_READY) return;\n\t\t\t\tvoid player.sendServerUpdate(connection);\n\t\t\t};\n\t\t\tawait player.sendServerUpdate(connection);\n\t\t\tconnection.on('connectionUpdate', onUpdate);\n\t\t\tthis.players.set(player.guildId, player);\n\t\t\treturn player;\n\t\t} catch (error) {\n\t\t\tconnection.disconnect();\n\t\t\tthis.connections.delete(options.guildId);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n     * Leaves a voice channel\n     * @param guildId The id of the guild you want to delete\n     * @returns The destroyed / disconnected player or undefined if none\n     */\n\tpublic async leaveVoiceChannel(guildId: string): Promise<void> {\n\t\tconst connection = this.connections.get(guildId);\n\t\tif (connection) {\n\t\t\tconnection.disconnect();\n\t\t\tthis.connections.delete(guildId);\n\t\t}\n\t\tconst player = this.players.get(guildId);\n\t\tif (player) {\n\t\t\ttry {\n\t\t\t\tawait player.destroy();\n\t\t\t} catch { /* empty */ }\n\t\t\tplayer.clean();\n\t\t\tthis.players.delete(guildId);\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA,EACE,MAAQ;AAAA,E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